cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <stuart.roeb...@adolos.co.uk>
Subject [C2] [Patch] ResourceReader.java - setContentType()
Date Sat, 03 Mar 2001 16:40:07 GMT
The 1.1.2.20 revision of ResourceReader.java has introduced a problem on my setup.  I include
a patch which fixes the problem for me, but I make no claims to know the surrounding code,
so I may only be dealing with the symptoms!

The impact of this for me was that javascript files were not being served properly to *most*
web browsers.  The exception was Internet Explorer on MacOS X Beta.  So I assume this is somehow
tied up with the nature of the HTTP request.

The direct symptom was a null pointer exception when setting the content type. It looks like
the newly introduced setting of content type doesn't account for situations when getMimeType
may return a null value.

Here's the patch:

Index: src/org/apache/cocoon/reading/ResourceReader.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
retrieving revision 1.1.2.20
diff -u -r1.1.2.20 ResourceReader.java
--- src/org/apache/cocoon/reading/ResourceReader.java	2001/02/23 21:36:37	1.1.2.20
+++ src/org/apache/cocoon/reading/ResourceReader.java	2001/03/03 16:32:14
@@ -132,7 +132,8 @@
             byte[] buffer = new byte[(int)len];
             is.read(buffer);
             is.close();
-            res.setContentType(this.getMimeType());
+            final String mimeType = this.getMimeType();
+            if (mimeType != null) res.setContentType(this.getMimeType());
             res.setContentLength(buffer.length);
             long expires = parameters.getParameterAsInteger("expires", -1);


Mime
View raw message