Skip to content

Commit 937d021

Browse files
committed
Code cleanup
1 parent e8ccf0b commit 937d021

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/main/java/org/sourcelab/kafka/connect/apiclient/KafkaConnectClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private <T> T submitRequest(final Request<T> request) {
293293
try {
294294
final RequestErrorResponse errorResponse = JacksonFactory.newInstance().readValue(responseStr, RequestErrorResponse.class);
295295
throw new InvalidRequestException(errorResponse.getMessage(), errorResponse.getErrorCode());
296-
} catch (IOException e) {
296+
} catch (final IOException e) {
297297
// swallow
298298
}
299299
throw new InvalidRequestException("Invalid response from server: " + responseStr, restResponse.getHttpCode());

src/main/java/org/sourcelab/kafka/connect/apiclient/rest/HttpClientRestClient.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void close() {
147147
if (httpClient != null) {
148148
try {
149149
httpClient.close();
150-
} catch (IOException e) {
150+
} catch (final IOException e) {
151151
logger.error("Error closing: {}", e.getMessage(), e);
152152
}
153153
}
@@ -178,7 +178,7 @@ public RestResponse submitRequest(final Request request) throws RestException {
178178
default:
179179
throw new IllegalArgumentException("Unknown Request Method: " + request.getRequestMethod());
180180
}
181-
} catch (IOException exception) {
181+
} catch (final IOException exception) {
182182
throw new RestException(exception.getMessage(), exception);
183183
}
184184
}
@@ -198,7 +198,7 @@ private <T> T submitGetRequest(final String url, final Map<String, String> getPa
198198
.setCharset(StandardCharsets.UTF_8);
199199

200200
// Attach submitRequest params
201-
for (Map.Entry<String, String> entry : getParams.entrySet()) {
201+
for (final Map.Entry<String, String> entry : getParams.entrySet()) {
202202
uriBuilder.setParameter(entry.getKey(), entry.getValue());
203203
}
204204

@@ -215,12 +215,12 @@ private <T> T submitGetRequest(final String url, final Map<String, String> getPa
215215

216216
// Execute and return
217217
return httpClient.execute(get, responseHandler);
218-
} catch (ClientProtocolException e) {
218+
} catch (final ClientProtocolException e) {
219219
e.printStackTrace();
220-
} catch (IOException e) {
220+
} catch (final IOException e) {
221221
// Typically this is a parse error.
222222
e.printStackTrace();
223-
} catch (URISyntaxException e) {
223+
} catch (final URISyntaxException e) {
224224
// Bad URI building
225225
e.printStackTrace();
226226
}
@@ -257,9 +257,9 @@ private <T> T submitPostRequest(final String url, final Object requestBody, fina
257257

258258
// Execute and return
259259
return httpClient.execute(post, responseHandler);
260-
} catch (ClientProtocolException e) {
260+
} catch (final ClientProtocolException e) {
261261
e.printStackTrace();
262-
} catch (IOException e) {
262+
} catch (final IOException e) {
263263
// Typically this is a parse error.
264264
e.printStackTrace();
265265
}
@@ -296,12 +296,12 @@ private <T> T submitPutRequest(final String url, final Object requestBody, final
296296

297297
// Execute and return
298298
return httpClient.execute(put, responseHandler);
299-
} catch (ClientProtocolException e) {
299+
} catch (final ClientProtocolException e) {
300300
e.printStackTrace();
301-
} catch (IOException e) {
301+
} catch (final IOException e) {
302302
// Typically this is a parse error.
303303
e.printStackTrace();
304-
} catch (URISyntaxException e) {
304+
} catch (final URISyntaxException e) {
305305
// Bad URI building
306306
e.printStackTrace();
307307
}
@@ -340,12 +340,12 @@ private <T> T submitDeleteRequest(final String url, final Object requestBody, fi
340340

341341
// Execute and return
342342
return httpClient.execute(delete, responseHandler);
343-
} catch (ClientProtocolException e) {
343+
} catch (final ClientProtocolException e) {
344344
e.printStackTrace();
345-
} catch (IOException e) {
345+
} catch (final IOException e) {
346346
// Typically this is a parse error.
347347
e.printStackTrace();
348-
} catch (URISyntaxException e) {
348+
} catch (final URISyntaxException e) {
349349
// Bad URI building
350350
e.printStackTrace();
351351
}

src/test/java/BadLoggersTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public void doTest() throws FileNotFoundException {
4848
walk(projectRootPath);
4949
}
5050

51-
private void walk(File root) throws FileNotFoundException {
52-
File[] list = root.listFiles();
51+
private void walk(final File root) throws FileNotFoundException {
52+
final File[] list = root.listFiles();
5353

5454
if (list == null) return;
5555

56-
for (File f : list) {
56+
for (final File f : list) {
5757
if (f.isDirectory()) {
5858
walk(f);
5959
} else {
@@ -66,27 +66,27 @@ private void walk(File root) throws FileNotFoundException {
6666
}
6767
}
6868

69-
private void testFile(File myFile) throws FileNotFoundException {
70-
String fileData = new Scanner(myFile).useDelimiter("\\Z").next();
69+
private void testFile(final File myFile) throws FileNotFoundException {
70+
final String fileData = new Scanner(myFile).useDelimiter("\\Z").next();
7171

7272
// Look for our pattern
73-
Matcher matches = regexPattern.matcher(fileData);
73+
final Matcher matches = regexPattern.matcher(fileData);
7474

7575
// If we didn't find a match
7676
if (!matches.find()) {
7777
return;
7878
}
7979

8080
// Grab out the Class name
81-
String loggerClassName = matches.group(1);
81+
final String loggerClassName = matches.group(1);
8282
if (loggerClassName == null) {
8383
return;
8484
}
8585

8686
// Get class name from the file name
8787
// I bet this will be completely broken for inner classes...
8888
// if you run into that, just exclude it? or figure out a better solution to this :p
89-
String className = myFile.getName().replace(".java", "");
89+
final String className = myFile.getName().replace(".java", "");
9090
if (!className.equals(loggerClassName)) {
9191
logger.info("Class {} ClassNameUsedByLogger {} ", className, loggerClassName);
9292
assertFalse("Found instance of logger using wrong class? " + myFile.getPath() + " Using " + loggerClassName, true);

0 commit comments

Comments
 (0)