Skip to content

Commit 66719f3

Browse files
committed
codeclimate feedback
1 parent 49ed865 commit 66719f3

File tree

9 files changed

+34
-20
lines changed

9 files changed

+34
-20
lines changed

.codeclimate.yml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ checks:
2424
plugins:
2525
sonar-java:
2626
enabled: true
27-
channel: "beta"
2827
exclude_patterns:
2928
- "**/src/test/"
3029
config:

bundle/src/main/java/com/adobe/acs/commons/analysis/jcrchecksum/impl/ChecksumGeneratorImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ private boolean isChecksumable(Node node, ChecksumGeneratorOptions options) thro
164164
* @throws RepositoryException
165165
* @throws IOException
166166
*/
167+
@SuppressWarnings("squid:S3776")
167168
protected String generatedNodeChecksum(final String aggregateNodePath,
168169
final Node node,
169170
final ChecksumGeneratorOptions options)

bundle/src/main/java/com/adobe/acs/commons/httpcache/engine/impl/TeeServletOutputStream.java

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ public void setWriteListener(WriteListener writeListener) {
105105
writeListener.onWritePossible();
106106
} catch (IOException e) {
107107
listener.onError(e);
108-
e.printStackTrace();
109108
}
110109
}
111110
}

bundle/src/main/java/com/adobe/acs/commons/logging/impl/JsonEventLogger.java

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
name = "webconsole.configurationFactory.nameHint",
6262
value = "Logger: {event.logger.category} for events matching '{event.filter}' on '{event.topics}'")
6363
})
64+
@SuppressWarnings("PMD.MoreThanOneLogger")
6465
public class JsonEventLogger implements EventHandler {
6566

6667
/**

bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/FakeSlingHttpServletRequest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ public String getServletPath() {
279279
}
280280

281281
@Override
282-
public HttpSession getSession() {
282+
public String changeSessionId() {
283283
return null;
284284
}
285285

286286
@Override
287-
public String changeSessionId() {
287+
public HttpSession getSession() {
288288
return null;
289289
}
290290

bundle/src/main/java/com/adobe/acs/commons/util/ParameterUtil.java

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public static Map<String, String> toMap(final String[] values, final String sepa
136136
* If false, entries with multiple separators are considered invalid
137137
* @return
138138
*/
139+
@SuppressWarnings("squid:S3776")
139140
public static Map<String, String> toMap(final String[] values, final String separator,
140141
final boolean allowValuelessKeys, final String defaultValue,
141142
final boolean allowMultipleSeparators) {

bundle/src/main/java/com/adobe/acs/commons/workflow/process/impl/SyncSmartTagsToXmpMetadataNodeProcess.java

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public class SyncSmartTagsToXmpMetadataNodeProcess implements WorkflowProcess {
7777
@Reference
7878
private WorkflowPackageManager workflowPackageManager;
7979

80+
@SuppressWarnings("squid:S1141")
8081
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap)
8182
throws WorkflowException {
8283

bundle/src/test/java/com/adobe/acs/commons/it/build/ScrMetadataIT.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import java.util.zip.ZipEntry;
5252
import java.util.zip.ZipInputStream;
5353

54+
@SuppressWarnings("PMD.SystemPrintln")
5455
public class ScrMetadataIT {
5556

5657
private static final Set<String> PROPERTIES_TO_IGNORE;
@@ -114,26 +115,24 @@ public void test() throws Exception {
114115
private List<String> compareDescriptors(Descriptor current, Descriptor latestRelease) {
115116
List<String> problems = new ArrayList<>();
116117

117-
current.properties.stream().filter(cp -> !PROPERTIES_TO_IGNORE.contains(cp.name)).
118-
filter(cp -> !COMPONENT_PROPERTIES_TO_IGNORE.contains(current.name + ":" + cp.name)).forEach(cp -> {
118+
current.properties.stream().filter(cp -> !PROPERTIES_TO_IGNORE.contains(cp.name))
119+
.filter(cp -> !COMPONENT_PROPERTIES_TO_IGNORE.contains(current.name + ":" + cp.name)).forEach(cp -> {
119120
Optional<Property> fromLatest = latestRelease.properties.stream().filter(p -> p.name.equals(cp.name)).findFirst();
120121
if (fromLatest.isPresent()) {
121122
Property lp = fromLatest.get();
122123
if (!StringUtils.equals(cp.value, lp.value)) {
123124
problems.add(String.format("Property %s on component %s has different values (was: {%s}, is: {%s})", cp.name, current.name, lp.value, cp.value));
124125
}
125-
if (!COMPONENT_PROPERTIES_TO_IGNORE_FOR_TYPE_CHANGE.contains(current.name + ":" + cp.name)) {
126-
if (!StringUtils.equals(cp.type, lp.type)) {
127-
problems.add(String.format("Property %s on component %s has different types (was: {%s}, is: {%s})", cp.name, current.name, lp.type, cp.type));
128-
}
126+
if (!COMPONENT_PROPERTIES_TO_IGNORE_FOR_TYPE_CHANGE.contains(current.name + ":" + cp.name) && !StringUtils.equals(cp.type, lp.type)) {
127+
problems.add(String.format("Property %s on component %s has different types (was: {%s}, is: {%s})", cp.name, current.name, lp.type, cp.type));
129128
}
130129
} else {
131130
System.out.printf("Property %s on component %s is only in current. Assuming OK.\n", cp.name, current.name);
132131
}
133132
});
134133

135-
latestRelease.properties.stream().filter(lp -> !PROPERTIES_TO_IGNORE.contains(lp.name)).
136-
filter(lp -> !COMPONENT_PROPERTIES_TO_IGNORE.contains(latestRelease.name + ":" + lp.name)).forEach(lp -> {
134+
latestRelease.properties.stream().filter(lp -> !PROPERTIES_TO_IGNORE.contains(lp.name))
135+
.filter(lp -> !COMPONENT_PROPERTIES_TO_IGNORE.contains(latestRelease.name + ":" + lp.name)).forEach(lp -> {
137136
Optional<Property> fromCurrent = current.properties.stream().filter(p -> p.name.equals(lp.name)).findFirst();
138137
if (!fromCurrent.isPresent()) {
139138
problems.add(String.format("Property %s on component %s has been removed.", lp.name, latestRelease.name));
@@ -334,6 +333,11 @@ private class InputStreamFacade extends InputStream {
334333
this.zis = zis;
335334
}
336335

336+
@Override
337+
public int read() throws IOException {
338+
return zis.read();
339+
}
340+
337341
@Override
338342
public int read(@NotNull byte[] b) throws IOException {
339343
return zis.read(b);
@@ -374,10 +378,6 @@ public boolean markSupported() {
374378
return zis.markSupported();
375379
}
376380

377-
@Override
378-
public int read() throws IOException {
379-
return zis.read();
380-
}
381381
}
382382

383383

bundle/src/test/java/com/adobe/acs/commons/replication/status/impl/JcrPackageReplicationStatusEventHandlerTest.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@
2626
import com.day.cq.replication.ReplicationActionType;
2727
import com.day.cq.replication.ReplicationEvent;
2828
import org.apache.jackrabbit.JcrConstants;
29-
import org.apache.jackrabbit.vault.packaging.*;
30-
import org.apache.sling.api.resource.*;
29+
import org.apache.jackrabbit.vault.packaging.JcrPackage;
30+
import org.apache.jackrabbit.vault.packaging.JcrPackageDefinition;
31+
import org.apache.jackrabbit.vault.packaging.PackageId;
32+
import org.apache.jackrabbit.vault.packaging.Packaging;
33+
import org.apache.jackrabbit.vault.packaging.VaultPackage;
34+
import org.apache.sling.api.resource.LoginException;
35+
import org.apache.sling.api.resource.Resource;
36+
import org.apache.sling.api.resource.ResourceResolver;
37+
import org.apache.sling.api.resource.ResourceResolverFactory;
38+
import org.apache.sling.api.resource.ValueMap;
3139
import org.apache.sling.api.wrappers.ValueMapDecorator;
3240
import org.apache.sling.event.jobs.Job;
3341
import org.apache.sling.event.jobs.JobManager;
@@ -42,7 +50,11 @@
4250
import org.osgi.service.event.Event;
4351

4452
import javax.jcr.Node;
45-
import java.util.*;
53+
import java.util.ArrayList;
54+
import java.util.Calendar;
55+
import java.util.HashMap;
56+
import java.util.List;
57+
import java.util.Map;
4658
import java.util.regex.Pattern;
4759
import org.apache.sling.discovery.InstanceDescription;
4860
import org.apache.sling.discovery.TopologyEvent;
@@ -136,7 +148,7 @@ public void setUp() throws Exception {
136148
when(jcrPackage.getPackage()).thenReturn(vaultPackage);
137149
when(vaultPackage.getCreated()).thenReturn(calendar);
138150

139-
Map<String, Object> properties = new HashMap<String, Object>();
151+
Map<String, Object> properties = new HashMap<>();
140152
properties.put(JcrConstants.JCR_LASTMODIFIED, calendar);
141153
when(jcrPackageJcrContent.adaptTo(ValueMap.class)).thenReturn(new ValueMapDecorator(properties));
142154

0 commit comments

Comments
 (0)