Fix and updated test for issue #241693.
authorNils Hoffmann <nhoffmann@netbeans.org>
Tue, 11 Feb 2014 13:50:38 +0100
changeset 181675b639acda36a
parent 18099 87119a9ef613
child 18168 1ff3fe3f312c
Fix and updated test for issue #241693.
licensechanger/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandler.java
licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandlerTest.java
licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/package-info_1.txt
licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/package-info_golden.txt
     1.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandler.java	Tue Jan 14 08:29:19 2014 +0100
     1.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandler.java	Tue Feb 11 13:50:38 2014 +0100
     1.3 @@ -100,7 +100,7 @@
     1.4  
     1.5          public boolean visitLine(String line) {
     1.6              String trimmed = line.trim();
     1.7 -            if (trimmed.startsWith("//") || trimmed.startsWith("/*") && trimmed.endsWith("*/")) {
     1.8 +            if (trimmed.startsWith("//") || trimmed.startsWith("/*") && !trimmed.startsWith("/**") && trimmed.endsWith("*/")) {
     1.9                  return visitCommentLine(line);
    1.10              } else if (trimmed.length() == 0) {
    1.11                  return visitEmptyLine(line);
    1.12 @@ -122,7 +122,7 @@
    1.13          }
    1.14  
    1.15          private boolean visitLineAndTestForComment(String line) {
    1.16 -            if (line.trim().startsWith("/*")) {
    1.17 +            if (line.trim().startsWith("/*") && !line.trim().startsWith("/**")) {
    1.18                  inComment = true;
    1.19                  delCount += line.length() + 1;
    1.20                  return true;
     2.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandlerTest.java	Tue Jan 14 08:29:19 2014 +0100
     2.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/JavaFileHandlerTest.java	Tue Feb 11 13:50:38 2014 +0100
     2.3 @@ -63,6 +63,7 @@
     2.4              String filename = "java_" + i + ".txt";
     2.5              testOneVersion(golden, license, filename);
     2.6          }
     2.7 +        testOneVersion(readFile(JavaFileHandlerTest.class, "package-info_golden.txt"), license, "package-info_1.txt");
     2.8      }
     2.9  
    2.10      private void testOneVersion(String golden, String license, String filename) throws Exception {
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/package-info_1.txt	Tue Feb 11 13:50:38 2014 +0100
     3.3 @@ -0,0 +1,42 @@
     3.4 +/* 
     3.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3.6 + *
     3.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
     3.8 + *
     3.9 + * The contents of this file are subject to the terms of either the GNU
    3.10 + * General Public License Version 2 only ("GPL") or the Common
    3.11 + * Development and Distribution License("CDDL") (collectively, the
    3.12 + * "License"). You may not use this file except in compliance with the
    3.13 + * License. You can obtain a copy of the License at
    3.14 + * http://www.netbeans.org/cddl-gplv2.html
    3.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    3.16 + * specific language governing permissions and limitations under the
    3.17 + * License.  When distributing the software, include this License Header
    3.18 + * Notice in each file and include the License file at
    3.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    3.20 + * particular file as subject to the "Classpath" exception as provided
    3.21 + * by Sun in the GPL Version 2 section of the License file that
    3.22 + * accompanied this code. If applicable, add the following below the
    3.23 + * License Header, with the fields enclosed by brackets [] replaced by
    3.24 + * your own identifying information:
    3.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    3.26 + *
    3.27 + * If you wish your version of this file to be governed by only the CDDL
    3.28 + * or only the GPL Version 2, indicate your decision by adding
    3.29 + * "[Contributor] elects to include this software in this distribution
    3.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    3.31 + * single choice of license, a recipient has the option to distribute
    3.32 + * your version of this file under either the CDDL, the GPL Version 2 or
    3.33 + * to extend the choice of license to its licensees as provided above.
    3.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    3.35 + * Version 2 license, then the option applies only if the new code is
    3.36 + * made subject to such option by the copyright holder.
    3.37 + *
    3.38 + * Contributor(s):
    3.39 + *
    3.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
    3.41 + */
    3.42 +/**
    3.43 + * A fancy description of the package.
    3.44 + */
    3.45 +package the.pkg;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fileHandlers/package-info_golden.txt	Tue Feb 11 13:50:38 2014 +0100
     4.3 @@ -0,0 +1,35 @@
     4.4 +/*
     4.5 + * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
     4.6 + * All rights reversed.
     4.7 + *
     4.8 + * Redistribution and use in source, binary or corpuscular forms, with or without
     4.9 + * modification, are prohibited under all circumstances unless the following
    4.10 + * conditions have been met:
    4.11 + *
    4.12 + *   1. You have an eyeball growing in the palm of your left hand
    4.13 + *
    4.14 + *   2. Seven dwarfs really like your golden hair
    4.15 + *
    4.16 + *   3. The moon has reversed its course a multiple of times divisible by
    4.17 + *      the eighteenth prime number in the last year
    4.18 + *
    4.19 + * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
    4.20 + * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
    4.21 + * DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
    4.22 + * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
    4.23 + * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
    4.24 + * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
    4.25 + * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
    4.26 + * BALL DROP, BECOMING A LAWYER.
    4.27 + *
    4.28 + * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
    4.29 + * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
    4.30 + * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
    4.31 + * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
    4.32 + *
    4.33 + * RUN, RUN NOW, AND RUN VERY FAST.
    4.34 + */
    4.35 +/**
    4.36 + * A fancy description of the package.
    4.37 + */
    4.38 +package the.pkg;