You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2016/03/02 16:31:05 UTC

[1/2] tika git commit: Copy Proxy download fix to 2.x

Repository: tika
Updated Branches:
  refs/heads/2.x 1d53ff4cf -> c342d3407


Copy Proxy download fix to 2.x


Project: http://git-wip-us.apache.org/repos/asf/tika/repo
Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/c4feaff1
Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/c4feaff1
Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/c4feaff1

Branch: refs/heads/2.x
Commit: c4feaff19187f548730f48a77fc437ca12bb40b4
Parents: f1e4ebd
Author: Thamme Gowda <tg...@gmail.com>
Authored: Wed Mar 2 01:12:26 2016 -0800
Committer: Thamme Gowda <tg...@gmail.com>
Committed: Wed Mar 2 01:12:26 2016 -0800

----------------------------------------------------------------------
 tika-test-resources/pom.xml                     | 22 ++++++------
 .../tika/parser/ner/opennlp/ModelGetter.groovy  | 35 ++++++++++++++++----
 2 files changed, 38 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tika/blob/c4feaff1/tika-test-resources/pom.xml
----------------------------------------------------------------------
diff --git a/tika-test-resources/pom.xml b/tika-test-resources/pom.xml
index 5df07f4..a39fc62 100644
--- a/tika-test-resources/pom.xml
+++ b/tika-test-resources/pom.xml
@@ -34,23 +34,21 @@
           <missing>${basedir}/src/test/resources/org/apache/tika/parser/ner/opennlp/ner-person.bin</missing>
         </file>
       </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-model</artifactId>
-          <version>3.3.3</version>
-        </dependency>
-      </dependencies>
       <build>
         <plugins>
           <plugin>
-            <groupId>org.codehaus.groovy.maven</groupId>
-            <artifactId>gmaven-plugin</artifactId>
+            <groupId>org.codehaus.gmaven</groupId>
+            <artifactId>groovy-maven-plugin</artifactId>
             <dependencies>
               <dependency>
-                <groupId>commons-io</groupId>
-                <artifactId>commons-io</artifactId>
-                <version>2.4</version>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-model</artifactId>
+                <version>3.3.3</version>
+              </dependency>
+              <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-all</artifactId>
+                <version>2.4.4</version>
               </dependency>
             </dependencies>
             <executions>

http://git-wip-us.apache.org/repos/asf/tika/blob/c4feaff1/tika-test-resources/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
----------------------------------------------------------------------
diff --git a/tika-test-resources/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy b/tika-test-resources/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
index 3b61f20..3b9fd0d 100644
--- a/tika-test-resources/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
+++ b/tika-test-resources/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
@@ -20,7 +20,26 @@
  * This file downloads Apache OpenNLP NER models for testing the NamedEntityParser
  */
 
-import org.apache.commons.io.IOUtils
+import org.apache.maven.settings.Proxy as MvnProxy
+import java.net.Proxy as JDKProxy
+import groovy.transform.Field
+
+//BEGIN: Global context ; ${settings} is injected by the plugin
+List<MvnProxy> mvnProxies = settings.getProxies()?.findAll{it.isActive()}
+@Field JDKProxy proxy = null
+if (mvnProxies && mvnProxies.size() > 0) {
+    mvnProxy = mvnProxies.get(0)
+    println "Using the first Proxy setting : ${mvnProxy.username}@ ${mvnProxy.host} : ${mvnProxy.port} "
+    proxy = new JDKProxy(JDKProxy.Type.HTTP, new InetSocketAddress(mvnProxy.host, mvnProxy.port))
+    Authenticator.setDefault(new Authenticator(){
+        @Override
+        protected PasswordAuthentication getPasswordAuthentication(){
+            return new PasswordAuthentication(mvnProxy.username, mvnProxy.password?.toCharArray())
+        }
+    })
+    println "Proxy is configured"
+}
+//END : Global Context
 
 /**
  * Copies input stream to output stream, additionally printing the progress.
@@ -45,8 +64,8 @@ def copyWithProgress(InputStream inStr, OutputStream outStr, long totalLength){
         }
     }
     println "Copy complete. "
-    IOUtils.closeQuietly(inStr)
-    IOUtils.closeQuietly(outStr)
+    inStr.close()
+    outStr.close()
 }
 
 /**
@@ -56,16 +75,18 @@ def copyWithProgress(InputStream inStr, OutputStream outStr, long totalLength){
  * @return
  */
 def downloadFile(String urlStr, File file) {
-    println "GET : $urlStr -> $file"
-    urlConn = new URL(urlStr).openConnection()
+    println "GET : $urlStr -> $file (Using proxy? ${proxy != null})"
+    url = new URL(urlStr)
+
+    urlConn =  proxy ? url.openConnection(proxy) : url.openConnection()
     contentLength = urlConn.getContentLengthLong()
 
     file.getParentFile().mkdirs()
     inStream = urlConn.getInputStream()
     outStream = new FileOutputStream(file)
     copyWithProgress(inStream, outStream, contentLength)
-    IOUtils.closeQuietly(outStream)
-    IOUtils.closeQuietly(inStream)
+    outStream.close()
+    inStream.close()
     println "Download Complete.."
 }
 


[2/2] tika git commit: Merge branch '2.x-TIKA-1816' of https://github.com/thammegowda/tika into 2.x_tika_1816

Posted by ta...@apache.org.
Merge branch '2.x-TIKA-1816' of https://github.com/thammegowda/tika into 2.x_tika_1816


Project: http://git-wip-us.apache.org/repos/asf/tika/repo
Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/c342d340
Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/c342d340
Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/c342d340

Branch: refs/heads/2.x
Commit: c342d340748218bc7c515e90c62c5eae4e02b65a
Parents: 1d53ff4 c4feaff
Author: tballison <ta...@mitre.org>
Authored: Wed Mar 2 09:52:03 2016 -0500
Committer: tballison <ta...@mitre.org>
Committed: Wed Mar 2 09:52:03 2016 -0500

----------------------------------------------------------------------
 tika-test-resources/pom.xml                     | 22 ++++++------
 .../tika/parser/ner/opennlp/ModelGetter.groovy  | 35 ++++++++++++++++----
 2 files changed, 38 insertions(+), 19 deletions(-)
----------------------------------------------------------------------