Return-Path: X-Original-To: apmail-creadur-commits-archive@www.apache.org Delivered-To: apmail-creadur-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2671610FFC for ; Sun, 8 Dec 2013 20:05:24 +0000 (UTC) Received: (qmail 49556 invoked by uid 500); 8 Dec 2013 20:05:21 -0000 Delivered-To: apmail-creadur-commits-archive@creadur.apache.org Received: (qmail 49532 invoked by uid 500); 8 Dec 2013 20:05:21 -0000 Mailing-List: contact commits-help@creadur.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@creadur.apache.org Delivered-To: mailing list commits@creadur.apache.org Received: (qmail 49525 invoked by uid 99); 8 Dec 2013 20:05:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 20:05:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 20:05:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6BBAA23888E2; Sun, 8 Dec 2013 20:04:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1549188 - /creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java Date: Sun, 08 Dec 2013 20:04:57 -0000 To: commits@creadur.apache.org From: rdonkin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131208200457.6BBAA23888E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rdonkin Date: Sun Dec 8 20:04:57 2013 New Revision: 1549188 URL: http://svn.apache.org/r1549188 Log: Format Code.Apply PMD change. Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java?rev=1549188&r1=1549187&r2=1549188&view=diff ============================================================================== --- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java (original) +++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java Sun Dec 8 20:04:57 2013 @@ -32,6 +32,8 @@ public class ApacheV2LicenceAppender ext /** The copyright. */ private String copyright; + private static final String EMPTY = ""; + /** * Create a licence appender with the standard ASF licence header. */ @@ -46,7 +48,7 @@ public class ApacheV2LicenceAppender ext * @param copyright * the copyright */ - public ApacheV2LicenceAppender(String copyright) { + public ApacheV2LicenceAppender(final String copyright) { super(); this.copyright = copyright; } @@ -59,72 +61,88 @@ public class ApacheV2LicenceAppender ext * .io.File) */ @Override - public String getLicenceHeader(File document) { + public String getLicenceHeader(final File document) { int type = getType(document); - StringBuilder sb = new StringBuilder(); + StringBuilder stringBuilder = new StringBuilder(); if (copyright == null) { - sb.append(getFirstLine(type)); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getFirstLine(type)); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder + .append(getLine(type, "Licensed to the Apache Software Foundation (ASF) under one")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "or more contributor license agreements. See the NOTICE file")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, "distributed with this work for additional information")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "regarding copyright ownership. The ASF licenses this file")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, "to you under the Apache License, Version 2.0 (the")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "\"License\"); you may not use this file except in compliance")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "with the License. You may obtain a copy of the License at")); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder.append(getLine(type, " http://www.apache.org/licenses/LICENSE-2.0")); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder + .append(getLine(type, "Unless required by applicable law or agreed to in writing,")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "software distributed under the License is distributed on an")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "KIND, either express or implied. See the License for the")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, "specific language governing permissions and limitations")); - sb.append(getLine(type, "under the License.")); - sb.append(getLine(type, "")); - sb.append(getLastLine(type)); + stringBuilder.append(getLine(type, "under the License.")); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder.append(getLastLine(type)); } else { - sb.append(getFirstLine(type)); - sb.append(getLine(type, "")); - sb.append(getLine(type, copyright)); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getFirstLine(type)); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder.append(getLine(type, copyright)); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder + .append(getLine(type, "Licensed under the Apache License, Version 2.0 (the \"License\");")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "you may not use this file except in compliance with the License.")); - sb.append(getLine(type, "You may obtain a copy of the License at")); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, + "You may obtain a copy of the License at")); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder.append(getLine(type, " http://www.apache.org/licenses/LICENSE-2.0")); - sb.append(getLine(type, "")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder + .append(getLine(type, "Unless required by applicable law or agreed to in writing,")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "software distributed under the License is distributed on an")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY")); - sb.append(getLine(type, + stringBuilder + .append(getLine(type, "KIND, either express or implied. See the License for the")); - sb.append(getLine(type, + stringBuilder.append(getLine(type, "specific language governing permissions and limitations")); - sb.append(getLine(type, "under the License.")); - sb.append(getLine(type, "")); - sb.append(getLastLine(type)); + stringBuilder.append(getLine(type, "under the License.")); + stringBuilder.append(getLine(type, EMPTY)); + stringBuilder.append(getLastLine(type)); } - return sb.toString(); + return stringBuilder.toString(); } }