[Fb-contrib-commit] SF.net SVN: fb-contrib:[1700] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2011-07-07 04:25:50
|
Revision: 1700
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1700&view=rev
Author: dbrosius
Date: 2011-07-07 04:25:40 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
allow for appended strings passed to a component, if the appended string looks like an html fragment
Modified Paths:
--------------
trunk/fb-contrib/samples/S508C_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Modified: trunk/fb-contrib/samples/S508C_Sample.java
===================================================================
--- trunk/fb-contrib/samples/S508C_Sample.java 2011-07-05 00:44:27 UTC (rev 1699)
+++ trunk/fb-contrib/samples/S508C_Sample.java 2011-07-07 04:25:40 UTC (rev 1700)
@@ -40,6 +40,11 @@
{
JLabel l = new JLabel(greeting + " " + user);
}
+
+ public void fpAppending(String greeting)
+ {
+ JLabel l = new JLabel("<html><body>" + greeting + "</body></html>");
+ }
}
class MyComponent extends JComponent
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-05 00:44:27 UTC (rev 1699)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-07 04:25:40 UTC (rev 1700)
@@ -25,6 +25,7 @@
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.ConstantString;
import org.apache.bcel.classfile.Field;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.generic.Type;
@@ -256,7 +257,16 @@
}
} else if ("java/lang/StringBuffer".equals(className) || "java/lang/StringBuilder".equals(className)) {
if ("append".equals(methodName)) {
- sawAppend = true;
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ Object con = item.getConstant();
+ if (con instanceof String) {
+ String literal = (String)con;
+ sawAppend = !literal.startsWith("<");
+ } else {
+ sawAppend = true;
+ }
+ }
} else if ("toString".equals(methodName)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|