contentTypes) {
+ this.uploadContentTypes = contentTypes;
+ }
+
+
+
+
+ public String upload() throws Exception {
+
+ System.out.println("\n\n upload1");
+ System.out.println("files:");
+ for (File u: uploads) {
+ System.out.println("*** "+u+"\t"+u.length());
+ }
+ System.out.println("filenames:");
+ for (String n: uploadFileNames) {
+ System.out.println("*** "+n);
+ }
+ System.out.println("content types:");
+ for (String c: uploadContentTypes) {
+ System.out.println("*** "+c);
+ }
+ System.out.println("\n\n");
+ return SUCCESS;
+ }
+
+
+}
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java
index d35a4dc95..d90b67547 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java
index deded4659..5bb5c4142 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java
index bf3448e57..ab68d7e58 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java
index 95340b580..b477c5a5e 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java
index 21f3d8e7f..ea546c9c6 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction-conversion.properties b/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction-conversion.properties
index 9e29b2560..fbf3d7730 100644
--- a/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction-conversion.properties
+++ b/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction-conversion.properties
@@ -1 +1 @@
-Element_upload=java.io.File
+Element_upload=java.io.File
diff --git a/backport/readme.html b/backport/readme.html
index d4cafcf89..602e42122 100644
--- a/backport/readme.html
+++ b/backport/readme.html
@@ -1,549 +1,549 @@
-
-
-
- Retrotranslator
-
-
-
-
-
- Retrotranslator |
-
- |
-
-
-
-Contents
-
- - What is Retrotranslator?
- - What Java 5 features are supported?
- - How to use Retrotranslator from a command line?
- - How to use Retrotranslator from Apache Ant or Maven?
- - How to use Retrotranslator from IntelliJ IDEA?
- - How to use Just-in-Time Retrotranslator?
- - What Java 5 classes and methods are supported?
- - How to write an extension for Retrotranslator?
- - What are the limitations?
- - Alternative tools
- - Contact
- - License
-
-
-
-Retrotranslator is a Java bytecode transformer
-that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4.
-It is a free, open-source tool based on the ASM bytecode manipulation framework
-and concurrency utilities
-backported to Java 1.4.
-
-
-
- - Generics (generic types)
- - Annotations (metadata)
- - Reflection on generics and annotations
- - Typesafe enums (enumerated types)
- - Autoboxing/unboxing
- - Enhanced for loop (for-each loop)
- - Varargs (variable arguments)
- - Covariant return types
- - Static import
- - Concurrency utilities
- - Collections framework enhancements
-
-
-
-
- - Download
- and unzip the binary distribution file
Retrotranslator-n.n.n-bin.zip,
- where n.n.n is the latest Retrotranslator release number.
-
- -
- Compile your classes with JDK 5.0 and put them into some directory, e.g.
myclasses.
-
- -
- Go to the unzipped directory
Retrotranslator-n.n.n-bin and execute:
- java -jar retrotranslator-transformer-n.n.n.jar -srcdir myclasses
-
- -
- If you use Java 5 API put
retrotranslator-runtime-n.n.n.jar and
- backport-util-concurrent.jar into the classpath of your application.
-
- -
- Run or debug the application as usual on any JVM 1.4, preferably JRE 1.4.2.
-
-
-
-The full command line syntax:
- java -jar retrotranslator-transformer-n.n.n.jar <options>
-
or
- java -cp retrotranslator-transformer-n.n.n.jar net.sf.retrotranslator.transformer.Retrotranslator <options>
-
- | Option | Description | Default |
-
- -srcdir |
- Directory with classes compiled using JDK 5.0 (may be specified several times). |
- - |
-
-
- -srcjar |
- JAR file with classes compiled using JDK 5.0 (may be specified several times). |
- - |
-
-
- -destdir |
- Directory to place classes compatible with J2SE 1.4. |
- Location of sources |
-
-
- -destjar |
- JAR file to place classes compatible with J2SE 1.4. |
- Location of sources |
-
-
- -stripsign |
- Asks the translator to strip signature (generics) information. |
- Off |
-
-
- -verbose |
- Asks the translator for verbose output. |
- Off |
-
-
- -lazy |
- Asks the translator to transform only Java 5 classes. |
- Off |
-
-
- -advanced |
- Allows to override Java 1.4 methods for better Java 5 compatibility. |
- Off |
-
-
- -verify |
- Asks the translator for warnings when references to unknown classes, methods, or fields are found. |
- Off |
-
-
- -classpath |
- The classpath to use for verification including rt.jar, jce.jar,
- jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar,
- and backport-util-concurrent.jar. |
- Current classpath |
-
-
- -srcmask |
- Files to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld".
- Only three special characters are supported: "*?;". |
- *.class |
-
-
- -embed |
- Package name for a private copy of retrotranslator-runtime-n.n.n.jar and
- backport-util-concurrent.jar to be put into -destdir or -destjar.
- This makes your application independent of other versions of Retrotranslator present in the classpath.
- |
- - |
-
-
- -retainapi |
- Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
- References introduced by a compiler will also remain unchanged,
- like the use of java.lang.StringBuilder for string concatenation
- or the implicit valueOf method call for autoboxing. |
- Off |
-
-
-
- For example, if you have a Java 5 application myapplication5.jar you can use the following command
- to produce myapplication4.jar that will run on J2SE 1.4 and is independent of Retrotranslator,
- since required classes are added to the translated application with a different package name:
-
-
- java -jar retrotranslator-transformer-n.n.n.jar
- -srcjar myapplication5.jar -destjar myapplication4.jar -embed com.mycompany.internal
-
-
-
-
-The distribution contains an integrated Apache Ant task
- net.sf.retrotranslator.transformer.RetrotranslatorTask. It has the following syntax:
-
- | Attribute | Description | Default |
-
- srcdir |
- Directory with classes compiled using JDK 5.0. |
- - |
-
-
- srcjar |
- JAR file with classes compiled using JDK 5.0. |
- - |
-
-
- destdir |
- Directory to place classes compatible with J2SE 1.4. |
- Location of sources |
-
-
- destjar |
- JAR file to place classes compatible with J2SE 1.4. |
- Location of sources |
-
-
- stripsign |
- Asks the translator to strip signature (generics) information. |
- Off |
-
-
- verbose |
- Asks the translator for verbose output. |
- Off |
-
-
- lazy |
- Asks the translator to transform only Java 5 classes. |
- Off |
-
-
- advanced |
- Allows to override Java 1.4 methods for better Java 5 compatibility. |
- Off |
-
-
- verify |
- Asks the translator for warnings when references to unknown classes, methods, or fields are found. |
- Off |
-
-
- classpath |
- The classpath to use for verification including rt.jar, jce.jar,
- jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar,
- and backport-util-concurrent.jar.
- |
- Current classpath |
-
-
- srcmask |
- Files to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld".
- Only three special characters are supported: "*?;". |
- *.class |
-
-
- embed |
- Package name for a private copy of retrotranslator-runtime-n.n.n.jar and
- backport-util-concurrent.jar to be put into -destdir or -destjar.
- This makes your application independent of other versions of Retrotranslator present in the classpath.
- |
- - |
-
-
- retainapi |
- Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
- References introduced by a compiler will also remain unchanged,
- like the use of java.lang.StringBuilder for string concatenation
- or the implicit valueOf method call for autoboxing. |
- Off |
-
-
- failonwarning |
- Indicates whether the build will fail when there are verification warnings. |
- On |
-
-
-
- You may use nested src elements to specify source directories or JAR files, and nested
- classpath elements to specify classpath for verification. For example:
-
-
- <path id="classpath">
- <fileset dir="lib" includes="**/*.jar"/>
- </path>
- <taskdef name="retrotranslator" classpathref="classpath"
- classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
- <retrotranslator destdir="build/classes14" verify="true">
- <src path="build/classes15"/>
- <classpath location="${java14_home}/jre/lib/rt.jar"/>
- <classpath refid="classpath"/>
- </retrotranslator>
-
-
- For Maven there is a
- Retrotranslator plugin
- from the Mojo Project.
-
-
-
- To automatically translate and verify classes compiled by IntelliJ IDEA
- you may download a plugin
- that generates classes compatible with 1.4 virtual machines from your Java 5 source code.
-
-
-
-
-
- JIT Retrotranslator is able to translate at runtime Java classes loaded with any classloader.
- It works on J2SE 1.4 from Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0 and other platforms.
- However translation at runtime consumes additional memory and processing resources and it will not
- work if your classes make use of Java 5 API but were compiled with "-target 1.4".
-
-
- -
- If you want to run a JAR file with the JIT, execute:
- java -cp retrotranslator-transformer-n.n.n.jar
- net.sf.retrotranslator.transformer.JITRetrotranslator -jar <jarfile> [<args...>]
-
- -
- When the first option does not work or if you just want to run a class from your classpath, execute:
- java -cp retrotranslator-transformer-n.n.n.jar:<classpath>
- net.sf.retrotranslator.transformer.JITRetrotranslator <class> [<args...>]
-
- -
- Alternatively you may simply call
JITRetrotranslator.install() from some JVM 1.4 compatible class
- before Java 5 classes are loaded.
-
-
-
-
-
- | Package | Class | Methods and fields | Compatibility notes |
- java.lang.annotation | * (all classes) | * (all methods) | |
- java.util.concurrent, java.util.concurrent.atomic, java.util.concurrent.locks |
- almost all classes | almost all methods |
-
- Backport of JSR 166
- Condition.awaitNanos(long) method is supported but with
-
- very little accuracy guarantees.
- |
- java.io | Closeable | * |
- new Closeable[...] is replaced with new Object[...]
- |
- Flushable | * |
- new Flushable[...] is replaced with new Object[...]
- |
- PrintStream |
- append(CharSequence), append(CharSequence, int, int), append(char)
- | |
- PrintWriter |
- PrintWriter(File), PrintWriter(File, String), PrintWriter(String), PrintWriter(String, String)
- | |
- Reader | read(CharBuffer) | |
- Writer |
- append(CharSequence), append(CharSequence, int, int), append(char)
- | |
- java.lang | Appendable | *
- |
- new Appendable[...] is replaced with new Object[...]
- |
- Boolean | parseBoolean(String), compareTo(Boolean) | |
- Byte | valueOf(byte) | |
- Character | valueOf(char) | |
- Class | * (21 new methods) |
- Class.getMethod(String, Class...) and Class.getDeclaredMethod(String, Class...) are
- intercepted in advanced mode to better support generics and covariant return types on several JVM implementations.
- |
- Deprecated | * | |
- Double | valueOf(double) | |
- Enum | * | |
- Float | valueOf(float) | |
- IllegalArgumentException | IllegalArgumentException(String, Throwable),
- IllegalArgumentException(Throwable) | |
- IllegalStateException | IllegalStateException(String, Throwable),
- IllegalStateException(Throwable) | |
- Integer | valueOf(int) | |
- Iterable | * |
- new Iterable[...] is replaced with new Object[...]
- |
- Long | valueOf(long) | |
- Package | * (4 new methods) | |
- Readable | * |
- new Readable[...] is replaced with new Object[...]
- |
- Short | valueOf(short) | |
- String | contains(CharSequence), contentEquals(CharSequence),
- replace(CharSequence, CharSequence) | |
- StringBuffer |
- StringBuffer(CharSequence), append(CharSequence), append(CharSequence, int, int),
- insert(int, CharSequence), insert(int, CharSequence, int, int)
- | |
- StringBuilder |
- All methods supported in StringBuffer
- | StringBuilder is replaced with StringBuffer |
- SuppressWarnings | * | |
- System | nanoTime(), clearProperty(String) |
- Backport of JSR 166
- System.nanoTime() method precision
-
- may vary on different platforms.
- |
- Thread | getStackTrace(), getId()
- | Thread.getStackTrace() returns non-empty stack trace only for the current thread;
- Thread.getId() does not reflect the order in which threads are created. |
- TypeNotPresentException | * | |
-
- java.lang.reflect | AnnotatedElement | * |
- new AnnotatedElement[...] is replaced with new Object[...]
- |
- Constructor | * (11 new methods) | |
- Field | * (8 new methods) | |
- GenericArrayType | * | |
- GenericDeclaration | * |
- new GenericDeclaration[...] is replaced with new Object[...]
- |
- GenericSignatureFormatError | * | |
- MalformedParameterizedTypeException | * | |
- Method | * (14 new methods) | |
- ParameterizedType | * | |
- Type | * |
- new Type[...] is replaced with new Object[...]
- |
- TypeVariable | * | |
- WildcardType | * | |
-
- java.math | BigDecimal |
- BigDecimal(int), BigDecimal(long), ZERO, ONE, TEN, divideAndRemainder(BigDecimal),
- divideToIntegralValue(BigDecimal), pow(int), remainder(BigDecimal), toPlainString(), valueOf(double),
- valueOf(long) | BigDecimal.setScale(int, int) supports negative scales in advanced mode. |
-
- java.rmi.server | RemoteObjectInvocationHandler |
- * | |
-
- java.util.nio | CharBuffer |
- append(CharSequence), append(CharSequence, int, int), append(char), read(CharBuffer)
- | |
-
- java.util | AbstractQueue | * |
- |
- Arrays | * (21 new methods) | |
- Collections | * (13 new methods) |
- Backport of JSR 166
- |
- EnumMap | * | |
- EnumSet | * | |
- LinkedList | * (5 new methods) | |
- PriorityQueue | * | |
- Queue | * |
- new Queue[...] is replaced with new Object[...]
- |
- UUID | * | |
-
- java.util.regex | Matcher |
- quoteReplacement(String), toMatchResult() | |
- MatchResult | * |
- new MatchResult[...] is replaced with new Object[...]
- |
- Pattern | quote(String) | |
-
-
-
-
-
- Since most backported classes are discovered by Retrotranslator at translation time,
- you may write an extension and simply put it into the Retrotranslator classpath to make it work.
- For example, all references to
- java.util.EnumSet
- are replaced with references to
-
- net.sf.retrotranslator.runtime.java.util.EnumSet_ (trailing underscore) if the latter can be found.
- But if you replace a whole class that exists in J2SE 1.4 you may encounter interoperability issues with other libraries.
- So, for example, support for Java 5 fields, methods, and constructors of
- java.math.BigDecimal is placed into
-
-
- net.sf.retrotranslator.runtime.java.math._BigDecimal (leading underscore):
-
-
- - For a static field there is a public static field with the same name and type.
- - For a static method there is a public static method with the same signature.
- - For an instance method there is a public static method with the same signature
- but with an additional first parameter representing an instance.
- - For a constructor there is a public static
convertConstructorArguments method that
- accepts constructor's arguments an returns an argument for a Java 1.4 constuctor.
-
-
- However, if the backported methods require access
- to non-public methods or fields of the instance, they cannot be fully handled by Retrotranslator.
- While you can use reflection to access any data, translated code generally should not depend on security settings.
- For example, it is impossible to write an implementation for methods getSource()
- and setSource() of java.beans.PropertyEditorSupport that will work in any environment.
- Also this approach cannot be used to replace instance field references.
-
-
- If you have written an extension that does not contain copyrighted code, you may send
- a patch
- under the Retrotranslator license.
-
-
-
-
-
- Basically, only classes, methods, and fields listed above should work, and other features,
- like formatted input/output, are not supported. Known issues:
-
-
- - Reflection-based tools may be unable to discover additional classes and methods introduced in Java 5 when running on JRE 1.4.
- - Translated code running on JRE 5.0 may be incompatible with other Java 5 code when Java 5 API is used.
- - Reflection on generics and metadata may return incomplete information for dynamically generated classes.
- - Access modifiers and constants inlined by a compiler are ignored during the verification.
- - Upcasting may help to translate invocations of inherited methods introduced in Java 5:
- ((Writer) new FileWriter("file.tmp")).append("Hello").close();
- - Serialized objects produced by translated code may be incompatible with JRE 5.0.
-
-
-
-
- - Retroweaver
- - a Java bytecode weaver that enables you to take advantage
- of the new 1.5 language features in your source code,
- while still retaining compatibility with 1.4 virtual machines.
- - Declawer
- - a customized Java compiler which reduces 1.5 Generics to equivalent 1.4 syntax.
-
-
-
-
-
-
-
- Retrotranslator: a Java bytecode transformer that translates Java classes
- compiled with JDK 5.0 into classes that can be run on JVM 1.4.
-
- Copyright (c) 2005, 2006 Taras Puchko
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
-
-
+
+
+
+ Retrotranslator
+
+
+
+
+
+ Retrotranslator |
+
+ |
+
+
+
+Contents
+
+ - What is Retrotranslator?
+ - What Java 5 features are supported?
+ - How to use Retrotranslator from a command line?
+ - How to use Retrotranslator from Apache Ant or Maven?
+ - How to use Retrotranslator from IntelliJ IDEA?
+ - How to use Just-in-Time Retrotranslator?
+ - What Java 5 classes and methods are supported?
+ - How to write an extension for Retrotranslator?
+ - What are the limitations?
+ - Alternative tools
+ - Contact
+ - License
+
+
+
+Retrotranslator is a Java bytecode transformer
+that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4.
+It is a free, open-source tool based on the ASM bytecode manipulation framework
+and concurrency utilities
+backported to Java 1.4.
+
+
+
+ - Generics (generic types)
+ - Annotations (metadata)
+ - Reflection on generics and annotations
+ - Typesafe enums (enumerated types)
+ - Autoboxing/unboxing
+ - Enhanced for loop (for-each loop)
+ - Varargs (variable arguments)
+ - Covariant return types
+ - Static import
+ - Concurrency utilities
+ - Collections framework enhancements
+
+
+
+
+ - Download
+ and unzip the binary distribution file
Retrotranslator-n.n.n-bin.zip,
+ where n.n.n is the latest Retrotranslator release number.
+
+ -
+ Compile your classes with JDK 5.0 and put them into some directory, e.g.
myclasses.
+
+ -
+ Go to the unzipped directory
Retrotranslator-n.n.n-bin and execute:
+ java -jar retrotranslator-transformer-n.n.n.jar -srcdir myclasses
+
+ -
+ If you use Java 5 API put
retrotranslator-runtime-n.n.n.jar and
+ backport-util-concurrent.jar into the classpath of your application.
+
+ -
+ Run or debug the application as usual on any JVM 1.4, preferably JRE 1.4.2.
+
+
+
+The full command line syntax:
+ java -jar retrotranslator-transformer-n.n.n.jar <options>
+
or
+ java -cp retrotranslator-transformer-n.n.n.jar net.sf.retrotranslator.transformer.Retrotranslator <options>
+
+ | Option | Description | Default |
+
+ -srcdir |
+ Directory with classes compiled using JDK 5.0 (may be specified several times). |
+ - |
+
+
+ -srcjar |
+ JAR file with classes compiled using JDK 5.0 (may be specified several times). |
+ - |
+
+
+ -destdir |
+ Directory to place classes compatible with J2SE 1.4. |
+ Location of sources |
+
+
+ -destjar |
+ JAR file to place classes compatible with J2SE 1.4. |
+ Location of sources |
+
+
+ -stripsign |
+ Asks the translator to strip signature (generics) information. |
+ Off |
+
+
+ -verbose |
+ Asks the translator for verbose output. |
+ Off |
+
+
+ -lazy |
+ Asks the translator to transform only Java 5 classes. |
+ Off |
+
+
+ -advanced |
+ Allows to override Java 1.4 methods for better Java 5 compatibility. |
+ Off |
+
+
+ -verify |
+ Asks the translator for warnings when references to unknown classes, methods, or fields are found. |
+ Off |
+
+
+ -classpath |
+ The classpath to use for verification including rt.jar, jce.jar,
+ jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar,
+ and backport-util-concurrent.jar. |
+ Current classpath |
+
+
+ -srcmask |
+ Files to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld".
+ Only three special characters are supported: "*?;". |
+ *.class |
+
+
+ -embed |
+ Package name for a private copy of retrotranslator-runtime-n.n.n.jar and
+ backport-util-concurrent.jar to be put into -destdir or -destjar.
+ This makes your application independent of other versions of Retrotranslator present in the classpath.
+ |
+ - |
+
+
+ -retainapi |
+ Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
+ References introduced by a compiler will also remain unchanged,
+ like the use of java.lang.StringBuilder for string concatenation
+ or the implicit valueOf method call for autoboxing. |
+ Off |
+
+
+
+ For example, if you have a Java 5 application myapplication5.jar you can use the following command
+ to produce myapplication4.jar that will run on J2SE 1.4 and is independent of Retrotranslator,
+ since required classes are added to the translated application with a different package name:
+
+
+ java -jar retrotranslator-transformer-n.n.n.jar
+ -srcjar myapplication5.jar -destjar myapplication4.jar -embed com.mycompany.internal
+
+
+
+
+The distribution contains an integrated Apache Ant task
+ net.sf.retrotranslator.transformer.RetrotranslatorTask. It has the following syntax:
+
+ | Attribute | Description | Default |
+
+ srcdir |
+ Directory with classes compiled using JDK 5.0. |
+ - |
+
+
+ srcjar |
+ JAR file with classes compiled using JDK 5.0. |
+ - |
+
+
+ destdir |
+ Directory to place classes compatible with J2SE 1.4. |
+ Location of sources |
+
+
+ destjar |
+ JAR file to place classes compatible with J2SE 1.4. |
+ Location of sources |
+
+
+ stripsign |
+ Asks the translator to strip signature (generics) information. |
+ Off |
+
+
+ verbose |
+ Asks the translator for verbose output. |
+ Off |
+
+
+ lazy |
+ Asks the translator to transform only Java 5 classes. |
+ Off |
+
+
+ advanced |
+ Allows to override Java 1.4 methods for better Java 5 compatibility. |
+ Off |
+
+
+ verify |
+ Asks the translator for warnings when references to unknown classes, methods, or fields are found. |
+ Off |
+
+
+ classpath |
+ The classpath to use for verification including rt.jar, jce.jar,
+ jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar,
+ and backport-util-concurrent.jar.
+ |
+ Current classpath |
+
+
+ srcmask |
+ Files to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld".
+ Only three special characters are supported: "*?;". |
+ *.class |
+
+
+ embed |
+ Package name for a private copy of retrotranslator-runtime-n.n.n.jar and
+ backport-util-concurrent.jar to be put into -destdir or -destjar.
+ This makes your application independent of other versions of Retrotranslator present in the classpath.
+ |
+ - |
+
+
+ retainapi |
+ Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
+ References introduced by a compiler will also remain unchanged,
+ like the use of java.lang.StringBuilder for string concatenation
+ or the implicit valueOf method call for autoboxing. |
+ Off |
+
+
+ failonwarning |
+ Indicates whether the build will fail when there are verification warnings. |
+ On |
+
+
+
+ You may use nested src elements to specify source directories or JAR files, and nested
+ classpath elements to specify classpath for verification. For example:
+
+
+ <path id="classpath">
+ <fileset dir="lib" includes="**/*.jar"/>
+ </path>
+ <taskdef name="retrotranslator" classpathref="classpath"
+ classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
+ <retrotranslator destdir="build/classes14" verify="true">
+ <src path="build/classes15"/>
+ <classpath location="${java14_home}/jre/lib/rt.jar"/>
+ <classpath refid="classpath"/>
+ </retrotranslator>
+
+
+ For Maven there is a
+ Retrotranslator plugin
+ from the Mojo Project.
+
+
+
+ To automatically translate and verify classes compiled by IntelliJ IDEA
+ you may download a plugin
+ that generates classes compatible with 1.4 virtual machines from your Java 5 source code.
+
+
+
+
+
+ JIT Retrotranslator is able to translate at runtime Java classes loaded with any classloader.
+ It works on J2SE 1.4 from Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0 and other platforms.
+ However translation at runtime consumes additional memory and processing resources and it will not
+ work if your classes make use of Java 5 API but were compiled with "-target 1.4".
+
+
+ -
+ If you want to run a JAR file with the JIT, execute:
+ java -cp retrotranslator-transformer-n.n.n.jar
+ net.sf.retrotranslator.transformer.JITRetrotranslator -jar <jarfile> [<args...>]
+
+ -
+ When the first option does not work or if you just want to run a class from your classpath, execute:
+ java -cp retrotranslator-transformer-n.n.n.jar:<classpath>
+ net.sf.retrotranslator.transformer.JITRetrotranslator <class> [<args...>]
+
+ -
+ Alternatively you may simply call
JITRetrotranslator.install() from some JVM 1.4 compatible class
+ before Java 5 classes are loaded.
+
+
+
+
+
+ | Package | Class | Methods and fields | Compatibility notes |
+ java.lang.annotation | * (all classes) | * (all methods) | |
+ java.util.concurrent, java.util.concurrent.atomic, java.util.concurrent.locks |
+ almost all classes | almost all methods |
+
+ Backport of JSR 166
+ Condition.awaitNanos(long) method is supported but with
+
+ very little accuracy guarantees.
+ |
+ java.io | Closeable | * |
+ new Closeable[...] is replaced with new Object[...]
+ |
+ Flushable | * |
+ new Flushable[...] is replaced with new Object[...]
+ |
+ PrintStream |
+ append(CharSequence), append(CharSequence, int, int), append(char)
+ | |
+ PrintWriter |
+ PrintWriter(File), PrintWriter(File, String), PrintWriter(String), PrintWriter(String, String)
+ | |
+ Reader | read(CharBuffer) | |
+ Writer |
+ append(CharSequence), append(CharSequence, int, int), append(char)
+ | |
+ java.lang | Appendable | *
+ |
+ new Appendable[...] is replaced with new Object[...]
+ |
+ Boolean | parseBoolean(String), compareTo(Boolean) | |
+ Byte | valueOf(byte) | |
+ Character | valueOf(char) | |
+ Class | * (21 new methods) |
+ Class.getMethod(String, Class...) and Class.getDeclaredMethod(String, Class...) are
+ intercepted in advanced mode to better support generics and covariant return types on several JVM implementations.
+ |
+ Deprecated | * | |
+ Double | valueOf(double) | |
+ Enum | * | |
+ Float | valueOf(float) | |
+ IllegalArgumentException | IllegalArgumentException(String, Throwable),
+ IllegalArgumentException(Throwable) | |
+ IllegalStateException | IllegalStateException(String, Throwable),
+ IllegalStateException(Throwable) | |
+ Integer | valueOf(int) | |
+ Iterable | * |
+ new Iterable[...] is replaced with new Object[...]
+ |
+ Long | valueOf(long) | |
+ Package | * (4 new methods) | |
+ Readable | * |
+ new Readable[...] is replaced with new Object[...]
+ |
+ Short | valueOf(short) | |
+ String | contains(CharSequence), contentEquals(CharSequence),
+ replace(CharSequence, CharSequence) | |
+ StringBuffer |
+ StringBuffer(CharSequence), append(CharSequence), append(CharSequence, int, int),
+ insert(int, CharSequence), insert(int, CharSequence, int, int)
+ | |
+ StringBuilder |
+ All methods supported in StringBuffer
+ | StringBuilder is replaced with StringBuffer |
+ SuppressWarnings | * | |
+ System | nanoTime(), clearProperty(String) |
+ Backport of JSR 166
+ System.nanoTime() method precision
+
+ may vary on different platforms.
+ |
+ Thread | getStackTrace(), getId()
+ | Thread.getStackTrace() returns non-empty stack trace only for the current thread;
+ Thread.getId() does not reflect the order in which threads are created. |
+ TypeNotPresentException | * | |
+
+ java.lang.reflect | AnnotatedElement | * |
+ new AnnotatedElement[...] is replaced with new Object[...]
+ |
+ Constructor | * (11 new methods) | |
+ Field | * (8 new methods) | |
+ GenericArrayType | * | |
+ GenericDeclaration | * |
+ new GenericDeclaration[...] is replaced with new Object[...]
+ |
+ GenericSignatureFormatError | * | |
+ MalformedParameterizedTypeException | * | |
+ Method | * (14 new methods) | |
+ ParameterizedType | * | |
+ Type | * |
+ new Type[...] is replaced with new Object[...]
+ |
+ TypeVariable | * | |
+ WildcardType | * | |
+
+ java.math | BigDecimal |
+ BigDecimal(int), BigDecimal(long), ZERO, ONE, TEN, divideAndRemainder(BigDecimal),
+ divideToIntegralValue(BigDecimal), pow(int), remainder(BigDecimal), toPlainString(), valueOf(double),
+ valueOf(long) | BigDecimal.setScale(int, int) supports negative scales in advanced mode. |
+
+ java.rmi.server | RemoteObjectInvocationHandler |
+ * | |
+
+ java.util.nio | CharBuffer |
+ append(CharSequence), append(CharSequence, int, int), append(char), read(CharBuffer)
+ | |
+
+ java.util | AbstractQueue | * |
+ |
+ Arrays | * (21 new methods) | |
+ Collections | * (13 new methods) |
+ Backport of JSR 166
+ |
+ EnumMap | * | |
+ EnumSet | * | |
+ LinkedList | * (5 new methods) | |
+ PriorityQueue | * | |
+ Queue | * |
+ new Queue[...] is replaced with new Object[...]
+ |
+ UUID | * | |
+
+ java.util.regex | Matcher |
+ quoteReplacement(String), toMatchResult() | |
+ MatchResult | * |
+ new MatchResult[...] is replaced with new Object[...]
+ |
+ Pattern | quote(String) | |
+
+
+
+
+
+ Since most backported classes are discovered by Retrotranslator at translation time,
+ you may write an extension and simply put it into the Retrotranslator classpath to make it work.
+ For example, all references to
+ java.util.EnumSet
+ are replaced with references to
+
+ net.sf.retrotranslator.runtime.java.util.EnumSet_ (trailing underscore) if the latter can be found.
+ But if you replace a whole class that exists in J2SE 1.4 you may encounter interoperability issues with other libraries.
+ So, for example, support for Java 5 fields, methods, and constructors of
+ java.math.BigDecimal is placed into
+
+
+ net.sf.retrotranslator.runtime.java.math._BigDecimal (leading underscore):
+
+
+ - For a static field there is a public static field with the same name and type.
+ - For a static method there is a public static method with the same signature.
+ - For an instance method there is a public static method with the same signature
+ but with an additional first parameter representing an instance.
+ - For a constructor there is a public static
convertConstructorArguments method that
+ accepts constructor's arguments an returns an argument for a Java 1.4 constuctor.
+
+
+ However, if the backported methods require access
+ to non-public methods or fields of the instance, they cannot be fully handled by Retrotranslator.
+ While you can use reflection to access any data, translated code generally should not depend on security settings.
+ For example, it is impossible to write an implementation for methods getSource()
+ and setSource() of java.beans.PropertyEditorSupport that will work in any environment.
+ Also this approach cannot be used to replace instance field references.
+
+
+ If you have written an extension that does not contain copyrighted code, you may send
+ a patch
+ under the Retrotranslator license.
+
+
+
+
+
+ Basically, only classes, methods, and fields listed above should work, and other features,
+ like formatted input/output, are not supported. Known issues:
+
+
+ - Reflection-based tools may be unable to discover additional classes and methods introduced in Java 5 when running on JRE 1.4.
+ - Translated code running on JRE 5.0 may be incompatible with other Java 5 code when Java 5 API is used.
+ - Reflection on generics and metadata may return incomplete information for dynamically generated classes.
+ - Access modifiers and constants inlined by a compiler are ignored during the verification.
+ - Upcasting may help to translate invocations of inherited methods introduced in Java 5:
+ ((Writer) new FileWriter("file.tmp")).append("Hello").close();
+ - Serialized objects produced by translated code may be incompatible with JRE 5.0.
+
+
+
+
+ - Retroweaver
+ - a Java bytecode weaver that enables you to take advantage
+ of the new 1.5 language features in your source code,
+ while still retaining compatibility with 1.4 virtual machines.
+ - Declawer
+ - a customized Java compiler which reduces 1.5 Generics to equivalent 1.4 syntax.
+
+
+
+
+
+
+
+ Retrotranslator: a Java bytecode transformer that translates Java classes
+ compiled with JDK 5.0 into classes that can be run on JVM 1.4.
+
+ Copyright (c) 2005, 2006 Taras Puchko
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTag.java b/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTag.java
index 228a5c77d..90f1b38be 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTag.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTag.java
@@ -1,33 +1,33 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.struts2.annotations.taglib;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-public @interface StrutsTag {
- String name();
- String tldBodyContent();
- String tldTagClass();
- String description();
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts2.annotations.taglib;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+public @interface StrutsTag {
+ String name();
+ String tldBodyContent();
+ String tldTagClass();
+ String description();
+}
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTagAttribute.java b/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTagAttribute.java
index 9f7c2acd4..11e4e98fc 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTagAttribute.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/StrutsTagAttribute.java
@@ -1,35 +1,35 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.struts2.annotations.taglib;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-@Target(ElementType.METHOD)
-public @interface StrutsTagAttribute {
- String name() default "";
- boolean required();
- boolean rtexprvalue() default true;
- String description();
- String defaultValue() default "";
- String type() default "String";
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts2.annotations.taglib;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+public @interface StrutsTagAttribute {
+ String name() default "";
+ boolean required();
+ boolean rtexprvalue() default true;
+ String description();
+ String defaultValue() default "";
+ String type() default "String";
+}
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TLDAnnotationProcessorFactory.java b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TLDAnnotationProcessorFactory.java
index de0b4f72b..fe418417f 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TLDAnnotationProcessorFactory.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TLDAnnotationProcessorFactory.java
@@ -1,76 +1,76 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.struts2.annotations.taglib.apt;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Set;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.mirror.apt.AnnotationProcessors;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-public class TLDAnnotationProcessorFactory implements AnnotationProcessorFactory {
-
- /**
- * Returns a TLD annotation processor.
- *
- * @return An annotation processor for note annotations if requested, otherwise, returns the NO_OP
- * annotation processor.
- */
- public AnnotationProcessor getProcessorFor(Set declarations,
- AnnotationProcessorEnvironment env) {
- AnnotationProcessor result;
- if (declarations.isEmpty()) {
- result = AnnotationProcessors.NO_OP;
- } else {
- result = new TagAnnotationProcessor(env);
- }
- return result;
- }
-
- /**
- * This factory builds a processor for Tag and TagAttribute
- *
- * @return a collection containing StutsTag and StrutsTagAttribute
- */
- public Collection supportedAnnotationTypes() {
- return Arrays.asList(TagAnnotationProcessor.TAG, TagAnnotationProcessor.TAG_ATTRIBUTE);
- }
-
- /**
- * Options used to generate the TLD
- *
- * @return an empty list.
- */
- public Collection supportedOptions() {
- return Arrays.asList("-AoutFile",
- "-AtlibVersion",
- "-AjspVersion",
- "-AshortName",
- "-Auri",
- "-Adescription",
- "-AdisplayName");
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts2.annotations.taglib.apt;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessors;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+public class TLDAnnotationProcessorFactory implements AnnotationProcessorFactory {
+
+ /**
+ * Returns a TLD annotation processor.
+ *
+ * @return An annotation processor for note annotations if requested, otherwise, returns the NO_OP
+ * annotation processor.
+ */
+ public AnnotationProcessor getProcessorFor(Set declarations,
+ AnnotationProcessorEnvironment env) {
+ AnnotationProcessor result;
+ if (declarations.isEmpty()) {
+ result = AnnotationProcessors.NO_OP;
+ } else {
+ result = new TagAnnotationProcessor(env);
+ }
+ return result;
+ }
+
+ /**
+ * This factory builds a processor for Tag and TagAttribute
+ *
+ * @return a collection containing StutsTag and StrutsTagAttribute
+ */
+ public Collection supportedAnnotationTypes() {
+ return Arrays.asList(TagAnnotationProcessor.TAG, TagAnnotationProcessor.TAG_ATTRIBUTE);
+ }
+
+ /**
+ * Options used to generate the TLD
+ *
+ * @return an empty list.
+ */
+ public Collection supportedOptions() {
+ return Arrays.asList("-AoutFile",
+ "-AtlibVersion",
+ "-AjspVersion",
+ "-AshortName",
+ "-Auri",
+ "-Adescription",
+ "-AdisplayName");
+ }
+}
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/Tag.java b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/Tag.java
index 9d347450c..08db77dcb 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/Tag.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/Tag.java
@@ -1,92 +1,92 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.annotations.taglib.apt;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Tag {
- private String name;
- private String tldBodyContent;
- private String tldTagClass;
- private String description;
- private boolean include = true;
- private String declaredType;
-
- private Map attributes = new HashMap();
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getTldBodyContent() {
- return tldBodyContent;
- }
-
- public void setTldBodyContent(String tldBodyContent) {
- this.tldBodyContent = tldBodyContent;
- }
-
- public String getTldTagClass() {
- return tldTagClass;
- }
-
- public void setTldTagClass(String tldTagClass) {
- this.tldTagClass = tldTagClass;
- }
-
- public void addTagAttribute(TagAttribute attribute) {
- attributes.put(attribute.getName(), attribute);
- }
-
- public Collection getAttributes() {
- return attributes.values();
- }
-
- public boolean isInclude() {
- return include;
- }
-
- public void setInclude(boolean include) {
- this.include = include;
- }
-
- public String getDeclaredType() {
- return declaredType;
- }
-
- public void setDeclaredType(String declaredType) {
- this.declaredType = declaredType;
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.annotations.taglib.apt;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class Tag {
+ private String name;
+ private String tldBodyContent;
+ private String tldTagClass;
+ private String description;
+ private boolean include = true;
+ private String declaredType;
+
+ private Map attributes = new HashMap();
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTldBodyContent() {
+ return tldBodyContent;
+ }
+
+ public void setTldBodyContent(String tldBodyContent) {
+ this.tldBodyContent = tldBodyContent;
+ }
+
+ public String getTldTagClass() {
+ return tldTagClass;
+ }
+
+ public void setTldTagClass(String tldTagClass) {
+ this.tldTagClass = tldTagClass;
+ }
+
+ public void addTagAttribute(TagAttribute attribute) {
+ attributes.put(attribute.getName(), attribute);
+ }
+
+ public Collection getAttributes() {
+ return attributes.values();
+ }
+
+ public boolean isInclude() {
+ return include;
+ }
+
+ public void setInclude(boolean include) {
+ this.include = include;
+ }
+
+ public String getDeclaredType() {
+ return declaredType;
+ }
+
+ public void setDeclaredType(String declaredType) {
+ this.declaredType = declaredType;
+ }
+}
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAnnotationProcessor.java b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAnnotationProcessor.java
index a3d7bc19f..bac77f784 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAnnotationProcessor.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAnnotationProcessor.java
@@ -1,299 +1,299 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.annotations.taglib.apt;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.declaration.AnnotationMirror;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
-import com.sun.mirror.declaration.AnnotationValue;
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.declaration.TypeDeclaration;
-
-public class TagAnnotationProcessor implements AnnotationProcessor {
- public static final String TAG = "org.apache.struts2.annotations.taglib.StrutsTag";
- public static final String TAG_ATTRIBUTE = "org.apache.struts2.annotations.taglib.StrutsTagAttribute";
-
- private AnnotationProcessorEnvironment environment;
- private AnnotationTypeDeclaration tagDeclaration;
- private AnnotationTypeDeclaration tagAttributeDeclaration;
- private Map tags = new HashMap();
-
- public TagAnnotationProcessor(AnnotationProcessorEnvironment env) {
- environment = env;
- tagDeclaration = (AnnotationTypeDeclaration) environment.getTypeDeclaration(TAG);
- tagAttributeDeclaration = (AnnotationTypeDeclaration) environment
- .getTypeDeclaration(TAG_ATTRIBUTE);
- }
-
- public void process() {
- //make sure all paramters were set
- checkOptions();
-
- // tags
- Collection tagDeclarations = environment
- .getDeclarationsAnnotatedWith(tagDeclaration);
- Collection attributesDeclarations = environment
- .getDeclarationsAnnotatedWith(tagAttributeDeclaration);
-
- // find Tags
- for (Declaration declaration : tagDeclarations) {
- // type
- TypeDeclaration typeDeclaration = (TypeDeclaration) declaration;
- String typeName = typeDeclaration.getQualifiedName();
- HashMap values = getValues(typeDeclaration, tagDeclaration);
- // create Tag and apply values found
- Tag tag = new Tag();
- tag.setDescription((String) values.get("description"));
- tag.setName((String) values.get("name"));
- tag.setTldBodyContent((String) values.get("tldBodyContent"));
- tag.setTldTagClass((String) values.get("tldTagClass"));
- tag.setDeclaredType(typeName);
- // add to map
- tags.put(typeName, tag);
- }
-
- // find Tags Attributes
- for (Declaration declaration : attributesDeclarations) {
- // type
- MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
- String typeName = methodDeclaration.getDeclaringType().getQualifiedName();
- HashMap values = getValues(methodDeclaration, tagAttributeDeclaration);
- // create Attribute and apply values found
- TagAttribute attribute = new TagAttribute();
- attribute.setDescription((String) values.get("description"));
- String name = (String) values.get("name");
- if(name == null || name.length() == 0) {
- //get name from method
- String methodName = methodDeclaration.getSimpleName();
- name = String.valueOf(Character.toLowerCase(methodName.charAt(3))) + methodName.substring(4);
- }
- methodDeclaration.getSimpleName();
- attribute.setName(name);
- attribute.setRequired((Boolean) values.get("required"));
- attribute.setRtexprvalue((Boolean) values.get("rtexprvalue"));
- // add to map
- Tag parentTag = tags.get(typeName);
- if(parentTag != null)
- tags.get(typeName).addTagAttribute(attribute);
- else {
- //an abstract or base class
- parentTag = new Tag();
- parentTag.setDeclaredType(typeName);
- parentTag.setInclude(false);
- parentTag.addTagAttribute(attribute);
- tags.put(typeName, parentTag);
- }
- }
-
- //we can't process the hierarchy on the first pass because
- //apt does not garantees that the base classes will be processed
- //before their subclasses
- for(Map.Entry entry : tags.entrySet()) {
- processHierarchy(entry.getValue());
- }
- // save as xml
- save();
- }
-
- private void processHierarchy(Tag tag) {
- try {
- Class clazz = Class.forName(tag.getDeclaredType());
- while((clazz = clazz.getSuperclass()) != null) {
- Tag parentTag = tags.get(clazz.getName());
- //copy parent annotations to this tag
- if(parentTag != null) {
- for(TagAttribute attribute : parentTag.getAttributes()) {
- tag.addTagAttribute(attribute);
- }
- }
- }
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- private void checkOptions() {
- if(getOption("tlibVersion") == null)
- throw new IllegalArgumentException("'tlibVersion' is missing");
- if(getOption("jspVersion") == null)
- throw new IllegalArgumentException("'jspVersion' is missing");
- if(getOption("shortName") == null)
- throw new IllegalArgumentException("'shortName' is missing");
- if(getOption("description") == null)
- throw new IllegalArgumentException("'description' is missing");
- if(getOption("displayName") == null)
- throw new IllegalArgumentException("'displayName' is missing");
- if(getOption("uri") == null)
- throw new IllegalArgumentException("'uri' is missing");
- }
-
- private void save() {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder;
-
- try {
- // create xml document
- builder = factory.newDocumentBuilder();
- Document document = builder.newDocument();
- document.setXmlVersion("1.0");
-
- // taglib
- Element tagLib = document.createElement("taglib");
- document.appendChild(tagLib);
- // tag lib attributes
- appendTextNode(document, tagLib, "tlib-version", getOption("tlibVersion"), false);
- appendTextNode(document, tagLib, "jsp-version", getOption("jspVersion"), false);
- appendTextNode(document, tagLib, "short-name", getOption("shortName"), false);
- appendTextNode(document, tagLib, "uri", getOption("uri"), false);
- appendTextNode(document, tagLib, "display-name", getOption("displayName"), false);
- appendTextNode(document, tagLib, "description", getOption("description"), true);
-
- // create tags
- for (Map.Entry entry : tags.entrySet()) {
- Tag tag = entry.getValue();
- if(tag.isInclude())
- createElement(document, tagLib, tag);
- }
-
- // save to file
- TransformerFactory tf = TransformerFactory.newInstance();
- tf.setAttribute("indent-number", new Integer(2));
- Transformer transformer = tf.newTransformer();
- //if tiger would just format it :(
- //formatting bug in tiger (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6296446)
-
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN");
- transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-
- Source source = new DOMSource(document);
- Result result = new StreamResult(new OutputStreamWriter(new FileOutputStream(getOption("out"))));
- transformer.transform(source, result);
- } catch (Exception e) {
- // oops we cannot throw checked exceptions
- throw new RuntimeException(e);
- }
- }
-
- private String getOption(String name) {
- // there is a bug in the 1.5 apt implementation:
- // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6258929
- // this is a hack-around
- if (environment.getOptions().containsKey(name))
- return environment.getOptions().get(name);
-
- for (Map.Entry entry : environment.getOptions().entrySet()) {
- String key = entry.getKey();
- if (key.startsWith("-A" + name))
- return key.substring(key.indexOf("=") + 1);
- }
- return null;
- }
-
- private void createElement(Document doc, Element tagLibElement, Tag tag) {
- Element tagElement = doc.createElement("tag");
- tagLibElement.appendChild(tagElement);
- appendTextNode(doc, tagElement, "name", tag.getName(), false);
- appendTextNode(doc, tagElement, "tag-class", tag.getTldTagClass(), false);
- appendTextNode(doc, tagElement, "body-content", tag.getTldBodyContent(), false);
- appendTextNode(doc, tagElement, "description", tag.getDescription(), true);
-
- // save attributes
- for (TagAttribute attribute : tag.getAttributes()) {
- createElement(doc, tagElement, attribute);
- }
-
- }
-
- private void createElement(Document doc, Element tagElement, TagAttribute attribute) {
- Element attributeElement = doc.createElement("attribute");
- tagElement.appendChild(attributeElement);
- appendTextNode(doc, attributeElement, "name", attribute.getName(), false);
- appendTextNode(doc, attributeElement, "required", String.valueOf(attribute.isRequired()), false);
- appendTextNode(doc,
- attributeElement,
- "rtexprvalue",
- String.valueOf(attribute.isRtexprvalue()),
- false);
- appendTextNode(doc, attributeElement, "description", attribute.getDescription(), true);
- }
-
- private void appendTextNode(Document doc, Element element, String name, String text, boolean cdata) {
- Text textNode = cdata ? doc.createCDATASection(text) : doc.createTextNode(text);
- Element newElement = doc.createElement(name);
- newElement.appendChild(textNode);
- element.appendChild(newElement);
- }
-
- /**
- * Get values of annotation
- *
- * @param declaration
- * @param type
- * The type of the annotation
- * @return name->value map of annotation values
- */
- private HashMap getValues(Declaration declaration, AnnotationTypeDeclaration type) {
- HashMap values = new HashMap();
- Collection annotations = declaration.getAnnotationMirrors();
- // iterate over the mirrors.
- for (AnnotationMirror mirror : annotations) {
- // if the mirror in this iteration is for our note declaration...
- if (mirror.getAnnotationType().getDeclaration().equals(type)) {
-
- // print out the goodies.
- Map annotationValues = mirror
- .getElementValues();
-
- for (Map.Entry entry : annotationValues
- .entrySet()) {
- AnnotationTypeElementDeclaration key = entry.getKey();
- AnnotationValue value = entry.getValue();
- values.put(key.getSimpleName(), value.getValue());
- }
- }
- }
- return values;
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.annotations.taglib.apt;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.AnnotationValue;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+
+public class TagAnnotationProcessor implements AnnotationProcessor {
+ public static final String TAG = "org.apache.struts2.annotations.taglib.StrutsTag";
+ public static final String TAG_ATTRIBUTE = "org.apache.struts2.annotations.taglib.StrutsTagAttribute";
+
+ private AnnotationProcessorEnvironment environment;
+ private AnnotationTypeDeclaration tagDeclaration;
+ private AnnotationTypeDeclaration tagAttributeDeclaration;
+ private Map tags = new HashMap();
+
+ public TagAnnotationProcessor(AnnotationProcessorEnvironment env) {
+ environment = env;
+ tagDeclaration = (AnnotationTypeDeclaration) environment.getTypeDeclaration(TAG);
+ tagAttributeDeclaration = (AnnotationTypeDeclaration) environment
+ .getTypeDeclaration(TAG_ATTRIBUTE);
+ }
+
+ public void process() {
+ //make sure all paramters were set
+ checkOptions();
+
+ // tags
+ Collection tagDeclarations = environment
+ .getDeclarationsAnnotatedWith(tagDeclaration);
+ Collection attributesDeclarations = environment
+ .getDeclarationsAnnotatedWith(tagAttributeDeclaration);
+
+ // find Tags
+ for (Declaration declaration : tagDeclarations) {
+ // type
+ TypeDeclaration typeDeclaration = (TypeDeclaration) declaration;
+ String typeName = typeDeclaration.getQualifiedName();
+ HashMap values = getValues(typeDeclaration, tagDeclaration);
+ // create Tag and apply values found
+ Tag tag = new Tag();
+ tag.setDescription((String) values.get("description"));
+ tag.setName((String) values.get("name"));
+ tag.setTldBodyContent((String) values.get("tldBodyContent"));
+ tag.setTldTagClass((String) values.get("tldTagClass"));
+ tag.setDeclaredType(typeName);
+ // add to map
+ tags.put(typeName, tag);
+ }
+
+ // find Tags Attributes
+ for (Declaration declaration : attributesDeclarations) {
+ // type
+ MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
+ String typeName = methodDeclaration.getDeclaringType().getQualifiedName();
+ HashMap values = getValues(methodDeclaration, tagAttributeDeclaration);
+ // create Attribute and apply values found
+ TagAttribute attribute = new TagAttribute();
+ attribute.setDescription((String) values.get("description"));
+ String name = (String) values.get("name");
+ if(name == null || name.length() == 0) {
+ //get name from method
+ String methodName = methodDeclaration.getSimpleName();
+ name = String.valueOf(Character.toLowerCase(methodName.charAt(3))) + methodName.substring(4);
+ }
+ methodDeclaration.getSimpleName();
+ attribute.setName(name);
+ attribute.setRequired((Boolean) values.get("required"));
+ attribute.setRtexprvalue((Boolean) values.get("rtexprvalue"));
+ // add to map
+ Tag parentTag = tags.get(typeName);
+ if(parentTag != null)
+ tags.get(typeName).addTagAttribute(attribute);
+ else {
+ //an abstract or base class
+ parentTag = new Tag();
+ parentTag.setDeclaredType(typeName);
+ parentTag.setInclude(false);
+ parentTag.addTagAttribute(attribute);
+ tags.put(typeName, parentTag);
+ }
+ }
+
+ //we can't process the hierarchy on the first pass because
+ //apt does not garantees that the base classes will be processed
+ //before their subclasses
+ for(Map.Entry entry : tags.entrySet()) {
+ processHierarchy(entry.getValue());
+ }
+ // save as xml
+ save();
+ }
+
+ private void processHierarchy(Tag tag) {
+ try {
+ Class clazz = Class.forName(tag.getDeclaredType());
+ while((clazz = clazz.getSuperclass()) != null) {
+ Tag parentTag = tags.get(clazz.getName());
+ //copy parent annotations to this tag
+ if(parentTag != null) {
+ for(TagAttribute attribute : parentTag.getAttributes()) {
+ tag.addTagAttribute(attribute);
+ }
+ }
+ }
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void checkOptions() {
+ if(getOption("tlibVersion") == null)
+ throw new IllegalArgumentException("'tlibVersion' is missing");
+ if(getOption("jspVersion") == null)
+ throw new IllegalArgumentException("'jspVersion' is missing");
+ if(getOption("shortName") == null)
+ throw new IllegalArgumentException("'shortName' is missing");
+ if(getOption("description") == null)
+ throw new IllegalArgumentException("'description' is missing");
+ if(getOption("displayName") == null)
+ throw new IllegalArgumentException("'displayName' is missing");
+ if(getOption("uri") == null)
+ throw new IllegalArgumentException("'uri' is missing");
+ }
+
+ private void save() {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder;
+
+ try {
+ // create xml document
+ builder = factory.newDocumentBuilder();
+ Document document = builder.newDocument();
+ document.setXmlVersion("1.0");
+
+ // taglib
+ Element tagLib = document.createElement("taglib");
+ document.appendChild(tagLib);
+ // tag lib attributes
+ appendTextNode(document, tagLib, "tlib-version", getOption("tlibVersion"), false);
+ appendTextNode(document, tagLib, "jsp-version", getOption("jspVersion"), false);
+ appendTextNode(document, tagLib, "short-name", getOption("shortName"), false);
+ appendTextNode(document, tagLib, "uri", getOption("uri"), false);
+ appendTextNode(document, tagLib, "display-name", getOption("displayName"), false);
+ appendTextNode(document, tagLib, "description", getOption("description"), true);
+
+ // create tags
+ for (Map.Entry entry : tags.entrySet()) {
+ Tag tag = entry.getValue();
+ if(tag.isInclude())
+ createElement(document, tagLib, tag);
+ }
+
+ // save to file
+ TransformerFactory tf = TransformerFactory.newInstance();
+ tf.setAttribute("indent-number", new Integer(2));
+ Transformer transformer = tf.newTransformer();
+ //if tiger would just format it :(
+ //formatting bug in tiger (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6296446)
+
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN");
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+
+ Source source = new DOMSource(document);
+ Result result = new StreamResult(new OutputStreamWriter(new FileOutputStream(getOption("out"))));
+ transformer.transform(source, result);
+ } catch (Exception e) {
+ // oops we cannot throw checked exceptions
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String getOption(String name) {
+ // there is a bug in the 1.5 apt implementation:
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6258929
+ // this is a hack-around
+ if (environment.getOptions().containsKey(name))
+ return environment.getOptions().get(name);
+
+ for (Map.Entry entry : environment.getOptions().entrySet()) {
+ String key = entry.getKey();
+ if (key.startsWith("-A" + name))
+ return key.substring(key.indexOf("=") + 1);
+ }
+ return null;
+ }
+
+ private void createElement(Document doc, Element tagLibElement, Tag tag) {
+ Element tagElement = doc.createElement("tag");
+ tagLibElement.appendChild(tagElement);
+ appendTextNode(doc, tagElement, "name", tag.getName(), false);
+ appendTextNode(doc, tagElement, "tag-class", tag.getTldTagClass(), false);
+ appendTextNode(doc, tagElement, "body-content", tag.getTldBodyContent(), false);
+ appendTextNode(doc, tagElement, "description", tag.getDescription(), true);
+
+ // save attributes
+ for (TagAttribute attribute : tag.getAttributes()) {
+ createElement(doc, tagElement, attribute);
+ }
+
+ }
+
+ private void createElement(Document doc, Element tagElement, TagAttribute attribute) {
+ Element attributeElement = doc.createElement("attribute");
+ tagElement.appendChild(attributeElement);
+ appendTextNode(doc, attributeElement, "name", attribute.getName(), false);
+ appendTextNode(doc, attributeElement, "required", String.valueOf(attribute.isRequired()), false);
+ appendTextNode(doc,
+ attributeElement,
+ "rtexprvalue",
+ String.valueOf(attribute.isRtexprvalue()),
+ false);
+ appendTextNode(doc, attributeElement, "description", attribute.getDescription(), true);
+ }
+
+ private void appendTextNode(Document doc, Element element, String name, String text, boolean cdata) {
+ Text textNode = cdata ? doc.createCDATASection(text) : doc.createTextNode(text);
+ Element newElement = doc.createElement(name);
+ newElement.appendChild(textNode);
+ element.appendChild(newElement);
+ }
+
+ /**
+ * Get values of annotation
+ *
+ * @param declaration
+ * @param type
+ * The type of the annotation
+ * @return name->value map of annotation values
+ */
+ private HashMap getValues(Declaration declaration, AnnotationTypeDeclaration type) {
+ HashMap values = new HashMap();
+ Collection annotations = declaration.getAnnotationMirrors();
+ // iterate over the mirrors.
+ for (AnnotationMirror mirror : annotations) {
+ // if the mirror in this iteration is for our note declaration...
+ if (mirror.getAnnotationType().getDeclaration().equals(type)) {
+
+ // print out the goodies.
+ Map annotationValues = mirror
+ .getElementValues();
+
+ for (Map.Entry entry : annotationValues
+ .entrySet()) {
+ AnnotationTypeElementDeclaration key = entry.getKey();
+ AnnotationValue value = entry.getValue();
+ values.put(key.getSimpleName(), value.getValue());
+ }
+ }
+ }
+ return values;
+ }
+}
diff --git a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAttribute.java b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAttribute.java
index 84c2c35a5..45ff7f3af 100644
--- a/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAttribute.java
+++ b/core/src/main/java/org/apache/struts2/annotations/taglib/apt/TagAttribute.java
@@ -1,65 +1,65 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.struts2.annotations.taglib.apt;
-
-/**
- * Used to hold tag attribute information for TLD generation
- *
- */
-class TagAttribute {
- private String name;
- private boolean required;
- private boolean rtexprvalue;
- private String description;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isRequired() {
- return required;
- }
-
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- public boolean isRtexprvalue() {
- return rtexprvalue;
- }
-
- public void setRtexprvalue(boolean rtexprvalue) {
- this.rtexprvalue = rtexprvalue;
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts2.annotations.taglib.apt;
+
+/**
+ * Used to hold tag attribute information for TLD generation
+ *
+ */
+class TagAttribute {
+ private String name;
+ private boolean required;
+ private boolean rtexprvalue;
+ private String description;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ public boolean isRtexprvalue() {
+ return rtexprvalue;
+ }
+
+ public void setRtexprvalue(boolean rtexprvalue) {
+ this.rtexprvalue = rtexprvalue;
+ }
+}
diff --git a/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java b/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java
index 1a0c1fab2..19b48fdff 100644
--- a/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java
@@ -1,5 +1,5 @@
/*
- * $Id: RemoteCallUIBean.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/main/java/org/apache/struts2/components/DropdownDateTimePicker.java b/core/src/main/java/org/apache/struts2/components/DropdownDateTimePicker.java
index 9843c60e9..c14287a12 100644
--- a/core/src/main/java/org/apache/struts2/components/DropdownDateTimePicker.java
+++ b/core/src/main/java/org/apache/struts2/components/DropdownDateTimePicker.java
@@ -1,5 +1,5 @@
/*
- * $Id: DatePicker.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
index 192409bc0..62ff6d1c0 100644
--- a/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java b/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
index 72f976eba..344cd662a 100644
--- a/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/LegacyPropertiesConfigurationProvider.java b/core/src/main/java/org/apache/struts2/config/LegacyPropertiesConfigurationProvider.java
index b036201e9..457046375 100644
--- a/core/src/main/java/org/apache/struts2/config/LegacyPropertiesConfigurationProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/LegacyPropertiesConfigurationProvider.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/Namespace.java b/core/src/main/java/org/apache/struts2/config/Namespace.java
index 08b485dc7..3ee34161a 100644
--- a/core/src/main/java/org/apache/struts2/config/Namespace.java
+++ b/core/src/main/java/org/apache/struts2/config/Namespace.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/NullResult.java b/core/src/main/java/org/apache/struts2/config/NullResult.java
index c5c80ae7d..2f695835e 100644
--- a/core/src/main/java/org/apache/struts2/config/NullResult.java
+++ b/core/src/main/java/org/apache/struts2/config/NullResult.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/ParentPackage.java b/core/src/main/java/org/apache/struts2/config/ParentPackage.java
index 341fd3095..b74cee888 100644
--- a/core/src/main/java/org/apache/struts2/config/ParentPackage.java
+++ b/core/src/main/java/org/apache/struts2/config/ParentPackage.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/config/Result.java b/core/src/main/java/org/apache/struts2/config/Result.java
index 9fd275c77..6e39c25e9 100644
--- a/core/src/main/java/org/apache/struts2/config/Result.java
+++ b/core/src/main/java/org/apache/struts2/config/Result.java
@@ -1,36 +1,36 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.config;
-
-import com.opensymphony.xwork2.Action;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Defines an XWork Result
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Result {
- String name() default Action.SUCCESS;
- Class type() default NullResult.class;
- String value();
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.config;
+
+import com.opensymphony.xwork2.Action;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Defines an XWork Result
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Result {
+ String name() default Action.SUCCESS;
+ Class type() default NullResult.class;
+ String value();
+}
diff --git a/core/src/main/java/org/apache/struts2/config/Results.java b/core/src/main/java/org/apache/struts2/config/Results.java
index 9cb8663f8..99b2db87b 100644
--- a/core/src/main/java/org/apache/struts2/config/Results.java
+++ b/core/src/main/java/org/apache/struts2/config/Results.java
@@ -1,32 +1,32 @@
-/*
- * $Id: $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.config;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Defines multiple XWork Results
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Results {
- Result[] value();
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.config;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Defines multiple XWork Results
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Results {
+ Result[] value();
+}
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java
index a6de5c46d..9d8a9f95e 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
index 0b3b31b41..6d94a440d 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
index 982109219..276fec589 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
index 1f5c3a10d..aa7b91f0b 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
index 1ea85ee47..14b73a6cf 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DropdownDateTimePickerModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DropdownDateTimePickerModel.java
index e02d0e9ca..81b3ac756 100644
--- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DropdownDateTimePickerModel.java
+++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DropdownDateTimePickerModel.java
@@ -1,5 +1,5 @@
/*
- * $Id: DatePickerModel.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java
index 1ca6ce72e..9083db2e8 100644
--- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java
+++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java
@@ -1,5 +1,5 @@
/*
- * $Id: DivTag.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/DropdownDateTimePickerTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/DropdownDateTimePickerTag.java
index 6f69b2f9b..df2b724e2 100644
--- a/core/src/main/java/org/apache/struts2/views/jsp/ui/DropdownDateTimePickerTag.java
+++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/DropdownDateTimePickerTag.java
@@ -1,5 +1,5 @@
/*
- * $Id: DatePickerTag.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/DropdownDateTimePickerDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/DropdownDateTimePickerDirective.java
index f25dbe956..76414aea5 100644
--- a/core/src/main/java/org/apache/struts2/views/velocity/components/DropdownDateTimePickerDirective.java
+++ b/core/src/main/java/org/apache/struts2/views/velocity/components/DropdownDateTimePickerDirective.java
@@ -1,5 +1,5 @@
/*
- * $Id: DatePickerDirective.java 451544 2006-09-30 05:38:02Z mrdon $
+ * $Id$
*
* Copyright 2006 The Apache Software Foundation.
*
diff --git a/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java b/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java
index cbe4c793c..76637a21f 100644
--- a/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java b/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java
index 7bff1a5f8..e4460f685 100644
--- a/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java
+++ b/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java b/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java
index 0628322d1..f88f5e154 100644
--- a/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java
+++ b/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/config/cltest/ActionImpl.java b/core/src/test/java/org/apache/struts2/config/cltest/ActionImpl.java
index 0edede85f..b6dc16374 100644
--- a/core/src/test/java/org/apache/struts2/config/cltest/ActionImpl.java
+++ b/core/src/test/java/org/apache/struts2/config/cltest/ActionImpl.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java b/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java
index fdd06f4c3..1a0724c51 100644
--- a/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java
+++ b/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java b/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java
index 2a2138445..dab878808 100644
--- a/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java
+++ b/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java
index 012015b53..321788b33 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java b/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java
index f2a8b71a7..db5b44719 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
index a684cd1da..27897ce46 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
index 7b505ea6c..6245c6179 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java
index 1db55fcf9..73cd4d4bc 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java b/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java
index 112d730e3..909637d06 100644
--- a/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java
+++ b/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java b/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
index b69cccd11..2233a697a 100644
--- a/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
+++ b/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
@@ -1,5 +1,5 @@
/*
- * $Id: DWRValidator.java 476642 2006-11-18 22:40:18Z mrdon $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java b/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
index 45149e045..0bf246b1a 100644
--- a/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
+++ b/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * $Id: DWRValidator.java 476642 2006-11-18 22:40:18Z mrdon $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormResetInterceptor.java b/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormResetInterceptor.java
index 45fab1e37..b6b016fda 100644
--- a/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormResetInterceptor.java
+++ b/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormResetInterceptor.java
@@ -1,5 +1,5 @@
/*
- * $Id: Action.java 240373 2005-08-27 01:58:39Z jmitchell $
+ * $Id$
*
* Copyright 2000-2004 The Apache Software Foundation.
*
diff --git a/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormValidationInterceptor.java b/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormValidationInterceptor.java
index bc92f1e5f..33795f8c3 100644
--- a/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormValidationInterceptor.java
+++ b/plugins/struts1/src/main/java/org/apache/struts2/s1/ActionFormValidationInterceptor.java
@@ -1,5 +1,5 @@
/*
- * $Id: Action.java 240373 2005-08-27 01:58:39Z jmitchell $
+ * $Id$
*
* Copyright 2000-2004 The Apache Software Foundation.
*
diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
index ead169e2d..2973547ee 100644
--- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
+++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
@@ -1,5 +1,5 @@
/*
- * $Id: $
+ * $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file