> Christopher Elkins wrote:
> > Great...exactly what I was afraid of: the org.webmacro.Template interface has
> > changed, which is breaking TurbineWebMacroService. I can describe the problem,
> > but I don't know enough about WM to fix it safely. Here's the error:
> >
> >
> C:\Projects\jakarta\turbine\bin\src\org\apache\turbine\services\webmacro\Turbine
> > WebMacroService.java:211: Method write(java.io.Writer,
> > org.webmacro.servlet.WebContext) not found in interface org.webmacro.Template.
> > template.write(out, wc);
> >
> > Template.write() now takes a FastWriter as the first param (see
> > org.webmacro.Macro for the inherited method). This is probably going to
> require
> > a refactoring of TurbineWebMacroService.handleRequest(). Any takers?
Here is the patch for fixing this:
--cut----------------------------------------------------------------------
diff -u -r1.7 TurbineWebMacroService.java
--- TurbineWebMacroService.java 2000/09/04 00:56:18 1.7
+++ TurbineWebMacroService.java 2000/09/10 20:51:02
@@ -197,18 +197,24 @@
throws Exception
{
String results = null;
- StringWriter sw = null;
try
{
- sw = new StringWriter();
- handleRequest (wc,filename,sw);
- results = sw.toString();
- }
- finally
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ // we should encode the byte stream as UTF-16, to achieve
+ // the fastest conversion back to Java characters
+ // for some reason this does not work. (bug in FastWriter?)
+ // UTF-8 seems to work and is used as a fallback option.
+ FastWriter fw = new FastWriter(bytes, "UTF-8");
+ handleRequest (wc,filename,fw);
+ fw.flush();
+ results = bytes.toString("UTF-8");
+ }
+ catch( Exception e )
{
- if (sw != null)
- sw.close();
- }
+ org.apache.turbine.util.Log.error("an error occured while rendering
+template "+filename+":\n"+e.getMessage());
+ org.apache.turbine.util.Log.error(e);
+ }
+
return results;
}
@@ -224,7 +230,7 @@
*/
public void handleRequest(WebContext wc,
String filename,
- Writer out)
+ FastWriter out)
throws Exception
{
Template template = getTemplate(filename);
diff -u -r1.5 WebMacroService.java
--- WebMacroService.java 2000/08/31 18:26:46 1.5
+++ WebMacroService.java 2000/09/10 20:51:03
@@ -105,7 +105,7 @@
*/
public void handleRequest(WebContext wc,
String template,
- Writer out)
+ FastWriter out)
throws Exception;
/**
--cut----------------------------------------------------------------------
I tested it, and works fine, but I didn't commit it. If someone is competent
to remove GPL'ed jars and make the build use the new APL'ed jars, please
do it, and use the above patch to fix Turbine.
Can't help you with JDK 1.1 issue though. I don't feel like messing around
with obsolete JDK. I'd be happy to see 1.1 compatibility dropped, and some
1.2 stuff used throughout Turbine (e.g. Collections), I hope that 1.2
is going to be available on BSD really soon ;-).
Rafal
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]