Skip to content

Commit 9d9f8b2

Browse files
committed
Eliminate tons of Javadoc warnings and some other code warnings
in both main and test code. Significant reorganization to pom and upgrades to many plugins and a few components. More to do.
1 parent f2ed172 commit 9d9f8b2

40 files changed

+445
-704
lines changed

pom.xml

Lines changed: 170 additions & 141 deletions
Large diffs are not rendered by default.

src/main/java/org/owasp/esapi/ESAPI.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ private static LogFactory logFactory() {
141141
* @param clazz The class to associate the logger with.
142142
* @return The current Logger associated with the specified class.
143143
*/
144-
@SuppressWarnings("unchecked") // Because Eclipse wants Class<T> instead.
145144
public static Logger getLogger(Class clazz) {
146145
return logFactory().getLogger(clazz);
147146
}
@@ -215,8 +214,7 @@ public static String initialize( String impl ) {
215214
* To clear an overridden Configuration, simple call this method with null for the config
216215
* parameter.
217216
*
218-
* @param config
219-
* @return
217+
* @param config The new security configuration.
220218
*/
221219
public static void override( SecurityConfiguration config ) {
222220
overrideConfig = config;

src/main/java/org/owasp/esapi/Encoder.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,21 +443,18 @@ public interface Encoder {
443443
* @param input
444444
* the Base64 text to decode
445445
*
446-
* @return input
447-
* decoded from Base64
446+
* @return input decoded from Base64
448447
*
449448
* @throws IOException
450449
*/
451450
byte[] decodeFromBase64(String input) throws IOException;
452451

453452
/**
454-
*
455453
* Get a version of the input URI that will be safe to run regex and other validations against.
456454
* It is not recommended to persist this value as it will transform user input. This method
457455
* will not test to see if the URI is RFC-3986 compliant.
458456
*
459-
* @param input
460-
* @return
457+
* @return The canonicalized URI
461458
*/
462459
public String getCanonicalizedURI(URI dirtyUri);
463460

src/main/java/org/owasp/esapi/EncryptedProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public interface EncryptedProperties {
7575
* Returns a {@code Set} view of properties. The {@code Set} is backed by a
7676
* {@code java.util.Hashtable}, so changes to the {@code Hashtable} are
7777
* reflected in the {@code Set}, and vice-versa. The {@code Set} supports element
78-
* removal (which removes the corresponding entry from the {@code Hashtable),
78+
* removal (which removes the corresponding entry from the {@code Hashtable},
7979
* but not element addition.
8080
*
8181
* @return

src/main/java/org/owasp/esapi/HTTPUtilities.java

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public interface HTTPUtilities
5252
/**
5353
* Calls addCookie with the *current* request.
5454
*
55-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
55+
* @param cookie The cookie to add
56+
*
57+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
5658
*/
5759
void addCookie(Cookie cookie);
5860

@@ -61,7 +63,8 @@ public interface HTTPUtilities
6163
* illegal characters in the name and name and value. This method also sets
6264
* the secure and HttpOnly flags on the cookie.
6365
*
64-
* @param cookie
66+
* @param response The HTTP response to add the cookie to
67+
* @param cookie The cookie to add
6568
*/
6669
void addCookie(HttpServletResponse response, Cookie cookie);
6770

@@ -77,7 +80,7 @@ public interface HTTPUtilities
7780
/**
7881
* Calls addHeader with the *current* request.
7982
*
80-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
83+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
8184
*/
8285
void addHeader(String name, String value);
8386

@@ -96,15 +99,15 @@ public interface HTTPUtilities
9699

97100
/**
98101
* Calls assertSecureRequest with the *current* request.
99-
* @see {@link HTTPUtilities#assertSecureRequest(HttpServletRequest)}
100-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
102+
* @see HTTPUtilities#assertSecureRequest(HttpServletRequest)
103+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
101104
*/
102105
void assertSecureRequest() throws AccessControlException;
103106

104107
/**
105108
* Calls assertSecureChannel with the *current* request.
106-
* @see {@link HTTPUtilities#assertSecureChannel(HttpServletRequest)}
107-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
109+
* @see HTTPUtilities#assertSecureChannel(HttpServletRequest)
110+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
108111
*/
109112
void assertSecureChannel() throws AccessControlException;
110113

@@ -132,7 +135,7 @@ public interface HTTPUtilities
132135
/**
133136
* Calls changeSessionIdentifier with the *current* request.
134137
*
135-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
138+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
136139
*/
137140
HttpSession changeSessionIdentifier() throws AuthenticationException;
138141

@@ -176,7 +179,7 @@ public interface HTTPUtilities
176179
/**
177180
* Calls decryptStateFromCookie with the *current* request.
178181
*
179-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
182+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
180183
*/
181184
Map<String, String> decryptStateFromCookie() throws EncryptionException;
182185

@@ -210,7 +213,7 @@ public interface HTTPUtilities
210213
/**
211214
* Calls encryptStateInCookie with the *current* response.
212215
*
213-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
216+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
214217
*/
215218
void encryptStateInCookie(Map<String, String> cleartext) throws EncryptionException;
216219

@@ -229,8 +232,12 @@ public interface HTTPUtilities
229232

230233
/**
231234
* Calls getCookie with the *current* response.
235+
*
236+
* @param name The cookie to get
237+
* @return the requested cookie value
238+
* @throws ValidationException
232239
*
233-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
240+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
234241
*/
235242
String getCookie(String name) throws ValidationException;
236243

@@ -241,15 +248,16 @@ public interface HTTPUtilities
241248
* more specific validation.
242249
*
243250
* @param request
244-
* @param name
251+
* @param name The cookie to get
245252
* @return the requested cookie value
253+
* @throws ValidationException
246254
*/
247255
String getCookie(HttpServletRequest request, String name) throws ValidationException;
248256

249257
/**
250258
* Returns the current user's CSRF token. If there is no current user then return null.
251259
*
252-
* @return the current users CSRF token
260+
* @return the current user's CSRF token
253261
*/
254262
String getCSRFToken();
255263

@@ -270,17 +278,26 @@ public interface HTTPUtilities
270278
/**
271279
* Calls getFileUploads with the *current* request, default upload directory, and default allowed file extensions
272280
*
273-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
281+
* @return List of new File objects from upload
282+
* @throws ValidationException if the file fails validation
283+
*
284+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
274285
*/
275286
List getFileUploads() throws ValidationException;
276287

277288
/**
278289
* Call getFileUploads with the specified request, default upload directory, and default allowed file extensions
290+
*
291+
* @return List of new File objects from upload
292+
* @throws ValidationException if the file fails validation
279293
*/
280294
List getFileUploads(HttpServletRequest request) throws ValidationException;
281295

282296
/**
283297
* Call getFileUploads with the specified request, specified upload directory, and default allowed file extensions
298+
*
299+
* @return List of new File objects from upload
300+
* @throws ValidationException if the file fails validation
284301
*/
285302
List getFileUploads(HttpServletRequest request, File finalDir) throws ValidationException;
286303

@@ -303,7 +320,7 @@ public interface HTTPUtilities
303320
/**
304321
* Calls getHeader with the *current* request.
305322
*
306-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
323+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
307324
*/
308325
String getHeader(String name) throws ValidationException;
309326

@@ -322,7 +339,7 @@ public interface HTTPUtilities
322339
/**
323340
* Calls getParameter with the *current* request.
324341
*
325-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
342+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
326343
*/
327344
String getParameter(String name) throws ValidationException;
328345

@@ -341,7 +358,7 @@ public interface HTTPUtilities
341358
/**
342359
* Calls killAllCookies with the *current* request and response.
343360
*
344-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
361+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
345362
*/
346363
void killAllCookies();
347364

@@ -357,7 +374,7 @@ public interface HTTPUtilities
357374
/**
358375
* Calls killCookie with the *current* request and response.
359376
*
360-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
377+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
361378
*/
362379
void killCookie(String name);
363380

@@ -374,7 +391,7 @@ public interface HTTPUtilities
374391
/**
375392
* Calls logHTTPRequest with the *current* request and logger.
376393
*
377-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
394+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
378395
*/
379396
void logHTTPRequest();
380397

@@ -399,7 +416,7 @@ public interface HTTPUtilities
399416
* include it here in case different parts of the application need to obfuscate
400417
* different parameters.
401418
*
402-
* @param request
419+
* @param request The HTTP request to log
403420
* @param logger the logger to write the request to
404421
* @param parameterNamesToObfuscate the sensitive parameters
405422
*/
@@ -408,7 +425,7 @@ public interface HTTPUtilities
408425
/**
409426
* Calls sendForward with the *current* request and response.
410427
*
411-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
428+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
412429
*/
413430
void sendForward(String location) throws AccessControlException, ServletException, IOException;
414431

@@ -431,7 +448,7 @@ public interface HTTPUtilities
431448
/**
432449
* Calls sendRedirect with the *current* response.
433450
*
434-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
451+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
435452
*/
436453
void sendRedirect(String location) throws AccessControlException, IOException;
437454

@@ -452,7 +469,7 @@ public interface HTTPUtilities
452469
/**
453470
* Calls setContentType with the *current* request and response.
454471
*
455-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
472+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
456473
*/
457474
void setContentType();
458475

@@ -486,7 +503,7 @@ public interface HTTPUtilities
486503
/**
487504
* Calls setHeader with the *current* response.
488505
*
489-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
506+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
490507
*/
491508
void setHeader(String name, String value);
492509

@@ -506,7 +523,7 @@ public interface HTTPUtilities
506523
/**
507524
* Calls setNoCacheHeaders with the *current* response.
508525
*
509-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
526+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
510527
*/
511528
void setNoCacheHeaders();
512529

@@ -547,7 +564,7 @@ public interface HTTPUtilities
547564
* ~DEPRECATED~ Per Kevin Wall, storing passwords with reversible encryption is contrary to *many*
548565
* company's stated security policies.
549566
*
550-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
567+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
551568
*/
552569
@Deprecated
553570
String setRememberToken(String password, int maxAge, String domain, String path);
@@ -591,7 +608,7 @@ public interface HTTPUtilities
591608
/**
592609
* Calls verifyCSRFToken with the *current* request.
593610
*
594-
* @see {@link HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)}
611+
* @see HTTPUtilities#setCurrentHTTP(HttpServletRequest, HttpServletResponse)
595612
*/
596613
void verifyCSRFToken();
597614

@@ -611,17 +628,14 @@ public interface HTTPUtilities
611628
*
612629
* @param key
613630
* The key that references the session attribute
614-
* @param <T>
615-
* The implied type of object expected.
616-
* @return
617-
* The requested object.
618-
* @see #getSessionAttribute(javax.servlet.http.HttpSession, String)
631+
* @return The requested object.
632+
* @see HTTPUtilities#getSessionAttribute(javax.servlet.http.HttpSession, String)
619633
*/
620634
<T> T getSessionAttribute( String key );
621635

622636
/**
623637
* Gets a typed attribute from the passed in session. This method has the same
624-
* responsibility as {link #getSessionAttribute(String} however only it references
638+
* responsibility as {link #getSessionAttribute(String} however it only references
625639
* the passed in session and thus performs slightly better since it does not need
626640
* to return to the Thread to get the {@link HttpSession} associated with the current
627641
* thread.
@@ -630,8 +644,6 @@ public interface HTTPUtilities
630644
* The session to retrieve the attribute from
631645
* @param key
632646
* The key that references the requested object
633-
* @param <T>
634-
* The implied type of object expected
635647
* @return The requested object
636648
*/
637649
<T> T getSessionAttribute( HttpSession session, String key );
@@ -642,7 +654,6 @@ public interface HTTPUtilities
642654
* type, a ClassCastException will be thrown back to the caller.
643655
*
644656
* @param key The key that references the request attribute.
645-
* @param <T> The implied type of the object expected
646657
* @return The requested object
647658
*/
648659
<T> T getRequestAttribute( String key );
@@ -654,7 +665,6 @@ public interface HTTPUtilities
654665
*
655666
* @param request The request to retrieve the attribute from
656667
* @param key The key that references the request attribute.
657-
* @param <T> The implied type of the object expected
658668
* @return The requested object
659669
*/
660670
<T> T getRequestAttribute( HttpServletRequest request, String key );

src/main/java/org/owasp/esapi/User.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ public interface User extends Principal, Serializable {
203203
void removeSession( HttpSession s );
204204

205205
/**
206-
* Returns the list of sessions associated with this User.
207-
* @return
206+
* Returns a Set containing the sessions associated with this User.
207+
* @return The Set of sessions for this User.
208208
*/
209209
Set getSessions();
210210

src/main/java/org/owasp/esapi/Validator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,21 +689,21 @@ public interface Validator {
689689
String safeReadLine(InputStream inputStream, int maxLength) throws ValidationException;
690690

691691
/**
692-
*
693692
* Parses and ensures that the URI in question is a valid RFC-3986 URI. This simplifies
694-
* the kind of regex required for subsequent validation to mitigate regex-based
695-
* DoS attacks.
693+
* the kind of regex required for subsequent validation to mitigate regex-based DoS attacks.
696694
*
697695
* @see <a href="https://www.ietf.org/rfc/rfc3986.txt">RFC-3986.</a>
698696
*
699697
* @param context
700-
* A descriptive name of the parameter that you are validating (e.g., LoginPage_UsernameField). This value is used by any logging or error handling that is done with respect to the value passed in.
698+
* A descriptive name of the parameter that you are validating (e.g., LoginPage_UsernameField). This value is used by any
699+
* logging or error handling that is done with respect to the value passed in.
701700
* @param input
702701
* redirect location to be returned as valid, according to encoding rules set in "ESAPI.properties"
703702
* @param allowNull
704-
* If allowNull is true then an input that is NULL or an empty string will be legal. If allowNull is false then NULL or an empty String will throw a ValidationException.
703+
* If allowNull is true then an input that is NULL or an empty string will be legal. If allowNull is false then NULL or an
704+
* empty String will throw a ValidationException.
705705
*
706-
* @return
706+
* @return True if the URI is valid
707707
* @throws ValidationException
708708
*/
709709
boolean isValidURI(String context, String input, boolean allowNull);

0 commit comments

Comments
 (0)