You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:20:58 UTC

[sling-org-apache-sling-commons-contentdetection] 18/30: SLING-4757 - be more explicit about IllegalArgumentException

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.contentdetection-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-contentdetection.git

commit 95159fa37c56d03a2fd379c90faa5c8e09b73ec6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jun 18 11:57:10 2015 +0000

    SLING-4757 - be more explicit about IllegalArgumentException
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/contentdetection@1686196 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/commons/contentdetection/ContentAwareMimeTypeService.java | 6 ++++--
 .../contentdetection/internal/ContentAwareMimeTypeServiceImpl.java  | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/contentdetection/ContentAwareMimeTypeService.java b/src/main/java/org/apache/sling/commons/contentdetection/ContentAwareMimeTypeService.java
index 5999dc1..3ccd6ae 100644
--- a/src/main/java/org/apache/sling/commons/contentdetection/ContentAwareMimeTypeService.java
+++ b/src/main/java/org/apache/sling/commons/contentdetection/ContentAwareMimeTypeService.java
@@ -35,9 +35,11 @@ public interface ContentAwareMimeTypeService extends MimeTypeService {
     /**
      * @param filename Used if <code>content</code> is <code>null</code> or if
      *                 this service does not support content-based detection
-     * @param content  Optional stream that points to the content to analyze,
+     * @param contentStream  Optional stream that points to the content to analyze,
      *                 must support mark/reset.
+     * @throws IllegalArgumentException if contentStream does not support mark/reset
+     * @throws IOException if there's a problem reading the contentStream                  
      * @return the mime type
      */
-    String getMimeType(String filename, InputStream content) throws IOException;
+    String getMimeType(String filename, InputStream contentStream) throws IOException, IllegalArgumentException;
 }
diff --git a/src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java b/src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java
index 29e8508..1e630ed 100644
--- a/src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java
+++ b/src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java
@@ -46,7 +46,7 @@ public class ContentAwareMimeTypeServiceImpl implements  ContentAwareMimeTypeSer
     @Reference
     MimeTypeService mimeTypeService;
 
-    public String getMimeType(String filename, InputStream content) throws IOException {
+    public String getMimeType(String filename, InputStream content) throws IOException, IllegalArgumentException {
         if(content == null) {
             return mimeTypeService.getMimeType(filename);
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.