You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2011/12/23 20:39:57 UTC
svn commit: r1222812 - in /incubator/rat/whisker/trunk:
apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java
apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java
Author: rdonkin
Date: Fri Dec 23 19:39:56 2011
New Revision: 1222812
URL: http://svn.apache.org/viewvc?rev=1222812&view=rev
Log:
Simplify code by pushing xml wrangling into builder
Modified:
incubator/rat/whisker/trunk/apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java
Modified: incubator/rat/whisker/trunk/apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java?rev=1222812&r1=1222811&r2=1222812&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-velocity/src/main/java/org/apache/rat/whisker/app/Whisker.java Fri Dec 23 19:39:56 2011
@@ -27,7 +27,6 @@ import org.apache.rat.whisker.model.Work
import org.apache.rat.whisker.scan.Directory;
import org.apache.rat.whisker.scan.FromFileSystem;
import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
/**
@@ -192,6 +191,6 @@ public class Whisker {
if (resourceAsStream == null) {
throw new IllegalArgumentException("Cannot load " + resource);
}
- return new JDomBuilder().build(new SAXBuilder().build(resourceAsStream));
+ return new JDomBuilder().build(resourceAsStream);
}
}
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java?rev=1222812&r1=1222811&r2=1222812&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java Fri Dec 23 19:39:56 2011
@@ -18,6 +18,8 @@
*/
package org.apache.rat.whisker.fromxml;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -39,6 +41,8 @@ import org.apache.rat.whisker.model.With
import org.apache.rat.whisker.model.Work;
import org.jdom.Document;
import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
/**
* Builds a model from xml using JDOM.
@@ -461,4 +465,8 @@ public class JDomBuilder {
return new Work(primaryLicense, primaryOrganisationId, primaryNotice,
licenses, notices, organisations, contents);
}
+
+ public Work build(final InputStream xmlStream) throws JDOMException, IOException {
+ return build(new SAXBuilder().build(xmlStream));
+ }
}