cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1205786 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs: provider/MultipartProvider.java utils/multipart/AttachmentUtils.java utils/multipart/MultipartReadException.java
Date Thu, 24 Nov 2011 10:59:00 GMT
Author: sergeyb
Date: Thu Nov 24 10:58:59 2011
New Revision: 1205786

URL: http://svn.apache.org/viewvc?rev=1205786&view=rev
Log:
[CXF-3933] Adding MultipartReadException

Added:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
  (with props)
Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java?rev=1205786&r1=1205785&r2=1205786&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
Thu Nov 24 10:58:59 2011
@@ -167,7 +167,7 @@ public class MultipartProvider extends A
         if (multipart != null) {
             return fromAttachment(multipart, c, t, anns);
         }
-        throw new WebApplicationException(404);
+        throw new WebApplicationException(400);
     }
     
     private Class<?> getActualType(Type type, int pos) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java?rev=1205786&r1=1205785&r2=1205786&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
Thu Nov 24 10:58:59 2011
@@ -114,8 +114,8 @@ public final class AttachmentUtils {
                                                        id.value(),
                                                        mt.toString());
             LOG.warning(errorMsg.toString());
-            return null;
-            
+            throw new WebApplicationException(
+                      new MultipartReadException(id.value(), id.type(), errorMsg.toString()));
         }
         
         return infos.size() > 0 ? infos.get(0) : null; 

Added: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java?rev=1205786&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
(added)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
Thu Nov 24 10:58:59 2011
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxrs.utils.multipart;
+
+import java.io.IOException;
+
+public class MultipartReadException extends IOException {
+    private String expectedContentId;    
+    private String expectedContentType;
+    private String errorMessage;
+    public MultipartReadException(String expectedContentId, 
+                                  String expectedContentType,
+                                  String errorMessage) {
+        this.expectedContentId = expectedContentId;
+        this.expectedContentType = expectedContentType;
+        this.errorMessage = errorMessage;
+    }
+    
+    public String getExpectedContentId() {
+        return expectedContentId;
+    }
+    
+    public String getExpectedContentType() {
+        return expectedContentType;
+    }
+    
+    public String getMessage() {
+        return errorMessage;
+    }
+}

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/MultipartReadException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message