james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [3/9] james-project git commit: JAMES-2013 Remove unused parameter
Date Thu, 08 Jun 2017 02:46:40 GMT
JAMES-2013 Remove unused parameter


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/16968c4f
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/16968c4f
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/16968c4f

Branch: refs/heads/master
Commit: 16968c4fbfe684ecd65363c119d1253c1f187f78
Parents: 1425048
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Wed May 3 16:15:45 2017 +0200
Committer: benwa <btellier@linagora.com>
Committed: Thu Jun 8 09:46:25 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/extractor/TextExtractor.java  |  2 +-
 .../mailbox/elasticsearch/json/MimePart.java    |  3 +--
 .../json/IndexableMessageTest.java              |  2 +-
 .../mailbox/inmemory/JsoupTextExtractor.java    |  2 +-
 .../inmemory/JsoupTextExtractorTest.java        |  2 +-
 .../store/extractor/DefaultTextExtractor.java   |  2 +-
 .../extractor/DefaultTextExtractorTest.java     |  5 ++--
 .../james/mailbox/tika/TikaTextExtractor.java   |  2 +-
 .../mailbox/tika/TikaTextExtractorTest.java     | 24 ++++++++++----------
 9 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/api/src/main/java/org/apache/james/mailbox/extractor/TextExtractor.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/extractor/TextExtractor.java
b/mailbox/api/src/main/java/org/apache/james/mailbox/extractor/TextExtractor.java
index 95036f8..b33d853 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/extractor/TextExtractor.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/extractor/TextExtractor.java
@@ -23,6 +23,6 @@ import java.io.InputStream;
 
 public interface TextExtractor {
 
-    ParsedContent extractContent(InputStream inputStream, String contentType, String fileName)
throws Exception;
+    ParsedContent extractContent(InputStream inputStream, String contentType) throws Exception;
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePart.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePart.java
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePart.java
index ee623cf..c559f1a 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePart.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MimePart.java
@@ -145,8 +145,7 @@ public class MimePart {
                 try {
                     return Optional.of(textExtractor.extractContent(
                         bodyContent.get(),
-                        computeContentType().orElse(null),
-                        fileName.orElse(null)));
+                        computeContentType().orElse(null)));
                 } catch (Throwable e) {
                     LOGGER.warn("Failed parsing attachment", e);
                 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
index 84b0ee0..db221b7 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
@@ -455,7 +455,7 @@ public class IndexableMessageTest {
             .thenReturn(MESSAGE_UID);
 
         TextExtractor textExtractor = mock(TextExtractor.class);
-        when(textExtractor.extractContent(any(), any(), any()))
+        when(textExtractor.extractContent(any(), any()))
             .thenReturn(new ParsedContent("first attachment content", ImmutableMap.of()))
             .thenThrow(new RuntimeException("second cannot be parsed"))
             .thenReturn(new ParsedContent("third attachment content", ImmutableMap.of()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/JsoupTextExtractor.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/JsoupTextExtractor.java
b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/JsoupTextExtractor.java
index 5a1975b..a7d91e4 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/JsoupTextExtractor.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/JsoupTextExtractor.java
@@ -38,7 +38,7 @@ public class JsoupTextExtractor implements TextExtractor {
     private static final String TITLE_HTML_TAG = "title";
 
     @Override
-    public ParsedContent extractContent(InputStream inputStream, String contentType, String
fileName) throws Exception {
+    public ParsedContent extractContent(InputStream inputStream, String contentType) throws
Exception {
         Map<String, List<String>> emptyMetadata = Maps.newHashMap();
         if (contentType != null) {
            if (contentType.equals("text/plain")) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/JsoupTextExtractorTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/JsoupTextExtractorTest.java
b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/JsoupTextExtractorTest.java
index 176550b..3a91e68 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/JsoupTextExtractorTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/JsoupTextExtractorTest.java
@@ -39,7 +39,7 @@ public class JsoupTextExtractorTest {
     public void extractedTextFromHtmlShouldNotContainTheContentOfTitleTag() throws Exception
{
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/html.txt");
 
-        assertThat(textExtractor.extractContent(inputStream, "text/html", null).getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "text/html").getTextualContent())
                 .doesNotContain("*|MC:SUBJECT|*");
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/store/src/main/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractor.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractor.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractor.java
index e692c27..c49c917 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractor.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractor.java
@@ -35,7 +35,7 @@ import org.apache.james.mailbox.extractor.TextExtractor;
 public class DefaultTextExtractor implements TextExtractor {
 
     @Override
-    public ParsedContent extractContent(InputStream inputStream, String contentType, String
fileName) throws Exception {
+    public ParsedContent extractContent(InputStream inputStream, String contentType) throws
Exception {
         if(contentType != null && contentType.startsWith("text/") ) {
             return new ParsedContent(IOUtils.toString(inputStream), new HashMap<String,
List<String>>());
         } else {

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/store/src/test/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractorTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractorTest.java
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractorTest.java
index 7d3834f..353bf58 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractorTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/extractor/DefaultTextExtractorTest.java
@@ -39,7 +39,7 @@ public class DefaultTextExtractorTest {
     public void textTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/Text.txt");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "text/plain", "Text.txt")
+        assertThat(textExtractor.extractContent(inputStream, "text/plain")
             .getTextualContent())
             .isEqualTo("This is some awesome text text.\n\n");
     }
@@ -50,8 +50,7 @@ public class DefaultTextExtractorTest {
         assertThat(inputStream).isNotNull();
         assertThat(textExtractor.extractContent(
             inputStream,
-            "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
-            "writter.docx")
+            "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
             .getTextualContent())
             .isNull();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/tika/src/main/java/org/apache/james/mailbox/tika/TikaTextExtractor.java
----------------------------------------------------------------------
diff --git a/mailbox/tika/src/main/java/org/apache/james/mailbox/tika/TikaTextExtractor.java
b/mailbox/tika/src/main/java/org/apache/james/mailbox/tika/TikaTextExtractor.java
index 04eee79..7d4b7b0 100644
--- a/mailbox/tika/src/main/java/org/apache/james/mailbox/tika/TikaTextExtractor.java
+++ b/mailbox/tika/src/main/java/org/apache/james/mailbox/tika/TikaTextExtractor.java
@@ -70,7 +70,7 @@ public class TikaTextExtractor implements TextExtractor {
     }
 
     @Override
-    public ParsedContent extractContent(InputStream inputStream, String contentType, String
fileName) throws Exception {
+    public ParsedContent extractContent(InputStream inputStream, String contentType) throws
Exception {
         ContentAndMetadata contentAndMetadata = convert(tikaHttpClient.rmetaAsJson(inputStream,
contentType));
         return new ParsedContent(contentAndMetadata.getContent(), contentAndMetadata.getMetadata());
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/16968c4f/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaTextExtractorTest.java
----------------------------------------------------------------------
diff --git a/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaTextExtractorTest.java
b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaTextExtractorTest.java
index 24524a1..1adbb4c 100644
--- a/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaTextExtractorTest.java
+++ b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaTextExtractorTest.java
@@ -62,7 +62,7 @@ public class TikaTextExtractorTest {
 
     @Test
     public void textualContentShouldReturnNullWhenInputStreamIsEmpty() throws Exception {
-        assertThat(textExtractor.extractContent(IOUtils.toInputStream(""), "text/plain",
"Text.txt").getTextualContent())
+        assertThat(textExtractor.extractContent(IOUtils.toInputStream(""), "text/plain").getTextualContent())
             .isNull();
     }
 
@@ -70,7 +70,7 @@ public class TikaTextExtractorTest {
     public void textTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/Text.txt");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "text/plain", "Text.txt").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "text/plain").getTextualContent())
             .isEqualTo("This is some awesome text text.\n\n\n");
     }
 
@@ -78,7 +78,7 @@ public class TikaTextExtractorTest {
     public void textMicrosoftWorldTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/writter.docx");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"writter.docx").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document").getTextualContent())
             .isEqualTo("This is an awesome document on libroffice writter !\n");
     }
 
@@ -86,7 +86,7 @@ public class TikaTextExtractorTest {
     public void textOdtTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/writter.odt");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.text",
"writter.odt").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.text").getTextualContent())
             .isEqualTo("This is an awesome document on libroffice writter !\n");
     }
 
@@ -94,7 +94,7 @@ public class TikaTextExtractorTest {
     public void documentWithBadDeclaredMetadataShouldBeWellHandled() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/fake.txt");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.text",
"writter.odt").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.text").getTextualContent())
             .isEqualTo("This is an awesome document on libroffice writter !\n");
     }
     
@@ -102,7 +102,7 @@ public class TikaTextExtractorTest {
     public void slidePowerPointTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/slides.pptx");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"slides.pptx").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.presentationml.presentation").getTextualContent())
             .isEqualTo("James is awesome\nIt manages attachments so well !\n\n\n");
     }
 
@@ -110,7 +110,7 @@ public class TikaTextExtractorTest {
     public void slideOdpTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/slides.odp");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.presentation",
"slides.odp").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.presentation").getTextualContent())
             .isEqualTo("James is awesome\n\nIt manages attachments so well !\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
     }
     
@@ -118,7 +118,7 @@ public class TikaTextExtractorTest {
     public void pdfTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/PDF.pdf");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/pdf", "PDF.pdf").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/pdf").getTextualContent())
             .isEqualTo("This is an awesome document on libroffice writter !\n\n\n");
     }
     
@@ -126,7 +126,7 @@ public class TikaTextExtractorTest {
     public void odsTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/calc.ods");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.spreadsheet",
"calc.ods").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.oasis.opendocument.spreadsheet").getTextualContent())
             .isEqualTo("This is an aesome LibreOffice document !\n" +
                 "\n" +
                 "\n" +
@@ -141,7 +141,7 @@ public class TikaTextExtractorTest {
     public void excelTest() throws Exception {
         InputStream inputStream = ClassLoader.getSystemResourceAsStream("documents/calc.xlsx");
         assertThat(inputStream).isNotNull();
-        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"calc.xlsx").getTextualContent())
+        assertThat(textExtractor.extractContent(inputStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet").getTextualContent())
             .isEqualTo("Feuille1\n" +
                 "\tThis is an aesome LibreOffice document !\n" +
                 "\n" +
@@ -166,7 +166,7 @@ public class TikaTextExtractorTest {
         });
 
         InputStream inputStream = null;
-        textExtractor.extractContent(inputStream, "text/plain", "fake.txt");
+        textExtractor.extractContent(inputStream, "text/plain");
     }
 
     @Test
@@ -183,7 +183,7 @@ public class TikaTextExtractorTest {
         });
 
         InputStream inputStream = null;
-        textExtractor.extractContent(inputStream, "text/plain", "fake.txt");
+        textExtractor.extractContent(inputStream, "text/plain");
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message