jersey
  1. jersey
  2. JERSEY-655

NPE in WaldGeneratorResourceDocSupport.java causes web application not to start

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5
    • Fix Version/s: 1.7
    • Component/s: None
    • Labels:
      None

      Description

      The following piece of code is called by a method which passes null to the AbstractMethod m parameter causing a NPE

      public Param createParam( AbstractResource r, AbstractMethod m, Parameter p ) {
              final Param result = _delegate.createParam( r, m, p );
              final ParamDocType paramDoc = _resourceDoc.getParamDoc( r.getResourceClass(), m.getMethod(), p );
              if ( paramDoc != null && !isEmpty( paramDoc.getCommentText() ) ) {
                  final Doc doc = new Doc();
                  doc.getContent().add( paramDoc.getCommentText() );
                  result.getDoc().add( doc );
              }
              return result;
          }
      

      The calling code is situated in WadlBuilder.java

      private Resource generateResource(AbstractResource r, String path, Set<Class<?>> visitedClasses) {
      ...
      
              for (Parameterized f : fieldsOrSetters) {
                  for (Parameter fp : f.getParameters()) {
                      Param wadlParam = generateParam(r, null, fp);
                      if (wadlParam != null) {
                          wadlResource.getParam().add(wadlParam);
                      }
                  }
              }
      ...
      

      which calls generateParam and passes null to WadlGeneratorResourceDocSupprt

       private Param generateParam(AbstractResource r, AbstractMethod m, final Parameter p) {
              if (p.getSource() == Parameter.Source.ENTITY || p.getSource() == Parameter.Source.CONTEXT) {
                  return null;
              }
              Param wadlParam = _wadlGenerator.createParam(r, m, p);
              return wadlParam;
          }
      

        Issue Links

          Activity

          Hide
          Martin Matula added a comment -

          I believe this was fixed by Pavel recently. Pavel, please confirm.

          Show
          Martin Matula added a comment - I believe this was fixed by Pavel recently. Pavel, please confirm.
          Hide
          Pavel Bucek added a comment -

          duplicate of #721, which is already fixed.

          Closing as duplicate.

          Show
          Pavel Bucek added a comment - duplicate of #721, which is already fixed. Closing as duplicate.

            People

            • Assignee:
              Pavel Bucek
              Reporter:
              Alex_Peelman
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: