Skip to content

Commit fbf5e7d

Browse files
Fixed Sonar issues
1 parent bb56b2a commit fbf5e7d

File tree

9 files changed

+8
-22
lines changed

9 files changed

+8
-22
lines changed

src/main/java/org/fuin/utils4j/jandex/JandexIndexFileReader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ private IndexView loadFile(final File file) throws IOException {
6262
private IndexView loadResources(final String indexFilePathAndName) throws IOException {
6363
final Enumeration<URL> enu = Thread.currentThread().getContextClassLoader().getResources(indexFilePathAndName);
6464
final List<IndexView> indexes = new ArrayList<>();
65-
final List<URL> resources = Collections.list(enu);
66-
for (final URL url : resources) {
65+
final List<URL> urlList = Collections.list(enu);
66+
for (final URL url : urlList) {
6767
try (final InputStream input = url.openStream()) {
6868
indexes.add(new IndexReader(input).read());
6969
}

src/main/java/org/fuin/utils4j/jandex/JandexIndexFileWriter.java

-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
import org.jboss.jandex.*;
44

55
import java.io.*;
6-
import java.net.URL;
7-
import java.util.ArrayList;
8-
import java.util.Collections;
9-
import java.util.Enumeration;
10-
import java.util.List;
116

127
/**
138
* Helps to write Jandex index files.

src/main/java/org/fuin/utils4j/jaxb/JaxbUtils.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public static <T> T unmarshal(final String xmlData, final Class<?>... classesToB
223223
if (classesToBeBound != null) {
224224
builder.addClassesToBeBound(classesToBeBound);
225225
}
226-
builder.withHandler(event -> { return false; });
226+
builder.withHandler(event -> false);
227227
return unmarshal(builder.build(), xmlData);
228228
}
229229

@@ -251,7 +251,7 @@ public static <T> T unmarshal(final String xmlData, final XmlAdapter<?, ?>[] ada
251251
builder.addClassesToBeBound(classesToBeBound);
252252
}
253253
builder.addAdapters(adapters);
254-
builder.withHandler(event -> { return false; });
254+
builder.withHandler(event -> false);
255255
return unmarshal(builder.build(), xmlData);
256256
}
257257

@@ -278,7 +278,7 @@ public static <T> T unmarshal(final JAXBContext ctx, final String xmlData, final
278278
if (adapters != null) {
279279
builder.addAdapters(adapters);
280280
}
281-
builder.withHandler(event -> { return false; });
281+
builder.withHandler(event -> false);
282282
return unmarshal(builder.build(), xmlData);
283283
}
284284

@@ -305,7 +305,7 @@ public static <T> T unmarshal(final JAXBContext ctx, final Reader reader, final
305305
if (adapters != null) {
306306
builder.addAdapters(adapters);
307307
}
308-
builder.withHandler(event -> { return false; });
308+
builder.withHandler(event -> false);
309309
return unmarshal(builder.build(), reader);
310310
}
311311

src/main/java/org/fuin/utils4j/jaxb/MarshallerBuilder.java

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public class MarshallerBuilder {
2929

3030
private ValidationEventHandler handler;
3131

32-
private boolean formattedOutput;
33-
3432
private JAXBContext ctx;
3533

3634

src/test/java/org/fuin/utils4j/fileprocessor/FileProcessorTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package org.fuin.utils4j.fileprocessor;
1919

20-
import org.assertj.core.api.Assertions;
2120
import org.junit.jupiter.api.Test;
2221

2322
import java.io.File;

src/test/java/org/fuin/utils4j/jandex/JandexIndexFileReaderTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
*/
1818
package org.fuin.utils4j.jandex;
1919

20-
import org.fuin.utils4j.jandex.JandexIndexFileReader;
2120
import org.fuin.utils4j.jandex.JandexIndexFileReader.Builder;
2221

23-
import org.fuin.utils4j.jandex.JandexUtils;
2422
import org.jboss.jandex.IndexView;
2523
import org.junit.jupiter.api.Test;
2624

src/test/java/org/fuin/utils4j/jandex/JandexIndexFileWriterTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public class JandexIndexFileWriterTest {
3737

3838
private static final File TARGET_DIR = new File("target");
3939

40-
private static final File CLASSES_DIR = new File(TARGET_DIR, "classes");
41-
4240
private static final File TEST_CLASSES_DIR = new File(TARGET_DIR, "test-classes");
4341

4442
@Test

src/test/java/org/fuin/utils4j/jandex/JandexUtilsTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ public class JandexUtilsTest {
4242

4343
private static final File CLASSES_DIR = new File(TARGET_DIR, "classes");
4444

45-
private static final File TEST_CLASSES_DIR = new File(TARGET_DIR, "test-classes");
46-
4745
@Test
4846
public final void testIndexClassFile() {
4947

src/test/java/org/fuin/utils4j/jaxb/MarshallerBuilderTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919

2020
import jakarta.xml.bind.JAXBContext;
2121
import jakarta.xml.bind.JAXBException;
22-
import jakarta.xml.bind.MarshalException;
2322
import jakarta.xml.bind.Marshaller;
2423
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
2524
import org.junit.jupiter.api.Test;
26-
import org.xml.sax.SAXParseException;
2725
import org.xmlunit.builder.DiffBuilder;
2826
import org.xmlunit.diff.Diff;
2927

@@ -201,9 +199,11 @@ public void testWithListener() throws JAXBException {
201199
final AtomicBoolean afterCalled = new AtomicBoolean(false);
202200
final Marshaller marshaller = new MarshallerBuilder().withContext(ctx).addAdapters(new MyId.Adapter())
203201
.withListener(new Marshaller.Listener() {
202+
@Override
204203
public void beforeMarshal(Object source) {
205204
beforeCalled.set(true);
206205
}
206+
@Override
207207
public void afterMarshal(Object source) {
208208
afterCalled.set(true);
209209
}

0 commit comments

Comments
 (0)