Skip to content

Instantly share code, notes, and snippets.

@ar
Created April 5, 2011 16:37
Show Gist options
  • Select an option

  • Save ar/903959 to your computer and use it in GitHub Desktop.

Select an option

Save ar/903959 to your computer and use it in GitHub Desktop.
jline issue on OS X and proposed simple patch
We found an issue when running it on OS X, we get this exception:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:99)
at jline.ClassNameCompletor.getClassNames(ClassNameCompletor.java:89)
at jline.ClassNameCompletor.<init>(ClassNameCompletor.java:33)
adding some debug here and there, we found that the ClassNameCompletor tried to find some non jar files, i.e:
/System/Library/Java/Extensions/libAppleScriptEngine.jnilib
From 6dab177d2eb23a99933fdffae4c6fb7ebd33d2c9 Mon Sep 17 00:00:00 2001
From: Alejandro Revilla <apr@jpos.org>
Date: Thu, 16 Dec 2010 14:02:09 -0200
Subject: [PATCH] Ignore non jars (i.e. .jnilib, etc)
---
src/main/java/jline/ClassNameCompletor.java | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/main/java/jline/ClassNameCompletor.java b/src/main/java/jline/ClassNameCompletor.java
index 7c6c6e0..3ef5802 100644
--- a/src/main/java/jline/ClassNameCompletor.java
+++ b/src/main/java/jline/ClassNameCompletor.java
@@ -85,6 +85,8 @@ public class ClassNameCompletor extends SimpleCompletor {
{
continue;
}
+ if (!file.toString().endsWith (".jar"))
+ continue;
JarFile jf = new JarFile(file);
--
1.7.3.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment