java.lang.NullPointerException

Atlassian JIRA | Joe Clark [Atlassian] | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Since time immemorial, the standard behaviour of Atlassian's user management subsystems has been to use {{null}} to represent an anonymous user context. This has been codified in the SAL interface javadoc for the {{com.atlassian.sal.api.user.UserManager}} interface. For example, the textual contract for the #getRemoteUser() method states: {code:lang=java} /** * Returns the profile of the currently logged in user or null if no user can be found. * <p/> * Getting the full {@link UserProfile} may have performance implications in some applications. Consider using {@link #getRemoteUserKey()} if you don't need the full object. * * @return the {@link UserProfile} of the logged in user or null * @see #getRemoteUserKey() * @since 2.10 */ @Nullable UserProfile getRemoteUser(); {code} The SAL UserManager API and the underlying JIRA implementation of UserManager were changed in JIRA 6.0 to support renaming users. This change has *broken* the textual contract of the #getRemoteUser() method in JIRA, which *no longer returns {{null}} for anonymous users*. This appears to simply be an oversight in the JIRA implementation: {code:lang=java} @Override public UserProfile getRemoteUser() { return new JiraUserProfile(jiraAuthenticationContext.getUser()); } {code} This method should return {{null}} if the value returned from {{jiraAuthenticationContext.getUser()}} also returns {{null}}. This subtle change in behaviour can end up with add-on developers getting a stack-trace like this: {noformat} java.lang.NullPointerException at com.atlassian.sal.jira.user.DefaultUserManager$JiraUserProfile.getUsername(DefaultUserManager.java:253) at com.atlassian.jira.examples.ExampleServlet.doGet(ExampleServlet.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) ... {noformat} This change may cause unexpected side effects in Atlassian-authored and third-party JIRA add-ons and should be corrected ASAP. This bug would only be detected through explicit testing, since this change is not mentioned in the [Preparing for JIRA 6.0|https://developer.atlassian.com/display/JIRADEV/Preparing+for+JIRA+6.0] guide or the [Renamable Users in JIRA 6.0|https://developer.atlassian.com/display/JIRADEV/Renamable+Users+in+JIRA+6.0] guide.

    Atlassian JIRA | 4 years ago | Joe Clark [Atlassian]
    java.lang.NullPointerException
  2. 0

    Since time immemorial, the standard behaviour of Atlassian's user management subsystems has been to use {{null}} to represent an anonymous user context. This has been codified in the SAL interface javadoc for the {{com.atlassian.sal.api.user.UserManager}} interface. For example, the textual contract for the #getRemoteUser() method states: {code:lang=java} /** * Returns the profile of the currently logged in user or null if no user can be found. * <p/> * Getting the full {@link UserProfile} may have performance implications in some applications. Consider using {@link #getRemoteUserKey()} if you don't need the full object. * * @return the {@link UserProfile} of the logged in user or null * @see #getRemoteUserKey() * @since 2.10 */ @Nullable UserProfile getRemoteUser(); {code} The SAL UserManager API and the underlying JIRA implementation of UserManager were changed in JIRA 6.0 to support renaming users. This change has *broken* the textual contract of the #getRemoteUser() method in JIRA, which *no longer returns {{null}} for anonymous users*. This appears to simply be an oversight in the JIRA implementation: {code:lang=java} @Override public UserProfile getRemoteUser() { return new JiraUserProfile(jiraAuthenticationContext.getUser()); } {code} This method should return {{null}} if the value returned from {{jiraAuthenticationContext.getUser()}} also returns {{null}}. This subtle change in behaviour can end up with add-on developers getting a stack-trace like this: {noformat} java.lang.NullPointerException at com.atlassian.sal.jira.user.DefaultUserManager$JiraUserProfile.getUsername(DefaultUserManager.java:253) at com.atlassian.jira.examples.ExampleServlet.doGet(ExampleServlet.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) ... {noformat} This change may cause unexpected side effects in Atlassian-authored and third-party JIRA add-ons and should be corrected ASAP. This bug would only be detected through explicit testing, since this change is not mentioned in the [Preparing for JIRA 6.0|https://developer.atlassian.com/display/JIRADEV/Preparing+for+JIRA+6.0] guide or the [Renamable Users in JIRA 6.0|https://developer.atlassian.com/display/JIRADEV/Renamable+Users+in+JIRA+6.0] guide.

    Atlassian JIRA | 4 years ago | Joe Clark [Atlassian]
    java.lang.NullPointerException
  3. 0

    perl Regular Expression to find Java StackTrace by keyword

    Stack Overflow | 6 years ago | Gofrolist
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    openmeetings-user - [openmeetings-user] Install problems on centos 5.2 - msg#00087 - Recent Discussion OSDir.com

    osdir.com | 2 years ago
    java.lang.NullPointerException: null at org.openmeetings.app.hibernate.utils.HibernateUtil.createSession(HibernateUtil.java: 35) [openmeetings.jar:na] at org.openmeetings.app.data.basic.Configurationmanagement.getConfKey(Configurationmanagement.java: 50) [openmeetings.jar:na] at org.openmeetings.servlet.outputhandler.DefaultIndex.handleRequest(DefaultIndex.java: 38) [openmeetings.jar:na] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(VelocityViewServlet.java: 541) [velocity-tools-view-1.3.jar:1.3] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(VelocityViewServlet.java: 507) [velocity-tools-view-1.3.jar:1.3]

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.atlassian.sal.jira.user.DefaultUserManager$JiraUserProfile.getUsername()
    2. com.atlassian.sal
      DefaultUserManager$JiraUserProfile.getUsername
      1. com.atlassian.sal.jira.user.DefaultUserManager$JiraUserProfile.getUsername(DefaultUserManager.java:253)
      1 frame
    3. com.atlassian.jira
      ExampleServlet.doGet
      1. com.atlassian.jira.examples.ExampleServlet.doGet(ExampleServlet.java:78)
      1 frame
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      2 frames
    5. com.atlassian.plugin
      DelegatingPluginServlet.service
      1. com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
      1 frame
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      1 frame
    7. com.atlassian.plugin
      ServletModuleContainerServlet.service
      1. com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)
      1 frame
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      1 frame