commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Kuenzler <sv...@imost.de>
Subject Re: [Morphos] Initial code commit in Jakarta Commons Sandbox
Date Thu, 25 Jul 2002 18:23:05 GMT
Nicola Ken Barozzi schrieb:

> Initial codebase for Morphos is now in jakarta-commons-sandbox/morphos.

I'd like to propose a patch modifing IS2SAXMorpher and EPMorpher. The 
way you initially commited it, people won't get what Morpher and 
AbstractMorpher are for.

Also, please note that the examples target fails because it misses 
JAXP+Parser in classpath. Setting fork="no" instantly opens 
xml.jar-hell, so this is no solution either :-(

	Sven

Index: src/java/org/apache/commons/morphos/MorphException.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/MorphException.java,v
retrieving revision 1.1
diff -u -r1.1 MorphException.java
--- src/java/org/apache/commons/morphos/MorphException.java	25 Jul 2002 13:18:10 -0000	1.1
+++ src/java/org/apache/commons/morphos/MorphException.java	25 Jul 2002 18:06:43 -0000
@@ -66,7 +66,7 @@
     public MorphException(String message){
       super(message);
     }
-
+   /* FIXME java.lang.Exception is not capable of nested Throwables.
     public MorphException(String message, Throwable cause){
       super(message, cause);
     }
@@ -74,7 +74,7 @@
     public MorphException(Throwable cause){
       super(cause);
     }
-
+   */
  }


Index: src/java/org/apache/commons/morphos/ObjectFlavorException.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/ObjectFlavorException.java,v
retrieving revision 1.1
diff -u -r1.1 ObjectFlavorException.java
--- src/java/org/apache/commons/morphos/ObjectFlavorException.java	25 Jul 2002 13:18:10 -0000
1.1
+++ src/java/org/apache/commons/morphos/ObjectFlavorException.java	25 Jul 2002 18:06:43 -0000
@@ -66,14 +66,14 @@
     public ObjectFlavorException(String message){
       super(message);
     }
-
+   /* FIXME java.lang.Exception is not capable of nested Throwables.
     public ObjectFlavorException(String message, Throwable cause){
       super(message, cause);
     }

     public ObjectFlavorException(Throwable cause){
       super(cause);
-   }
+   }*/

  }

Index: 
src/java/org/apache/commons/morphos/morphers/dataform/InputSource2SAXMorpher.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/morphers/dataform/InputSource2SAXMorpher.java,v
retrieving revision 1.1
diff -u -r1.1 InputSource2SAXMorpher.java
--- src/java/org/apache/commons/morphos/morphers/dataform/InputSource2SAXMorpher.java	25 Jul
2002 13:19:28 -0000	1.1
+++ src/java/org/apache/commons/morphos/morphers/dataform/InputSource2SAXMorpher.java	25 Jul
2002 18:06:44 -0000
@@ -73,13 +73,23 @@
      super();
    }

-  public void setInput(InputSource input){
-       this.input=input;
+  public void setInput(Object input) throws ObjectFlavorException{
+     	if(input instanceof InputSource){
+          this.input = (InputSource)input;
+        } else {
+          throw new ObjectFlavorException("Cannot handle input object 
of class "+input.getClass().getName()+", expected InputSource");
+        }
    }

-  public void setOutput(ContentHandler output){
-       this.output=output;
-  }
+     public void setOutput(Object output) throws ObjectFlavorException
+     {
+     	if(output instanceof ContentHandler){
+          this.output = (ContentHandler)output;
+        } else {
+          throw new ObjectFlavorException("Cannot handle output object 
of class "+output.getClass().getName()+", expected ContentHandler");
+        }
+     }
+

    public void morph() throws MorphException{
      try{
Index: 
src/java/org/apache/commons/morphos/morphers/poi/ElementProcessorMorpher.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/morphers/poi/ElementProcessorMorpher.java,v
retrieving revision 1.1
diff -u -r1.1 ElementProcessorMorpher.java
--- src/java/org/apache/commons/morphos/morphers/poi/ElementProcessorMorpher.java	25 Jul 2002
13:19:50 -0000	1.1
+++ src/java/org/apache/commons/morphos/morphers/poi/ElementProcessorMorpher.java	25 Jul 2002
18:06:45 -0000
@@ -138,9 +138,13 @@
       * @param output the OutputStream to which the serialized data will
       *            be written
       */
-     public void setOutput(OutputStream output)
+     public void setOutput(Object output) throws ObjectFlavorException
       {
-        _output_stream = output;
+     	if(output instanceof OutputStream){
+          _output_stream = (OutputStream)output;
+        } else {
+          throw new ObjectFlavorException("Cannot handle output object 
of class "+output.getClass().getName()+", expected OutputStream.");
+        }
       }

      /**




--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message