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

IllegalArgumentException when using an invalid PrivacyStatus value #44

Closed
pcarana opened this issue Jul 11, 2017 · 2 comments
Closed

IllegalArgumentException when using an invalid PrivacyStatus value #44

pcarana opened this issue Jul 11, 2017 · 2 comments

Comments

@pcarana
Copy link
Contributor

pcarana commented Jul 11, 2017

Whenever an invalid value is placed at the properties in webapp/WEB-INF/privacy/*.properties an IllegalArgumentException is thrown. Eg. at the file "autnum_events.properties", set "eventAction=anyy" (note the typo) and start the server.

The issue is at mx.nic.rdap.server.util.PrivacyUtil function loadObjectPrivacySettings(String). This block is at the function, I added some comments:

String property = properties.getProperty((String) key).trim();
/** Here's the problem, the exception is never handled. The enum will never have an invalid value. **/
PrivacyStatus privacyProperty = PrivacyStatus.valueOf(property.toUpperCase());

switch (privacyProperty) {
case OWNER:
	break;
case AUTHENTICATED:
	break;
case ANY:
	break;
case NONE:
	break;
default:
	/** Good intentions, but the code is never reached **/
	isInvalidProperties = true;
	builder.append(key + "=" + property + ", ");
	continue;
}
@pcarana pcarana added this to the v1.1.3 milestone Sep 22, 2017
@pcarana pcarana added the Solved label Sep 22, 2017
@pcarana
Copy link
Contributor Author

pcarana commented Oct 2, 2017

Whenever an invalid value is configured, the server will indicate it in a friendly manner (logged at console) since the exception IllegalArgumentException is now handled.

@TheRedTrainer
Copy link

Verified. If an invalid value is configured for privacy status properties (for example "supernintendochalmers" for handle property in domain.properties), the following stack trace is displayed on logs:

04-Oct-2017 19:05:44.200 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class mx.nic.rdap.server.listener.RdapInitializer
java.lang.IllegalArgumentException: java.lang.RuntimeException: Invalid privacy file 'domain.properties'.
Invalid values: handle=supernintendochalmers,
at mx.nic.rdap.server.listener.RdapInitializer.contextInitialized(RdapInitializer.java:67)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)

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

No branches or pull requests

2 participants