forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r485912 - in /forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin: AggregateInputPlugin.java PassThroughInputPlugin.java XSLTInputPlugin.java
Date Mon, 11 Dec 2006 22:12:48 GMT
Author: rgardler
Date: Mon Dec 11 14:12:47 2006
New Revision: 485912

URL: http://svn.apache.org/viewvc?view=rev&rev=485912
Log:
- Keep tabs on the source document that created this internal document so that we have tracability
(particularly useful in error messages)
- better error handling in XSLT Plugin

Modified:
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/AggregateInputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/AggregateInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/AggregateInputPlugin.java?view=diff&rev=485912&r1=485911&r2=485912
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/AggregateInputPlugin.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/AggregateInputPlugin.java
Mon Dec 11 14:12:47 2006
@@ -66,12 +66,12 @@
 			if (startPos > -1 && endPos > -1) {
 				sb.append(content.substring(startPos + 6, endPos - 1));
 			} else {
-				throw new ProcessingException("Invalid document in the aggregate collection");
+				throw new ProcessingException("Invalid document in the aggregate collection: Document
type = " + doc.getType());
 			}
 		}
 		sb.append(getDocumentFooter());
 
-		return new InternalDocument(aggregateDoc.getRequestURI(), sb.toString());
+		return new InternalDocument((AbstractSourceDocument)aggregateDoc, sb.toString());
 	}
 
 	private CharSequence getDocumentHeader() {

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java?view=diff&rev=485912&r1=485911&r2=485912
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
Mon Dec 11 14:12:47 2006
@@ -19,6 +19,7 @@
 import java.io.IOException;
 
 import org.apache.forrest.core.Controller;
+import org.apache.forrest.core.document.AbstractSourceDocument;
 import org.apache.forrest.core.document.IDocument;
 import org.apache.forrest.core.document.InternalDocument;
 
@@ -31,7 +32,7 @@
 public class PassThroughInputPlugin extends AbstractInputPlugin {
 
 	public IDocument process(final Controller controller, final IDocument doc) throws IOException
{
-		return new InternalDocument(doc.getRequestURI(), doc.getContentAsString());
+		return new InternalDocument((AbstractSourceDocument)doc, doc.getContentAsString());
 	}
 
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java?view=diff&rev=485912&r1=485911&r2=485912
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java
Mon Dec 11 14:12:47 2006
@@ -33,8 +33,10 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.apache.forrest.core.Controller;
+import org.apache.forrest.core.document.AbstractSourceDocument;
 import org.apache.forrest.core.document.IDocument;
 import org.apache.forrest.core.document.InternalDocument;
+import org.apache.forrest.core.exception.ProcessingException;
 
 /**
  * A plugin that performs an XSLT transformation on a source documents to create
@@ -68,7 +70,7 @@
 		}
 	}
 
-	public IDocument process(final Controller controller, final IDocument doc) throws IOException
{
+	public IDocument process(final Controller controller, final IDocument doc) throws IOException,
ProcessingException {
 		final TransformerFactory tFactory = TransformerFactory.newInstance();
 
 		try {
@@ -83,19 +85,13 @@
 			final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
 			final StreamResult out = new StreamResult(outStream);
 			transformer.transform(in, out);
-			return new InternalDocument(doc.getRequestURI(), outStream.toString());
+			return new InternalDocument((AbstractSourceDocument)doc, outStream.toString());
 		} catch (final TransformerConfigurationException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			return null;
+			throw new ProcessingException("Unable tocfigure XSL Transformer", e);
 		} catch (final TransformerException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			return null;
+			throw new ProcessingException("Unable to transform source document", e);
 		} catch (final URISyntaxException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			return null;
+			throw new ProcessingException("URI Syntax exception", e);
 		}
 	}
 



Mime
View raw message