Skip to content

Commit 22fbc05

Browse files
committed
scijava-meta: fix IntelliJ warnings
1 parent a3e92c6 commit 22fbc05

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

scijava-meta/src/main/java/org/scijava/meta/POM.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
*/
4848
public class POM extends XML implements Comparable<POM>, Versioned {
4949

50-
private String version;
50+
private volatile String version;
5151

5252
/** Parses a POM from the given file. */
5353
public POM(final File file) throws IOException {
@@ -273,8 +273,7 @@ private static POM findPOM(final URL location, final String groupId,
273273
// known groupId and artifactId; grab it directly
274274
final String pomPath = "META-INF/maven/" + groupId + "/" +
275275
artifactId + "/pom.xml";
276-
final URL pomURL = new URL("jar:" + location.toString() + "!/" +
277-
pomPath);
276+
final URL pomURL = new URL("jar:" + location + "!/" + pomPath);
278277
return new POM(pomURL);
279278
}
280279
}
@@ -347,7 +346,7 @@ public static List<POM> allPOMs() {
347346
* suffix will be considered <em>less than</em> the one without a suffix. The
348347
* reason for this is to accommodate the
349348
* <a href="http://semver.org/">SemVer</a> versioning scheme's usage of
350-
* "prerelease" version suffixes. For example, {@code 2.0.0} will compare
349+
* "pre-release" version suffixes. For example, {@code 2.0.0} will compare
351350
* greater than {@code 2.0.0-beta-1}, whereas {@code 2.0.0} will compare less
352351
* than {@code 2.0.0.1}.</li>
353352
* </ul>

scijava-meta/src/main/java/org/scijava/meta/XML.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public class XML {
7777
/** XPath evaluation mechanism. */
7878
private final XPath xpath;
7979

80-
private final boolean debug = "debug".equals(System.getProperty(
81-
"scijava.log.level"));
80+
private final boolean debug =
81+
"debug".equals(System.getProperty("scijava.log.level"));
8282

8383
/** Parses XML from the given file. */
8484
public XML(final File file) throws IOException {
@@ -122,7 +122,7 @@ public XML(final String path, final Document doc) {
122122
System.err.println(Classes.location(XPathFactory.class));
123123
}
124124

125-
XPath xp = null;
125+
XPath xp;
126126
final Thread thread = Thread.currentThread();
127127
final ClassLoader contextClassLoader = thread.getContextClassLoader();
128128
try {
@@ -219,7 +219,7 @@ public String toString() {
219219
/** Gets the CData beneath the given node. */
220220
public static String cdata(final Node item) {
221221
final NodeList children = item.getChildNodes();
222-
if (children == null || children.getLength() == 0) return null;
222+
if (children.getLength() == 0) return null;
223223
for (int i = 0; i < children.getLength(); i++) {
224224
final Node child = children.item(i);
225225
if (child.getNodeType() != Node.TEXT_NODE) continue;
@@ -231,7 +231,7 @@ public static String cdata(final Node item) {
231231
/** Gets the CData beneath the given element's specified child. */
232232
public static String cdata(final Element el, final String child) {
233233
NodeList children = el.getElementsByTagName(child);
234-
if (children == null || children.getLength() == 0) return null;
234+
if (children.getLength() == 0) return null;
235235
return cdata(children.item(0));
236236
}
237237

@@ -269,8 +269,7 @@ private static Document loadXML(final File file) throws IOException {
269269
/** Loads an XML document from the given URL. */
270270
private static Document loadXML(final URL url) throws IOException {
271271
try (final InputStream in = url.openStream()) {
272-
final Document document = loadXML(in);
273-
return document;
272+
return loadXML(in);
274273
}
275274
}
276275

0 commit comments

Comments
 (0)