[seam-issues] [JBoss JIRA] (SOLDER-320) Bug(s) in org.jboss.solder.properties.MethodPropertyImpl<V>.toString()

Ioan LUPU (JIRA) jira-events at lists.jboss.org
Wed Mar 14 16:55:47 EDT 2012


     [ https://issues.jboss.org/browse/SOLDER-320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ioan LUPU updated SOLDER-320:
-----------------------------

           Description: 
Here's the code:

public boolean isReadOnly() {
 return setterMethod == null;
}

@Override
public String toString() {
 StringBuilder builder = new StringBuilder();
 if (isReadOnly()) {
   builder.append("read-only ").append(setterMethod.toString()).append("; ");
 }
 builder.append(getterMethod.toString());
 return builder.toString();
}

So... isReadOnly() returns true if setterMethod is null. This means a NullPointerException on the
builder.append("read-only ").append(setterMethod.toString()).append("; ");
line.


  was:
Here's the code:

public boolean isReadOnly() {
 return setterMethod == null;
}

@Override
public String toString() {
 StringBuilder builder = new StringBuilder();
 if (isReadOnly()) {
   builder.append("read-only ").append(setterMethod.toString()).append("; ");
 }
 builder.append(getterMethod.toString());
 return builder.toString();
}

So... isReadOnly() returns true if setterMethod is null. This means a NullPointerException on the
builder.append("read-only ").append(setterMethod.toString()).append("; ");
line.

And a simple piece of code to reproduce it:

import org.jboss.solder.properties.query.PropertyQueries;

public class Test01 {

  public static void main(String[] args) {
    System.out.println(PropertyQueries.createQuery(Test01.class).getResultList());
    // Exception in thread "main" java.lang.NullPointerException
    // at org.jboss.solder.properties.MethodPropertyImpl.toString(MethodPropertyImpl.java:174)
    // at java.lang.String.valueOf(String.java:2826)
    // at java.lang.StringBuilder.append(StringBuilder.java:115)
    // at java.util.AbstractCollection.toString(AbstractCollection.java:422)
    // at java.lang.String.valueOf(String.java:2826)
    // at java.io.PrintStream.println(PrintStream.java:771)
    // at Test01.main(Test01.java:6)
  }

}


    Steps to Reproduce: 

And a simple piece of code to reproduce it:

import org.jboss.solder.properties.query.PropertyQueries;

public class Test01 {

  public static void main(String[] args) {
    System.out.println(PropertyQueries.createQuery(Test01.class).getResultList());
    // Exception in thread "main" java.lang.NullPointerException
    // at org.jboss.solder.properties.MethodPropertyImpl.toString(MethodPropertyImpl.java:174)
    // at java.lang.String.valueOf(String.java:2826)
    // at java.lang.StringBuilder.append(StringBuilder.java:115)
    // at java.util.AbstractCollection.toString(AbstractCollection.java:422)
    // at java.lang.String.valueOf(String.java:2826)
    // at java.io.PrintStream.println(PrintStream.java:771)
    // at Test01.main(Test01.java:6)
  }

}


    
> Bug(s) in org.jboss.solder.properties.MethodPropertyImpl<V>.toString()
> ----------------------------------------------------------------------
>
>                 Key: SOLDER-320
>                 URL: https://issues.jboss.org/browse/SOLDER-320
>             Project: Solder
>          Issue Type: Bug
>    Affects Versions: 3.1.0.Final
>            Reporter: Ioan LUPU
>            Priority: Minor
>
> Here's the code:
> public boolean isReadOnly() {
>  return setterMethod == null;
> }
> @Override
> public String toString() {
>  StringBuilder builder = new StringBuilder();
>  if (isReadOnly()) {
>    builder.append("read-only ").append(setterMethod.toString()).append("; ");
>  }
>  builder.append(getterMethod.toString());
>  return builder.toString();
> }
> So... isReadOnly() returns true if setterMethod is null. This means a NullPointerException on the
> builder.append("read-only ").append(setterMethod.toString()).append("; ");
> line.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list