Turbine's ParameterParser utility class makes use of the
TurbineUploadService to handle upload of files during multipart
requests automatically:

        if (tmp != null && tmp.startsWith("multipart/form-data") &&
            TurbineUpload.getAutomatic())
        {
            ...

If you do not have the TurbineUploadService configured in your
properties file, the call to getAutomatic() fails internally when the
TurbineServices broker throws an InstantiationException after being
passed the name of service it knows nothing about.  This patch allows
getAutomatic() to be called regardless of whether the service is
registered in the TurbineResources.properties file.  If no one has a
problem with it, I will be applying it this weekend.  Let me know if
you have any questions.

Index: TurbineUpload.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/services/upload/TurbineUpload.java,v
retrieving revision 1.4
diff -u -u -r1.4 TurbineUpload.java
--- TurbineUpload.java  2000/12/06 10:13:37     1.4
+++ TurbineUpload.java  2000/12/08 07:45:43
@@ -88,8 +88,16 @@
      */
     public static boolean getAutomatic()
     {
-        UploadService upload = (UploadService)TurbineServices
-            .getInstance().getService(UploadService.SERVICE_NAME);
+        UploadService upload = null;
+        try
+        {
+            upload = (UploadService)TurbineServices.getInstance()
+                .getService(UploadService.SERVICE_NAME);
+        }
+        catch (org.apache.turbine.services.InstantiationException
notConfigured)
+        {
+            return false;
+        }
         String auto = upload.getProperties()
             .getProperty(UploadService.AUTOMATIC_KEY,
                          UploadService.AUTOMATIC_DEFAULT.toString())


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to