You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by cz...@apache.org on 2002/01/04 14:21:31 UTC
cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source SourceUtil.java URLSource.java
cziegeler 02/01/04 05:21:31
Modified: src/scratchpad/org/apache/avalon/excalibur/i18n
XmlBundle.java
src/scratchpad/org/apache/avalon/excalibur/source
SourceUtil.java URLSource.java
Log:
Added utility method for get an InputSource
Revision Changes Path
1.8 +3 -4 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/XmlBundle.java
Index: XmlBundle.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/XmlBundle.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XmlBundle.java 4 Jan 2002 12:33:18 -0000 1.7
+++ XmlBundle.java 4 Jan 2002 13:21:31 -0000 1.8
@@ -20,6 +20,7 @@
import org.apache.avalon.excalibur.xml.Parser;
import org.apache.avalon.excalibur.source.Source;
import org.apache.avalon.excalibur.source.SourceResolver;
+import org.apache.avalon.excalibur.source.SourceUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -35,7 +36,7 @@
* @author <a href="mailto:mengelhart@earthtrip.com">Mike Engelhart</a>
* @author <a href="mailto:neeme@apache.org">Neeme Praks</a>
* @author <a href="mailto:oleg@one.lv">Oleg Podolsky</a>
- * @version $Id: XmlBundle.java,v 1.7 2002/01/04 12:33:18 cziegeler Exp $
+ * @version $Id: XmlBundle.java,v 1.8 2002/01/04 13:21:31 cziegeler Exp $
*/
public class XmlBundle extends AbstractBundle implements Configurable, Initializable, Disposable, Composable {
@@ -122,9 +123,7 @@
* @exception SAXException if an error occurs while parsing the file
*/
public void initialize(Source source) throws Exception {
- final InputSource newObject = new InputSource( source.getInputStream() );
- newObject.setSystemId( source.getSystemId() );
- initialize( newObject );
+ initialize( SourceUtil.getInputSource( source ) );
}
/**
1.3 +17 -1 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceUtil.java
Index: SourceUtil.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SourceUtil.java 11 Dec 2001 09:53:36 -0000 1.2
+++ SourceUtil.java 4 Jan 2002 13:21:31 -0000 1.3
@@ -7,17 +7,20 @@
*/
package org.apache.avalon.excalibur.source;
+import org.xml.sax.InputSource;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.BitSet;
+
/**
*
* Utility class for source resolving.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/12/11 09:53:36 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/01/04 13:21:31 $
*/
public final class SourceUtil {
@@ -171,6 +174,19 @@
}
return out.toString();
+ }
+
+ /**
+ * Return a new <code>InputSource</code> object
+ *
+ * @throws IOException if I/O error occured.
+ */
+ public static InputSource getInputSource(Source source)
+ throws IOException
+ {
+ final InputSource newObject = new InputSource( source.getInputStream() );
+ newObject.setSystemId( source.getSystemId() );
+ return newObject;
}
}
1.10 +4 -5 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/URLSource.java
Index: URLSource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/URLSource.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- URLSource.java 3 Jan 2002 13:03:31 -0000 1.9
+++ URLSource.java 4 Jan 2002 13:21:31 -0000 1.10
@@ -31,7 +31,7 @@
* Description of a source which is described by an URL.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.9 $ $Date: 2002/01/03 13:03:31 $
+ * @version CVS $Revision: 1.10 $ $Date: 2002/01/04 13:21:31 $
*/
public final class URLSource
@@ -243,12 +243,11 @@
/**
* Return a new <code>InputSource</code> object
*
- * @throws ResourceNotFoundException if file not found or
- * HTTP location does not exist.
* @throws IOException if I/O error occured.
*/
- public InputSource getInputSource()
- throws IOException {
+ protected InputSource getInputSource()
+ throws IOException
+ {
InputSource newObject = new InputSource(this.getInputStream());
newObject.setSystemId(this.systemId);
return newObject;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>