Uploaded image for project: 'Apache Rat'
  1. Apache Rat
  2. RAT-148

LicenseAddingReport#report has useless call to metaData.getData

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.11
    • reports
    • None

    Description

      While perusing the current trunk code, I noticed that LicenseAddingReport.java#report has a useless call to metaData.getData:

      public class LicenseAddingReport extends AbstractReport {
          private final AbstractLicenceAppender appender;
      
          public LicenseAddingReport(String pCopyrightMsg, boolean pForced) {
              appender = pCopyrightMsg == null ? new ApacheV2LicenceAppender() : new ApacheV2LicenceAppender(pCopyrightMsg);
              appender.setForce(pForced);
          }
      
          @Override
          public void report(org.apache.rat.api.Document document) throws RatException {
              final MetaData metaData = document.getMetaData();
              final Datum licenseHeader = metaData.get(MetaData.RAT_URL_HEADER_CATEGORY);
              if (licenseHeader == null
                      ||  MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_UNKNOWN.getValue().equals(licenseHeader.getValue())) {
                  final File file = new File(document.getName());
                  if (file.isFile()) {
                      try {
                          appender.append(file);
                      } catch (IOException e) {
                          throw new RatException(e.getMessage(), e);
                      }
                  }
              }
              metaData.getData();
          }
      }
      

      Looks to me that metaData is a local final variable, and that the call to getData returns a MetaData object, which in turn is never used.

      Attachments

        1. RAT-148.Mattmann.082813.patch.txt
          0.4 kB
          Chris A. Mattmann

        Activity

          People

            pottlinger Philipp Ottlinger
            chrismattmann Chris A. Mattmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: