ICEfaces
  1. ICEfaces
  2. ICE-2786

ICEfaces trunk has failures on Fortify Java Open Review Project site

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7Beta1
    • Fix Version/s: 1.7RC1, 1.7
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces trunk

      Description

      The Fortify Software "Java Open Review" site lists ICEfaces as having 14 "defects" as of a scan completed against our trunk repository on Jan. 8, 2008. Note that as of the 1.7DR#3 release on Dec. 20th, 2007 ICEfaces was listed as being defect free, so something has changed between then and Jan. 8th to cause these failures.

      http://opensource.fortifysoftware.com/welcome.html

        Activity

        Hide
        Ted Goddard added a comment -

        Redundant Comparison to null.

        AbstractAttributeMap.java:318 Mircea

        318 if (!value.equals(AbstractAttributeMap.this.get(key)) ||
        319 key == null || value == null)
        320 return false;

        Either perform (value == null) first or remove the test; a NullPointerException will be thrown by the first conditional clause.

        CMGenerator.java:145 Frank

        145 Node testElement = getElementByCategoryName(tagElement, "category",propertyBean.getCategory());
        ...
        150 categoryElement.setAttribute("displaylabel", "%Category.Label."+propertyBean.getCategory());
        ...
        156 if(propertyBean != null && propertyBean.getCategory() != null){

        propertyBean != null will already have thrown NullPointerException on line 145 (and 150). Recommend just remove the test for null.

        CurrentStyle.java:257 Adnan/Mark

        257 Map map = (Map) facesContext.getExternalContext().getSessionMap()
        ...
        302 if (facesContext == null)

        { 303 log.error("Faces Context is null"); 304 }

        NullPointerException will already have been thrown on line 257. Recommend remove the test on line 302.

        SelectInputDate.java:891 Adnan/Mark

        891 if (this.highlightWeekClass.indexOf(highlightWeekClass) == -1) {
        892 if (this.highlightWeekClass == null || this.highlightWeekClass.length() == 0)

        NullPointerException will already have been thrown on line 891. Recommend remove the test for null on line 892.

        SelectInputDate.java:900 Adnan/Mark

        900 if (this.highlightDayClass.indexOf(highlightDayClass) == -1) {
        901 if (this.highlightDayClass == null || this.highlightDayClass.length() == 0)

        NullPointerException will already have been thrown on line 900. Recommend remove the test for null on line 901.

        TLDGenerator.java:249 Mark
        249 if (cb.isSuppressed())
        ...
        256 if(cb == null){

        NullPointerException will already have been thrown on line 249. Recommend remove the test for null on line 256.

        Bad use of return value.

        CacheControlledServer.java:65 Mircea

        65 String eTag = String.valueOf(Math.abs(request.getURI().hashCode()));

        Fortify claims that Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE, so recommend replacing with
        Integer.toHexString(request.getURI().hashCode()));

        Confusing Method Name.

        TagToTagClassElement.java:51 Mark

        51 public void TagToTagClassElement() {

        remove void and change to a constructor.

        Null pointer dereference.

        AsynchServlet.java:83 Jack
        83 asyncHttpServer.stop();

        Class seems to contain unused code. Recommend commenting out line.

        AsynchServlet.java:83 Jack
        202 out.print( "Server is listening on port: " + asyncHttpServer.getPort() );
        Not clear where asyncHttpServer is set. Make Class abstract or check for null asyncHttpServer here?

        MatchAddressDB.java:141 Brad

        141 xDecode.close();

        Test for null xDecode near beginning of function and return if null.

        PanelCollapsible.java:269 Adnan/Mark

        266 else

        { 267 message = new FacesMessage(messageStr); 268 }

        269 message.setSeverity(FacesMessage.SEVERITY_ERROR);

        Can't construct message in the else block and then use it below. Recommend just construct outside the else block.

        Properties.java:581 Mircea

        581 return String.valueOf(null);
        Recommend static String constant "(null)" for return value.

        Properties.java:810 Mircea

        808 if (value == null || value instanceof String) {
        809 try{
        810 return Double.valueOf((String)value).doubleValue();

        Recommend adding separate block to test for null value and throw specific PropertyException("value is null")

        Properties.java:827 Mircea

        825 if (value == null || value instanceof String) {
        826 try{
        827 return Float.valueOf((String)value).floatValue();
        Recommend adding separate block to test for null value and throw specific PropertyException("value is null")

        Uncallable method of anonymous class.

        AsyncHttpServerAdaptingServlet.java:75 Jack
        75 protected void updatedViewsQueueExceeded(

        Fortify claims this method is not callable. Recommend removing it.

        Uninitialized read of field in constructor

        TreeNavigation.java: 91 Adnan/Mark
        91 rootObject.setNavigationSelection(navigationBean);
        navigationBean is not initialized in the constructor. Recommend initialize to null when declared.

        View.java:76 Mircea
        76 this.facesContext = new BridgeFacesContext(externalContext, viewIdentifier, sessionID, this, configuration, resourceDispatcher);
        externalContext is not initialized here. Recommend initialize to null when declared (strange to pass it, though).

        Unwritten field.
        AsyncServlet.java:83 Jack
        Same problem as above.

        StubPageContext.java: 97 Mircea
        97 if (httpSession == null) {
        httpSession never initialized. Recommend initialize to null when declared;

        StubPageContext.java: 212 Mircea
        212 return servletRequest;
        servletRequest never initialized. Recommend initialize to null when declared;

        Show
        Ted Goddard added a comment - Redundant Comparison to null. AbstractAttributeMap.java:318 Mircea 318 if (!value.equals(AbstractAttributeMap.this.get(key)) || 319 key == null || value == null) 320 return false; Either perform (value == null) first or remove the test; a NullPointerException will be thrown by the first conditional clause. CMGenerator.java:145 Frank 145 Node testElement = getElementByCategoryName(tagElement, "category",propertyBean.getCategory()); ... 150 categoryElement.setAttribute("displaylabel", "%Category.Label."+propertyBean.getCategory()); ... 156 if(propertyBean != null && propertyBean.getCategory() != null){ propertyBean != null will already have thrown NullPointerException on line 145 (and 150). Recommend just remove the test for null. CurrentStyle.java:257 Adnan/Mark 257 Map map = (Map) facesContext.getExternalContext().getSessionMap() ... 302 if (facesContext == null) { 303 log.error("Faces Context is null"); 304 } NullPointerException will already have been thrown on line 257. Recommend remove the test on line 302. SelectInputDate.java:891 Adnan/Mark 891 if (this.highlightWeekClass.indexOf(highlightWeekClass) == -1) { 892 if (this.highlightWeekClass == null || this.highlightWeekClass.length() == 0) NullPointerException will already have been thrown on line 891. Recommend remove the test for null on line 892. SelectInputDate.java:900 Adnan/Mark 900 if (this.highlightDayClass.indexOf(highlightDayClass) == -1) { 901 if (this.highlightDayClass == null || this.highlightDayClass.length() == 0) NullPointerException will already have been thrown on line 900. Recommend remove the test for null on line 901. TLDGenerator.java:249 Mark 249 if (cb.isSuppressed()) ... 256 if(cb == null){ NullPointerException will already have been thrown on line 249. Recommend remove the test for null on line 256. Bad use of return value. CacheControlledServer.java:65 Mircea 65 String eTag = String.valueOf(Math.abs(request.getURI().hashCode())); Fortify claims that Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE, so recommend replacing with Integer.toHexString(request.getURI().hashCode())); Confusing Method Name. TagToTagClassElement.java:51 Mark 51 public void TagToTagClassElement() { remove void and change to a constructor. Null pointer dereference. AsynchServlet.java:83 Jack 83 asyncHttpServer.stop(); Class seems to contain unused code. Recommend commenting out line. AsynchServlet.java:83 Jack 202 out.print( "Server is listening on port: " + asyncHttpServer.getPort() ); Not clear where asyncHttpServer is set. Make Class abstract or check for null asyncHttpServer here? MatchAddressDB.java:141 Brad 141 xDecode.close(); Test for null xDecode near beginning of function and return if null. PanelCollapsible.java:269 Adnan/Mark 266 else { 267 message = new FacesMessage(messageStr); 268 } 269 message.setSeverity(FacesMessage.SEVERITY_ERROR); Can't construct message in the else block and then use it below. Recommend just construct outside the else block. Properties.java:581 Mircea 581 return String.valueOf(null); Recommend static String constant "(null)" for return value. Properties.java:810 Mircea 808 if (value == null || value instanceof String) { 809 try{ 810 return Double.valueOf((String)value).doubleValue(); Recommend adding separate block to test for null value and throw specific PropertyException("value is null") Properties.java:827 Mircea 825 if (value == null || value instanceof String) { 826 try{ 827 return Float.valueOf((String)value).floatValue(); Recommend adding separate block to test for null value and throw specific PropertyException("value is null") Uncallable method of anonymous class. AsyncHttpServerAdaptingServlet.java:75 Jack 75 protected void updatedViewsQueueExceeded( Fortify claims this method is not callable. Recommend removing it. Uninitialized read of field in constructor TreeNavigation.java: 91 Adnan/Mark 91 rootObject.setNavigationSelection(navigationBean); navigationBean is not initialized in the constructor. Recommend initialize to null when declared. View.java:76 Mircea 76 this.facesContext = new BridgeFacesContext(externalContext, viewIdentifier, sessionID, this, configuration, resourceDispatcher); externalContext is not initialized here. Recommend initialize to null when declared (strange to pass it, though). Unwritten field. AsyncServlet.java:83 Jack Same problem as above. StubPageContext.java: 97 Mircea 97 if (httpSession == null) { httpSession never initialized. Recommend initialize to null when declared; StubPageContext.java: 212 Mircea 212 return servletRequest; servletRequest never initialized. Recommend initialize to null when declared;
        Hide
        Frank Ye added a comment -

        Eclipse CM model already changed, remove the generator for the time being.

        Committed revision 15904.

        Show
        Frank Ye added a comment - Eclipse CM model already changed, remove the generator for the time being. Committed revision 15904.
        Hide
        Jack Van Ooststroom added a comment -

        I removed the com.icesoft.faces.async.server.AsyncServlet class which is not used anymore ever since the move from AHS into the core product. This solved 3 of the 4 issues I introduced.

        Show
        Jack Van Ooststroom added a comment - I removed the com.icesoft.faces.async.server.AsyncServlet class which is not used anymore ever since the move from AHS into the core product. This solved 3 of the 4 issues I introduced.
        Hide
        Mark Collette added a comment -

        Fixed the Mark/Adnan ones.

        Subversion 15910
        icefaces\core\src\com\icesoft\faces\context\effects\CurrentStyle.java
        icefaces\core\src\com\icesoft\faces\webapp\parser\TagToTagClassElement.java
        icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDate.java
        icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsible.java
        icefaces\component-metadata\src\main\java\com\icesoft\metadata\generators\TLDGenerator.java
        icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\navigation\TreeNavigation.java

        Show
        Mark Collette added a comment - Fixed the Mark/Adnan ones. Subversion 15910 icefaces\core\src\com\icesoft\faces\context\effects\CurrentStyle.java icefaces\core\src\com\icesoft\faces\webapp\parser\TagToTagClassElement.java icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDate.java icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsible.java icefaces\component-metadata\src\main\java\com\icesoft\metadata\generators\TLDGenerator.java icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\navigation\TreeNavigation.java
        Hide
        Jack Van Ooststroom added a comment -

        I fixed the last one I introduced as well in AsyncHttpServerAdaptingServlet.java.

        As the framework currently doesn't have support for recovering from updated views queue exceeded messages and the actual handler wasn't doing anything at the moment, I commented out the handler. We should revisit this when the framework has the recovering capability.

        Show
        Jack Van Ooststroom added a comment - I fixed the last one I introduced as well in AsyncHttpServerAdaptingServlet.java. As the framework currently doesn't have support for recovering from updated views queue exceeded messages and the actual handler wasn't doing anything at the moment, I commented out the handler. We should revisit this when the framework has the recovering capability.
        Hide
        Mark Collette added a comment -

        Fixed the "fix".

        Subversion 15914
        icefaces\component-metadata\src\main\java\com\icesoft\metadata\generators\TLDGenerator.java

        Show
        Mark Collette added a comment - Fixed the "fix". Subversion 15914 icefaces\component-metadata\src\main\java\com\icesoft\metadata\generators\TLDGenerator.java
        Hide
        Mark Collette added a comment -

        Subversion 15928
        icefaces\samples\address-demo\src\com\icesoft\applications\faces\address\MatchAddressDB.java

        Show
        Mark Collette added a comment - Subversion 15928 icefaces\samples\address-demo\src\com\icesoft\applications\faces\address\MatchAddressDB.java
        Hide
        Mircea Toma added a comment -

        Fixed assigned issues. See commits corresponding messages.

        Show
        Mircea Toma added a comment - Fixed assigned issues. See commits corresponding messages.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ken Fyten
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: