From 73b46e381ff0a7a0b3bc280ac45de592e547513a Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 16 Jul 2015 13:51:30 +0200 Subject: merge it-sonar-runner and update groupId --- .../java-bytecode/.sonar/findbugs-include.xml | 7 +++ .../java-bytecode/.sonar/findbugs-result.xml | 69 +++++++++++++++++++++ it/projects/java-bytecode/build.xml | 32 ++++++++++ .../build/classes/HasFindbugsViolation.class | Bin 0 -> 720 bytes it/projects/java-bytecode/lib/deprecated.jar | Bin 0 -> 909 bytes it/projects/java-bytecode/sonar-project.properties | 9 +++ .../java-bytecode/src/HasFindbugsViolation.java | 13 ++++ 7 files changed, 130 insertions(+) create mode 100644 it/projects/java-bytecode/.sonar/findbugs-include.xml create mode 100644 it/projects/java-bytecode/.sonar/findbugs-result.xml create mode 100644 it/projects/java-bytecode/build.xml create mode 100644 it/projects/java-bytecode/build/classes/HasFindbugsViolation.class create mode 100644 it/projects/java-bytecode/lib/deprecated.jar create mode 100644 it/projects/java-bytecode/sonar-project.properties create mode 100644 it/projects/java-bytecode/src/HasFindbugsViolation.java (limited to 'it/projects/java-bytecode') diff --git a/it/projects/java-bytecode/.sonar/findbugs-include.xml b/it/projects/java-bytecode/.sonar/findbugs-include.xml new file mode 100644 index 0000000..d4846f0 --- /dev/null +++ b/it/projects/java-bytecode/.sonar/findbugs-include.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/it/projects/java-bytecode/.sonar/findbugs-result.xml b/it/projects/java-bytecode/.sonar/findbugs-result.xml new file mode 100644 index 0000000..0ae2961 --- /dev/null +++ b/it/projects/java-bytecode/.sonar/findbugs-result.xml @@ -0,0 +1,69 @@ + + + + + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/src/HasFindbugsViolation.java + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/build/classes/HasFindbugsViolation.class + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/build/classes + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/lib/deprecated.jar + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar/findbugs/annotations.jar + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar/findbugs/jsr305.jar + /home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar + + + Method invokes System.exit(...) + HasFindbugsViolation.use() invokes System.exit(...), which shuts down the entire virtual machine + + + At HasFindbugsViolation.java:[lines 1-12] + + In class HasFindbugsViolation + + + + In method HasFindbugsViolation.use() + + + At HasFindbugsViolation.java:[line 7] + + + + Bad practice + + + Method invokes System.exit(...) +
Invoking System.exit shuts down the entire Java virtual machine. This + should only been done when it is appropriate. Such calls make it + hard or impossible for your code to be invoked by other code. + Consider throwing a RuntimeException instead.

+ + ]]>
+
+ + Dubious method used + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/it/projects/java-bytecode/build.xml b/it/projects/java-bytecode/build.xml new file mode 100644 index 0000000..d24c2b8 --- /dev/null +++ b/it/projects/java-bytecode/build.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/it/projects/java-bytecode/build/classes/HasFindbugsViolation.class b/it/projects/java-bytecode/build/classes/HasFindbugsViolation.class new file mode 100644 index 0000000..f482325 Binary files /dev/null and b/it/projects/java-bytecode/build/classes/HasFindbugsViolation.class differ diff --git a/it/projects/java-bytecode/lib/deprecated.jar b/it/projects/java-bytecode/lib/deprecated.jar new file mode 100644 index 0000000..65e3be9 Binary files /dev/null and b/it/projects/java-bytecode/lib/deprecated.jar differ diff --git a/it/projects/java-bytecode/sonar-project.properties b/it/projects/java-bytecode/sonar-project.properties new file mode 100644 index 0000000..cf6eb18 --- /dev/null +++ b/it/projects/java-bytecode/sonar-project.properties @@ -0,0 +1,9 @@ +# Note that the format of project key is still groupId:artifactId in order to support test with sonar 2.6. +sonar.projectKey=java:bytecode +sonar.projectName=Java Bytecode Sample +sonar.projectVersion=1.0 +sonar.profile=With Findbugs + +sonar.sources=src +sonar.binaries=build/classes +sonar.libraries=lib/*.jar diff --git a/it/projects/java-bytecode/src/HasFindbugsViolation.java b/it/projects/java-bytecode/src/HasFindbugsViolation.java new file mode 100644 index 0000000..c68f54f --- /dev/null +++ b/it/projects/java-bytecode/src/HasFindbugsViolation.java @@ -0,0 +1,13 @@ +public class HasFindbugsViolation { + + private String field; + + public void use() { + new DeprecatedExample().deprecatedMethod(); // violation of squid rule: CallToDeprecatedMethod + System.exit(33); // violation on findbugs rule: DM_EXIT + } + + public void useFieldForLcom4() { + System.out.println(field); + } +} -- cgit v1.2.3