You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Timothy Larson <Td...@ci.canton.oh.us> on 2003/02/13 17:07:14 UTC

[2.0.5dev 20030212 snapshot] SWT: Cannot set serializer

Using Cocoon-2.0.5dev from the 2003-02-12 snapshot.
I am trying to write a PDF file to disk using the SourceWriting-Transformer.
The trouble is I cannot seem to set the serializer to "fo2pdf".
It insists on using the "xml" serializer, and even then fails with this message:

ERROR   (2003-02-13) 10:48.34:800   [access] (/cocoon-2.0.5-12/test/template.save-pdf) PoolThread-4/CocoonServlet: Problem with Cocoon servlet
org.apache.cocoon.ProcessingException: Exception during processing of cocoon://test/template.xml: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: org.apache.cocoon.ProcessingException: Cannot get 'xml' serializer

The xml I am feeding to the SWT looks about like this:

<?xml version="1.0" encoding="UTF-8"?>
<source:write serializer="fo2pdf" xmlns:source="http://apache.org/cocoon/source/1.0">
<source:serializer>fo2pdf</source:serializer>
<source:source>../data/template.pdf</source:source>
<source:fragment>
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    ...
  </fo:root>
</source:fragment>
</source:write>

I call the SWT like this:

<map:transform type="swt">
  <map:parameter name="serializer" value="fo2pdf"/>
</map:transform>

I define the SWT like this:

<map:transformer name="swt"
  src="org.apache.cocoon.transformation.SourceWritingTransformer"
  logger="sitemap.transformer.filewriter">
  <map:parameter name="serializer" value="fo2pdf"/>
</map:transformer>

Any help resolving this would be appreciated,
Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForms prepare/perform nothrow

Posted by Jakob Praher <jp...@yahoo.de>.
Am Don, 2003-02-13 um 19.17 schrieb Jeroen Cranendonk:
> > Am Don, 2003-02-13 um 17.20 schrieb Jeroen Cranendonk:
> > > Our company is currently building a project around cocoon(yay:) and
> xmlforms.
> > > We are using the current development cvs version.
> > > Working on this it occured to me that the prepare and perform methods of
> > > the AbstractXMLFormAction class don't allow the throwing of any
> exceptions
> > > whatsoever.
> > > My question is if this is by design or by error, and how I should handle
> any
> > > errors occuring in my implementations of prepare and perform.
> > > (And if this is by error and not design, if anyone feels like fixin it
> soon
> > > ^.^ )
> >
> > you mean the perform( ) method does not declare a checked exception?
> I mean AbstractXMLFormAction.java says :
> perform();
> and not
> perform() throws someExceptions;

jup.

> > first:
> > you can use the following trick to throw always an exception
> >
> > try {
> >
> > } catch ( Throwable t ) {
> > throw new RuntimeException( t ) ;
> > }
> >
> > this works, since RuntimeException and subclasses don't need to occur in
> > the signature.
> Sounds good, I'll try that :)
> will this still be cought more upwards by cocoon tho, so it can generate a
> cocoon
> error page ? (using <map:handle-errors>, that's what I want really )
> 
sure ase RuntimeException extends Exception, so if you do 

catch ( Exception e ) {
	
}

you also get RuntimeExceptions like NullPointerException and things like
that ...

-- Jakob


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForms prepare/perform nothrow

Posted by Jeroen Cranendonk <j....@emaxx.nl>.
> Am Don, 2003-02-13 um 17.20 schrieb Jeroen Cranendonk:
> > Our company is currently building a project around cocoon(yay:) and
xmlforms.
> > We are using the current development cvs version.
> > Working on this it occured to me that the prepare and perform methods of
> > the AbstractXMLFormAction class don't allow the throwing of any
exceptions
> > whatsoever.
> > My question is if this is by design or by error, and how I should handle
any
> > errors occuring in my implementations of prepare and perform.
> > (And if this is by error and not design, if anyone feels like fixin it
soon
> > ^.^ )
>
> you mean the perform( ) method does not declare a checked exception?
I mean AbstractXMLFormAction.java says :
perform();
and not
perform() throws someExceptions;

> first:
> you can use the following trick to throw always an exception
>
> try {
>
> } catch ( Throwable t ) {
> throw new RuntimeException( t ) ;
> }
>
> this works, since RuntimeException and subclasses don't need to occur in
> the signature.
Sounds good, I'll try that :)
will this still be cought more upwards by cocoon tho, so it can generate a
cocoon
error page ? (using <map:handle-errors>, that's what I want really )

> if you want to say that the form has an error, you are better up using
> the Form.addViolations( ... ) method.
>
> for more info on Violations look into
> org.apache.cocoon.components.validation.Violation
I want to report an error more sever then a violation, like a db failing or
so,
or a coders messup ^.^
violations are really only for when the user input on a form is bad right ?

>
> hope this helps
>
> -- Jakob
>
Thankies for the interest :)
 Jeroen


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForms prepare/perform nothrow

Posted by Jakob Praher <jp...@yahoo.de>.
Am Don, 2003-02-13 um 17.20 schrieb Jeroen Cranendonk:
> Our company is currently building a project around cocoon(yay:) and xmlforms.
> We are using the current development cvs version.
> Working on this it occured to me that the prepare and perform methods of
> the AbstractXMLFormAction class don't allow the throwing of any exceptions
> whatsoever.
> My question is if this is by design or by error, and how I should handle any
> errors occuring in my implementations of prepare and perform.
> (And if this is by error and not design, if anyone feels like fixin it soon 
> ^.^ )

you mean the perform( ) method does not declare a checked exception? 

first:
you can use the following trick to throw always an exception

try {

} catch ( Throwable t ) {
	throw new RuntimeException( t ) ;
}

this works, since RuntimeException and subclasses don't need to occur in
the signature.

if you want to say that the form has an error, you are better up using
the Form.addViolations( ... ) method.

for more info on Violations look into
org.apache.cocoon.components.validation.Violation

hope this helps

-- Jakob

> 
> Many thanks in advance for any replies,
> 	Jeroen Cranendonk,
> 		eMAXX software developer.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForms prepare/perform nothrow

Posted by ivelin <iv...@apache.org>.
This is by design.
AbstractXMLFormAction does not know how to handle application specific
errors thrown by the prepare/perform callbacks.
If you can't do anything about an exception which occurs within the method,
then throw a runtime exception.



-=Ivelin=-
----- Original Message -----
From: "Jeroen Cranendonk" <j....@emaxx.nl>
To: <co...@xml.apache.org>
Sent: Thursday, February 13, 2003 10:20 AM
Subject: XMLForms prepare/perform nothrow


Our company is currently building a project around cocoon(yay:) and
xmlforms.
We are using the current development cvs version.
Working on this it occured to me that the prepare and perform methods of
the AbstractXMLFormAction class don't allow the throwing of any exceptions
whatsoever.
My question is if this is by design or by error, and how I should handle any
errors occuring in my implementations of prepare and perform.
(And if this is by error and not design, if anyone feels like fixin it soon
^.^ )

Many thanks in advance for any replies,
Jeroen Cranendonk,
eMAXX software developer.



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


XMLForms prepare/perform nothrow

Posted by Jeroen Cranendonk <j....@emaxx.nl>.
Our company is currently building a project around cocoon(yay:) and xmlforms.
We are using the current development cvs version.
Working on this it occured to me that the prepare and perform methods of
the AbstractXMLFormAction class don't allow the throwing of any exceptions
whatsoever.
My question is if this is by design or by error, and how I should handle any
errors occuring in my implementations of prepare and perform.
(And if this is by error and not design, if anyone feels like fixin it soon 
^.^ )

Many thanks in advance for any replies,
	Jeroen Cranendonk,
		eMAXX software developer.



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org