Skip to content

Commit 49c3e27

Browse files
pbouilletstefansiegl
authored andcommitted
INSPECTIT-1948: updated PMD plugin and replaced eclipse PMD
1 parent 93daafa commit 49c3e27

File tree

32 files changed

+116
-101
lines changed

32 files changed

+116
-101
lines changed

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip

inspectit.agent.java/.eclipse-pmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
3+
<analysis enabled="true" />
4+
<rulesets>
5+
<ruleset name="Custom ruleset" ref="../resources/config/pmd/pmd_rules.xml" refcontext="project" />
6+
</rulesets>
7+
</eclipse-pmd>

inspectit.agent.java/.pmd

-7
This file was deleted.

inspectit.agent.java/.project

+6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
<arguments>
2626
</arguments>
2727
</buildCommand>
28+
<buildCommand>
29+
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
2833
</buildSpec>
2934
<natures>
3035
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
3136
<nature>org.eclipse.jdt.core.javanature</nature>
3237
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
3338
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
39+
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
3440
</natures>
3541
<linkedResources>
3642
<link>

inspectit.agent.java/src/main/java/rocks/inspectit/agent/java/logback/LogInitializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void initLogging() {
7878
}
7979

8080
// then fail to default if none is specified
81-
if ((null == is) && (null != agentJar)) {
81+
if (null == is) {
8282
String logPath = agentJar.getParent() + File.separator + File.separator + DEFAULT_LOG_FILE_NAME;
8383
File logFile = new File(logPath);
8484
if (logFile.exists()) {

inspectit.agent.java/src/main/java/rocks/inspectit/agent/java/sensor/method/http/HttpHook.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public HttpHook(Timer timer, IPlatformManager platformManager, Map<String, Objec
144144
this.threadMXBean = threadMXBean;
145145
this.extractor = new HttpInformationExtractor(new StringConstraint(parameters));
146146

147-
if ((null != parameters) && "true".equals(parameters.get("sessioncapture"))) {
147+
if ("true".equals(parameters.get("sessioncapture"))) {
148148
if (LOG.isDebugEnabled()) {
149149
LOG.debug("Enabling session capturing for the http sensor");
150150
}

inspectit.agent.java/src/main/java/rocks/inspectit/agent/java/sensor/method/jdbc/PreparedStatementParameterHook.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void secondAfterBody(ICoreService coreService, long methodId, long sensor
8383
threadLast.set(Boolean.FALSE);
8484

8585
List<String> parameterTypes = rsc.getParameterTypes();
86-
if (METHOD_VALUE_MAP.containsKey(rsc.getTargetMethodName()) && (parameterTypes.size() >= 1) && "int".equals(parameterTypes.get(0))) {
86+
if (METHOD_VALUE_MAP.containsKey(rsc.getTargetMethodName()) && !parameterTypes.isEmpty() && "int".equals(parameterTypes.get(0))) {
8787
// subtract one as the index starts at 1, and not at 0
8888
int index = ((Integer) parameters[0]).intValue() - 1;
8989
Object value = METHOD_VALUE_MAP.get(rsc.getTargetMethodName());

inspectit.root.gradle

+19-11
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ cpdCheck {
230230
}
231231
}
232232

233-
task cpdHtmlReport << {
234-
ant.xslt(in: "${buildQAAnalysisCPD}/main.xml", style: cpdReportFile, out: "${buildQAAnalysisCPD}/../cpd.html")
233+
task cpdHtmlReport {
234+
doLast {
235+
ant.xslt(in: "${buildQAAnalysisCPD}/main.xml", style: cpdReportFile, out: "${buildQAAnalysisCPD}/../cpd.html")
236+
}
235237
}
236238
cpdCheck.finalizedBy cpdHtmlReport
237239

@@ -327,13 +329,15 @@ subprojects {
327329
ruleSetFiles = files(pmdRulesFile)
328330
ruleSets = []
329331
reportsDir = file(buildQAAnalysisPMD)
330-
toolVersion = '5.1.0'
332+
toolVersion = '5.4.1'
331333
}
332334

333-
task pmdHtmlReport << {
334-
ant.xslt(in: "${buildQAAnalysisPMD}/main.xml", style: pmdReportFile, out: "${buildQAAnalysisPMD}/sortable_report.html")
335-
ant.copy(todir: buildQAAnalysisPMD, file: pmdSortableFile)
336-
new File(buildQAAnalysis, "pmd.html").text = "<meta http-equiv=\"refresh\" content=\"0; url=pmd/sortable_report.html\" >"
335+
task pmdHtmlReport {
336+
doLast {
337+
ant.xslt(in: "${buildQAAnalysisPMD}/main.xml", style: pmdReportFile, out: "${buildQAAnalysisPMD}/sortable_report.html")
338+
ant.copy(todir: buildQAAnalysisPMD, file: pmdSortableFile)
339+
new File(buildQAAnalysis, "pmd.html").text = "<meta http-equiv=\"refresh\" content=\"0; url=pmd/sortable_report.html\" >"
340+
}
337341
}
338342
pmdMain.finalizedBy pmdHtmlReport
339343

@@ -347,8 +351,10 @@ subprojects {
347351
toolVersion = '5.6'
348352
}
349353

350-
task checkstyleHtmlReport << {
351-
ant.xslt(in: "${buildQAAnalysisCheckstyle}/main.xml", style: "${checkstyleReportFile}", out: "${buildQAAnalysisCheckstyle}/../checkstyle.html")
354+
task checkstyleHtmlReport {
355+
doLast {
356+
ant.xslt(in: "${buildQAAnalysisCheckstyle}/main.xml", style: "${checkstyleReportFile}", out: "${buildQAAnalysisCheckstyle}/../checkstyle.html")
357+
}
352358
}
353359
checkstyleMain.finalizedBy checkstyleHtmlReport
354360

@@ -363,8 +369,10 @@ subprojects {
363369
toolVersion = '2.0.0'
364370
}
365371

366-
task findbugsHtmlReport << {
367-
ant.xslt(in: "${buildQAAnalysisFindbugs}/main.xml", style: findbugsConfigFancyHist, out: "${buildQAAnalysisFindbugs}/../findbugs.html")
372+
task findbugsHtmlReport {
373+
doLast {
374+
ant.xslt(in: "${buildQAAnalysisFindbugs}/main.xml", style: findbugsConfigFancyHist, out: "${buildQAAnalysisFindbugs}/../findbugs.html")
375+
}
368376
}
369377
findbugsMain.finalizedBy findbugsHtmlReport
370378

inspectit.server/.eclipse-pmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
3+
<analysis enabled="true" />
4+
<rulesets>
5+
<ruleset name="Custom ruleset" ref="../resources/config/pmd/pmd_rules.xml" refcontext="project" />
6+
</rulesets>
7+
</eclipse-pmd>

inspectit.server/.pmd

-7
This file was deleted.

inspectit.server/.project

+6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
<arguments>
2626
</arguments>
2727
</buildCommand>
28+
<buildCommand>
29+
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
2833
</buildSpec>
2934
<natures>
3035
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
3136
<nature>org.eclipse.jdt.core.javanature</nature>
3237
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
3338
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
39+
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
3440
</natures>
3541
<linkedResources>
3642
<link>

inspectit.server/src/main/java/rocks/inspectit/server/dao/impl/TimerDataAggregator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ void saveAllInPersistList() {
181181
protected void doInTransactionWithoutResult(TransactionStatus status) {
182182
TimerData last = persistList.poll();
183183
while (last != null) {
184-
last.finalizeData();
185-
TimerDataAggregator.super.create(last);
184+
TimerData data = (TimerData) last.finalizeData();
185+
TimerDataAggregator.super.create(data);
186186
last = persistList.poll();
187187
}
188188
}

inspectit.server/src/main/java/rocks/inspectit/server/property/PropertyUpdateExecutor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ private static final class PropertyUpdateFieldInfo {
250250
* @param property
251251
* Property name.
252252
*/
253-
public PropertyUpdateFieldInfo(Object target, Field field, String property) {
253+
PropertyUpdateFieldInfo(Object target, Field field, String property) {
254254
if (null == target) {
255255
throw new IllegalArgumentException("Target object can not be null.");
256256
}

inspectit.server/src/main/java/rocks/inspectit/server/service/AgentStorageService.java

-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ public void run() {
212212

213213
List<? extends DefaultData> defaultDataList = softReference.get();
214214
if (defaultDataList != null) {
215-
for (DefaultData data : defaultDataList) {
216-
data.finalizeData();
217-
}
218-
219215
long time = 0;
220216
if (log.isDebugEnabled()) {
221217
time = System.nanoTime();

inspectit.server/src/main/java/rocks/inspectit/server/storage/CmrStorageManager.java

+7-14
Original file line numberDiff line numberDiff line change
@@ -763,12 +763,9 @@ public void addLabelToStorage(StorageData storageData, AbstractStorageLabel<?> s
763763
*/
764764
public boolean removeLabelFromStorage(StorageData storageData, AbstractStorageLabel<?> storageLabel) throws IOException, SerializationException, BusinessException {
765765
StorageData local = getLocalStorageDataObject(storageData);
766-
if (null != local) {
767-
boolean removed = local.removeLabel(storageLabel);
768-
writeStorageDataToDisk(local);
769-
return removed;
770-
}
771-
return false;
766+
boolean removed = local.removeLabel(storageLabel);
767+
writeStorageDataToDisk(local);
768+
return removed;
772769
}
773770

774771
/**
@@ -785,14 +782,10 @@ public boolean removeLabelFromStorage(StorageData storageData, AbstractStorageLa
785782
*/
786783
public void updateStorageData(StorageData storageData) throws BusinessException, IOException, SerializationException {
787784
StorageData local = getLocalStorageDataObject(storageData);
788-
if (null == local) {
789-
throw new BusinessException("Update of the storage data" + storageData + ".", StorageErrorCodeEnum.STORAGE_DOES_NOT_EXIST);
790-
} else {
791-
synchronized (local) {
792-
local.setName(storageData.getName());
793-
local.setDescription(storageData.getDescription());
794-
writeStorageDataToDisk(local);
795-
}
785+
synchronized (local) {
786+
local.setName(storageData.getName());
787+
local.setDescription(storageData.getDescription());
788+
writeStorageDataToDisk(local);
796789
}
797790
}
798791

inspectit.server/src/main/java/rocks/inspectit/server/template/AlertEMailTemplateType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public boolean isText() {
9090
* @author Alexander Wert
9191
*
9292
*/
93-
public interface Placeholders {
93+
interface Placeholders {
9494
/**
9595
* Placeholder for alert definition name.
9696
*/

inspectit.shared.all/.eclipse-pmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
3+
<analysis enabled="true" />
4+
<rulesets>
5+
<ruleset name="Custom ruleset" ref="../resources/config/pmd/pmd_rules.xml" refcontext="project" />
6+
</rulesets>
7+
</eclipse-pmd>

inspectit.shared.all/.pmd

-7
This file was deleted.

inspectit.shared.all/.project

+6
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@
3535
<arguments>
3636
</arguments>
3737
</buildCommand>
38+
<buildCommand>
39+
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
40+
<arguments>
41+
</arguments>
42+
</buildCommand>
3843
</buildSpec>
3944
<natures>
4045
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
4146
<nature>org.eclipse.jdt.core.javanature</nature>
4247
<nature>org.eclipse.pde.PluginNature</nature>
4348
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
4449
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
50+
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
4551
</natures>
4652
<linkedResources>
4753
<link>

inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/communication/data/JmxSensorValueData.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ protected void prePersist() {
287287
@Override
288288
public String toString() {
289289
return "JmxSensorValueData [jmxSensorDefinitionDataIdent=" + jmxSensorDefinitionDataIdentId + ", value=" + value + ", getId()=" + getId() + ", getPlatformIdent()=" + getPlatformIdent()
290-
+ ", getSensorTypeIdent()=" + getSensorTypeIdent() + ", getTimeStamp()=" + getTimeStamp() + "]";
290+
+ ", getSensorTypeIdent()=" + getSensorTypeIdent() + ", getTimeStamp()=" + getTimeStamp() + "]";
291291
}
292292

293293
/**

inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/minlog/MinlogToSLF4JLogger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void log(int level, String category, String message, Throwable ex) {
7777
* @return combinedMessage
7878
*/
7979
private String getMessage(String category, String message) {
80-
int size = (category != null) ? category.length() + 2 : (0 + message) != null ? message.length() : 0;
80+
int size = (category != null) ? category.length() + 2 : (message != null) ? message.length() : 0;
8181
StringBuilder stringBuilder = new StringBuilder(size);
8282
if (null != category) {
8383
stringBuilder.append(category);

inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/serializer/schema/ClassSchemaManager.java

+6-10
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,9 @@ public void loadSchemasFromLocations() throws IOException {
124124
}
125125
}
126126

127-
if (null != br) {
128-
br.close();
129-
}
130-
if (null != isr) {
131-
isr.close();
132-
}
133-
if (null != is) {
134-
is.close();
135-
}
127+
br.close();
128+
isr.close();
129+
is.close();
136130
}
137131

138132
/**
@@ -153,7 +147,9 @@ public boolean accept(File dir, String fileName) {
153147
}
154148
});
155149

156-
loadSchemas(files);
150+
if (files != null) {
151+
loadSchemas(files);
152+
}
157153
}
158154

159155
/**

inspectit.shared.cs/.classpath

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
<attribute name="FROM_GRADLE_MODEL" value="true"/>
1616
</attributes>
1717
</classpathentry>
18-
<classpathentry kind="src" path="src/test/resources"/>
18+
<classpathentry kind="src" path="src/test/resources">
19+
<attributes>
20+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
21+
</attributes>
22+
</classpathentry>
1923
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
2024
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
2125
<classpathentry kind="output" path="bin"/>

inspectit.shared.cs/.eclipse-pmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
3+
<analysis enabled="true" />
4+
<rulesets>
5+
<ruleset name="Custom ruleset" ref="../resources/config/pmd/pmd_rules.xml" refcontext="project" />
6+
</rulesets>
7+
</eclipse-pmd>

inspectit.shared.cs/.pmd

-7
This file was deleted.

inspectit.shared.cs/.project

+6
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@
3535
<arguments>
3636
</arguments>
3737
</buildCommand>
38+
<buildCommand>
39+
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
40+
<arguments>
41+
</arguments>
42+
</buildCommand>
3843
</buildSpec>
3944
<natures>
4045
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
4146
<nature>org.eclipse.jdt.core.javanature</nature>
4247
<nature>org.eclipse.pde.PluginNature</nature>
4348
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
4449
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
50+
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
4551
</natures>
4652
<linkedResources>
4753
<link>

inspectit.ui.rcp/.eclipse-pmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
3+
<analysis enabled="true" />
4+
<rulesets>
5+
<ruleset name="Custom ruleset" ref="../resources/config/pmd/pmd_rules.xml" refcontext="project" />
6+
</rulesets>
7+
</eclipse-pmd>

inspectit.ui.rcp/.pmd

-7
This file was deleted.

0 commit comments

Comments
 (0)