Skip to content

Conversation

@dr0i
Copy link
Member

@dr0i dr0i commented Aug 24, 2020

dr0i added 2 commits August 24, 2020 17:59
Complements the last commit.
The ignored test would test an expected behaviour of java.net.URL.HttpURLConnection,
i.e. not to automatically follow redirects when this involves a protocol switching
(e.g. from HTTP to HTTPS).

See #289.
Copy link
Member

@ansell ansell left a comment

Choose a reason for hiding this comment

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

There is a resource leak in the new version with a submethod. The resource cleanup pattern in use works in pointer-based languages, but not Java. The cleanup needs to be moved down into the submethod or the creation point moved back into the original method.

Also not sure why we are only looking for Link headers on JSON-LD responses. My impression was that the Link header was suitable for use on any other content type, potentially even HTTP 204 responses with no content, and the Link would be the way to go through to a JSON-LD document.

Also concerned about infinite recursion in the current model. Recursion shouldn't be necessary, but if it is simpler to understand that way, we need to do it safely.

// We prefer application/ld+json, but fallback to application/json
// or whatever is available
request.addHeader("Accept", ACCEPT_HEADER);
response = httpClient.execute(request);
Copy link
Member

Choose a reason for hiding this comment

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

This will not work in Java to close the response in the outer method. You will need to do the try-catch or try-with-resources in here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Treated with 776e77d and 818b118 .

Copy link
Member

Choose a reason for hiding this comment

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

Comment about another possible resource leak in the latest version of this.

- remove unused imports
- sorted alphabetically
dr0i added a commit to dr0i/jsonld-java that referenced this pull request Aug 25, 2020
As proposed in jsonld-java#292 (comment)

Doesn't work for when the connection is closed the stream is broken:

"javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify"
@dr0i dr0i assigned dr0i and fsteeg and unassigned dr0i Aug 28, 2020
@fsteeg fsteeg removed their assignment Sep 3, 2020
dr0i added 2 commits September 8, 2020 16:28
- remove superfluous check (was always false)
- remove superfluous IOException
- remove logger as it is no more needed

See #292 (comment).
@dr0i dr0i requested review from ansell and fsteeg September 8, 2020 15:06
@dr0i
Copy link
Member Author

dr0i commented Sep 8, 2020

Thx for the reviews! Also, I now installed sonarLint into my IDE to help me check the code.

@ansell ansell merged commit 9b05185 into master Sep 9, 2020
@ansell
Copy link
Member

ansell commented Sep 9, 2020

Thanks, have merged it and will release it today.

@dr0i dr0i deleted the 289-followLinkHeaderToContextFile branch September 14, 2020 07:17
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.

http://schema.org/ (base URL) does not respond with JSON when 'Accept' header is set

4 participants