Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write after response commit on proxy response #7353

Conversation

juanluisrp
Copy link
Contributor

When the Links table is empty an 500 error happens when using the proxy:

java.lang.IllegalStateException: Cannot call `sendError()` after the response has been committed

This is caused because the response.sendError(...) method is being called twice when the Links table has no entries. This commits fix this error calling the method only once.
In addition, it removes unnecessary info returned to the client.

When the Links table is empty an 500 error happens:
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

This is caused because the response.sendError(...) method is being called twice when
the Links table has no entries. This commits fix this error calling the method only
once.
In addition, it removes unnecessary info returned to the client.

Signed-off-by: Juan Luis Rodríguez <juanluisrp@gmail.com>
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

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

Works fine, now when the table is empty, returns the following error:

{
"servlet":"HttpProxy",
"message":"The proxy is configured with DB_LINK_CHECK mode but the MetadataLink table is empty. Administrator may need to analyze record links from the admin console in order to register URL allowed by the proxy.",
"url":"/geonetwork/proxy",
"status":"403"
}

But the UI for example to add a WMS service in the map viewer doesn't show the message, but that is another stuff:

URL .... returned status ''. You should check the URL or check that the service is running.

@josegar74 josegar74 merged commit b486ff2 into geonetwork:main Sep 22, 2023
6 checks passed
josegar74 pushed a commit that referenced this pull request Sep 22, 2023
When the Links table is empty an 500 error happens:
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

This is caused because the response.sendError(...) method is being called twice when
the Links table has no entries. This commits fix this error calling the method only
once.
In addition, it removes unnecessary info returned to the client.

Signed-off-by: Juan Luis Rodríguez <juanluisrp@gmail.com>
josegar74 pushed a commit that referenced this pull request Sep 22, 2023
When the Links table is empty an 500 error happens:
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

This is caused because the response.sendError(...) method is being called twice when
the Links table has no entries. This commits fix this error calling the method only
once.
In addition, it removes unnecessary info returned to the client.

Signed-off-by: Juan Luis Rodríguez <juanluisrp@gmail.com>
@juanluisrp juanluisrp deleted the fix/proxy-send-error-after-response-comitted-exception branch September 22, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants