Skip to content

Commit 9743450

Browse files
committed
Minor code cleanup
1 parent 33c942f commit 9743450

File tree

28 files changed

+54
-70
lines changed

28 files changed

+54
-70
lines changed

deployment/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>com.mapcode</groupId>
2525
<artifactId>mapcode-rest-service</artifactId>
26-
<version>2.4.12.2</version>
26+
<version>2.4.12.3-SNAPSHOT</version>
2727
</parent>
2828

2929
<artifactId>deployment</artifactId>

deployment/src/main/java/com/mapcode/services/cli/Main.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.List;
2929
import java.util.jar.JarEntry;
3030
import java.util.jar.JarFile;
31+
import java.util.regex.Pattern;
3132

3233
/**
3334
* Stub to load CLI main from war file.
@@ -44,16 +45,14 @@ private Main() {
4445
// Prevent instantiation.
4546
}
4647

47-
@SuppressWarnings("OverlyBroadThrowsClause")
48-
public static void main(@Nonnull final String[] args)
48+
public static void main(@Nonnull final String... args)
4949
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IOException {
5050
assert args != null;
5151
final List<URL> newUrls = new ArrayList<>();
5252
URL.setURLStreamHandlerFactory(new NestedJarURLStreamHandlerFactory());
5353
final String warFile = getWarFile();
5454
try (final JarFile jarFile = new JarFile(warFile)) {
5555

56-
//noinspection ForLoopWithMissingComponent
5756
for (final Enumeration<JarEntry> entryEnum = jarFile.entries(); entryEnum.hasMoreElements(); ) {
5857
final JarEntry entry = entryEnum.nextElement();
5958
if (entry.getName().endsWith(".jar")) {
@@ -126,7 +125,8 @@ public URLStreamHandler createURLStreamHandler(@Nonnull final String protocol) {
126125

127126
static class JarJarURLStreamHandler extends URLStreamHandler {
128127

129-
@SuppressWarnings("DuplicateThrows")
128+
private static final Pattern PATTERN = Pattern.compile("\\~/");
129+
130130
@Nonnull
131131
@Override
132132
protected URLConnection openConnection(@Nonnull final URL u) throws IOException {
@@ -138,7 +138,7 @@ protected URLConnection openConnection(@Nonnull final URL u) throws IOException
138138
protected void parseURL(@Nonnull final URL u, @Nonnull final String spec, final int start, final int limit) {
139139
assert u != null;
140140
assert spec != null;
141-
final String file = "jar:" + spec.substring(start, limit).replaceFirst("\\~/", "!/");
141+
final String file = "jar:" + PATTERN.matcher(spec.substring(start, limit)).replaceFirst("!/");
142142
setURL(u, "nestedjar", "", -1, null, null, file, null, null);
143143
}
144144
}

deployment/src/main/java/com/mapcode/services/deployment/StartupCheck.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public final class StartupCheck {
7070

7171
// Start JMX server.
7272
final SystemMetricsAgent jmxAgent = injector.getInstance(SystemMetricsAgent.class);
73+
//noinspection OverlyBroadCatchBlock
7374
try {
7475
jmxAgent.register();
7576
}

deployment/src/test/java/com/mapcode/services/cli/MainTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public void testMainFails() throws Exception {
3131

3232
// This will fail, as it needs to run from a WAR file and we can't do that here.
3333
// Arguments: [--port <port>] [--silent] [--debug] [--help]
34-
Main.main(new String[]{"--port", "8080", "--debug"});
34+
Main.main("--port", "8080", "--debug");
3535
}
3636
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<artifactId>mapcode-rest-service</artifactId>
2525

2626
<packaging>pom</packaging>
27-
<version>2.4.12.2</version>
27+
<version>2.4.12.3-SNAPSHOT</version>
2828

2929
<name>Mapcode REST API Web Service</name>
3030
<description>

resources/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>com.mapcode</groupId>
2525
<artifactId>mapcode-rest-service</artifactId>
26-
<version>2.4.12.2</version>
26+
<version>2.4.12.3-SNAPSHOT</version>
2727
</parent>
2828

2929
<artifactId>resources</artifactId>

service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>com.mapcode</groupId>
2525
<artifactId>mapcode-rest-service</artifactId>
26-
<version>2.4.12.2</version>
26+
<version>2.4.12.3-SNAPSHOT</version>
2727
</parent>
2828

2929
<artifactId>service</artifactId>

service/src/main/java/com/mapcode/services/MapcodeResource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
/**
3131
* This class handle the Mapcode REST API, which includes conversions to and from mapcodes.
3232
*/
33+
@SuppressWarnings("SimplifiableAnnotation")
3334
@Api(value = "mapcode", description = "This resource provides the Mapcode REST API.")
3435
@Path("/mapcode")
3536
public interface MapcodeResource {

service/src/main/java/com/mapcode/services/RootResource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import javax.ws.rs.container.Suspended;
3030
import javax.ws.rs.core.MediaType;
3131

32+
@SuppressWarnings("SimplifiableAnnotation")
3233
@Api(value = "monitoring", description = "These resources are provided for monitoring purposes.")
3334
@Path("/mapcode")
3435
public interface RootResource {

service/src/main/java/com/mapcode/services/dto/AlphabetDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import javax.xml.bind.annotation.XmlElement;
3030
import javax.xml.bind.annotation.XmlRootElement;
3131

32-
@SuppressWarnings({"NonFinalFieldReferenceInEquals", "NonFinalFieldReferencedInHashCode", "NullableProblems", "EqualsWhichDoesntCheckParameterClass"})
32+
@SuppressWarnings({"NullableProblems", "InstanceVariableMayNotBeInitialized"})
3333
@ApiModel(
3434
value = "alphabet",
3535
description = "An alphabet definition object, such as returned by `GET /mapcode/alphabets/roman`.")

0 commit comments

Comments
 (0)