You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2019/05/30 19:51:00 UTC

[creadur-rat] branch RAT-244/migratedToJDK7 created (now 543b41b)

This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a change to branch RAT-244/migratedToJDK7
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git.


      at 543b41b  RAT-244: Apply JDK7 language changes

This branch includes the following new commits:

     new f3c4982  RAT-244: Try updating to JDK7 to fix CVE issue
     new 543b41b  RAT-244: Apply JDK7 language changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[creadur-rat] 01/02: RAT-244: Try updating to JDK7 to fix CVE issue

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a commit to branch RAT-244/migratedToJDK7
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git

commit f3c4982c72a207642534d14350cc3cdc7168a485
Author: Hugo Hirsch <gi...@hugo-hirsch.de>
AuthorDate: Thu May 30 21:48:05 2019 +0200

    RAT-244: Try updating to JDK7 to fix CVE issue
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index cf8a658..528aacc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@ agnostic home for software distribution comprehension and audit tools.
   <inceptionYear>2006</inceptionYear>
   <properties>
     <ant.version>1.9.14</ant.version>
-    <javaVersion>6</javaVersion>
+    <javaVersion>7</javaVersion>
     <maven.compiler.source>${javaVersion}</maven.compiler.source>
     <maven.compiler.target>${javaVersion}</maven.compiler.target>
     <!-- This is the version of Maven required to use the Rat Maven Plugin -->
@@ -119,7 +119,7 @@ agnostic home for software distribution comprehension and audit tools.
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-compress</artifactId>
         <!--  later versions require Java 1.6+ -->
-        <version>1.12</version>
+        <version>1.18</version>
       </dependency>
       <dependency>
         <groupId>junit</groupId>


[creadur-rat] 02/02: RAT-244: Apply JDK7 language changes

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a commit to branch RAT-244/migratedToJDK7
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git

commit 543b41b7de6d991abb99db1631b121d7b2e842e1
Author: Hugo Hirsch <gi...@hugo-hirsch.de>
AuthorDate: Thu May 30 21:50:28 2019 +0200

    RAT-244: Apply JDK7 language changes
---
 .../rat/annotation/AbstractLicenseAppender.java      |  2 +-
 .../main/java/org/apache/rat/api/ContentType.java    |  2 +-
 .../src/main/java/org/apache/rat/api/MetaData.java   |  2 +-
 .../org/apache/rat/config/ConfigurationUtil.java     |  2 +-
 .../rat/config/SourceCodeManagementSystems.java      |  4 ++--
 .../apache/rat/document/impl/DocumentImplUtils.java  |  2 --
 .../rat/document/impl/MonolithicFileDocument.java    |  3 ++-
 .../java/org/apache/rat/policy/DefaultPolicy.java    |  8 ++++----
 .../rat/report/claim/impl/ClaimAggregator.java       |  6 +++---
 .../org/apache/rat/report/xml/XmlReportFactory.java  |  2 +-
 .../rat/report/xml/writer/impl/base/XmlWriter.java   |  2 +-
 .../org/apache/rat/analysis/MockLicenseMatcher.java  |  2 +-
 .../rat/analysis/license/CDDL1LicenseTest.java       |  2 +-
 .../rat/analysis/license/GPL123LicenseTest.java      |  2 +-
 .../apache/rat/analysis/license/MITLicenseTest.java  |  2 +-
 .../apache/rat/document/MockDocumentAnalyser.java    |  2 +-
 .../org/apache/rat/report/xml/MockXmlWriter.java     |  2 +-
 .../org/apache/rat/report/xml/XmlReportTest.java     |  2 +-
 .../java/org/apache/rat/report/xml/XmlUtils.java     |  4 +---
 .../java/org/apache/rat/test/utils/Resources.java    |  5 +++--
 .../main/java/org/apache/rat/mp/AbstractRatMojo.java | 20 +++++++-------------
 .../main/java/org/apache/rat/mp/RatReportMojo.java   | 12 +++---------
 .../java/org/apache/rat/mp/util/ScmIgnoreParser.java |  4 ++--
 .../java/org/apache/rat/mp/RatCheckMojoTest.java     |  8 +++-----
 .../org/apache/rat/mp/util/ExclusionHelperTest.java  |  8 ++++----
 .../main/java/org/apache/rat/anttasks/Report.java    | 18 ++++++------------
 .../apache/rat/anttasks/SubstringLicenseMatcher.java |  2 +-
 .../java/org/apache/rat/anttasks/ReportTest.java     | 10 ++++------
 28 files changed, 58 insertions(+), 82 deletions(-)

diff --git a/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java b/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java
index 6f9ca40..17d6cd3 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java
@@ -115,7 +115,7 @@ public abstract class AbstractLicenseAppender {
             TYPE_VISUAL_STUDIO_SOLUTION,
     };
 
-    private static final Map<String, Integer> EXT2TYPE = new HashMap<String, Integer>();
+    private static final Map<String, Integer> EXT2TYPE = new HashMap<>();
 
     static {
         // these arrays are used in Arrays.binarySearch so they must
diff --git a/apache-rat-core/src/main/java/org/apache/rat/api/ContentType.java b/apache-rat-core/src/main/java/org/apache/rat/api/ContentType.java
index a609b93..84b4ee3 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/api/ContentType.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/api/ContentType.java
@@ -41,7 +41,7 @@ public class ContentType {
         super();
         this.mediaType = mediaType.toLowerCase(Locale.US);
         this.subType = subType.toLowerCase(Locale.US);
-        this.parameters = new HashMap<String, String>(parameters.size());
+        this.parameters = new HashMap<>(parameters.size());
         for (Map.Entry<String, String> entry : parameters.entrySet()) {
             this.parameters.put(entry.getKey().toLowerCase(Locale.US), entry.getValue());
         }
diff --git a/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java b/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
index d2bf87c..556912e 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
@@ -147,7 +147,7 @@ public class MetaData {
     
     public MetaData(final ContentType contentType) {
         this.contentType = contentType;
-        this.data = new ArrayList<Datum>(16);
+        this.data = new ArrayList<>(16);
     }
     
     /**
diff --git a/apache-rat-core/src/main/java/org/apache/rat/config/ConfigurationUtil.java b/apache-rat-core/src/main/java/org/apache/rat/config/ConfigurationUtil.java
index 482345e..e7e73fc 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/config/ConfigurationUtil.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/config/ConfigurationUtil.java
@@ -32,7 +32,7 @@ public class ConfigurationUtil {
      * @return extracted names of given license families.
      */
     public static final List<String> toNames(final ILicenseFamily[] approvedLicenses) {
-        List<String> names = new ArrayList<String>();
+        List<String> names = new ArrayList<>();
         if (approvedLicenses != null && approvedLicenses.length > 0) {
             for (ILicenseFamily approvedFamily : approvedLicenses) {
                 names.add(approvedFamily.getFamilyName());
diff --git a/apache-rat-core/src/main/java/org/apache/rat/config/SourceCodeManagementSystems.java b/apache-rat-core/src/main/java/org/apache/rat/config/SourceCodeManagementSystems.java
index 571e240..908ec82 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/config/SourceCodeManagementSystems.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/config/SourceCodeManagementSystems.java
@@ -63,7 +63,7 @@ public enum SourceCodeManagementSystems {
      * @return list of excludes if the current SCM is used.
      */
     public List<String> getExclusions() {
-        List<String> excludes = new ArrayList<String>(2);
+        List<String> excludes = new ArrayList<>(2);
 
         if (hasIgnoreFile()) {
             excludes.add("**/" + ignoreFile);
@@ -84,7 +84,7 @@ public enum SourceCodeManagementSystems {
      * @return the global list of exclusions usable for all known SCM.
      */
     public static List<String> getPluginExclusions() {
-        List<String> pluginExclusions = new ArrayList<String>();
+        List<String> pluginExclusions = new ArrayList<>();
 
         for (SourceCodeManagementSystems scm : values()) {
             pluginExclusions.addAll(scm.getExclusions());
diff --git a/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java b/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
index a7d2024..f72160f 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
@@ -39,8 +39,6 @@ public class DocumentImplUtils {
         try {
             zip.getNextEntry();
             return true;
-        } catch (ZipException e) {
-            return false;
         } catch (IOException e) {
             return false;
         } finally {
diff --git a/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java b/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
index 16e9e4e..f46005f 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
@@ -26,6 +26,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.rat.api.Document;
 
@@ -49,7 +50,7 @@ public class MonolithicFileDocument extends AbstractMonolithicDocument {
         }
         return new AbstractMonolithicDocument(url.toExternalForm()){
             public Reader reader() throws IOException {
-                return new InputStreamReader(inputStream(), UTF_8);
+                return new InputStreamReader(inputStream(), StandardCharsets.UTF_8);
            }
 
             public InputStream inputStream() throws IOException {
diff --git a/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java b/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
index 71bf11f..6cbf7a3 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
@@ -48,20 +48,20 @@ public class DefaultPolicy implements IDocumentAnalyser {
     }
 
     public DefaultPolicy(final List<String> approvedLicenseNames, boolean mergeWithDefault) {
-        this.approvedLicenseNames = new ArrayList<String>();
+        this.approvedLicenseNames = new ArrayList<>();
 
         if (approvedLicenseNames == null || approvedLicenseNames.isEmpty()) {
             // used in tests only, no additional licenses given but defaults requested
             if(mergeWithDefault) {
-                this.approvedLicenseNames = new ArrayList<String>(Defaults.DEFAULT_LICENSE_FAMILIES);
+                this.approvedLicenseNames = new ArrayList<>(Defaults.DEFAULT_LICENSE_FAMILIES);
             }
         } else {
             // avoid duplicate entries and merge with defaults if requested
-            Set<String> mergedLicenses = new HashSet<String>(approvedLicenseNames);
+            Set<String> mergedLicenses = new HashSet<>(approvedLicenseNames);
             if(mergeWithDefault) {
                 mergedLicenses.addAll(Defaults.DEFAULT_LICENSE_FAMILIES);
             }
-            this.approvedLicenseNames = new ArrayList<String>(mergedLicenses);
+            this.approvedLicenseNames = new ArrayList<>(mergedLicenses);
         }
         Collections.sort(this.approvedLicenseNames);
     }
diff --git a/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/ClaimAggregator.java b/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/ClaimAggregator.java
index a4f915d..cef4445 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/ClaimAggregator.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/ClaimAggregator.java
@@ -33,9 +33,9 @@ import java.util.Map;
  */
 public class ClaimAggregator extends AbstractClaimReporter {
     private final ClaimStatistic statistic;
-    private final Map<String, Integer> numsByLicenseFamilyName = new HashMap<String, Integer>();
-    private final Map<String, Integer> numsByLicenseFamilyCode = new HashMap<String, Integer>();
-    private final Map<String, Integer> numsByFileType = new HashMap<String, Integer>();
+    private final Map<String, Integer> numsByLicenseFamilyName = new HashMap<>();
+    private final Map<String, Integer> numsByLicenseFamilyCode = new HashMap<>();
+    private final Map<String, Integer> numsByFileType = new HashMap<>();
     private int numApproved, numUnApproved, numGenerated, numUnknown;
 
     public ClaimAggregator(ClaimStatistic pStatistic) {
diff --git a/apache-rat-core/src/main/java/org/apache/rat/report/xml/XmlReportFactory.java b/apache-rat-core/src/main/java/org/apache/rat/report/xml/XmlReportFactory.java
index 939b608..ae3c23b 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/report/xml/XmlReportFactory.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/report/xml/XmlReportFactory.java
@@ -41,7 +41,7 @@ import java.util.List;
 public class XmlReportFactory {
     public static final RatReport createStandardReport(IXmlWriter writer,
             final ClaimStatistic pStatistic, ReportConfiguration pConfiguration) {
-        final List<RatReport> reporters = new ArrayList<RatReport>();
+        final List<RatReport> reporters = new ArrayList<>();
         if (pStatistic != null) {
             reporters.add(new ClaimAggregator(pStatistic));
         }
diff --git a/apache-rat-core/src/main/java/org/apache/rat/report/xml/writer/impl/base/XmlWriter.java b/apache-rat-core/src/main/java/org/apache/rat/report/xml/writer/impl/base/XmlWriter.java
index 2542c1d..ea832fb 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/report/xml/writer/impl/base/XmlWriter.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/report/xml/writer/impl/base/XmlWriter.java
@@ -401,7 +401,7 @@ public final class XmlWriter implements IXmlWriter {
 
     private final Writer writer;
     private final ArrayStack elementNames;
-    private final Set<CharSequence> currentAttributes = new HashSet<CharSequence>();
+    private final Set<CharSequence> currentAttributes = new HashSet<>();
 
     boolean elementsWritten = false;
     boolean inElement = false;
diff --git a/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java b/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java
index 3c7ff13..75da1c6 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java
@@ -25,7 +25,7 @@ import java.util.List;
 
 public class MockLicenseMatcher implements IHeaderMatcher {
 
-    public final List<String> lines = new ArrayList<String>();
+    public final List<String> lines = new ArrayList<>();
     public int resets = 0;
     public boolean result = true;
 
diff --git a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
index 813e5e5..3afe377 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
@@ -53,7 +53,7 @@ public class CDDL1LicenseTest {
 
     @BeforeClass
     public static void initLicensesUnderTest() {
-        licenseStringMap = new HashMap<IHeaderMatcher, String>();
+        licenseStringMap = new HashMap<>();
         licenseStringMap.put(new CDDL1License(), LICENSE_LINE);
         assertEquals(1, licenseStringMap.entrySet().size());
     }
diff --git a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java
index 127d75a..9c4fd80 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java
@@ -49,7 +49,7 @@ public class GPL123LicenseTest {
      */
     @Before
     public void initLicensesUnderTest() {
-        licenseStringMap = new HashMap<IHeaderMatcher, String>();
+        licenseStringMap = new HashMap<>();
         licenseStringMap.put(new GPL1License(), GPL1License.FIRST_LICENSE_LINE);
         licenseStringMap.put(new GPL2License(), GPL2License.FIRST_LICENSE_LINE);
         licenseStringMap.put(new GPL3License(), GPL3License.FIRST_LICENSE_LINE);
diff --git a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java
index 8cb1f84..9635aa6 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java
@@ -44,7 +44,7 @@ public class MITLicenseTest {
      */
     @Before
     public void initLicensesUnderTest() {
-        licenseStringMap = new HashMap<IHeaderMatcher, String>();
+        licenseStringMap = new HashMap<>();
         licenseStringMap.put(new MITLicense(),
                 MITLicense.FIRST_LICENSE_LINE
                         + "\n" + MITLicense.MIDDLE_LICENSE_LINE
diff --git a/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java b/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java
index 4348f55..65a3d44 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java
@@ -25,7 +25,7 @@ import java.util.List;
 
 public class MockDocumentAnalyser implements IDocumentAnalyser {
 
-    public final List<Document> matches = new ArrayList<Document>();
+    public final List<Document> matches = new ArrayList<>();
     
     public void analyse(Document document) throws RatDocumentAnalysisException {
         matches.add(document);
diff --git a/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java b/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
index 4ad95ad..ceaf2d0 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
@@ -26,7 +26,7 @@ import java.util.List;
 
 public class MockXmlWriter implements IXmlWriter {
 
-    public final List<Object> calls = new ArrayList<Object>();
+    public final List<Object> calls = new ArrayList<>();
     
     public IXmlWriter attribute(CharSequence name, CharSequence value)
             throws IOException {
diff --git a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
index 7b97443..3d6f597 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
@@ -65,7 +65,7 @@ public class XmlReportTest {
             }            
         };
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcher);
-        final List<AbstractReport> reporters = new ArrayList<AbstractReport>();
+        final List<AbstractReport> reporters = new ArrayList<>();
         reporters.add(reporter);
         report = new ClaimReporterMultiplexer(analyser, reporters); 
     }
diff --git a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java
index 3d1ffba..098e201 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java
@@ -59,9 +59,7 @@ public final class XmlUtils {
         } catch (SAXException e) {
             e.printStackTrace();
             return false;
-        } catch (IOException e) {
-            throw new UndeclaredThrowableException(e);
-        } catch (ParserConfigurationException e) {
+        } catch (IOException | ParserConfigurationException e) {
             throw new UndeclaredThrowableException(e);
         }
     }
diff --git a/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java b/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
index 08eb518..f960884 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.charset.StandardCharsets;
 
 
 /**
@@ -101,7 +102,7 @@ public class Resources {
      * Locates a resource file in the class path and returns a {@link Reader}.
      */
     public static Reader getResourceReader(String pResource) throws IOException {
-        return new InputStreamReader(getResourceStream(pResource), "UTF-8");
+        return new InputStreamReader(getResourceStream(pResource), StandardCharsets.UTF_8);
     }
 
     /**
@@ -115,7 +116,7 @@ public class Resources {
      * Locates a resource file in the class path and returns a {@link BufferedReader}.
      */
     public static BufferedReader getBufferedReader(File file) throws IOException {
-        return new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
+        return new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
     }
 
     /**
diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
index ef75ba9..5e143be 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
@@ -253,7 +253,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
      */
     private List<IHeaderMatcher> mergeLicenseMatchers()
             throws MojoFailureException, MojoExecutionException {
-        List<IHeaderMatcher> matchers = new ArrayList<IHeaderMatcher>();
+        List<IHeaderMatcher> matchers = new ArrayList<>();
 
         if (licenses != null) {
             matchers.addAll(Arrays.asList(licenses));
@@ -339,7 +339,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
 
     private void setIncludes(DirectoryScanner ds) throws MojoExecutionException {
         if ((includes != null  &&  includes.length > 0)  ||  includesFile != null) {
-        	final List<String> includeList = new ArrayList<String>();
+        	final List<String> includeList = new ArrayList<>();
         	if (includes != null) {
         		includeList.addAll(Arrays.asList(includes));
         	}
@@ -363,7 +363,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
     	Reader r = null;
     	BufferedReader br = null;
     	Throwable th = null;
-    	final List<String> patterns = new ArrayList<String>();
+    	final List<String> patterns = new ArrayList<>();
     	try {
     		is = new FileInputStream(pFile);
     		bis = new BufferedInputStream(is);
@@ -421,7 +421,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
     }
 
     private List<String> mergeDefaultExclusions() throws MojoExecutionException {
-        final Set<String> results = new HashSet<String>();
+        final Set<String> results = new HashSet<>();
 
         addPlexusAndScmDefaults(getLog(), useDefaultExcludes, results);
         addMavenDefaults(getLog(), useMavenDefaultExcludes, results);
@@ -466,7 +466,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
         	results.addAll(getPatternsFromFile(f, charset));
         }
 
-        return new ArrayList<String>(results);
+        return new ArrayList<>(results);
     }
 
     /**
@@ -516,13 +516,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
             } else {
                 return Report.report(getResources(), out, configuration);
             }
-        } catch (final TransformerConfigurationException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
-        } catch (final IOException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
-        } catch (final InterruptedException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
-        } catch (final RatException e) {
+        } catch (final TransformerConfigurationException | RatException | InterruptedException | IOException e) {
             throw new MojoExecutionException(e.getMessage(), e);
         }
     }
@@ -539,7 +533,7 @@ public abstract class AbstractRatMojo extends AbstractMojo {
 
     private List<ILicenseFamily> mergeApprovedLicenseNames()
             throws MojoExecutionException, MojoFailureException {
-        final List<ILicenseFamily> list = new ArrayList<ILicenseFamily>();
+        final List<ILicenseFamily> list = new ArrayList<>();
         if (licenseFamilies != null) {
             getLog().info("Added " + licenseFamilies.length + " custom approved licenses.");
             list.addAll(Arrays.asList(licenseFamilies));
diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
index fbbbfdb..396009d 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
@@ -128,7 +128,7 @@ public class RatReportMojo extends AbstractRatMojo implements MavenReport {
 
         final DecorationModel model = new DecorationModel();
         model.setBody(new Body());
-        final Map<String, String> attributes = new HashMap<String, String>();
+        final Map<String, String> attributes = new HashMap<>();
         attributes.put("outputEncoding", "UTF-8");
         final Locale locale = Locale.getDefault();
         try {
@@ -151,11 +151,7 @@ public class RatReportMojo extends AbstractRatMojo implements MavenReport {
 
             siteRenderer.copyResources(siteContext, new File(getProject().getBasedir(), "src/site/resources"),
                     outputDirectory);
-        } catch (IOException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
-        } catch (MavenReportException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
-        } catch (RendererException e) {
+        } catch (IOException | RendererException | MavenReportException e) {
             throw new MojoExecutionException(e.getMessage(), e);
         }
     }
@@ -223,9 +219,7 @@ public class RatReportMojo extends AbstractRatMojo implements MavenReport {
         sink.verbatim(true);
         try {
             sink.text(createReport(Defaults.getDefaultStyleSheet()));
-        } catch (MojoExecutionException e) {
-            throw new MavenReportException(e.getMessage(), e);
-        } catch (MojoFailureException e) {
+        } catch (MojoExecutionException | MojoFailureException e) {
             throw new MavenReportException(e.getMessage(), e);
         }
         sink.verbatim_();
diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/util/ScmIgnoreParser.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/util/ScmIgnoreParser.java
index e21ee0f..97b81c1 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/util/ScmIgnoreParser.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/util/ScmIgnoreParser.java
@@ -52,7 +52,7 @@ public final class ScmIgnoreParser {
      */
     public static List<String> getExcludesFromFile(final Log log, final File scmIgnore) {
 
-        final List<String> exclusionLines = new ArrayList<String>();
+        final List<String> exclusionLines = new ArrayList<>();
 
         if (scmIgnore != null && scmIgnore.exists() && scmIgnore.isFile()) {
             log.info("Parsing exclusions from " + scmIgnore);
@@ -84,7 +84,7 @@ public final class ScmIgnoreParser {
      * @return Exclusions from the SCM ignore files.
      */
     public static List<String> getExclusionsFromSCM(final Log log, final File baseDir) {
-        List<String> exclusions = new ArrayList<String>();
+        List<String> exclusions = new ArrayList<>();
         for (SourceCodeManagementSystems scm : SourceCodeManagementSystems.values()) {
             if (scm.hasIgnoreFile()) {
                 exclusions.addAll(getExcludesFromFile(log, new File(baseDir, scm.getIgnoreFile())));
diff --git a/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java b/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
index 49fcb69..9e785dc 100644
--- a/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
+++ b/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
@@ -30,6 +30,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.lang.reflect.Field;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import static junit.framework.TestCase.assertTrue;
@@ -172,7 +173,7 @@ public class RatCheckMojoTest extends AbstractMojoTestCase {
         BufferedReader breader = null;
         try {
             fis = new FileInputStream(pFile);
-            reader = new InputStreamReader(fis, "UTF8");
+            reader = new InputStreamReader(fis, StandardCharsets.UTF_8);
             breader = new BufferedReader(reader);
             final String result = breader.readLine();
             breader.close();
@@ -236,8 +237,7 @@ public class RatCheckMojoTest extends AbstractMojoTestCase {
         }
         assertTrue(ratTxtFile.exists());
         DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        FileInputStream fis = new FileInputStream(ratTxtFile);
-        try {
+        try (FileInputStream fis = new FileInputStream(ratTxtFile)) {
             Document doc = db.parse(fis);
             NodeList headerSample = doc.getElementsByTagName("header-sample");
             String textContent = headerSample.item(0).getTextContent();
@@ -248,8 +248,6 @@ public class RatCheckMojoTest extends AbstractMojoTestCase {
             assertTrue("Report should contain test umlauts, got '" + textContent + "'", byteSequencePresent);
         } catch (Exception ex) {
             fail("Report file could not be parsed as XML: " + ex.getMessage());
-        } finally {
-            fis.close();
         }
     }
 
diff --git a/apache-rat-plugin/src/test/java/org/apache/rat/mp/util/ExclusionHelperTest.java b/apache-rat-plugin/src/test/java/org/apache/rat/mp/util/ExclusionHelperTest.java
index db801b6..2d6f965 100644
--- a/apache-rat-plugin/src/test/java/org/apache/rat/mp/util/ExclusionHelperTest.java
+++ b/apache-rat-plugin/src/test/java/org/apache/rat/mp/util/ExclusionHelperTest.java
@@ -55,7 +55,7 @@ public class ExclusionHelperTest {
 
     @Test
     public void testAddingEclipseExclusions() {
-        final Set<String> exclusion = new HashSet<String>();
+        final Set<String> exclusion = new HashSet<>();
         addEclipseDefaults(log, false, exclusion);
         assertTrue(exclusion.isEmpty());
         addEclipseDefaults(log, true, exclusion);
@@ -66,7 +66,7 @@ public class ExclusionHelperTest {
 
     @Test
     public void testAddingIdeaExclusions() {
-        final Set<String> exclusion = new HashSet<String>();
+        final Set<String> exclusion = new HashSet<>();
         addIdeaDefaults(log, false, exclusion);
         assertTrue(exclusion.isEmpty());
         addIdeaDefaults(log, true, exclusion);
@@ -77,7 +77,7 @@ public class ExclusionHelperTest {
 
     @Test
     public void testAddingMavenExclusions() {
-        final Set<String> exclusion = new HashSet<String>();
+        final Set<String> exclusion = new HashSet<>();
         addMavenDefaults(log, false, exclusion);
         assertTrue(exclusion.isEmpty());
         addMavenDefaults(log, true, exclusion);
@@ -90,7 +90,7 @@ public class ExclusionHelperTest {
     public void testAddingPlexusAndScmExclusion() {
         final int expectedSizeMergedFromPlexusDefaultsAndScm = (38 + SourceCodeManagementSystems.getPluginExclusions().size());
 
-        final Set<String> exclusion = new HashSet<String>();
+        final Set<String> exclusion = new HashSet<>();
         addPlexusAndScmDefaults(log, false, exclusion);
         assertTrue(exclusion.isEmpty());
         addPlexusAndScmDefaults(log, true, exclusion);
diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java
index 0776daa..78b27f9 100644
--- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java
+++ b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java
@@ -72,9 +72,9 @@ public class Report extends Task {
     /**
      * The licenses we want to match on.
      */
-    private final ArrayList<IHeaderMatcher> licenseMatchers = new ArrayList<IHeaderMatcher>();
+    private final ArrayList<IHeaderMatcher> licenseMatchers = new ArrayList<>();
 
-    private final ArrayList<ILicenseFamily> licenseNames = new ArrayList<ILicenseFamily>();
+    private final ArrayList<ILicenseFamily> licenseNames = new ArrayList<>();
 
     /**
      * Whether to add the default list of license matchers.
@@ -199,14 +199,8 @@ public class Report extends Task {
             }
             createReport(out);
             out.flush();
-        } catch (IOException ioex) {
+        } catch (IOException | RatException | InterruptedException | TransformerException ioex) {
             throw new BuildException(ioex);
-        } catch (TransformerException e) {
-            throw new BuildException(e);
-        } catch (InterruptedException e) {
-            throw new BuildException(e);
-        } catch (RatException e) {
-            throw new BuildException(e);
         } finally {
             IOUtils.closeQuietly(out);
         }
@@ -292,13 +286,13 @@ public class Report extends Task {
      * required) into a single array.
      */
     private List<IHeaderMatcher> getLicenseMatchers() {
-        List<IHeaderMatcher> matchers = new ArrayList<IHeaderMatcher>(
-        (addDefaultLicenseMatchers ? Defaults.DEFAULT_MATCHERS.size() : 0) + licenseMatchers.size());
+        List<IHeaderMatcher> matchers = new ArrayList<>(
+                (addDefaultLicenseMatchers ? Defaults.DEFAULT_MATCHERS.size() : 0) + licenseMatchers.size());
         if (addDefaultLicenseMatchers) {
             matchers.addAll(Defaults.DEFAULT_MATCHERS);
             matchers.addAll(licenseMatchers);
         } else {
-            matchers = new ArrayList<IHeaderMatcher>(licenseMatchers);
+            matchers = new ArrayList<>(licenseMatchers);
         }
         return matchers;
     }
diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/SubstringLicenseMatcher.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/SubstringLicenseMatcher.java
index 0d01334..a241732 100644
--- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/SubstringLicenseMatcher.java
+++ b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/SubstringLicenseMatcher.java
@@ -30,7 +30,7 @@ import org.apache.tools.ant.BuildException;
  * @since Rat Antlib 0.8
  */
 public class SubstringLicenseMatcher extends SimplePatternBasedLicense {
-    private final List<String> patterns = new ArrayList<String>();
+    private final List<String> patterns = new ArrayList<>();
     private boolean validated = false;
 
     public void addConfiguredPattern(Pattern p) {
diff --git a/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java b/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
index 0690574..a943ec3 100644
--- a/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
+++ b/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.lang.reflect.Field;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import org.apache.rat.document.impl.guesser.BinaryGuesser;
@@ -105,7 +106,7 @@ public class ReportTest extends AbstractRatAntTaskTest {
         BufferedReader breader = null;
         try {
             fis = new FileInputStream(pFile);
-            reader = new InputStreamReader(fis, "UTF8");
+            reader = new InputStreamReader(fis, StandardCharsets.UTF_8);
             breader = new BufferedReader(reader);
             final String result = breader.readLine();
             breader.close();
@@ -151,9 +152,8 @@ public class ReportTest extends AbstractRatAntTaskTest {
         buildRule.executeTarget("testISO88591WithReportFile");
         overrideFileEncoding(origEncoding);
         DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        FileInputStream fis = new FileInputStream(selftestOutput);
-        boolean documentParsed = false;
-        try {
+        try (FileInputStream fis = new FileInputStream(selftestOutput)) {
+            boolean documentParsed = false;
             Document doc = db.parse(fis);
             boolean byteSequencePresent = doc.getElementsByTagName("header-sample")
                     .item(0)
@@ -163,8 +163,6 @@ public class ReportTest extends AbstractRatAntTaskTest {
             documentParsed = true;
         } catch (Exception ex) {
             documentParsed = false;
-        } finally {
-            fis.close();
         }
         assertTrue("Report file could not be parsed as XML", documentParsed);
     }