aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-11-01 22:43:00 +0100
committerReinier Zwitserloot <reinier@tipit.to>2009-11-01 22:43:00 +0100
commit6733b1ec567ef2cc647e690f7a4fabc85a541252 (patch)
treed5f1f013e676ed5fe790dc5105b98acd1da374df
parentd23591a469148fca426ddcbc9ec66d3ba9b2f88e (diff)
downloadlombok-6733b1ec567ef2cc647e690f7a4fabc85a541252.tar.gz
lombok-6733b1ec567ef2cc647e690f7a4fabc85a541252.tar.bz2
lombok-6733b1ec567ef2cc647e690f7a4fabc85a541252.zip
Weird conditions on the disk, such as having an unformatted drive, screws up the eclipse autofinder on windows, causing the installer to throw an exception on bootup.
Fixed it by guarding various blocks in the detector with try/catch/ignore. Reported by: http://groups.google.com/group/project-lombok/browse_thread/thread/2f4ded6c942ad0a5
-rw-r--r--src/lombok/installer/EclipseFinder.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/lombok/installer/EclipseFinder.java b/src/lombok/installer/EclipseFinder.java
index 57e52065..07e28484 100644
--- a/src/lombok/installer/EclipseFinder.java
+++ b/src/lombok/installer/EclipseFinder.java
@@ -153,24 +153,34 @@ class EclipseFinder {
ignore.printStackTrace();
}
+ //Various try/catch/ignore statements are in this for loop. Weird conditions on the disk can cause exceptions,
+ //such as an unformatted drive causing a NullPointerException on listFiles. Best action is almost invariably to just
+ //continue onwards.
for (String letter : driveLetters) {
- File f = new File(letter + ":\\");
- for (File dir : f.listFiles()) {
- if (!dir.isDirectory()) continue;
- if (dir.getName().toLowerCase().contains("eclipse")) {
- String eclipseLocation = findEclipseOnWindows1(dir);
- if (eclipseLocation != null) eclipses.add(eclipseLocation);
- }
- if (dir.getName().toLowerCase().contains("program files")) {
- for (File dir2 : dir.listFiles()) {
- if (!dir2.isDirectory()) continue;
+ try {
+ File f = new File(letter + ":\\");
+ for (File dir : f.listFiles()) {
+ if (!dir.isDirectory()) continue;
+ try {
if (dir.getName().toLowerCase().contains("eclipse")) {
String eclipseLocation = findEclipseOnWindows1(dir);
if (eclipseLocation != null) eclipses.add(eclipseLocation);
}
- }
+ } catch (Exception ignore) {}
+
+ try {
+ if (dir.getName().toLowerCase().contains("program files")) {
+ for (File dir2 : dir.listFiles()) {
+ if (!dir2.isDirectory()) continue;
+ if (dir.getName().toLowerCase().contains("eclipse")) {
+ String eclipseLocation = findEclipseOnWindows1(dir);
+ if (eclipseLocation != null) eclipses.add(eclipseLocation);
+ }
+ }
+ }
+ } catch (Exception ignore) {}
}
- }
+ } catch (Exception ignore) {}
}
return eclipses;