|
Lines 210-221
Link Here
|
| 210 |
* Get the properties from the eclipse.inf file from the given jar. If the file is not a jar, null is returned. |
210 |
* Get the properties from the eclipse.inf file from the given jar. If the file is not a jar, null is returned. |
| 211 |
* If the file is a jar, but does not contain an eclipse.inf file, an empty Properties object is returned. |
211 |
* If the file is a jar, but does not contain an eclipse.inf file, an empty Properties object is returned. |
| 212 |
* @param jarFile |
212 |
* @param jarFile |
| 213 |
* @return |
213 |
* @return The eclipse.inf properties for the given jar file |
| 214 |
*/ |
214 |
*/ |
| 215 |
public static Properties getEclipseInf(File jarFile) { |
215 |
public static Properties getEclipseInf(File jarFile, boolean verbose) { |
| 216 |
if (jarFile == null || !jarFile.exists()) |
216 |
if (jarFile == null || !jarFile.exists()) { |
|
|
217 |
if (verbose) |
| 218 |
System.out.println("Failed to obtain eclipse.inf due to missing jar file: " + jarFile); |
| 217 |
return null; |
219 |
return null; |
| 218 |
|
220 |
} |
| 219 |
JarFile jar = null; |
221 |
JarFile jar = null; |
| 220 |
try { |
222 |
try { |
| 221 |
jar = new JarFile(jarFile, false); |
223 |
jar = new JarFile(jarFile, false); |
|
Lines 229-243
Link Here
|
| 229 |
} |
231 |
} |
| 230 |
return new Properties(); |
232 |
return new Properties(); |
| 231 |
} catch (IOException e) { |
233 |
} catch (IOException e) { |
|
|
234 |
if (verbose) { |
| 235 |
System.out.println("Failed to obtain eclipse.inf due to IOException: " + jarFile); |
| 236 |
e.printStackTrace(); |
| 237 |
} |
| 232 |
//not a jar |
238 |
//not a jar |
|
|
239 |
return null; |
| 233 |
} finally { |
240 |
} finally { |
| 234 |
close(jar); |
241 |
close(jar); |
| 235 |
} |
242 |
} |
| 236 |
return null; |
|
|
| 237 |
} |
243 |
} |
| 238 |
|
244 |
|
| 239 |
public static boolean shouldSkipJar(File input, boolean processAll, boolean verbose) { |
245 |
public static boolean shouldSkipJar(File input, boolean processAll, boolean verbose) { |
| 240 |
Properties inf = getEclipseInf(input); |
246 |
Properties inf = getEclipseInf(input, verbose); |
| 241 |
if (inf == null) { |
247 |
if (inf == null) { |
| 242 |
//not a jar, could be a pack.gz |
248 |
//not a jar, could be a pack.gz |
| 243 |
return false; |
249 |
return false; |