[FOray-commit] SF.net SVN: foray: [7675] trunk/foray/foray-common/src/java/org/foray/common
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-06-17 17:08:01
|
Revision: 7675 Author: victormote Date: 2006-06-17 10:07:54 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7675&view=rev Log Message: ----------- Throw an exception if the InputStream cannot be created. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/ClasspathHandler.java trunk/foray/foray-common/src/java/org/foray/common/FOrayURLStreamHandlerFactory.java Modified: trunk/foray/foray-common/src/java/org/foray/common/ClasspathHandler.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ClasspathHandler.java 2006-06-17 16:53:45 UTC (rev 7674) +++ trunk/foray/foray-common/src/java/org/foray/common/ClasspathHandler.java 2006-06-17 17:07:54 UTC (rev 7675) @@ -24,6 +24,7 @@ package org.foray.common; +import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; @@ -44,12 +45,17 @@ return new URLConnection(u) { public void connect() {} - public InputStream getInputStream() { + public InputStream getInputStream() throws IOException { String path = url.getPath(); String resourcePath = (path.charAt(0) == '/')? path.substring(1): path; - return getClass().getClassLoader(). + InputStream inputStream = getClass().getClassLoader(). getResourceAsStream(resourcePath); + if (inputStream == null) { + throw new IOException("Unable to open input stream for: " + + url.toString()); + } + return inputStream; } }; } Modified: trunk/foray/foray-common/src/java/org/foray/common/FOrayURLStreamHandlerFactory.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/FOrayURLStreamHandlerFactory.java 2006-06-17 16:53:45 UTC (rev 7674) +++ trunk/foray/foray-common/src/java/org/foray/common/FOrayURLStreamHandlerFactory.java 2006-06-17 17:07:54 UTC (rev 7675) @@ -16,7 +16,9 @@ * */ -/* $Id$ */ +/* +$Id$ + */ /* Known contributors: * Vincent Hennebert (original author) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |