You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2003/01/27 11:38:44 UTC
cvs commit: jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl ResourceSource.java
leosimons 2003/01/27 02:38:44
Modified: sourceresolve/src/java/org/apache/excalibur/source/impl
ResourceSource.java
Log:
applying patch for bug 16447. It changes behaviour so that ResourceSource throws an exception instead of returning null. As such it is a backwards-incompatible change. Can someone confirm the new behaviour is the desired behaviour? Submitted by Stephan Michels, stephan@apache.org.
Revision Changes Path
1.7 +9 -3 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java
Index: ResourceSource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ResourceSource.java 15 Dec 2002 11:56:48 -0000 1.6
+++ ResourceSource.java 27 Jan 2003 10:38:44 -0000 1.7
@@ -58,6 +58,8 @@
import java.io.InputStream;
import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceValidity;
import org.apache.excalibur.source.impl.validity.NOPValidity;
@@ -88,14 +90,18 @@
* Return an <code>InputStream</code> object to read from the source.
*/
public InputStream getInputStream()
- throws IOException
+ throws IOException, SourceException
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if( loader == null )
{
loader = getClass().getClassLoader();
}
- return loader.getResourceAsStream( m_location );
+
+ InputStream in = loader.getResourceAsStream( m_location );
+ if ( in == null )
+ throw new SourceNotFoundException( "Source '"+m_location+"' was not found" );
+ return in;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>