Hi,All of my .java files have the Apache copyright as *the first lines* in the file.
I don't really understand why you would do anything except find out that there was no license and then insert the license at the top of the file (yes, even in front of the package statement).
Craig On Sep 2, 2008, at 3:52 AM, Ross Gardler wrote:
Gavin wrote: ...cd /project/to/test java -jar /path/to/rat-core/target/rat-core-0.6-SNAPSHOT.jar -a .That should all be rat-app , not app-core.The above does create filename.ext.new files but they are identical totheold ones....Strange, the contribution does have tests with it [2]. The tests are runon a "mvn install": Running org.apache.rat.annotation.TestLicenceAppenderTests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047sec Yep I get all tests pass also....Well, I now know what the problem is. In the AbstractLicenseAppender.java file you have if (type == TYPE_JAVA && line.startsWith("package ")) So, your looking to insert the License after the package line. Your also assuming that all java files have a package line :)Well it conforms to *my* coding standards ;-)However, there are use cases where this would fail for genuine reasons. For example some projects add version control keywords in the first line.So, what's the solution, 2 choices I see :-1. Do nothing (almost) - Document that a package line must exist and that the license will be appended after that line. Therefore you are activelyforcing this limitation as an intentional design feature.If this route is chosen then you should bail out without writing a .new file if there is no package line, perhaps with a WARNING message appended to the output. A .new file is currently written anyway because the file has alreadybeen opened and written ("\n") to before that 'package' check above.2. If no package line exists then put the license in anyway at the very top.Option 2 is certainly easier and would catch cases like CVS keywords. However, I'm guessing I put the check for a package name in for good reason. I can't think why at this moment, but if it wasn't just some random strangeness I probably put a test in place for it.Please raise an issue complete with your suggestions (even providing a patch if you feel the urge - start with option 2 and see what happens to the tests).Ross
Craig L Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
