Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-22456

Fix possible NPE in class 'UITypesConfigurationActions'

    XMLWordPrintable

    Details

      Description

      It can happen (unable to reproduce but encountered by customer) that a NPE occurs when sorting document types in class UITypesConfigurationActions, here is a diff (6.0) I provided in a patched jar to the customer:

      diff --git a/nuxeo-features/localconf/nuxeo-localconf-web/src/main/java/org/nuxeo/ecm/localconf/UITypesConfigurationActions.java b/nuxeo-features/localconf/nuxeo-localconf-web/src/main/java/org/nuxeo/ecm/localconf/UITypesConfigurationActions.java
      index dfb7f99..5982c47 100644
      --- a/nuxeo-features/localconf/nuxeo-localconf-web/src/main/java/org/nuxeo/ecm/localconf/UITypesConfigurationActions.java
      +++ b/nuxeo-features/localconf/nuxeo-localconf-web/src/main/java/org/nuxeo/ecm/localconf/UITypesConfigurationActions.java
      @@ -28,6 +28,8 @@ import java.util.Iterator;
       import java.util.List;
       import java.util.Map;
       
      +import org.apache.commons.logging.Log;
      +import org.apache.commons.logging.LogFactory;
       import org.jboss.seam.annotations.In;
       import org.jboss.seam.annotations.Install;
       import org.jboss.seam.annotations.Name;
      @@ -55,6 +57,8 @@ public class UITypesConfigurationActions implements Serializable {
       
           private static final long serialVersionUID = 1L;
       
      +    private static final Log log = LogFactory.getLog(UITypesConfigurationActions.class);
      +    
           @In(create = true)
           protected Map<String, String> messages;
       
      @@ -87,7 +91,15 @@ public class UITypesConfigurationActions implements Serializable {
               @Override
               public int compare(Type type1, Type type2) {
                   String label1 = messages.get(type1.getLabel());
      +            if (label1 == null) {
      +                log.error("No label for " + type1.getId());
      +                label1 = type1.getId();
      +            }
                   String label2 = messages.get(type2.getLabel());
      +            if (label2 == null) {
      +                log.error("No label for " + type2.getId());
      +                label2 = type2.getId();
      +            }
                   return label1.compareTo(label2);
               }
           }
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours
                  5h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.