Would you mind submitting a patch for your proposed solution at
http://jython.org/patches?
I'm having trouble figuring out what you're suggesting from the email alone.
Thanks,
Charlie
On 6/29/07, Mehendran T <TMehendran@...> wrote:
> Hi,
>
> I am looking at the bug [ 931129 ] jython -jar some-path/test.jar fails
>
> lets say ur in /home/someuser/.
> In this folder u r creating prog.jar which has __run__.py.
>
> __run__.py
> -----------
> # __run__.py begin --
> from java.lang import Thread
> class PythonThread(Thread): pass
> # __run__.py end --
>
> if u run --> jython -jar prog.jar from /home/someuser/
> it is not giving any error.
>
> but if run from some other folder or even the same folder
> like jython -jar /home/someuser/prog.jar
> it is throwing exception
>
> java.lang.NoClassDefFoundError: IllegalName: org.python.proxies./home
> /someuser/prog.jar$PythonThread$0
>
> Reason:
> --------
> The name of the class is generated as following
>
> PyClass.java
> ------------
> String proxyName = __name__; ------> "PythonThread"
> PyObject module = dict.__finditem__("__module__"); ------>"/home/someuser/prog.jar"
> if (module != null) {
> proxyName = module.toString() + "$" + __name__;
>
>
> MakeProxies.java
> ----------------
> String fullProxyName = proxyPrefix + proxyName + "$" + proxyNumber++;
>
> Now the name of the class name >>>
> org.python.proxies./home/someuser/prog.jar$PythonThread$0
>
> When you run, this class is loaded with the name of above said.
> But here is the check, before loading.
>
> ClassLoader.java (java.lang.ClassLoader)
> ------------------------------------
> private ProtectionDomain preDefineClass(String name, ProtectionDomain protectionDomain)
> {
> if (!checkName(name)) // name - class name with pkg including
> throw new NoClassDefFoundError("IllegalName: " + name);
> ---
> ---
> ---
> }
>
> the checkName method
> ----------------------
> private boolean checkName(String name) {
> if ((name == null) || (name.length() == 0))
> return true;
> if ((name.indexOf('/') != -1)
> || (!VM.allowArraySyntax() && (name.charAt(0) == '[')))
> return false;
> return true;
> }
>
> Because '/ ' char is in the name of the class, the check func fails and it
> results in Exceptiion.
>
> Solution :
> --------
> This may be one of solutions
>
> jython.java
> ----------
> public static void runJar(String filename) {
> ---
> locals.__setitem__("__name__", new PyString(filename));
>
> ---
> ---
> }
>
> Here filename = "/home/someuser/prog.jar".
>
> So if u pass the file name after trimming of
> path that is merely name of the jar("prog.jar"),
> the program runs quietly.
>
>
>
>
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Jython-dev mailing list
> Jython-dev@...
> https://lists.sourceforge.net/lists/listinfo/jython-dev
>
|