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 2018/06/15 13:41:47 UTC
[tika] branch branch_1x updated: TIKA-2670 add try/catch block into
ModelGetter
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch branch_1x
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/branch_1x by this push:
new 45468aa TIKA-2670 add try/catch block into ModelGetter
45468aa is described below
commit 45468aa9d3f12a4ba9eae289e70026ea64018280
Author: tballison <ta...@mitre.org>
AuthorDate: Fri Jun 15 09:41:23 2018 -0400
TIKA-2670 add try/catch block into ModelGetter
---
.../tika/parser/ner/opennlp/ModelGetter.groovy | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/tika-parsers/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy b/tika-parsers/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
index 453a6ca..7560ee7 100644
--- a/tika-parsers/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
+++ b/tika-parsers/src/test/resources/org/apache/tika/parser/ner/opennlp/ModelGetter.groovy
@@ -78,17 +78,21 @@ def copyWithProgress(InputStream inStr, OutputStream outStr, long totalLength){
def downloadFile(String urlStr, File file) {
println "GET : $urlStr -> $file (Using proxy? ${proxy != null})"
url = new URL(urlStr)
+ try {
+ urlConn = proxy ? url.openConnection(proxy) : url.openConnection()
+ contentLength = urlConn.getContentLengthLong()
- urlConn = proxy ? url.openConnection(proxy) : url.openConnection()
- contentLength = urlConn.getContentLengthLong()
-
- file.getParentFile().mkdirs()
- inStream = urlConn.getInputStream()
- outStream = new FileOutputStream(file)
- copyWithProgress(inStream, outStream, contentLength)
- outStream.close()
- inStream.close()
- println "Download Complete.."
+ file.getParentFile().mkdirs()
+ inStream = urlConn.getInputStream()
+ outStream = new FileOutputStream(file)
+ copyWithProgress(inStream, outStream, contentLength)
+ outStream.close()
+ inStream.close()
+ println "Download Complete.."
+ } catch (IOException e) {
+ println "Couldn't download $file at the moment. Will skip tests that require that model/file for now."
+ e.printStackTrace()
+ }
}
def urlPrefix = "http://opennlp.sourceforge.net/models-1.5"
--
To stop receiving notification emails like this one, please contact
tallison@apache.org.