Skip to content

Commit 6bdcdcb

Browse files
committed
#280 fixed indent
1 parent f87a944 commit 6bdcdcb

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

core/src/main/java/org/bsc/confluence/ConfluenceService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ class Credentials {
120120

121121
public final String username;
122122
public final String password;
123-
public final Map<String, String> httpHeaders;
123+
public final Map<String, String> httpHeaders;
124124

125125
public Credentials(String username, String password, Map<String, String> httpHeaders) {
126126
this.username = username;
127127
this.password = password;
128-
this.httpHeaders = httpHeaders;
128+
this.httpHeaders = httpHeaders;
129129
}
130130

131131
}

plugin-reporting/src/main/java/org/bsc/mojo/AbstractBaseConfluenceMojo.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public abstract class AbstractBaseConfluenceMojo extends AbstractMojo implements
101101
* Additional HTTP headers for Confluence.
102102
*/
103103
@Parameter(property = "confluence.httpHeaders", required = false)
104-
private Map<String, String> httpHeaders = new HashMap<>();
104+
private Map<String, String> httpHeaders = new HashMap<>();
105105

106106
/**
107107
* @parameter expression="${settings}"
@@ -319,17 +319,17 @@ private void loadUserInfoFromSettings() throws MojoExecutionException {
319319
}
320320
}
321321

322-
if (getHttpHeaders().isEmpty() && server.getConfiguration() != null) {
323-
httpHeaders = stream(((Xpp3Dom) server.getConfiguration()).getChild("httpHeaders").getChildren())
324-
.filter(child ->
325-
child.getName().equals("property")
326-
&& child.getChild("name") != null
327-
&& child.getChild("value") != null
328-
)
329-
.collect(toMap(
330-
property -> property.getChild("name").getValue(),
331-
property -> property.getChild("value").getValue()));
332-
}
322+
if (getHttpHeaders().isEmpty() && server.getConfiguration() != null) {
323+
httpHeaders = stream(((Xpp3Dom) server.getConfiguration()).getChild("httpHeaders").getChildren())
324+
.filter(child ->
325+
child.getName().equals("property")
326+
&& child.getChild("name") != null
327+
&& child.getChild("value") != null
328+
)
329+
.collect(toMap(
330+
property -> property.getChild("name").getValue(),
331+
property -> property.getChild("value").getValue()));
332+
}
333333
}
334334
}
335335

service-rest-api/src/main/java/org/bsc/confluence/rest/RESTConfluenceService.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,20 @@ public RESTConfluenceService(String url, Credentials credentials, SSLCertificate
8282
;
8383
}
8484

85-
client.addInterceptor(chain -> {
86-
Request.Builder requestBuilder = chain.request().newBuilder();
87-
if (credentials.username != null) {
88-
final String credential =
89-
okhttp3.Credentials.basic(credentials.username, credentials.password);
90-
requestBuilder.header("Authorization", credential);
91-
}
92-
if (!credentials.httpHeaders.isEmpty()) {
93-
credentials.httpHeaders.entrySet().forEach(entry ->
94-
requestBuilder.header(entry.getKey(), entry.getValue()));
95-
}
96-
return chain.proceed(requestBuilder.build());
97-
});
85+
// Use interceptor which transparently adds credentials and HTTP headers for each request
86+
client.addInterceptor(chain -> {
87+
Request.Builder requestBuilder = chain.request().newBuilder();
88+
if (credentials.username != null) {
89+
final String credential =
90+
okhttp3.Credentials.basic(credentials.username, credentials.password);
91+
requestBuilder.header("Authorization", credential);
92+
}
93+
if (!credentials.httpHeaders.isEmpty()) {
94+
credentials.httpHeaders.entrySet().forEach(entry ->
95+
requestBuilder.header(entry.getKey(), entry.getValue()));
96+
}
97+
return chain.proceed(requestBuilder.build());
98+
});
9899

99100
}
100101

0 commit comments

Comments
 (0)