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

NPE in prettyDateTimeFormat #2216

Closed
ghost opened this issue Dec 18, 2017 · 4 comments
Closed

NPE in prettyDateTimeFormat #2216

ghost opened this issue Dec 18, 2017 · 4 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Dec 18, 2017

Description


https://github.com/payara/Payara/blob/master/appserver/admingui/payara-console-extras/src/main/java/fish/payara/admingui/extras/PayaraUtilHandlers.java throws NPE in line 81:

public static void prettyDateTimeFormat(HandlerContext context){
    String value = (String) context.getInputValue("milliseconds");
    String result = DateFormat.getDateTimeInstance().format(new Date(Long.valueOf(value)));	// throws NPE if value == null
    context.setOutputValue("prettyString", result);
}

Expected Outcome

Input should be validated before use. I got this NPE after a change to an application (adding an attribute). InvocationTargetException while attempting to process a 'beforeCreate' event for 'deploymentOccuranceTime'

Current Outcome

NPE prevents display of tabs (Installed application > Descriptor,Resources,Target and Configuration Properties)

Steps to reproduce (Only for bug reports)

Add a configuration property to a web application

Environment

  • Payara Version: 4.1.2.174
  • Edition: Full
  • JDK Version: Oracle JDK 8
  • Operating System: Linux
  • Database:
@Cousjava
Copy link
Contributor

I was unable to reproduce your issue, I could add an attribute to the application and then go back to the applications page without an errors being thrown.

@ghost
Copy link
Author

ghost commented Dec 19, 2017

I don't know exactly which value causes the problem. I tried to fix the domain.xml by removing my entry, but the bug is still there. Anyway, Long.valueOf tries to parse the input string and it obviously fails if the string can't be parsed. So adding some form of input validation is good defensive programming and it won't cost you an arm and a leg.

@michaelranaldo
Copy link
Contributor

Hi @a-genius ,

Similarly, I've been unable to reproduce this issue.

However, I have created an internal JIRA PAYARA-2440.

Were you able to get your domain working in the end?

@smillidge
Copy link
Contributor

Fixed by #2424

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

No branches or pull requests

5 participants