Hi,
I am using velocity to generate sql. When I use a StringWriter generation is
full and is displayed correctly in console. However when I use a
java.io.FileWriter, the generated file does not contain all data, and gets
truncated after 32K. I am running JDK 1.5 on Windows XP and I am using Velocity
1.4. I see no errors in the velocity log.
Is there a limit to the size of the file (32K), that can be generated? What
else could be wrong? Would appreciate any help.
Here is the code I am using:
package com.orcc.qwb;
import java.io.StringWriter;
import java.util.Hashtable;
import java.util.List;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import java.io.File;
import java.io.FileWriter;
public class VelocityBean {
public static void generateApptextSQL(String appid, Hashtable table) throws
Exception {
/* first, we init the runtime engine. Defaults are fine. */
Velocity.init();
VelocityContext context = new VelocityContext();
context.put("appid", appid);
context.put("apptext",table);
//Works fine
StringWriter sw = new StringWriter();
Velocity.mergeTemplate("velocityTemplate.vm","ISO-8859-1",context,sw);
System.out.println(sw);
//Output truncated after 32K
File file = new File("c:\velcoityOutput.txt");
FileWriter fw = new FileWriter(file);
Velocity.mergeTemplate("apptext.vm","ISO-8859-1",context,fw);
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]