Skip to content

Conversation

@desyncr
Copy link
Collaborator

@desyncr desyncr commented Jul 31, 2020

This PR contains the work done to upgrade SnakeYAML to 1.25 (latest version), to compile against java 8, and changes related to fred.

It's a partial work of #15

@desyncr desyncr self-assigned this Jul 31, 2020
@desyncr desyncr requested a review from Bombe July 31, 2020 12:33
Copy link

@Bombe Bombe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not familiar with what this is supposed to be doing but I’m a little bit appalled by all the “instanceof String / Long / …” if-cascades… are those really necessary?

Date modified = (Date)map.get("modified");
if (totalPagesObj instanceof String) { // FIXME
totalPages = Long.parseLong((String) totalPagesObj);
} else if (totalPagesObj instanceof Long) { // FIXME yaml??? It seems to give a Long if the number
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use Number and it’s longValue() method.

ProtoIndexComponentSerialiser cmpsrl = ProtoIndexComponentSerialiser.get((Integer)map.get("serialFormatUID"), subsrl);
Object serialFormatUIDObj = map.get("serialFormatUID");
int serialFormatUID;
if (serialFormatUIDObj instanceof String) { // FIXME
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does everything in this map potentially exist as String? Where does this map come from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could write this in the situation when I met a String there during debugging. Dirty. In my opinion it starts with "snakeyaml implicit resolver", which I turned off as a result.

if (s == null) {
throw new IllegalArgumentException("can't have a null subject!");
// throw new IllegalArgumentException("can't have a null subject!");
s = "null"; // FIXME
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this FIXME in combination with the removed exception does not inspire confidence. How is using "null" as subject better than getting an exception and fixing the cause of that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably related to https://github.com/freenet/plugin-Library/pull/16/files#diff-aa254c0343e62a1fcd16f7077a106f09R302. Not sure if that gives away a bit more of context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can remember this situation, this is about the fact that the subject can contain the human word "null", but then it turns into null (smart library mode)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like something that should be fixed in a different place… but as with the rest of this PR I’m totally not qualified to talk about any of it because I have no clue of all the contexts in question. :)

assertTrue(m.get("key2") instanceof Bean); // NOTE these tests fail in snakeYAML 1.2 and below, fixed in 1.3
assertTrue(m.get("key3") instanceof Custom);
assertTrue(m.get("key4") instanceof Wrapper);
assertTrue(map.get("key1") instanceof Bean);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only tests for the general existence in the map but does not validate the values… at least for key4 I would expect a bit more here. 😃

@ArneBab
Copy link
Contributor

ArneBab commented Jan 22, 2022

@desyncr @Olezha are you working on getting this merge-ready?

@desyncr
Copy link
Collaborator Author

desyncr commented Jan 23, 2022

@desyncr @Olezha are you working on getting this merge-ready?

I'll not be available to look into this. Initially I just re-create the PR but I could potentially take it over but not at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants