diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml index 4f9dbbfda2..51cfe841ba 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -58,58 +58,6 @@ sb.append('a'); // use this instead - - - Problem: Use of FileItem.get and FileItem.getString could exhaust memory since they load the entire file into memory - Solution: Use streaming methods and buffering. - - 2 - - - - - - - - - - - - - + + +Problem: Use of [FileItem.get()](https://commons.apache.org/proper/commons-fileupload/apidocs/org/apache/commons/fileupload/FileItem.html#get--) +and [FileItem.getString()](https://commons.apache.org/proper/commons-fileupload/apidocs/org/apache/commons/fileupload/FileItem.html#getString--) +could exhaust memory since they load the entire file into memory. + +Solution: Use IO streams and buffering. + + 2 + + + + + + + + + + + + + + xmlns="http://pmd.sourceforge.net/rule-tests" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> + violation: FileItem get() used 3 @@ -26,8 +27,9 @@ public class Foo { globalFileItem.get(); // bad } } - ]]> + ]]> + violation: FileItem get() used with fully qualified class reference 3 @@ -50,8 +52,9 @@ public class Foo { globalFileItem.get(); // bad } } - ]]> + ]]> + violation: FileItem getString() used 4 @@ -75,8 +78,9 @@ public class Foo { globalFileItem.getString(); // bad } } - ]]> + ]]> + violation: FileItem getString() used with fully qualified class reference 4 @@ -99,8 +103,9 @@ public class Foo { globalFileItem.getString(); // bad } } - ]]> + ]]> + no violation: harmless get methods 0 @@ -116,8 +121,9 @@ public class Foo { } } } - ]]> + ]]> + Harmless getString methods 0 @@ -133,6 +139,6 @@ public class Foo { } } } - ]]> + ]]>