[Fb-contrib-commit] SF.net SVN: fb-contrib: [931] trunk/fb-contrib
Brought to you by:
dbrosius
From: <dbr...@us...> - 2007-10-11 05:57:17
|
Revision: 931 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=931&view=rev Author: dbrosius Date: 2007-10-10 22:57:21 -0700 (Wed, 10 Oct 2007) Log Message: ----------- filter out RuntimeExceptions from throws clauses when building constraining info Modified Paths: -------------- trunk/fb-contrib/samples/EXS_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java Modified: trunk/fb-contrib/samples/EXS_Sample.java =================================================================== --- trunk/fb-contrib/samples/EXS_Sample.java 2007-10-11 03:21:15 UTC (rev 930) +++ trunk/fb-contrib/samples/EXS_Sample.java 2007-10-11 05:57:21 UTC (rev 931) @@ -43,6 +43,19 @@ throw new RuntimeException("Ooops"); } } + + @Override + public void constrainedByRuntime() + { + try + { + InputStream is = new FileInputStream("c:\\test.txt"); + } + catch (IOException ioe) + { + throw new RuntimeException("Ooops"); + } + } } class Super @@ -52,4 +65,7 @@ public void constrainedNon() throws SQLException {} + + public void constrainedByRuntime() throws RuntimeException + {} } \ No newline at end of file Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2007-10-11 03:21:15 UTC (rev 930) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2007-10-11 05:57:21 UTC (rev 931) @@ -344,7 +344,7 @@ * @param m the method to add exceptions from * @return a map with one entry of a class name to a set of exceptions that constrain what can be thrown. */ - private Map<String, Set<String>> buildConstrainingInfo(JavaClass cls, Method m) { + private Map<String, Set<String>> buildConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { Map<String, Set<String>> constraintInfo = new HashMap<String, Set<String>>(); Set<String> exs = new HashSet<String>(); ExceptionTable et = m.getExceptionTable(); @@ -355,7 +355,10 @@ int index = indexTable[i]; if (index != 0) { ConstantClass ccls = (ConstantClass)pool.getConstant(index); - exs.add(ccls.getBytes(pool)); + String exName = ccls.getBytes(pool); + JavaClass exClass = Repository.lookupClass(exName); + if (!exClass.instanceOf(runtimeClass)) + exs.add(ccls.getBytes(pool)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |