Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#334 - fix log message pattern to include parameter index #335

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@
logger.log(Level.FINEST, "Result of the status notification is: {0}, with status code: {1}",
new Object[] {responseBody, response.getStatusLine().getStatusCode()});
} catch (IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());
}
else if (credentials instanceof StringCredentials) {
try {
Response response = this.send((StringCredentials) credentials, verb, url, payload);

logger.log(Level.FINEST, "Result of the state notification is: {0}, with status code: {1}",
new Object[] {response.getBody(), response.getCode()});
} catch (ExecutionException | IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());

Check warning on line 72 in src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/client/BitBucketPPRClientCloudVisitor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 63-72 are not covered by tests
} catch (InterruptedException e) {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@
logger.log(Level.FINEST, "Result of the status notification is: {0}, with status code: {1}",
new Object[] {responseBody, response.getStatusLine().getStatusCode()});
} catch (IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());
}
else if (credentials instanceof StringCredentials)
try {
HttpResponse response = this.send((StringCredentials) credentials, verb, url, payload);
logger.log(Level.FINEST, "Result of the state notification is: {0}, with status code: {1}",
new Object[] {response.getEntity().getContent(),
response.getStatusLine().getStatusCode()});
} catch (ExecutionException | IOException | KeyManagementException | NoSuchAlgorithmException
| KeyStoreException e) {
logger.log(Level.WARNING, "Error du" + "ring state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error du" + "ring state notification: {0} ", e.getMessage());

Check warning on line 76 in src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/client/BitBucketPPRClientServerVisitor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 66-76 are not covered by tests
} catch (InterruptedException e) {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static boolean matchWithRegex(@Nonnull String haystack, @Nonnull String p
}

if (patternStr == null || patternStr.trim().isEmpty()) {
logger.fine(String.format("The regex filter on the comment from BB is null or it is empty", new Object[] {}));
logger.fine("The regex filter on the comment from BB is null or it is empty");
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@
String jsonPayload = objectMapper.writeValueAsString(payload);
BitBucketPPRClientFactory.createClient(clientType, context).send(url, jsonPayload);
} catch (JsonProcessingException e) {
logger.log(Level.WARNING, "Cannot create payload: {}", e.getMessage());
logger.log(Level.WARNING, "Cannot create payload: {0}", e.getMessage());
} catch (Exception e) {
logger.warning(e.getMessage());
}
}

protected void callClient(@Nonnull Verb verb, @Nonnull String url,
@Nonnull Map<String, String> payload) {
ObjectMapper objectMapper = new ObjectMapper();

try {
String jsonPayload = payload.isEmpty() ? "" : objectMapper.writeValueAsString(payload);
BitBucketPPRClientFactory.createClient(clientType, context).send(verb, url, jsonPayload);
} catch (JsonProcessingException e) {
logger.log(Level.WARNING, "Cannot create payload: {}", e.getMessage());
logger.log(Level.WARNING, "Cannot create payload: {0}", e.getMessage());

Check warning on line 107 in src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/observer/BitBucketPPRHandlerTemplate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 93-107 are not covered by tests
} catch (Exception e) {
logger.warning(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@

if (REPOSITORY_EVENT.equalsIgnoreCase(bitbucketEvent.getEvent())
&& REPOSITORY_CLOUD_PUSH.equalsIgnoreCase(bitbucketEvent.getAction())) {
logger.log(Level.FINE, "Add BitBucketPPRPushCloudObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPushCloudObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPushCloudObserver());
}

if (REPOSITORY_EVENT.equalsIgnoreCase(bitbucketEvent.getEvent())
&& REPOSITORY_SERVER_PUSH.equalsIgnoreCase(bitbucketEvent.getAction())) {
logger.log(Level.FINE, "Add BitBucketPPRPushServerObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPushServerObserver for {0}", bitbucketEvent);

Check warning on line 52 in src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/observer/BitBucketPPRObserverFactory.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 52 is not covered by tests
observable.addObserver(new BitBucketPPRPushServerObserver());
}

if (PULL_REQUEST_CLOUD_EVENT.equals(bitbucketEvent.getEvent())) {
logger.log(Level.FINE, "Add BitBucketPPRPullRequestCloudObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPullRequestCloudObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPullRequestCloudObserver());
}

if (PULL_REQUEST_SERVER_EVENT.equals(bitbucketEvent.getEvent())) {
logger.log(Level.FINE, "Add BitBucketPPRPullRequestServerObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPullRequestServerObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPullRequestServerObserver());
}

if (observable.getObservers().isEmpty())
logger.log(Level.FINE, "No observer found for the observable of event {}", bitbucketEvent);
logger.log(Level.FINE, "No observer found for the observable of event {0}", bitbucketEvent);

Check warning on line 67 in src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/observer/BitBucketPPRObserverFactory.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 67 is not covered by tests

return observable;
}
Expand Down
Loading