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;
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()
{ 303 log.error("Faces Context is null"); 304 }...
302 if (facesContext == null)
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;