aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 06:12:07 (EST)
committerWinston Prakash2011-12-01 20:46:48 (EST)
commit6698f8b0d4008e64223196d9285b74d4b6c9a4ad (patch)
treec0e9361d5ee892d6b3b251663fbe5fee6415f8c5
parentc3d5fe5d7ad09e47009415ee66c555a7a767b64b (diff)
downloadorg.eclipse.hudson.core-6698f8b0d4008e64223196d9285b74d4b6c9a4ad.zip
org.eclipse.hudson.core-6698f8b0d4008e64223196d9285b74d4b6c9a4ad.tar.gz
org.eclipse.hudson.core-6698f8b0d4008e64223196d9285b74d4b6c9a4ad.tar.bz2
Add legacy commons-digester and commons-lang dependencies for backward compatibility
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/pom.xml11
-rw-r--r--hudson-core/src/main/java/hudson/util/Digester2.java34
2 files changed, 43 insertions, 2 deletions
diff --git a/hudson-core/pom.xml b/hudson-core/pom.xml
index 442a8ac..4fb3428 100644
--- a/hudson-core/pom.xml
+++ b/hudson-core/pom.xml
@@ -411,6 +411,17 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
+ <dependency><!-- Left for backward compatibility-->
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency><!-- Left for backward compatibility-->
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.7</version>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-digester3</artifactId>
diff --git a/hudson-core/src/main/java/hudson/util/Digester2.java b/hudson-core/src/main/java/hudson/util/Digester2.java
index 4f70bc9..e68efc3 100644
--- a/hudson-core/src/main/java/hudson/util/Digester2.java
+++ b/hudson-core/src/main/java/hudson/util/Digester2.java
@@ -16,15 +16,45 @@
package hudson.util;
-import org.apache.commons.digester3.Digester;
+import hudson.RestrictedSince;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.Rule;
+import org.kohsuke.accmod.Restricted;
+import org.kohsuke.accmod.restrictions.NoExternalUse;
+import org.xml.sax.Attributes;
/**
* {@link Digester} wrapper to fix the issue DIGESTER-118.
*
* @author Kohsuke Kawaguchi
* @since 1.125
- * @deprecated use {@link Digester} instead
+ * @deprecated use {@link org.apache.commons.digester3.Digester} instead
* @since 2.1.2
*/
+@Restricted(NoExternalUse.class)
+@RestrictedSince("2.1.2")
public class Digester2 extends Digester {
+ @Override
+ public void addObjectCreate(String pattern, Class clazz) {
+ addRule(pattern,new ObjectCreateRule2(clazz));
+ }
+
+ private static final class ObjectCreateRule2 extends Rule {
+ private final Class clazz;
+
+ public ObjectCreateRule2(Class clazz) {
+ this.clazz = clazz;
+ }
+
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ Object instance = clazz.newInstance();
+ digester.push(instance);
+ }
+
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ digester.pop();
+ }
+ }
}