forked from jakartaee/mail-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spotbugs-exclude.xml
330 lines (304 loc) · 10.7 KB
/
spotbugs-exclude.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!-- FindBugs exclude list for Jakarta Mail -->
<FindBugsFilter>
<!--
FindBugs *really* wants us to use zero length arrays instead
of null. Unfortunately, there's a bunch of places we can't
do this for various reasons:
- The API specifies null and we can't make an incompatible change.
- We use null to indicate no header and an empty array to indicate
the header exists but has no entries.
- We use null to indicate NIL in the protocol and an empty array
to indicate an empty list "()" in the protocol.
This error occurs often enough that we just ignore it everywhere.
-->
<Match>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
<!--
There are a bunch of places where FindBugs complains about
exposing internal representations. We exclude cases where
this only happens in internal classes that are never visible
through the public Jakarta Mail API, or cases where the user
passes in an object (usually an array) and can only hurt
themselves by modifying the array while a method is in progress,
or where the implementation is passing the data back to the user
(e.g., in an Exception) and never uses it again.
-->
<Match>
<Or>
<Class name="jakarta.mail.SendFailedException"/>
<Class name="jakarta.mail.event.MessageCountEvent"/>
<Class name="jakarta.mail.event.TransportEvent"/>
</Or>
<Or>
<Bug pattern="EI_EXPOSE_REP"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Or>
</Match>
<Match>
<Class name="jakarta.mail.internet.MimeBodyPart"/>
<Method name="<init>"/> <!-- match constructor -->
<!-- passed in byte array -->
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<Match>
<Class name="jakarta.mail.util.ByteArrayDataSource"/>
<Method name="<init>"/> <!-- match constructor -->
<!-- passed in byte array -->
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<!--
A few places where we catch Exception even though it's not
explicitly thrown. We need to make sure that if anything
goes wrong we clean things up. Perhaps these should be
converted to a finally block and a boolean "success" flag?
Most of these are related to reflection or ClassLoader
operations, which can fail for all sorts of unexpected reasons.
Some of these could be converted to use multi-catch with JDK 1.7.
-->
<Match>
<Class name="jakarta.mail.Session"/>
<Or>
<Method name="getService"/>
<Method name="loadAllResources"/>
</Or>
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
<Match>
<Class name="jakarta.mail.internet.MimeUtility"/>
<Or>
<Method name="<clinit>"/> <!-- match static initializer -->
<Method name="getEncoding"/>
</Or>
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
<!--
Yes, the "next" element in my linked list isn't ever actually
used, but it feels weird to only have a "prev" element.
-->
<Match>
<Class name="jakarta.mail.EventQueue$QueueElement"/>
<Field name="next"/>
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>
<!--
Stupid Serializable EventObject class causes FindBugs to complain
about transient fields in subclasses. I don't know why it's
complaining about these fields but not others, but since I don't
really expect anyone to serialize these events I'm just ignoring
this complaint. Ditto Exception fields.
-->
<Match>
<Class name="jakarta.mail.event.TransportEvent"/>
<Or>
<Field name="invalid"/>
<Field name="validSent"/>
<Field name="validUnsent"/>
</Or>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
<Class name="jakarta.mail.event.FolderEvent"/>
<Or>
<Field name="folder"/>
<Field name="newFolder"/>
</Or>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
<Class name="jakarta.mail.event.MessageChangedEvent"/>
<Field name="msg"/>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
<Class name="jakarta.mail.event.MessageCountEvent"/>
<Field name="msgs"/>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
<Class name="jakarta.mail.event.TransportEvent"/>
<Field name="msg"/>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
<Class name="jakarta.mail.SendFailedException"/>
<Or>
<Field name="invalid"/>
<Field name="validSent"/>
<Field name="validUnsent"/>
</Or>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<!--
These string comparisons are just optimizations.
-->
<Match>
<Or>
<Class name="jakarta.mail.URLName"/>
<Class name="jakarta.mail.internet.InternetAddress"/>
</Or>
<Method name="equals"/>
<Bug pattern="ES_COMPARING_STRINGS_WITH_EQ"/>
</Match>
<!--
This string comparison using == is to determine whether the
String object is a different String object.
-->
<Match>
<Class name="jakarta.mail.internet.MimeUtility"/>
<Method name="decodeText"/>
<Bug pattern="ES_COMPARING_STRINGS_WITH_EQ"/>
</Match>
<!--
We extract the "lang" field of an encoded string but we don't
currently do anything with it. Ignore this complaint.
-->
<Match>
<Class name="jakarta.mail.internet.ParameterList"/>
<Method name="decodeValue"/>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
</Match>
<!--
The call ParameterList.set(null, "DONE") is a kludge used by the
IMAP provider to indicate that it's done setting parameters.
In other cases we *want* a null name to cause a NullPointerException.
-->
<Match>
<Class name="jakarta.mail.internet.ParameterList"/>
<Method name="set"/>
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
</Match>
<!--
We purposely don't close these streams, which are just wrappers
around the original stream that needs to remain open.
-->
<Match>
<Class name="jakarta.mail.internet.MimeMultipart"/>
<Or>
<Method name="parse"/>
<Method name="parsebm"/>
</Or>
<Bug pattern="OS_OPEN_STREAM"/>
</Match>
<!--
Can't fix these errors in toString until JavaMail 1.5 because
it's part of the spec. Sigh.
-->
<Match>
<Or>
<Class name="jakarta.mail.internet.ContentDisposition"/>
<Class name="jakarta.mail.internet.ContentType"/>
</Or>
<Method name="toString"/>
<Bug pattern="NP_TOSTRING_COULD_RETURN_NULL"/>
</Match>
<!--
These errors are in code imported from the JDK, where it seems
to be purposely using the platform default encoding. It's safer
to just leave this alone and ignore the errors.
-->
<Match>
<Class name="jakarta.mail.URLName"/>
<Bug pattern="DM_DEFAULT_ENCODING"/>
</Match>
<!--
We're purposely using the platform default encoding because
we're trying to discover what the platform default encoding *is*!
-->
<Match>
<Class name="jakarta.mail.internet.MimeUtility"/>
<Method name="getDefaultJavaCharset"/>
<Bug pattern="DM_DEFAULT_ENCODING"/>
</Match>
<!--
We're purposely using the platform default encoding when a
charset hasn't been specified.
-->
<Match>
<Class name="jakarta.mail.internet.ParameterList"/>
<Method name="combineMultisegmentNames"/>
<Bug pattern="DM_DEFAULT_ENCODING"/>
</Match>
<!--
MimeBodyPart.headers is set in the constructor. IMAPBodyPart has
perhaps paranoid defensive code to set it if it's not set. That
code is protected by the object lock, but all of the reads of the
field are not, thus FindBugs complains. For now I think it's
better to leave the defensive code in and ignore this error.
-->
<Match>
<Class name="jakarta.mail.internet.MimeBodyPart"/>
<Field name="headers"/>
<Bug pattern="IS2_INCONSISTENT_SYNC"/>
</Match>
<!--
These unread fields are part of the public API.
-->
<Match>
<Class name="jakarta.mail.Service"/>
<Field name="debug"/>
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
</Match>
<Match>
<Class name="jakarta.mail.Quota$Resource"/>
<Field name="usage"/>
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
</Match>
<!--
I know Exception.toString is never supposed to return null,
but this extra check is cheap insurance.
-->
<Match>
<Class name="jakarta.mail.MessagingException"/>
<Method name="toString"/>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
<!--
I know ClassLoader.getResources is never supposed to return null,
but this extra check is cheap insurance.
-->
<Match>
<Class name="~jakarta\.mail\.Session\$.*"/>
<Method name="run"/>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
<!--
These names may be confusing, but we're stuck with them.
-->
<Match>
<Class name="jakarta.mail.PasswordAuthentication"/>
<Method name="getUserName"/>
<Bug pattern="NM_CONFUSING"/>
</Match>
<!--
This trivial inner class extends ArrayList, but is never serialized,
so it doesn't really need a serialVersionUID.
-->
<Match>
<Class name="jakarta.mail.internet.ParameterList$MultiValue"/>
<Bug pattern="SE_NO_SERIALVERSIONID"/>
</Match>
<!--
The Authenticator fields are only accessible by subclasses,
which are only called through the one synchronized public
method, assuming the subclass doesn't do something crazy and
expose them itself.
-->
<Match>
<Class name="jakarta.mail.Authenticator"/>
<Bug pattern="IS2_INCONSISTENT_SYNC"/>
</Match>
</FindBugsFilter>