File: 625764.diff

package info (click to toggle)
sitemesh 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,792 kB
  • sloc: java: 6,708; xml: 551; jsp: 393; perl: 64; makefile: 11
file content (92 lines) | stat: -rw-r--r-- 3,910 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Description: Compatibility with Velocity Tools 2.0
Author: Miguel Landaeta <miguel@miguel.cc>
Bug-Debian: http://bugs.debian.org/625764
Forwarded: no
Last-Update: 2011-05-06

--- sitemesh-2.4.1+dfsg.orig/src/java/com/opensymphony/module/sitemesh/velocity/VelocityDecoratorServlet.java
+++ sitemesh-2.4.1+dfsg/src/java/com/opensymphony/module/sitemesh/velocity/VelocityDecoratorServlet.java
@@ -19,6 +19,7 @@ import org.apache.velocity.tools.view.se
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.StringWriter;
+import java.io.IOException;
 
 /**
  * Servlet that allows Velocity templates to be used as decorators.
@@ -27,7 +28,7 @@ import java.io.StringWriter;
  * @version $Revision: 1.9 $
  */
 public class VelocityDecoratorServlet extends VelocityViewServlet {
-    public Template handleRequest(HttpServletRequest request, HttpServletResponse response, Context context) throws Exception {
+    public Template handleRequest(HttpServletRequest request, HttpServletResponse response, Context context) {
         HTMLPage htmlPage = (HTMLPage) request.getAttribute(RequestConstants.PAGE);
         String template;
 
@@ -48,13 +49,21 @@ public class VelocityDecoratorServlet ex
             context.put("title", OutputConverter.convert(htmlPage.getTitle()));
             {
                 StringWriter buffer = new StringWriter();
-                htmlPage.writeBody(OutputConverter.getWriter(buffer));
-                context.put("body", buffer.toString());
+                try {
+                    htmlPage.writeBody(OutputConverter.getWriter(buffer));
+                    context.put("body", buffer.toString());
+                } catch (IOException e) {
+                    context.put("body", "<p>Body?</p>");
+                }
             }
             {
                 StringWriter buffer = new StringWriter();
-                htmlPage.writeHead(OutputConverter.getWriter(buffer));
-                context.put("head", buffer.toString());
+                try {
+                    htmlPage.writeHead(OutputConverter.getWriter(buffer));
+                    context.put("head", buffer.toString());
+                } catch (IOException e) {
+                    context.put("head", "<!-- head -->");
+                }
             }
             context.put("page", htmlPage);
             DecoratorMapper decoratorMapper = getDecoratorMapper();
@@ -70,4 +79,4 @@ public class VelocityDecoratorServlet ex
         DecoratorMapper decoratorMapper = factory.getDecoratorMapper();
         return decoratorMapper;
     }
-}
\ No newline at end of file
+}
--- sitemesh-2.4.1+dfsg.orig/src/java/com/opensymphony/module/sitemesh/util/OutputConverter.java
+++ sitemesh-2.4.1+dfsg/src/java/com/opensymphony/module/sitemesh/util/OutputConverter.java
@@ -18,14 +18,21 @@ public class OutputConverter
 
     public static Writer getWriter(Writer out)
     {
+        /* resin 2.1.12 was released at least 8 years ago...
+         * I guess it is safe to disable this work around
         if ("true".equalsIgnoreCase(System.getProperty(WORK_AROUND_RESIN_I18N_BUG)))
             return new ResinWriter(out);
         else
             return out;
+        */
+        return out;
     }
 
-    public static String convert(String inputString) throws IOException
+    // public static String convert(String inputString) throws IOException
+    public static String convert(String inputString)
     {
+        /* resin 2.1.12 was released at least 8 years ago...
+         * I guess it is safe to disable this work around
         if ("true".equalsIgnoreCase(System.getProperty(WORK_AROUND_RESIN_I18N_BUG)))
         {
             StringWriter sr = new StringWriter();
@@ -34,6 +41,8 @@ public class OutputConverter
         }
         else
             return inputString;
+        */
+        return inputString;
     }
 
     /**