[Fb-contrib-commit] SF.net SVN: fb-contrib: [625] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-09-03 20:51:03
|
Revision: 625 http://svn.sourceforge.net/fb-contrib/?rev=625&view=rev Author: dbrosius Date: 2006-09-03 13:50:45 -0700 (Sun, 03 Sep 2006) Log Message: ----------- filter out tricky false positives due to trinaries in ISB Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2006-08-27 00:47:59 UTC (rev 624) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2006-09-03 20:50:45 UTC (rev 625) @@ -99,18 +99,22 @@ || "java/lang/StringBuilder".equals(calledClass)) && "append".equals(getNameConstantOperand()) && getSigConstantOperand().startsWith("(Ljava/lang/String;)")) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item itm = stack.getStackItem(0); - Object cons = itm.getConstant(); - if ((cons instanceof String) && (itm.getRegisterNumber() < 0)) { - if (((String)cons).length() == 0) { - bugReporter.reportBug( - new BugInstance(this, "ISB_EMPTY_STRING_APPENDING", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - } + if (stack.getStackDepth() > 1) { + OpcodeStack.Item sbItm = stack.getStackItem(1); + if ((sbItm != null) && (sbItm.getUserValue() == null)) + { + OpcodeStack.Item itm = stack.getStackItem(0); + Object cons = itm.getConstant(); + if ((cons instanceof String) && (itm.getRegisterNumber() < 0)) { + if (((String)cons).length() == 0) { + bugReporter.reportBug( + new BugInstance(this, "ISB_EMPTY_STRING_APPENDING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |