Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 9300da5

Browse files
author
Adam Lindenthal
committed
Findbugs exclusion filter config update
Change-Id: I3aeb00cf17426a68332ad6e2221ee48e1f76ac1a
1 parent 3d78b5d commit 9300da5

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

core-common/src/main/java/org/glassfish/jersey/filter/LoggingFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContex
295295
final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
296296
writerInterceptorContext.proceed();
297297
if (stream != null) {
298-
log(stream.getStringBuilder());
298+
log(stream.getStringBuilder(MessageUtils.getCharset(writerInterceptorContext.getMediaType())));
299299
}
300300
}
301301

@@ -309,11 +309,11 @@ private class LoggingStream extends OutputStream {
309309
this.inner = inner;
310310
}
311311

312-
StringBuilder getStringBuilder() {
312+
StringBuilder getStringBuilder(Charset charset) {
313313
// write entity to the builder
314314
final byte[] entity = baos.toByteArray();
315315

316-
b.append(new String(entity, 0, Math.min(entity.length, maxEntitySize)));
316+
b.append(new String(entity, 0, Math.min(entity.length, maxEntitySize), charset));
317317
if (entity.length > maxEntitySize) {
318318
b.append("...more...");
319319
}

etc/config/findbugs-exclude.xml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,45 @@
9494
<!-- individual ad-hoc ignores -->
9595
<!-- ServerScopeProvider.getFilteringScopes() - returned object would be identical -->
9696
<Match>
97-
<Class name="~.*.ServerScopeProvider" />
98-
<Method name="getFilteringScopes()" />
97+
<Class name="org.glassfish.jersey.message.filtering.ServerScopeProvider" />
98+
<Method name="getFilteringScopes" />
9999
<Bug pattern="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED" />
100100
</Match>
101101

102+
<!-- used as fallback, can be ignored here -->
103+
<Match>
104+
<Bug pattern="DM_DEFAULT_ENCODING" />
105+
<Class name="~.*.Base64" />
106+
</Match>
107+
102108
<!-- There are few cases in the codebase -->
103109
<Match>
104110
<Bug pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" />
105111
</Match>
106112

113+
<Match>
114+
<Bug pattern="REC_CATCH_EXCEPTION" />
115+
<Class name="~.*.VfsSchemeResourceFinderFactory" />
116+
</Match>
117+
118+
<!-- TODOs - those are the FindBugs warnings not resolved yet -->
119+
<!-- Those exclusions should either be fixed or, after evaluation moved outside of this "TODO" section -->
120+
<Match>
121+
<Bug pattern="DM_DEFAULT_ENCODING" />
122+
<Or>
123+
<Class name="~.*.AbstractTemplateProcessor" />
124+
<Class name="~.*.HmaSha1Method" />
125+
<Class name="~.*.RsaSha1Method" />
126+
<Class name="~.*.ConsumerCredentials" />
127+
<Class name="~.*.AccessToken" />
128+
<Class name="~.*.ClientIdentifier" />
129+
<Class name="~.*.ChunkedInput" />
130+
<Class name="~.*.ChunkedOutput" />
131+
</Or>
132+
</Match>
133+
134+
<Match>
135+
<Class name="org.glassfish.jersey.apache.connector.ApacheConnector" />
136+
</Match>
137+
107138
</FindBugsFilter>

0 commit comments

Comments
 (0)