]> source.dussan.org Git - jgit.git/commitdiff
Cleanup catch Exception when making Java7FSFactory 22/23222/1
authorShawn Pearce <spearce@spearce.org>
Tue, 11 Mar 2014 21:57:27 +0000 (14:57 -0700)
committerShawn Pearce <spearce@spearce.org>
Tue, 11 Mar 2014 21:57:27 +0000 (14:57 -0700)
Catching Exception and rethrowing as Error when the Java7 factory was
not available threw an unexpected error to the caller, but then
confused things by still setting the factory to the default Java
5 version.  A second call to FS.detect(Boolean) would succeed.

Do not throw to the caller. Instead always default to the Java5
factory if the Java7 one is not loading.

Change-Id: I6e9edb257b404d213ff08c44560fdb1672a5c80b

org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

index dcece62894e9eb912b7f2c2223bc37402bcfd216..0c63b190f2d7ee11c1c4cd641dbf8cdbe9978bce 100644 (file)
@@ -138,14 +138,14 @@ public abstract class FS {
                                factory = (FSFactory) activatorClass.newInstance();
                        } catch (ClassNotFoundException e) {
                                // Java7 module not found
-                               factory = new FS.FSFactory();
                                // Silently ignore failure to find Java7 FS factory
+                               factory = new FS.FSFactory();
                        } catch (UnsupportedClassVersionError e) {
-                               // Java7 module not accessible
                                factory = new FS.FSFactory();
-                       } catch (Exception e) {
+                       } catch (InstantiationException e) {
+                               factory = new FS.FSFactory();
+                       } catch (IllegalAccessException e) {
                                factory = new FS.FSFactory();
-                               throw new Error(e);
                        }
                }
                return factory.detect(cygwinUsed);