Check for a behavior change on the request.getAttribute() method

WebSphere Application Server v5.1 automatically casted the return of request.getAttribute("string") to a String . In Version 6, this is no longer the case and the returned data is an instance of java.lang.Object, not java.lang.String. The rule will detect the entry in JSP files if the request.getAttribute() is part of an assignment or is part of a variable declaration.

Examples of entries that will get flagged

Variable declaration:
<% String myAtt = request.getAttribute("myAtt");%>

Variable assignment:
<% String myAtt;
   myAtt = request.getAttribute("myAtt");%>


Non-Object variable assignment without a cast operator
<% Date d= request.getAttribute("myDate");%>

The following code will not get flagged:

Code already casted:
<% String myAtt= (String) request.getAttribute("myAtt");%>

Code not part of assignment or variable deceleration
<% request.getAttribute("myDate");%>

To preserve the behavior of V5.1, you can use custom property com.ibm.wsspi.jsp.useStringCast . For more details on the property usage, see:

JavaServer Pages specific web container custom properties