aboutsummaryrefslogtreecommitdiffstats
path: root/it/projects/java-bytecode
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-07-16 13:51:30 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-07-20 12:59:15 +0200
commit73b46e381ff0a7a0b3bc280ac45de592e547513a (patch)
treea784542f624aa1a97be6f77eed75eda094be2166 /it/projects/java-bytecode
parentf20b8927e6b8747b37ae750de393215312b774c2 (diff)
downloadsonar-scanner-cli-73b46e381ff0a7a0b3bc280ac45de592e547513a.tar.gz
sonar-scanner-cli-73b46e381ff0a7a0b3bc280ac45de592e547513a.zip
merge it-sonar-runner and update groupId
Diffstat (limited to 'it/projects/java-bytecode')
-rw-r--r--it/projects/java-bytecode/.sonar/findbugs-include.xml7
-rw-r--r--it/projects/java-bytecode/.sonar/findbugs-result.xml69
-rw-r--r--it/projects/java-bytecode/build.xml32
-rw-r--r--it/projects/java-bytecode/build/classes/HasFindbugsViolation.classbin0 -> 720 bytes
-rw-r--r--it/projects/java-bytecode/lib/deprecated.jarbin0 -> 909 bytes
-rw-r--r--it/projects/java-bytecode/sonar-project.properties9
-rw-r--r--it/projects/java-bytecode/src/HasFindbugsViolation.java13
7 files changed, 130 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated by SonarQube -->
+<FindBugsFilter>
+ <Match>
+ <Bug pattern="DM_EXIT"/>
+ </Match>
+</FindBugsFilter> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<BugCollection version="3.0.1" sequence="0" timestamp="1432107278000" analysisTimestamp="1437046750473" release="">
+ <Project>
+ <Jar>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/src/HasFindbugsViolation.java</Jar>
+ <Jar>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/build/classes/HasFindbugsViolation.class</Jar>
+ <AuxClasspathEntry>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/build/classes</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/lib/deprecated.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar/findbugs/annotations.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar/findbugs/jsr305.jar</AuxClasspathEntry>
+ <WrkDir>/home/duartem/git/sonar-tests-core/it-sonar-runner/projects/java-bytecode/.sonar</WrkDir>
+ </Project>
+ <BugInstance type="DM_EXIT" priority="2" rank="16" abbrev="Dm" category="BAD_PRACTICE" instanceHash="fc6ac81278eca1b0ea92d10f13e0a9e9" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="382">
+ <ShortMessage>Method invokes System.exit(...)</ShortMessage>
+ <LongMessage>HasFindbugsViolation.use() invokes System.exit(...), which shuts down the entire virtual machine</LongMessage>
+ <Class classname="HasFindbugsViolation" primary="true">
+ <SourceLine classname="HasFindbugsViolation" start="1" end="12" sourcefile="HasFindbugsViolation.java" sourcepath="HasFindbugsViolation.java">
+ <Message>At HasFindbugsViolation.java:[lines 1-12]</Message>
+ </SourceLine>
+ <Message>In class HasFindbugsViolation</Message>
+ </Class>
+ <Method classname="HasFindbugsViolation" name="use" signature="()V" isStatic="false" primary="true">
+ <SourceLine classname="HasFindbugsViolation" start="6" end="8" startBytecode="0" endBytecode="65" sourcefile="HasFindbugsViolation.java" sourcepath="HasFindbugsViolation.java"/>
+ <Message>In method HasFindbugsViolation.use()</Message>
+ </Method>
+ <SourceLine classname="HasFindbugsViolation" primary="true" start="7" end="7" startBytecode="12" endBytecode="12" sourcefile="HasFindbugsViolation.java" sourcepath="HasFindbugsViolation.java">
+ <Message>At HasFindbugsViolation.java:[line 7]</Message>
+ </SourceLine>
+ </BugInstance>
+ <BugCategory category="BAD_PRACTICE">
+ <Description>Bad practice</Description>
+ </BugCategory>
+ <BugPattern type="DM_EXIT" abbrev="Dm" category="BAD_PRACTICE" cweid="382">
+ <ShortDescription>Method invokes System.exit(...)</ShortDescription>
+ <Details><![CDATA[
+
+ <p> 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.</p>
+
+ ]]></Details>
+ </BugPattern>
+ <BugCode abbrev="Dm">
+ <Description>Dubious method used</Description>
+ </BugCode>
+ <Errors errors="0" missingClasses="0"></Errors>
+ <FindBugsSummary timestamp="Wed, 20 May 2015 09:34:38 +0200" total_classes="1" referenced_classes="13" total_bugs="1" total_size="11" num_packages="1" java_version="1.7.0_79" vm_version="24.79-b02" cpu_seconds="3.30" clock_seconds="1.10" peak_mbytes="227.75" alloc_mbytes="3538.00" gc_seconds="0.02" priority_2="1">
+ <FileStats path="HasFindbugsViolation.java" bugCount="1" size="11" bugHash="74a612ed42a469c4b358a80c33515967"/>
+ <PackageStats package="" total_bugs="1" total_types="1" total_size="11" priority_2="1">
+ <ClassStats class="HasFindbugsViolation" sourceFile="HasFindbugsViolation.java" interface="false" size="11" bugs="1" priority_2="1"/>
+ </PackageStats>
+ <FindBugsProfile>
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine" totalMilliseconds="224" invocations="320" avgMicrosecondsPerInvocation="700" maxMicrosecondsPerInvocation="17955" standardDeviationMircosecondsPerInvocation="1606"/>
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FieldItemSummary" totalMilliseconds="67" invocations="13" avgMicrosecondsPerInvocation="5161" maxMicrosecondsPerInvocation="13026" standardDeviationMircosecondsPerInvocation="5212"/>
+ <ClassProfile name="edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory" totalMilliseconds="57" invocations="56" avgMicrosecondsPerInvocation="1018" maxMicrosecondsPerInvocation="4755" standardDeviationMircosecondsPerInvocation="939"/>
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FindNoSideEffectMethods" totalMilliseconds="41" invocations="13" avgMicrosecondsPerInvocation="3202" maxMicrosecondsPerInvocation="12613" standardDeviationMircosecondsPerInvocation="3864"/>
+ <ClassProfile name="edu.umd.cs.findbugs.util.TopologicalSort" totalMilliseconds="36" invocations="288" avgMicrosecondsPerInvocation="127" maxMicrosecondsPerInvocation="1297" standardDeviationMircosecondsPerInvocation="215"/>
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine" totalMilliseconds="34" invocations="321" avgMicrosecondsPerInvocation="105" maxMicrosecondsPerInvocation="458" standardDeviationMircosecondsPerInvocation="52"/>
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.MethodGenFactory" totalMilliseconds="28" invocations="3" avgMicrosecondsPerInvocation="9462" maxMicrosecondsPerInvocation="27862" standardDeviationMircosecondsPerInvocation="13010"/>
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngine" totalMilliseconds="25" invocations="28" avgMicrosecondsPerInvocation="925" maxMicrosecondsPerInvocation="11951" standardDeviationMircosecondsPerInvocation="2278"/>
+ <ClassProfile name="edu.umd.cs.findbugs.detect.NoteDirectlyRelevantTypeQualifiers" totalMilliseconds="23" invocations="13" avgMicrosecondsPerInvocation="1779" maxMicrosecondsPerInvocation="5478" standardDeviationMircosecondsPerInvocation="1779"/>
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FunctionsThatMightBeMistakenForProcedures" totalMilliseconds="22" invocations="13" avgMicrosecondsPerInvocation="1761" maxMicrosecondsPerInvocation="5446" standardDeviationMircosecondsPerInvocation="1973"/>
+ <ClassProfile name="edu.umd.cs.findbugs.detect.BuildStringPassthruGraph" totalMilliseconds="17" invocations="13" avgMicrosecondsPerInvocation="1358" maxMicrosecondsPerInvocation="3601" standardDeviationMircosecondsPerInvocation="1349"/>
+ </FindBugsProfile>
+ </FindBugsSummary>
+ <ClassFeatures></ClassFeatures>
+ <History></History>
+</BugCollection>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Java Bytecode" default="all" basedir="." xmlns:sonar="antlib:org.sonar.ant">
+
+ <property name="lib.dir" value="../ant-libs"/>
+
+ <property name="build.dir" value="build"/>
+
+ <property name="classes.dir" value="${build.dir}/classes"/>
+
+ <path id="classpath">
+ <fileset dir="./lib" includes="*.jar" />
+ </path>
+
+ <target name="clean" description="Remove all files created by the build process.">
+ <delete dir="${build.dir}" />
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ <mkdir dir="${classes.dir}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="${classes.dir}" classpathref="classpath" fork="true" debug="true" includeAntRuntime="false">
+ <src path="src"/>
+ </javac>
+ </target>
+
+ <target name="all"
+ depends="clean,compile" />
+
+</project>
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
--- /dev/null
+++ b/it/projects/java-bytecode/build/classes/HasFindbugsViolation.class
Binary files 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
--- /dev/null
+++ b/it/projects/java-bytecode/lib/deprecated.jar
Binary files 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);
+ }
+}