-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Added some logic into JeevesNodeAwareLogoutSuccessHandler to deal with the case where no port is set in the settings manager #7124
Conversation
…h the case where no port is set in the settings manager
core/src/main/java/jeeves/config/springutil/JeevesNodeAwareLogoutSuccessHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jeeves/config/springutil/JeevesNodeAwareLogoutSuccessHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jeeves/config/springutil/JeevesNodeAwareLogoutSuccessHandler.java
Outdated
Show resolved
Hide resolved
@josegar74 thanks for the suggested changes, I have made them and re-tested |
core/src/main/java/jeeves/config/springutil/JeevesNodeAwareLogoutSuccessHandler.java
Outdated
Show resolved
Hide resolved
@archaeogeek the code works fine, but I'm checking additional code and setting the port to empty it can cause issues in other code like this one, if the value is empty it will add the core-geonetwork/core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java Lines 920 to 925 in 376e9e6
Note also that xslt process code can have the same problem as the previous class: core-geonetwork/web/src/main/webapp/xslt/services/dcat/rdf.xsl Lines 40 to 47 in bb48909
I would do the following:
public int getSitePort() {
SettingManager settingManager = ApplicationContextHolder.get().getBean(SettingManager.class);
// some conditional logic to handle the case where there's no port in the settings
int sitePort = Geonet.DefaultHttpPort.HTTP;
if (StringUtils.isNumeric(settingManager.getValue(Settings.SYSTEM_SERVER_PORT))) {
sitePort = settingManager.getValueAsInt(Settings.SYSTEM_SERVER_PORT);
}
return sitePort;
} And use it in your change of |
@josegar74 I've tried to do what you suggested, but have ended up with compilation errors: Here's what I've done: Add the following after getSiteUrl in SettingInfo.java, along with adding a line
Change BaseMetadataManager.java like so (eg by commenting out the logic for picking up the port and adding the new line), and adding the line
Changing JeevesNodeAwareLogoutSuccessHanlder.java by adding the line
When I then build with maven I get the following error:
Can you see what I'm doing wrong? |
@josegar74 could you check my code to see where I am going wrong? |
…goutSuccessHandler and BaseMetadataManager to get around compilation error about not referring to a non-static method from a static context
@josegar74 Hopefully these latest changes fix the issues you reported- I'd be grateful if this could make it into the 4.2.5 release if possible! |
@archaeogeek I'm going to check the code, thanks and apologies for the late reply, missing your previous comments to review the code. |
core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jeeves/config/springutil/JeevesNodeAwareLogoutSuccessHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/fao/geonet/kernel/setting/SettingInfo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@archaeogeek I've added some code suggestions, to remove commented code and fix a wrong tab in a code line. You can commit them from GitHub.
Other than that, looks working ok, thanks.
Co-authored-by: Jose García <josegar74@gmail.com>
…MetadataManager.java Co-authored-by: Jose García <josegar74@gmail.com>
…outSuccessHandler.java Co-authored-by: Jose García <josegar74@gmail.com>
@josegar74 Great, is it OK to merge this now? |
This PR handles the error on signout where there is no port set in the settings manager. Previously if no port was set (because it's not needed) logging out would produce a null pointer error (see below):
This PR adds some logic to check for the value of the port in the settings and to set it to 80 if it is not included.
With this pull request, if no port is set the logout error no longer occurs.