Uploaded image for project: 'Click'
  1. Click
  2. CLK-132

Property Select throws a null pointer exception when you use a non required field as the label and at least one of the fields is null.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: extras
    • Labels:
      None

      Description

      Please add a check before line 460 that label is not null. Either

      if (label == null) {
      label = "";
      }

      or

      if (label == null) {
      label = value;
      }

      451: String value = String.valueOf(pk);
      452: Object label = null;
      453:
      454: if (getDecorator() != null)

      { 455: label = getDecorator().render(dataObject, getContext()); 456: }

      else

      { 457: label = Ognl.getValue(optionLabel, ognlContext, dataObject); 458: }

      459:
      460: Option option = new Option(value, label.toString());
      461:
      462: add(option);
      463: }
      464:
      465: } catch (Exception e)

      { 466: throw new RuntimeException(e); 467: }

      468: }
      469:
      470: }

      Trace:

      java.lang.NullPointerException
      at net.sf.click.extras.cayenne.PropertySelect.loadOptionList(PropertySelect.java:460)
      at net.sf.click.extras.cayenne.PropertySelect.toString(PropertySelect.java:355)
      at java.lang.String.valueOf(String.java:2131)
      at net.sf.click.util.HtmlStringBuffer.append(HtmlStringBuffer.java:129)
      at net.sf.click.control.FieldSet.renderFields(FieldSet.java:608)
      at net.sf.click.control.FieldSet.toString(FieldSet.java:512)
      at java.lang.String.valueOf(String.java:2131)
      at net.sf.click.util.HtmlStringBuffer.append(HtmlStringBuffer.java:129)
      at net.sf.click.control.Form.renderFields(Form.java:2098)
      at net.sf.click.control.Form.toString(Form.java:1942)
      at net.sf.click.extras.cayenne.CayenneForm.toString(CayenneForm.java:473)
      at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:270)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:235)
      at org.apache.velocity.runtime.directive.Parse.render(Parse.java:211)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:117)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:235)
      at org.apache.velocity.Template.merge(Template.java:254)
      at net.sf.click.ClickServlet.renderTemplate(ClickServlet.java:584)
      at net.sf.click.ClickServlet.processPage(ClickServlet.java:523)
      at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:345)
      at net.sf.click.ClickServlet.doGet(ClickServlet.java:268)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at net.sf.click.extras.filter.CompressionFilter.doFilter(CompressionFilter.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at net.sf.click.extras.cayenne.DataContextFilter.doFilter(DataContextFilter.java:125)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:534)

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        Checked into SVN will be available in release 1.1

        Show
        medgar Malcolm Edgar added a comment - Checked into SVN will be available in release 1.1

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            dfrizelle David Frizelle
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development