Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib:[1087] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-02-14 05:08:10
|
Revision: 1087
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1087&view=rev
Author: dbrosius
Date: 2009-02-14 05:08:05 +0000 (Sat, 14 Feb 2009)
Log Message:
-----------
fix for [ 2494245 ] LEST False Positive
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-01-26 07:32:48 UTC (rev 1086)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-02-14 05:08:05 UTC (rev 1087)
@@ -35,6 +35,7 @@
import org.apache.bcel.classfile.LocalVariable;
import org.apache.bcel.classfile.LocalVariableTable;
import org.apache.bcel.classfile.Method;
+import org.apache.bcel.generic.Type;
import com.mebigfatguy.fbcontrib.utils.Integer14;
import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
@@ -61,7 +62,7 @@
}
}
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private OpcodeStack stack;
private CodeException[] exceptions;
private Set<CatchInfo> catchInfos;
@@ -173,7 +174,6 @@
}
} else if (pc == ex.getHandlerPC()) {
removePreviousHandlers(pc);
-
}
}
@@ -189,16 +189,20 @@
it.remove();
break;
} else if ((pc > catchInfo.getStart()) && (pc <= catchInfo.getFinish())) {
- if ((seen == INVOKESPECIAL) && ("<init>".equals(getNameConstantOperand()))) {
- String className = getClassConstantOperand();
- JavaClass exClass = Repository.lookupClass(className);
- if (exClass.instanceOf(throwableClass)) {
- String sig = getSigConstantOperand();
- if ((sig.indexOf("Exception") >= 0)
- || (sig.indexOf("Throwable") >= 0)) {
- markAsValid = true;
- break;
+ if (seen == INVOKESPECIAL) {
+ if ("<init>".equals(getNameConstantOperand())) {
+ String className = getClassConstantOperand();
+ JavaClass exClass = Repository.lookupClass(className);
+ if (exClass.instanceOf(throwableClass)) {
+ String sig = getSigConstantOperand();
+ if ((sig.indexOf("Exception") >= 0)
+ || (sig.indexOf("Throwable") >= 0)) {
+ markAsValid = true;
+ break;
+ }
}
+ } else if (isPossibleExBuilder(catchInfo.getRegister())) {
+ markAsValid = true;
}
} else if (seen == INVOKEVIRTUAL) {
if ("initCause".equals(getNameConstantOperand())) {
@@ -215,7 +219,12 @@
}
} else if ("getTargetException".equals(getNameConstantOperand()) && "java/lang/reflect/InvocationTargetException".equals(getClassConstantOperand())) {
markAsValid = true;
- }
+ } else if (isPossibleExBuilder(catchInfo.getRegister())) {
+ markAsValid = true;
+ }
+ } else if (seen == INVOKEINTERFACE) {
+ if (isPossibleExBuilder(catchInfo.getRegister()))
+ markAsValid = true;
} else if (seen == ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
@@ -264,6 +273,33 @@
}
}
+ /** returns whether the method called might be a method that builds an exception using
+ * the original exception. It does so by looking to see if the method returns an exception,
+ * and if one of the parameters is the original exception
+ * @param exReg the register of the original exception caught
+ * @return whether this method call could be an exception builder method
+ */
+ public boolean isPossibleExBuilder(int exReg) throws ClassNotFoundException {
+ String sig = getSigConstantOperand();
+ Type returnType = Type.getReturnType(sig);
+ String returnSig = returnType.getSignature();
+ if (returnSig.startsWith("L")) {
+ returnSig = returnSig.substring(1, returnSig.length() - 1);
+ JavaClass retCls = Repository.lookupClass(returnSig);
+ if (retCls.instanceOf(throwableClass)) {
+ int numParms = Type.getArgumentTypes(sig).length;
+ if (stack.getStackDepth() >= numParms) {
+ for (int p = 0; p < numParms; p++) {
+ OpcodeStack.Item item = stack.getStackItem(p);
+ if (item.getRegisterNumber() == exReg)
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
/** returns whether the class in question was compiled with a jdk less than 1.4
*
* @param exClass the class to check
@@ -329,7 +365,7 @@
}
private static class CatchInfo {
- private int catchStart;
+ private final int catchStart;
private int catchFinish;
private int exReg;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-02-20 07:10:38
|
Revision: 1096
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1096&view=rev
Author: dbrosius
Date: 2009-02-20 07:10:32 +0000 (Fri, 20 Feb 2009)
Log Message:
-----------
add static exception builders to the ignore set
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-02-20 07:07:12 UTC (rev 1095)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-02-20 07:10:32 UTC (rev 1096)
@@ -222,7 +222,7 @@
} else if (isPossibleExBuilder(catchInfo.getRegister())) {
markAsValid = true;
}
- } else if (seen == INVOKEINTERFACE) {
+ } else if ((seen == INVOKEINTERFACE) || (seen == INVOKESTATIC)) {
if (isPossibleExBuilder(catchInfo.getRegister()))
markAsValid = true;
} else if (seen == ATHROW) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-03-04 04:05:27
|
Revision: 1137
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1137&view=rev
Author: dbrosius
Date: 2009-03-04 04:05:25 +0000 (Wed, 04 Mar 2009)
Log Message:
-----------
don't report throws from finally
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-02 02:44:48 UTC (rev 1136)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-04 04:05:25 UTC (rev 1137)
@@ -143,7 +143,7 @@
public CodeException[] collectExceptions(CodeException[] exceptions) {
List<CodeException> filteredEx = new ArrayList<CodeException>();
for (CodeException ce : exceptions) {
- if ((ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) {
+ if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) {
filteredEx.add(ce);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-03-15 04:28:52
|
Revision: 1141
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1141&view=rev
Author: dbrosius
Date: 2009-03-15 04:28:50 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
reduce fps
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-09 04:09:21 UTC (rev 1140)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-15 04:28:50 UTC (rev 1141)
@@ -108,11 +108,15 @@
*/
public boolean prescreen(Code code, Method method) {
if (method.isSynthetic())
- return false;
+ {
+ return false;
+ }
CodeException[] ce = code.getExceptionTable();
if ((ce == null) || (ce.length == 0))
- return false;
+ {
+ return false;
+ }
BitSet bytecodeSet = getClassContext().getBytecodeSet(method);
return (bytecodeSet != null) && (bytecodeSet.get(Constants.ATHROW));
@@ -163,15 +167,18 @@
int pc = getPC();
for (CodeException ex : exceptions) {
if (pc == ex.getEndPC()) {
- if (ex.getCatchType() != 0)
+ if ((seen >= IRETURN) && (seen <= RETURN))
{
- if ((seen >= IRETURN) && (seen <= RETURN))
- addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
- else if ((seen == GOTO) || (seen == GOTO_W))
- addCatchBlock(ex.getHandlerPC(), this.getBranchTarget());
- else
- addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
+ addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
}
+ else if ((seen == GOTO) || (seen == GOTO_W))
+ {
+ addCatchBlock(ex.getHandlerPC(), this.getBranchTarget());
+ }
+ else
+ {
+ addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
+ }
} else if (pc == ex.getHandlerPC()) {
removePreviousHandlers(pc);
}
@@ -183,7 +190,9 @@
CatchInfo catchInfo = it.next();
if (pc == catchInfo.getStart()) {
if (!updateExceptionRegister(catchInfo, seen, pc))
+ {
it.remove();
+ }
break;
} else if (pc > catchInfo.getFinish()) {
it.remove();
@@ -213,7 +222,9 @@
OpcodeStack.Item itm = stack.getStackItem(1);
int reg = itm.getRegisterNumber();
if (reg >= 0)
- exReg.put(Integer14.valueOf(reg), Boolean.TRUE);
+ {
+ exReg.put(Integer14.valueOf(reg), Boolean.TRUE);
+ }
markAsValid = true; // Fixes javac generated code
}
}
@@ -224,7 +235,9 @@
}
} else if ((seen == INVOKEINTERFACE) || (seen == INVOKESTATIC)) {
if (isPossibleExBuilder(catchInfo.getRegister()))
- markAsValid = true;
+ {
+ markAsValid = true;
+ }
} else if (seen == ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
@@ -253,7 +266,12 @@
} else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) {
Boolean valid = exReg.get(Integer14.valueOf(RegisterUtils.getALoadReg(this, seen)));
if (valid != null)
- markAsValid = valid.booleanValue();
+ {
+ markAsValid = valid.booleanValue();
+ }
+ } else if ((seen >= IRETURN) && (seen <= RETURN)) {
+ removeIndeterminateHandlers(pc);
+ break;
}
}
} catch (ClassNotFoundException cnfe) {
@@ -292,7 +310,9 @@
for (int p = 0; p < numParms; p++) {
OpcodeStack.Item item = stack.getStackItem(p);
if (item.getRegisterNumber() == exReg)
- return true;
+ {
+ return true;
+ }
}
}
}
@@ -317,10 +337,24 @@
while (it.hasNext()) {
CatchInfo ci = it.next();
if (ci.getStart() < pc)
+ {
it.remove();
+ }
}
}
+ private void removeIndeterminateHandlers(int pc)
+ {
+ Iterator<CatchInfo> it = catchInfos.iterator();
+ while (it.hasNext()) {
+ CatchInfo ci = it.next();
+ if ((ci.getStart() < pc) && (ci.getFinish() == Integer.MAX_VALUE))
+ {
+ it.remove();
+ }
+ }
+ }
+
/**
* looks to update the catchinfo block with the register used for the
* exception variable. If their is a local variable table, but the local
@@ -343,10 +377,14 @@
if (lv != null) {
int finish = lv.getStartPC() + lv.getLength();
if (finish < ci.getFinish())
+ {
ci.setFinish(finish);
+ }
}
else
+ {
return false;
+ }
}
}
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-03-16 03:01:08
|
Revision: 1142
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1142&view=rev
Author: dbrosius
Date: 2009-03-16 03:01:00 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
remove some more fps due to crazy jdk6 finally block generations
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-15 04:28:50 UTC (rev 1141)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-16 03:01:00 UTC (rev 1142)
@@ -67,6 +67,7 @@
private CodeException[] exceptions;
private Set<CatchInfo> catchInfos;
private Map<Integer, Boolean> exReg;
+ private boolean lastWasExitPoint = false;
/**
* constructs a LEST detector given the reporter to report bugs on
@@ -134,6 +135,7 @@
catchInfos.clear();
exceptions = collectExceptions(obj.getExceptionTable());
exReg.clear();
+ lastWasExitPoint = false;
super.visitCode(obj);
}
}
@@ -255,6 +257,12 @@
}
}
} else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
+ if (lastWasExitPoint) {
+ //crazy jdk6 finally block injection -- shut off detection
+ catchInfos.clear();
+ break;
+ }
+
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
int reg = RegisterUtils.getAStoreReg(this, seen);
@@ -279,6 +287,8 @@
it.remove();
}
}
+
+ lastWasExitPoint = ((seen >= IRETURN) && (seen <= RETURN)) || (seen == GOTO) || (seen == GOTO_W);
}
finally {
stack.sawOpcode(this, seen);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-03-16 03:09:37
|
Revision: 1143
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1143&view=rev
Author: dbrosius
Date: 2009-03-16 03:09:24 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
more fps with a throw followed by a store
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-16 03:01:00 UTC (rev 1142)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-03-16 03:09:24 UTC (rev 1143)
@@ -288,7 +288,7 @@
}
}
- lastWasExitPoint = ((seen >= IRETURN) && (seen <= RETURN)) || (seen == GOTO) || (seen == GOTO_W);
+ lastWasExitPoint = ((seen >= IRETURN) && (seen <= RETURN)) || (seen == GOTO) || (seen == GOTO_W) || (seen == ATHROW);
}
finally {
stack.sawOpcode(this, seen);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-11-26 03:23:39
|
Revision: 1387
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1387&view=rev
Author: dbrosius
Date: 2009-11-26 03:23:30 +0000 (Thu, 26 Nov 2009)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-11-26 03:23:03 UTC (rev 1386)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-11-26 03:23:30 UTC (rev 1387)
@@ -332,7 +332,7 @@
/** returns whether the class in question was compiled with a jdk less than 1.4
*
- * @param exClass the class to check
+ * @param cls the class to check
* @return whether the class is compiled with a jdk less than 1.4
*/
private boolean isPre14Class(JavaClass cls)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2010-08-31 01:27:01
|
Revision: 1600
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1600&view=rev
Author: dbrosius
Date: 2010-08-31 01:26:54 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
weaken the LEST report, when the situation looks like it's synthetic, for instance throwing exceptions out of synchronized blocks
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:10:22 UTC (rev 1599)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:26:54 UTC (rev 1600)
@@ -85,7 +85,7 @@
@Override
public void visitClassContext(ClassContext classContext) {
try {
- if ((throwableClass != null) && (!isPre14Class(classContext.getJavaClass()))) {
+ if (throwableClass != null && !isPre14Class(classContext.getJavaClass())) {
stack = new OpcodeStack();
catchInfos = new HashSet<CatchInfo>();
exReg = new HashMap<Integer, Boolean>();
@@ -113,13 +113,13 @@
}
CodeException[] ce = code.getExceptionTable();
- if ((ce == null) || (ce.length == 0))
+ if (ce == null || ce.length == 0)
{
return false;
}
BitSet bytecodeSet = getClassContext().getBytecodeSet(method);
- return (bytecodeSet != null) && (bytecodeSet.get(Constants.ATHROW));
+ return bytecodeSet != null && bytecodeSet.get(Constants.ATHROW);
}
/**
@@ -148,7 +148,7 @@
public CodeException[] collectExceptions(CodeException[] exs) {
List<CodeException> filteredEx = new ArrayList<CodeException>();
for (CodeException ce : exs) {
- if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) {
+ if (ce.getCatchType() != 0 && ce.getStartPC() < ce.getEndPC() && ce.getEndPC() <= ce.getHandlerPC()) {
filteredEx.add(ce);
}
}
@@ -168,11 +168,11 @@
int pc = getPC();
for (CodeException ex : exceptions) {
if (pc == ex.getEndPC()) {
- if ((seen >= IRETURN) && (seen <= RETURN))
+ if (seen >= IRETURN && seen <= RETURN)
{
addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
}
- else if ((seen == GOTO) || (seen == GOTO_W))
+ else if (seen == GOTO || seen == GOTO_W)
{
addCatchBlock(ex.getHandlerPC(), this.getBranchTarget());
}
@@ -198,15 +198,15 @@
} else if (pc > catchInfo.getFinish()) {
it.remove();
break;
- } else if ((pc > catchInfo.getStart()) && (pc <= catchInfo.getFinish())) {
+ } else if (pc > catchInfo.getStart() && pc <= catchInfo.getFinish()) {
if (seen == INVOKESPECIAL) {
if ("<init>".equals(getNameConstantOperand())) {
String className = getClassConstantOperand();
JavaClass exClass = Repository.lookupClass(className);
if (exClass.instanceOf(throwableClass)) {
String sig = getSigConstantOperand();
- if ((sig.indexOf("Exception") >= 0)
- || (sig.indexOf("Throwable") >= 0)) {
+ if (sig.indexOf("Exception") >= 0
+ || sig.indexOf("Throwable") >= 0) {
markAsValid = true;
break;
}
@@ -234,7 +234,7 @@
} else if (isPossibleExBuilder(catchInfo.getRegister())) {
markAsValid = true;
}
- } else if ((seen == INVOKEINTERFACE) || (seen == INVOKESTATIC)) {
+ } else if (seen == INVOKEINTERFACE || seen == INVOKESTATIC) {
if (isPossibleExBuilder(catchInfo.getRegister()))
{
markAsValid = true;
@@ -242,11 +242,24 @@
} else if (seen == ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
- if ((itm.getRegisterNumber() != catchInfo.getRegister())
- && (itm.getUserValue() == null)) {
+ if (itm.getRegisterNumber() != catchInfo.getRegister()
+ && itm.getUserValue() == null) {
if (!isPre14Class(itm.getJavaClass()))
{
- bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY)
+ int priority = NORMAL_PRIORITY;
+
+ LocalVariableTable lvt = getCode().getLocalVariableTable();
+ if (lvt != null) {
+ LocalVariable lv = lvt.getLocalVariable(itm.getRegisterNumber(), getPC());
+ if (lv == null) {
+ /** It's probably synthetic, for instance throwing an exception
+ * out of a synchronized block
+ */
+ priority = LOW_PRIORITY;
+ }
+ }
+
+ bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", priority)
.addClass(this)
.addMethod(this)
.addSourceLine(this));
@@ -255,7 +268,7 @@
break;
}
}
- } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
+ } else if (seen == ASTORE || seen >= ASTORE_0 && seen <= ASTORE_3) {
if (lastWasExitPoint) {
//crazy jdk6 finally block injection -- shut off detection
catchInfos.clear();
@@ -266,17 +279,17 @@
OpcodeStack.Item itm = stack.getStackItem(0);
int reg = RegisterUtils.getAStoreReg(this, seen);
exReg.put(Integer.valueOf(reg), (Boolean)itm.getUserValue());
- if ((reg == catchInfo.getRegister() && catchInfo.getFinish() == Integer.MAX_VALUE)) {
+ if (reg == catchInfo.getRegister() && catchInfo.getFinish() == Integer.MAX_VALUE) {
it.remove();
}
}
- } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) {
+ } else if (seen == ALOAD || seen >= ALOAD_0 && seen <= ALOAD_3) {
Boolean valid = exReg.get(Integer.valueOf(RegisterUtils.getALoadReg(this, seen)));
if (valid != null)
{
markAsValid = valid.booleanValue();
}
- } else if ((seen >= IRETURN) && (seen <= RETURN)) {
+ } else if (seen >= IRETURN && seen <= RETURN) {
removeIndeterminateHandlers(pc);
break;
}
@@ -287,7 +300,7 @@
}
}
- lastWasExitPoint = ((seen >= IRETURN) && (seen <= RETURN)) || (seen == GOTO) || (seen == GOTO_W) || (seen == ATHROW);
+ lastWasExitPoint = seen >= IRETURN && seen <= RETURN || seen == GOTO || seen == GOTO_W || seen == ATHROW;
}
finally {
stack.sawOpcode(this, seen);
@@ -336,7 +349,7 @@
*/
private boolean isPre14Class(JavaClass cls)
{
- return (cls != null) && cls.getMajor() < Constants.MAJOR_1_4;
+ return cls != null && cls.getMajor() < Constants.MAJOR_1_4;
}
private void removePreviousHandlers(int pc)
@@ -357,7 +370,7 @@
Iterator<CatchInfo> it = catchInfos.iterator();
while (it.hasNext()) {
CatchInfo ci = it.next();
- if ((ci.getStart() < pc) && (ci.getFinish() == Integer.MAX_VALUE))
+ if (ci.getStart() < pc && ci.getFinish() == Integer.MAX_VALUE)
{
it.remove();
}
@@ -376,7 +389,7 @@
* @return whether the catch block is empty
*/
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) {
- if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
+ if (seen == ASTORE || seen >= ASTORE_0 && seen <= ASTORE_3) {
int reg = RegisterUtils.getAStoreReg(this, seen);
ci.setReg(reg);
exReg.put(Integer.valueOf(reg), Boolean.TRUE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2010-08-31 01:30:13
|
Revision: 1601
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1601&view=rev
Author: dbrosius
Date: 2010-08-31 01:30:07 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
rollback -- wasn't working as i first thought
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:26:54 UTC (rev 1600)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:30:07 UTC (rev 1601)
@@ -246,20 +246,7 @@
&& itm.getUserValue() == null) {
if (!isPre14Class(itm.getJavaClass()))
{
- int priority = NORMAL_PRIORITY;
-
- LocalVariableTable lvt = getCode().getLocalVariableTable();
- if (lvt != null) {
- LocalVariable lv = lvt.getLocalVariable(itm.getRegisterNumber(), getPC());
- if (lv == null) {
- /** It's probably synthetic, for instance throwing an exception
- * out of a synchronized block
- */
- priority = LOW_PRIORITY;
- }
- }
-
- bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", priority)
+ bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", 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.
|
|
From: <dbr...@us...> - 2010-08-31 01:33:52
|
Revision: 1602
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1602&view=rev
Author: dbrosius
Date: 2010-08-31 01:33:46 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
a better way, if the throw directly follows a MONITOREXIT, it's probably synthetic, so mark it LOW
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:30:07 UTC (rev 1601)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-08-31 01:33:46 UTC (rev 1602)
@@ -246,7 +246,8 @@
&& itm.getUserValue() == null) {
if (!isPre14Class(itm.getJavaClass()))
{
- bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY)
+ int priority = getPrevOpcode(1) == MONITOREXIT ? LOW_PRIORITY : NORMAL_PRIORITY;
+ bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", 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.
|