You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/12/18 09:19:48 UTC

[27/50] [abbrv] git commit: [KARAF-2040] Ignore JSoup UnsupportedMimeTypeException

[KARAF-2040] Ignore JSoup UnsupportedMimeTypeException

git-svn-id: https://svn.apache.org/repos/asf/karaf/cave/trunk@1420645 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/master
Commit: bd7cc731641aa9572a26dee744495fd4026ad0dd
Parents: c9e4ddc
Author: jbonofre <jb...@13f79535-47bb-0310-9956-ffa450edef68>
Authored: Wed Dec 12 12:48:16 2012 +0000
Committer: jbonofre <jb...@13f79535-47bb-0310-9956-ffa450edef68>
Committed: Wed Dec 12 12:48:16 2012 +0000

----------------------------------------------------------------------
 .../cave/server/storage/CaveRepositoryImpl.java | 28 ++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/bd7cc731/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
index 3398c23..08e6e1e 100644
--- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
+++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
@@ -28,6 +28,7 @@ import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.karaf.cave.server.api.CaveRepository;
 import org.jsoup.Jsoup;
+import org.jsoup.UnsupportedMimeTypeException;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
@@ -198,6 +199,7 @@ public class CaveRepositoryImpl extends CaveRepository {
 
     /**
      * Proxy a local filesystem (folder).
+     *
      * @param entry the filesystem to proxyFilesystem.
      * @throws Exception in case of proxyFilesystem failure
      */
@@ -250,15 +252,19 @@ public class CaveRepositoryImpl extends CaveRepository {
                 }
             } else {
                 // try to find link to "browse"
-                Document document = Jsoup.connect(url).get();
-
-                Elements links = document.select("a");
-                if (links.size() > 1) {
-                    for (int i = 1; i < links.size(); i++) {
-                        Element link = links.get(i);
-                        String absoluteHref = link.attr("abs:href");
-                        this.proxyHttp(absoluteHref);
+                try {
+                    Document document = Jsoup.connect(url).get();
+
+                    Elements links = document.select("a");
+                    if (links.size() > 1) {
+                        for (int i = 1; i < links.size(); i++) {
+                            Element link = links.get(i);
+                            String absoluteHref = link.attr("abs:href");
+                            this.proxyHttp(absoluteHref);
+                        }
                     }
+                } catch (UnsupportedMimeTypeException e) {
+                    // ignore
                 }
             }
         }
@@ -267,7 +273,7 @@ public class CaveRepositoryImpl extends CaveRepository {
     /**
      * Populate an URL into the Karaf Cave repository, and eventually update the OBR information.
      *
-     * @param url the URL to copy.
+     * @param url    the URL to copy.
      * @param update if true the OBR information is updated, false else.
      * @throws Exception in case of populate failure.
      */
@@ -290,7 +296,7 @@ public class CaveRepositoryImpl extends CaveRepository {
      * Populate the Karaf Cave repository using a filesystem directory.
      *
      * @param filesystem the "source" directory.
-     * @param update if true, the resources are added into the OBR metadata, false else.
+     * @param update     if true, the resources are added into the OBR metadata, false else.
      * @throws Exception in case of populate failure.
      */
     private void populateFromFilesystem(File filesystem, boolean update) throws Exception {
@@ -323,7 +329,7 @@ public class CaveRepositoryImpl extends CaveRepository {
     /**
      * Populate the Karaf Cave repository using the given URL.
      *
-     * @param url the "source" HTTP URL.
+     * @param url    the "source" HTTP URL.
      * @param update true if the OBR metadata should be updated, false else.
      * @throws Exception in case of populate failure.
      */