Skip to content

Commit 6b18728

Browse files
committed
1 parent 1bfd668 commit 6b18728

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33

44
Changelog of Violation comments to bitbucket server lib.
55

6+
## Unreleased
7+
### No issue
8+
9+
**doc**
10+
11+
12+
[1bfd66826481215](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/1bfd66826481215) Tomas Bjerre *2019-10-09 16:59:35*
13+
14+
**Create FUNDING.yml**
15+
16+
17+
[b41689fab7a557a](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/b41689fab7a557a) Tomas Bjerre *2019-09-28 07:03:52*
18+
19+
620
## 1.90
721
### No issue
822

src/main/java/se/bjurr/violations/comments/bitbucketserver/lib/client/BitbucketServerInvoker.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ private String doInvokeUrl(
114114
statusCode = "" + response.getStatusLine().getStatusCode();
115115
reasonPhrase = response.getStatusLine().getReasonPhrase();
116116
}
117-
violationsLogger.log(INFO, method + " " + url + " " + statusCode + " " + reasonPhrase);
117+
boolean wasNotOk = !statusCode.startsWith("2");
118+
if (wasNotOk) {
119+
violationsLogger.log(
120+
INFO,
121+
method + " " + url + " " + statusCode + " " + reasonPhrase + "\nSent:\n" + postContent);
122+
} else {
123+
violationsLogger.log(INFO, method + " " + url + " " + statusCode + " " + reasonPhrase);
124+
}
118125
if (response.getEntity() == null) {
119126
return null;
120127
}
@@ -126,6 +133,9 @@ private String doInvokeUrl(
126133
stringBuilder.append(line + "\n");
127134
}
128135
final String json = stringBuilder.toString();
136+
if (wasNotOk) {
137+
violationsLogger.log(INFO, "Response:\n" + json);
138+
}
129139
return json;
130140
} catch (final Throwable e) {
131141
throw new RuntimeException("Error calling:\n" + url + "\n" + method + "\n" + postContent, e);

0 commit comments

Comments
 (0)