vgritsenko 01/08/11 12:02:21
Modified: src/org/apache/cocoon/generation Tag: cocoon_20_branch
DirectoryGenerator.java HTMLGenerator.java
ImageDirectoryGenerator.java ScriptGenerator.java
ServerPagesGenerator.java
Log:
exception handling changes, formatting.
Revision Changes Path
No revision
No revision
1.6.2.2 +15 -19
xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java
Index: DirectoryGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- DirectoryGenerator.java 2001/07/07 19:08:14 1.6.2.1
+++ DirectoryGenerator.java 2001/08/11 19:02:21 1.6.2.2
@@ -62,7 +62,7 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Conny Krappatsch</a>
* (SMB GmbH) for Virbus AG
- * @version CVS $Revision: 1.6.2.1 $ $Date: 2001/07/07 19:08:14 $ */
+ * @version CVS $Revision: 1.6.2.2 $ $Date: 2001/08/11 19:02:21 $ */
public class DirectoryGenerator extends ComposerGenerator implements
Recyclable {
@@ -174,37 +174,33 @@
public void generate()
throws SAXException, ProcessingException {
try {
-
Source inputSource;
- File path;
+ File path;
inputSource = this.resolver.resolve(super.source);
if (inputSource.isFile() == false) {
- throw new IOException("Cannot read directory from "
- + inputSource.getSystemId() + "\"");
- }
+ throw new ResourceNotFoundException(inputSource.getSystemId()
+ + " is not a directory.");
+ }
path = inputSource.getFile();
- if (!path.isDirectory()) {
- throw new IOException("Cannot read directory from "
- + inputSource.getSystemId() + "\"");
- }
+ if (!path.isDirectory()) {
+ throw new ResourceNotFoundException(inputSource.getSystemId()
+ + " is not a directory.");
+ }
+ this.contentHandler.startDocument();
+ this.contentHandler.startPrefixMapping(PREFIX,URI);
- this.contentHandler.startDocument();
- this.contentHandler.startPrefixMapping(PREFIX,URI);
+ Stack ancestors = getAncestors(path);
+ addPathWithAncestors(path, ancestors);
- Stack ancestors = getAncestors(path);
- addPathWithAncestors(path, ancestors);
-
- this.contentHandler.endPrefixMapping(PREFIX);
- this.contentHandler.endDocument();
+ this.contentHandler.endPrefixMapping(PREFIX);
+ this.contentHandler.endDocument();
} catch (IOException ioe) {
getLogger().warn("Could not get resource", ioe);
throw new ResourceNotFoundException("Could not get directory",
ioe);
}
-
}
-
/**
* Creates a stack containing the ancestors of File up to specified
1.4.2.5 +4 -3
xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
Index: HTMLGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -u -r1.4.2.4 -r1.4.2.5
--- HTMLGenerator.java 2001/08/05 16:41:35 1.4.2.4
+++ HTMLGenerator.java 2001/08/11 19:02:21 1.4.2.5
@@ -45,7 +45,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.4.2.4 $ $Date: 2001/08/05 16:41:35 $
+ * @version CVS $Revision: 1.4.2.5 $ $Date: 2001/08/11 19:02:21 $
*/
public class HTMLGenerator extends ComposerGenerator implements Cacheable,
Recyclable {
@@ -143,10 +143,11 @@
}
} catch (IOException e){
getLogger().warn("HTMLGenerator.generate()", e);
- throw new ResourceNotFoundException("Could not get Resource for
HTMLGenerator", e);
+ throw new ResourceNotFoundException("Could not get resource "
+ + this.inputSource.getSystemId(), e);
} catch (SAXException e){
getLogger().error("HTMLGenerator.generate()", e);
- throw(e);
+ throw e;
} catch (ProcessingException e){
throw e;
} catch (Exception e){
1.4.2.3 +4 -3
xml-cocoon2/src/org/apache/cocoon/generation/ImageDirectoryGenerator.java
Index: ImageDirectoryGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ImageDirectoryGenerator.java,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- ImageDirectoryGenerator.java 2001/07/23 13:01:13 1.4.2.2
+++ ImageDirectoryGenerator.java 2001/08/11 19:02:21 1.4.2.3
@@ -26,7 +26,7 @@
* files.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Donald A. Ball Jr.</a>
- * @version $Revision: 1.4.2.2 $ $Date: 2001/07/23 13:01:13 $
+ * @version $Revision: 1.4.2.3 $ $Date: 2001/08/11 19:02:21 $
*/
public class ImageDirectoryGenerator extends DirectoryGenerator {
@@ -48,8 +48,9 @@
getLogger().debug("getSize(path) = " + dim);
attributes.addAttribute("",IMAGE_WIDTH_ATTR_NAME,IMAGE_WIDTH_ATTR_NAME,"CDATA",""+dim[0]);
attributes.addAttribute("",IMAGE_HEIGHT_ATTR_NAME,IMAGE_HEIGHT_ATTR_NAME,"CDATA",""+dim[1]);
- } catch (RuntimeException e)
{getLogger().debug("ImageDirectoryGenerator.setNodeAttributes", e);}
- catch (Exception e) {
+ } catch (RuntimeException e) {
+ getLogger().debug("ImageDirectoryGenerator.setNodeAttributes",
e);
+ } catch (Exception e) {
getLogger().error("ImageDirectoryGenerator.setNodeAttributes",
e);
throw new SAXException(e);
}
1.7.2.2 +4 -3
xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java
Index: ScriptGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- ScriptGenerator.java 2001/07/07 19:08:17 1.7.2.1
+++ ScriptGenerator.java 2001/08/11 19:02:21 1.7.2.2
@@ -21,6 +21,7 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.components.parser.Parser;
import org.apache.cocoon.environment.Source;
import org.apache.cocoon.environment.SourceResolver;
@@ -47,7 +48,7 @@
* </pre>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Foster</a>
- * @version CVS $Revision: 1.7.2.1 $ $Date: 2001/07/07 19:08:17 $
+ * @version CVS $Revision: 1.7.2.2 $ $Date: 2001/08/11 19:02:21 $
*/
public class ScriptGenerator extends ComposerGenerator implements
Configurable,
Recyclable {
@@ -166,8 +167,8 @@
parser.setConsumer(this.xmlConsumer);
parser.parse(xmlInput);
} catch (FileNotFoundException e) {
- throw new ProcessingException(
- "Exception in ScriptGenerator.generate()", e);
+ throw new ResourceNotFoundException(
+ "Could not load script " + this.inputSource.getSystemId(),
e);
} catch (BSFException e) {
throw new ProcessingException(
"Exception in ScriptGenerator.generate()", e);
1.7.2.6 +8 -8
xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -u -r1.7.2.5 -r1.7.2.6
--- ServerPagesGenerator.java 2001/07/24 00:37:08 1.7.2.5
+++ ServerPagesGenerator.java 2001/08/11 19:02:21 1.7.2.6
@@ -47,7 +47,7 @@
* delegating actual SAX event generation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.7.2.5 $ $Date: 2001/07/24 00:37:08 $
+ * @version CVS $Revision: 1.7.2.6 $ $Date: 2001/08/11 19:02:21 $
*/
public class ServerPagesGenerator
extends ServletGenerator
@@ -149,16 +149,16 @@
}
try {
- generator = (XSPGenerator)
- programGenerator.load(this.manager, super.source,
this.markupLanguage, this.programmingLanguage, this.resolver);
+ generator = (XSPGenerator)
+ programGenerator.load(this.manager, super.source,
this.markupLanguage, this.programmingLanguage, this.resolver);
} catch (ProcessingException e) {
- throw e;
+ throw e;
} catch (Exception e) {
- getLogger().warn("ServerPagesGenerator.generate()", e);
- throw new ResourceNotFoundException(e.getMessage(), e);
+ getLogger().warn("ServerPagesGenerator.generate()", e);
+ throw new ResourceNotFoundException(e.getMessage(), e);
} catch (NoClassDefFoundError e) {
- getLogger().warn("Failed to load class: " + e);
- throw new ResourceNotFoundException(e.getMessage());
+ getLogger().warn("Failed to load class: " + e);
+ throw new ResourceNotFoundException(e.getMessage());
}
generator.setup(this.resolver, this.objectModel, super.source,
this.parameters);
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]