Author: jfrederic.clere(a)jboss.com
Date: 2008-04-01 11:48:09 -0400 (Tue, 01 Apr 2008)
New Revision: 578
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/jasper/compiler/Compiler.java
Log:
Fix bugzilla 42693 for case 171944.
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/jasper/compiler/Compiler.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/jasper/compiler/Compiler.java 2008-04-01
15:37:54 UTC (rev 577)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/jasper/compiler/Compiler.java 2008-04-01
15:48:09 UTC (rev 578)
@@ -141,24 +141,10 @@
ctxt.checkOutputDir();
String javaFileName = ctxt.getServletJavaFileName();
+
ServletWriter writer = null;
-
try {
- // Setup the ServletWriter
- String javaEncoding = ctxt.getOptions().getJavaEncoding();
- OutputStreamWriter osw = null;
- try {
- osw = new OutputStreamWriter(
- new FileOutputStream(javaFileName), javaEncoding);
- } catch (UnsupportedEncodingException ex) {
- errDispatcher.jspError("jsp.error.needAlternateJavaEncoding",
- javaEncoding);
- }
-
- writer = new ServletWriter(new PrintWriter(osw));
- ctxt.setWriter(writer);
-
// Reset the temporary variable counter for the generator.
JspUtil.resetTemporaryVariableName();
@@ -168,6 +154,7 @@
if (ctxt.isPrototypeMode()) {
// generate prototype .java file for the tag file
+ writer = setupContextWriter(javaFileName);
Generator.generate(writer, this, pageNodes);
writer.close();
writer = null;
@@ -207,6 +194,7 @@
ELFunctionMapper.map(this, pageNodes);
// generate servlet .java file
+ writer = setupContextWriter(javaFileName);
Generator.generate(writer, this, pageNodes);
writer.close();
writer = null;
@@ -259,6 +247,26 @@
return smapStr;
}
+ private ServletWriter setupContextWriter(String javaFileName)
+ throws FileNotFoundException, JasperException {
+ ServletWriter writer;
+ // Setup the ServletWriter
+ String javaEncoding = ctxt.getOptions().getJavaEncoding();
+ OutputStreamWriter osw = null;
+
+ try {
+ osw = new OutputStreamWriter(
+ new FileOutputStream(javaFileName), javaEncoding);
+ } catch (UnsupportedEncodingException ex) {
+ errDispatcher.jspError("jsp.error.needAlternateJavaEncoding",
+ javaEncoding);
+ }
+
+ writer = new ServletWriter(new PrintWriter(osw));
+ ctxt.setWriter(writer);
+ return writer;
+ }
+
/**
* Compile the servlet from .java file to .class file
*/
Show replies by date