Skip to content

Commit 930fcf3

Browse files
committed
More improvements/upgrades to pom.xml. Start at elimination of
PMD findings. Many more still to go.
1 parent a252d00 commit 930fcf3

15 files changed

+203
-168
lines changed

pom.xml

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,11 @@
306306
<artifactId>powermock-api-mockito2</artifactId>
307307
<version>2.0.0</version>
308308
<scope>test</scope>
309+
<!-- The following exclusions and import of mockito-core 2.27.0 (or 2.23.0) result in 100% convergence in the test dependencies,
310+
but introduce a test dependency that requires Java 8. As such, we are commenting this out for now. -->
311+
<!-- TODO: There are still 7 errors when running the test cases with Java 7, caused by something else that requires Java 8. Figure out what. -->
309312
<!-- These exclusions required to avoid convergence issues with import of mockito-core -->
310-
<exclusions>
313+
<!-- exclusions>
311314
<exclusion>
312315
<groupId>org.mockito</groupId>
313316
<artifactId>mockito-core</artifactId>
@@ -322,8 +325,8 @@
322325
</exclusion>
323326
</exclusions>
324327
</dependency>
325-
<!-- The following imported solely so we can exclude its dependency on: org.objenesis:objenesis, which conflicts with
326-
another import by a dependency of powermock-api-mockito2. -->
328+
<- The following imported solely so we can exclude its dependency on: org.objenesis:objenesis, which conflicts with
329+
another import by a dependency of powermock-api-mockito2. ->
327330
<dependency>
328331
<groupId>org.mockito</groupId>
329332
<artifactId>mockito-core</artifactId>
@@ -334,7 +337,7 @@
334337
<groupId>org.objenesis</groupId>
335338
<artifactId>objenesis</artifactId>
336339
</exclusion>
337-
</exclusions>
340+
</exclusions -->
338341
</dependency>
339342
<dependency>
340343
<groupId>org.powermock</groupId>
@@ -352,6 +355,11 @@
352355
<artifactId>maven-dependency-plugin</artifactId>
353356
<version>3.1.1</version>
354357
</plugin>
358+
<plugin>
359+
<groupId>org.apache.maven.plugins</groupId>
360+
<artifactId>maven-release-plugin</artifactId>
361+
<version>2.5.3</version>
362+
</plugin>
355363
</plugins>
356364
</pluginManagement>
357365

@@ -385,6 +393,24 @@
385393
</configuration>
386394
</plugin>
387395

396+
<plugin>
397+
<groupId>net.sourceforge.maven-taglib</groupId>
398+
<artifactId>maven-taglib-plugin</artifactId>
399+
<version>2.4</version>
400+
</plugin>
401+
402+
<plugin>
403+
<groupId>org.apache.maven.plugins</groupId>
404+
<artifactId>maven-assembly-plugin</artifactId>
405+
<version>2.6</version>
406+
</plugin>
407+
408+
<plugin>
409+
<groupId>org.apache.maven.plugins</groupId>
410+
<artifactId>maven-changelog-plugin</artifactId>
411+
<version>2.3</version>
412+
</plugin>
413+
388414
<plugin>
389415
<groupId>org.apache.maven.plugins</groupId>
390416
<artifactId>maven-clean-plugin</artifactId>
@@ -495,7 +521,19 @@
495521
</execution>
496522
</executions>
497523
</plugin>
498-
524+
525+
<plugin>
526+
<groupId>org.apache.maven.plugins</groupId>
527+
<artifactId>maven-pmd-plugin</artifactId>
528+
<version>3.11.0</version>
529+
</plugin>
530+
531+
<plugin>
532+
<groupId>org.apache.maven.plugins</groupId>
533+
<artifactId>maven-project-info-reports-plugin</artifactId>
534+
<version>3.0.0</version>
535+
</plugin>
536+
499537
<plugin>
500538
<groupId>org.apache.maven.plugins</groupId>
501539
<artifactId>maven-resources-plugin</artifactId>
@@ -545,6 +583,18 @@
545583
</configuration>
546584
</plugin>
547585

586+
<plugin>
587+
<groupId>org.codehaus.mojo</groupId>
588+
<artifactId>jdepend-maven-plugin</artifactId>
589+
<version>2.0</version>
590+
</plugin>
591+
592+
<plugin>
593+
<groupId>org.codehaus.mojo</groupId>
594+
<artifactId>versions-maven-plugin</artifactId>
595+
<version>2.7</version>
596+
</plugin>
597+
548598
<plugin>
549599
<groupId>org.eluder.coveralls</groupId>
550600
<artifactId>coveralls-maven-plugin</artifactId>
@@ -579,12 +629,10 @@
579629
<plugin>
580630
<groupId>net.sourceforge.maven-taglib</groupId>
581631
<artifactId>maven-taglib-plugin</artifactId>
582-
<version>2.4</version>
583632
</plugin>
584633
<plugin>
585634
<groupId>org.apache.maven.plugins</groupId>
586635
<artifactId>maven-changelog-plugin</artifactId>
587-
<version>2.3</version>
588636
<configuration>
589637
<issueIDRegexPattern>[Ii]ssue[# ]*(\d)+</issueIDRegexPattern>
590638
<issueLinkUrl>https://github.com/ESAPI/esapi-java-legacy/issues/%ISSUE%</issueLinkUrl>
@@ -607,12 +655,26 @@
607655
<plugin>
608656
<groupId>org.apache.maven.plugins</groupId>
609657
<artifactId>maven-pmd-plugin</artifactId>
610-
<version>3.6</version>
611658
<configuration>
612659
<targetJdk>1.7</targetJdk>
613660
<sourceEncoding>utf-8</sourceEncoding>
661+
<!-- excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile -->
614662
</configuration>
615663
</plugin>
664+
<plugin>
665+
<groupId>org.apache.maven.plugins</groupId>
666+
<artifactId>maven-project-info-reports-plugin</artifactId>
667+
<reportSets>
668+
<reportSet>
669+
<reports>
670+
<report>dependency-convergence</report>
671+
</reports>
672+
</reportSet>
673+
</reportSets>
674+
<configuration>
675+
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
676+
</configuration>
677+
</plugin>
616678
<plugin>
617679
<groupId>org.apache.maven.plugins</groupId>
618680
<artifactId>maven-site-plugin</artifactId>
@@ -638,13 +700,11 @@
638700
<plugin>
639701
<groupId>org.codehaus.mojo</groupId>
640702
<artifactId>jdepend-maven-plugin</artifactId>
641-
<version>2.0</version>
642703
</plugin>
643704
<!-- Check for updates to dependencies and report on them. -->
644705
<plugin>
645706
<groupId>org.codehaus.mojo</groupId>
646707
<artifactId>versions-maven-plugin</artifactId>
647-
<version>2.7</version>
648708
<reportSets>
649709
<reportSet>
650710
<reports>
@@ -655,22 +715,7 @@
655715
</reportSet>
656716
</reportSets>
657717
</plugin>
658-
659-
<plugin>
660-
<groupId>org.apache.maven.plugins</groupId>
661-
<artifactId>maven-project-info-reports-plugin</artifactId>
662-
<version>3.0.0</version>
663-
<reportSets>
664-
<reportSet>
665-
<reports>
666-
<report>dependency-convergence</report>
667-
</reports>
668-
</reportSet>
669-
</reportSets>
670-
<configuration>
671-
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
672-
</configuration>
673-
</plugin>
718+
674719
</plugins>
675720
</reporting>
676721

@@ -761,6 +806,7 @@
761806

762807
<!-- Attached JavaDocs are required by Sonatype Nexus Repository -->
763808
<plugin>
809+
<groupId>org.apache.maven.plugins</groupId>
764810
<artifactId>maven-javadoc-plugin</artifactId>
765811
<configuration>
766812
<doclint>none</doclint>
@@ -779,7 +825,6 @@
779825
<plugin>
780826
<groupId>org.apache.maven.plugins</groupId>
781827
<artifactId>maven-assembly-plugin</artifactId>
782-
<version>2.6</version>
783828
<configuration>
784829
<descriptors>
785830
<descriptor>src/main/assembly/dist.xml</descriptor>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
public interface AccessControlRule<P, R> {
5-
public void setPolicyParameters(P policyParameter);
6-
public P getPolicyParameters();
7-
public boolean isAuthorized(R runtimeParameter) throws Exception;
5+
void setPolicyParameters(P policyParameter);
6+
P getPolicyParameters();
7+
boolean isAuthorized(R runtimeParameter) throws Exception;
88
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Enterprise Security API (ESAPI) project. For details, please see
66
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77
*
8-
* Copyright (c) 2007 - The OWASP Foundation
8+
* Copyright (c) 2007-2019 - The OWASP Foundation
99
*
1010
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111
* LICENSE before you use, modify, and/or redistribute this software.
@@ -17,8 +17,6 @@
1717

1818
import org.owasp.esapi.errors.AccessControlException;
1919

20-
21-
2220
/**
2321
* The AccessController interface defines a set of methods that can be used in a wide variety of applications to
2422
* enforce access control. In most applications, access control must be performed in multiple different locations across
@@ -95,7 +93,7 @@ public interface AccessController {
9593
* by <code>key</code> exists and returned <code>true</code>.
9694
* Otherwise returns <code>false</code>
9795
*/
98-
public boolean isAuthorized(Object key, Object runtimeParameter);
96+
boolean isAuthorized(Object key, Object runtimeParameter);
9997

10098
/**
10199
* <code>assertAuthorized</code> executes the <code>AccessControlRule</code>
@@ -121,7 +119,7 @@ public interface AccessController {
121119
* @param runtimeParameter runtimeParameter can contain anything that
122120
* the AccessControlRule needs from the runtime system.
123121
*/
124-
public void assertAuthorized(Object key, Object runtimeParameter)
122+
void assertAuthorized(Object key, Object runtimeParameter)
125123
throws AccessControlException;
126124

127125

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Enterprise Security API (ESAPI) project. For details, please see
66
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77
*
8-
* Copyright (c) 2007 - The OWASP Foundation
8+
* Copyright (c) 2007-2019 - The OWASP Foundation
99
*
1010
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111
* LICENSE before you use, modify, and/or redistribute this software.
@@ -456,6 +456,6 @@ public interface Encoder {
456456
*
457457
* @return The canonicalized URI
458458
*/
459-
public String getCanonicalizedURI(URI dirtyUri);
459+
String getCanonicalizedURI(URI dirtyUri);
460460

461461
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Enterprise Security API (ESAPI) project. For details, please see
66
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77
*
8-
* Copyright (c) 2007 - The OWASP Foundation
8+
* Copyright (c) 2007-2019 - The OWASP Foundation
99
*
1010
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111
* LICENSE before you use, modify, and/or redistribute this software.
@@ -81,7 +81,7 @@ public interface EncryptedProperties {
8181
* @return
8282
* a set view of the properties contained in this map.
8383
*/
84-
public Set<?> keySet();
84+
Set<?> keySet();
8585

8686
/**
8787
* Reads a property list (key and element pairs) from the input stream.
@@ -92,7 +92,7 @@ public interface EncryptedProperties {
9292
* @throws IOException
9393
* Signals that an I/O exception has occurred.
9494
*/
95-
public void load(InputStream in) throws IOException;
95+
void load(InputStream in) throws IOException;
9696

9797
/**
9898
* Writes this property list (key and element pairs) in this Properties table to
@@ -106,7 +106,7 @@ public interface EncryptedProperties {
106106
* @throws IOException
107107
* Signals that an I/O exception has occurred.
108108
*/
109-
public void store(OutputStream out, String comments) throws IOException;
109+
void store(OutputStream out, String comments) throws IOException;
110110

111111

112112
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Enterprise Security API (ESAPI) project. For details, please see
66
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77
*
8-
* Copyright &copy; 2007,2009 - The OWASP Foundation
8+
* Copyright &copy; 2007-2019 - The OWASP Foundation
99
*
1010
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111
* LICENSE before you use, modify, and/or redistribute this software.
@@ -245,7 +245,6 @@ CipherText encrypt(SecretKey key, PlainText plaintext)
245245
*
246246
* @return
247247
* true, if the signature is verified, false otherwise
248-
*
249248
*/
250249
boolean verifySignature(String signature, String data);
251250

@@ -259,8 +258,8 @@ CipherText encrypt(SecretKey key, PlainText plaintext)
259258
*
260259
* @return
261260
* the seal
262-
* @throws IntegrityException
263261
*
262+
* @throws IntegrityException
264263
*/
265264
String seal(String data, long timestamp) throws IntegrityException;
266265

@@ -303,8 +302,7 @@ CipherText encrypt(SecretKey key, PlainText plaintext)
303302
* @return
304303
* the absolute timestamp
305304
*/
306-
public long getRelativeTimeStamp( long offset );
307-
305+
long getRelativeTimeStamp( long offset );
308306

309307
/**
310308
* Gets a timestamp representing the current date and time to be used by

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Enterprise Security API (ESAPI) project. For details, please see
66
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77
*
8-
* Copyright (c) 2007 - The OWASP Foundation
8+
* Copyright (c) 2007-2019 - The OWASP Foundation
99
*
1010
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111
* LICENSE before you use, modify, and/or redistribute this software.
@@ -27,7 +27,6 @@
2727
import java.util.List;
2828
import java.util.Map;
2929

30-
3130
/**
3231
* The HTTPUtilities interface is a collection of methods that provide additional security related to HTTP requests,
3332
* responses, sessions, cookies, headers, and logging.
@@ -37,17 +36,16 @@
3736
*/
3837
public interface HTTPUtilities
3938
{
40-
41-
final static String REMEMBER_TOKEN_COOKIE_NAME = "rtoken";
42-
final static int MAX_COOKIE_LEN = 4096; // From RFC 2109
43-
final static int MAX_COOKIE_PAIRS = 20; // From RFC 2109
44-
final static String CSRF_TOKEN_NAME = "ctoken";
45-
final static String ESAPI_STATE = "estate";
46-
47-
final static int PARAMETER = 0;
48-
final static int HEADER = 1;
49-
final static int COOKIE = 2;
50-
39+
// All implied static final as this is an interface
40+
String REMEMBER_TOKEN_COOKIE_NAME = "rtoken";
41+
int MAX_COOKIE_LEN = 4096; // From RFC 2109
42+
int MAX_COOKIE_PAIRS = 20; // From RFC 2109
43+
String CSRF_TOKEN_NAME = "ctoken";
44+
String ESAPI_STATE = "estate";
45+
46+
int PARAMETER = 0;
47+
int HEADER = 1;
48+
int COOKIE = 2;
5149

5250
/**
5351
* Calls addCookie with the *current* request.

0 commit comments

Comments
 (0)