Skip to content

Commit f47e8b4

Browse files
claude[bot]vmassol
andauthored
[Misc] Fix 28 SonarCloud issues in various modules (#1852)
* java:S7476 (20): remove decorative `//////` banner comment lines * java:S3706 (8): replace `.stream().forEach()` with `.forEach()` Co-authored-by: Vincent Massol <vincent@massol.net>
1 parent 1091ed5 commit f47e8b4

12 files changed

Lines changed: 8 additions & 31 deletions

File tree

xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,10 @@ private void customizeEviction(ConfigurationBuilder builder)
7171
(EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID);
7272

7373
if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) {
74-
////////////////////
7574
// Eviction
7675
// Max entries
7776
customizeEvictionMaxEntries(builder, eec);
7877

79-
////////////////////
8078
// Expiration
8179
// Wakeup interval
8280
customizeExpirationWakeUpInterval(builder, eec);

xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/internal/JarExtendedURLStreamHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ public void dispose() throws ComponentLifecycleException
148148
}
149149

150150
// @formatter:off
151-
//////////////////////////////////////////////////////////////////////////////////////
152151
// Begin copying a few sun.net.www.protocol.jar.Handler methods that we cannot reuse
153-
//////////////////////////////////////////////////////////////////////////////////////
154152

155153
private static int indexOfBangSlash(String spec) {
156154
int indexOfBang = spec.length();
@@ -315,8 +313,6 @@ private static String doCanonize(String file) {
315313
return file;
316314
}
317315

318-
//////////////////////////////////////////////////////////////////////////////////////
319316
// Finish sun.net.www.protocol.jar.Handler copy
320-
//////////////////////////////////////////////////////////////////////////////////////
321317
// @formatter:on
322318
}

xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-xml/src/main/java/org/xwiki/diff/xml/internal/AbstractXMLDiffMarker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ protected Map<Node, Patch<?>> markDiffBlocks(Map<Node, Patch<?>> patches)
189189
}
190190

191191
// Mark the change blocks.
192-
diffBlocks.stream().forEach(node -> this.markDiffBlock((Element) node));
192+
diffBlocks.forEach(node -> this.markDiffBlock((Element) node));
193193

194194
// Take into account only the outer most change blocks.
195195
Set<Node> nestedDiffBlocks = diffBlocks.stream().filter(this::hasDiffBlockParent).collect(Collectors.toSet());
196-
nestedDiffBlocks.stream().forEach(node -> this.unmarkDiffBlock((Element) node));
196+
nestedDiffBlocks.forEach(node -> this.unmarkDiffBlock((Element) node));
197197
diffBlocks.removeAll(nestedDiffBlocks);
198198

199199
return acceptedPatches;
@@ -481,7 +481,7 @@ private void removeTextWrappers(Node node)
481481
XPath xpath = XPathFactory.newInstance().newXPath();
482482
String expression = "//" + getInlineMarkerElementName() + "[@" + TEXT_WRAPPER + "]";
483483
try {
484-
XMLDiffUtils.asList((NodeList) xpath.compile(expression).evaluate(node, XPathConstants.NODESET)).stream()
484+
XMLDiffUtils.asList((NodeList) xpath.compile(expression).evaluate(node, XPathConstants.NODESET))
485485
.forEach(this::replaceWithChildren);
486486
} catch (XPathExpressionException e) {
487487
// This shouldn't happen but in case it does the text wrappers shouldn't case any problems (they just make

xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-xml/src/main/java/org/xwiki/diff/xml/internal/HTMLDiffMarker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ private void insertRightBlocks(Node node)
456456
XPath xpath = XPathFactory.newInstance().newXPath();
457457
String expression = "//*[@" + DIFF_BLOCK_ATTRIBUTE + " = '" + DELETED + "']";
458458
try {
459-
XMLDiffUtils.asList((NodeList) xpath.compile(expression).evaluate(node, XPathConstants.NODESET)).stream()
459+
XMLDiffUtils.asList((NodeList) xpath.compile(expression).evaluate(node, XPathConstants.NODESET))
460460
.forEach(this::insertRightBlock);
461461
} catch (XPathExpressionException e) {
462462
// This shouldn't happen.

xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-xml/src/main/java/org/xwiki/diff/xml/internal/HTMLDiffPruner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ public void before(Document document)
6363
public void after(Document document)
6464
{
6565
// Mark parents and siblings we want to keep by going upwards from the change blocks.
66-
getElementsWithAttribute(document, HTMLDiffMarker.DIFF_BLOCK_ATTRIBUTE).stream()
66+
getElementsWithAttribute(document, HTMLDiffMarker.DIFF_BLOCK_ATTRIBUTE)
6767
.forEach(this::markContextElements);
6868

6969
// Iterate the tree top -> down and hide nodes we don't want to keep.
7070
hideNodesWeDontWantToKeep(document);
7171

7272
// Remove the marker from the context nodes.
73-
getElementsWithAttribute(document, DIFF_CONTEXT_ATTRIBUTE).stream().forEach(this::unmarkContextElement);
73+
getElementsWithAttribute(document, DIFF_CONTEXT_ATTRIBUTE).forEach(this::unmarkContextElement);
7474
}
7575

7676
private void markContextElements(Node diffBlock)
7777
{
7878
Node node = diffBlock;
7979
while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
8080
markContextElement(node);
81-
getContextSiblings(node).stream().forEach(this::markContextElement);
81+
getContextSiblings(node).forEach(this::markContextElement);
8282
node = node.getParentNode();
8383
}
8484
}
@@ -109,7 +109,7 @@ private void hideNodesWeDontWantToKeep(Node node)
109109
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
110110
Element element = (Element) node;
111111
if (element.hasAttribute(DIFF_CONTEXT_ATTRIBUTE)) {
112-
XMLDiffUtils.asList(element.getChildNodes()).stream().forEach(this::hideNodesWeDontWantToKeep);
112+
XMLDiffUtils.asList(element.getChildNodes()).forEach(this::hideNodesWeDontWantToKeep);
113113
} else if (!element.hasAttribute(HTMLDiffMarker.DIFF_BLOCK_ATTRIBUTE)) {
114114
element.setAttribute(DIFF_HIDDEN_ATTRIBUTE, String.valueOf(true));
115115
}

xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-handlers/xwiki-commons-extension-handler-jar/src/main/java/org/xwiki/extension/jar/internal/handler/JarExtensionHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public static boolean isWebjar(Extension extension)
115115
return true;
116116
}
117117

118-
///////////////////////////////
119118
// But it's not the case for:
120119

121120
// ** webjar.org releases (i.e. most of the webjars). We assume "org.webjars:*" id means it's a webjar

xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-common/src/main/java/org/xwiki/jakartabridge/JakartaBridge.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ private JakartaBridge()
4747
{
4848
}
4949

50-
//////////////////////////////////////////////////
5150
// Wrapped
5251

5352
/**
@@ -98,7 +97,6 @@ public static <X, K> K toJakarta(X javax, Function<X, K> jakartaConstructor)
9897
return jakarta;
9998
}
10099

101-
//////////////////////////////////////////////////
102100
// Multi
103101

104102
/**

xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-common/src/test/java/org/xwiki/jakartabridge/JakartaBridgeTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,13 @@ void single()
7878
assertNull(JakartaBridge.toJavax(null, null));
7979
assertNull(JakartaBridge.toJakarta(null, null));
8080

81-
///
82-
8381
TestJakarta jakarta = new DefaultTestJakarta();
8482

8583
TestJavax javax = JakartaBridge.toJavax(jakarta, TestJavaxToJakarta::new);
8684

8785
assertNotNull(javax);
8886
assertSame(jakarta, JakartaBridge.toJakarta(javax, TestJakartaToJavax::new));
8987

90-
///
91-
9288
javax = new DefaultTestJavax();
9389

9490
jakarta = JakartaBridge.toJakarta(javax, TestJakartaToJavax::new);

xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JakartaServletBridge.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ private JakartaServletBridge()
133133
{
134134
}
135135

136-
//////////////////////////////////////////////////
137136
// Wrapped
138137

139138
/**
@@ -747,7 +746,6 @@ public static Cookie toJakarta(javax.servlet.http.Cookie javax)
747746
return JakartaBridge.toJavax(javax, JakartaToJavaxCookie::new);
748747
}
749748

750-
//////////////////////////////////////////////////
751749
// Converted
752750

753751
/**
@@ -884,7 +882,6 @@ public static MultipartConfigElement toJakarta(javax.servlet.MultipartConfigElem
884882
javax.getFileSizeThreshold());
885883
}
886884

887-
//////////////////////////////////////////////////
888885
// Multi
889886

890887
/**
@@ -989,7 +986,6 @@ public static EnumSet<DispatcherType> toJakarta(EnumSet<javax.servlet.Dispatcher
989986
.collect(Collectors.toCollection(() -> EnumSet.noneOf(jakarta.servlet.DispatcherType.class)));
990987
}
991988

992-
//////////////////////////////////////////////////
993989
// Unsupported
994990

995991
/**

xwiki-commons-core/xwiki-commons-job/xwiki-commons-job-default/src/test/java/org/xwiki/job/internal/DefaultJobExecutorTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ void matchingGroupPathAreBlocked()
143143
this.executor.execute(jobAB);
144144
this.executor.execute(job1);
145145

146-
////////////////////
147146
// A and A/B
148147

149148
assertSame(State.WAITING, jobA.getStatus().getState());
@@ -163,7 +162,6 @@ void matchingGroupPathAreBlocked()
163162
assertSame(State.FINISHED, jobA.getStatus().getState());
164163
assertSame(State.FINISHED, jobAB.getStatus().getState());
165164

166-
////////////////////
167165
// 1/2 and 1
168166

169167
assertSame(State.WAITING, job12.getStatus().getState());
@@ -345,7 +343,6 @@ void matchingGroupPathAreBlockedPoolMultiSizeChildrenFirst() throws InterruptedE
345343
jobAB2.lock();
346344
jobAB3.lock();
347345

348-
////////////////////
349346
// A/B and A
350347

351348
this.executor.execute(jobAB1);

0 commit comments

Comments
 (0)