<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>537</bug_id>
          
          <creation_ts>2011-12-15 15:30:03 +0100</creation_ts>
          <short_desc>New USE_TEMP_JAR_CACHE inhibits running directly from class files</short_desc>
          <delta_ts>2012-01-05 08:59:04 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Gluegen</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>pc_x86_64</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Wade Walker">wwalker3</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>---</cf_type>
          <cf_scm_refs>791dacb29bcd6d7ed161c6bd2abf7937c7d00691
1b88a636af0c7d85ed14a2395d65f813cb14f98c
9a211fe6cfb4150d97b50325c1778b7f5d3419af</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1280</commentid>
    <comment_count>0</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-15 15:30:03 +0100</bug_when>
    <thetext>The new USE_TEMP_JAR_CACHE flag in Platform.java causes failure if you try to run a JOGL app that depends directly on the compiled .class files (instead of on the JAR). This happens (for example) if you run a project from inside an IDE like Eclipse, and your project depends directly on the gluegen and jogl projects (instead of depending on their JAR files).

I&apos;ve got a fix prepared for this that I&apos;ll submit soon, I just need to test it on other platforms.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1286</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2011-12-18 16:15:09 +0100</bug_when>
    <thetext>Attempt to simply suppress the IllegalArgumentException in case the class is loaded from the plain
filesystem - not the JAR file.

No need to toggle USE_TEMP_JAR_CACHE flag, since the use should be transparent,
ie fallback properly using the &apos;old style&apos;.

If this is not the case (now), pls let me know how to fix it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1311</commentid>
    <comment_count>2</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-30 21:56:06 +0100</bug_when>
    <thetext>Reopened after verifying that this bug is still there in the latest release. Submitted pull request for my fix at https://github.com/sgothel/gluegen/pull/8.

I tested this fix on Win 7, CentOS, and OS X, and it fixes the problem on all three platforms.

The commit is at https://github.com/WadeWalker/gluegen/commit/1b88a636af0c7d85ed14a2395d65f813cb14f98c.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1315</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2012-01-04 08:42:13 +0100</bug_when>
    <thetext>http://jogamp.org/git/?p=gluegen.git;a=commit;h=3eb4fd96cd65e49625663fdb6421a2f1cf2204dc
+++
Merge pull request #8 from WadeWalker/bug_537_jar_cache_prevents_running_from_class_files

Fix JAR cache to allow running from class files.
Fixes bug 537.

Note: We may need to verify why commit 791dacb29bcd6d7ed161c6bd2abf7937c7d00691
is not sufficient.
+++

.. since it&apos;s a crucial part of our architecture, Wade&apos;s patch pre-emptive avoids using the JAR 
cache in case it&apos;s running from a plain class file based environment.
However, the JAR Cache utilization shall fail and fall back to the traditional style, 
hence work transparent. This is obviously not the case .. so I like to know the culprit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1320</commentid>
    <comment_count>4</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2012-01-04 15:35:52 +0100</bug_when>
    <thetext>I tried making it &quot;fall through&quot; when it tries to set up the JAR cache, but this didn&apos;t work cleanly -- that&apos;s why I turned off USE_TEMP_JAR_CACHE instead. Here&apos;s a full explanation:

The original failure happens in JarUtil.getJarSubURL() here:

if(!urlS.startsWith(&quot;jar:&quot;)) {
  throw new IllegalArgumentException(&quot;JAR URL doesn&apos;t start with &apos;jar:&apos;, got &lt;&quot;+urlS+&quot;&gt;&quot;);
}

This exception is not caught in Platform.loadGlueGenRTImpl(), so it causes failure. If I catch that exception, more exceptions are thrown from GLProfile.initSingleton():

Catched: JAR URL doesn&apos;t start with &apos;jar:&apos;, got &lt;file:/work/jogl2/jogl/build/jogl/classes/javax/media/opengl/GLProfile.class&gt;
Catched: JAR URL doesn&apos;t start with &apos;jar:&apos;, got &lt;file:/work/jogl2/jogl/build/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.class&gt;
Catched: JAR URL doesn&apos;t start with &apos;jar:&apos;, got &lt;file:/work/jogl2/jogl/build/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.class&gt;

This is because Platform.loadGlueGenRTImpl() calls TempJarCache.initSingleton() before it tries to load the JAR, so later when GLProfile.initSingleton() calls TempJarCache.isInitialized(), it thinks the JAR cache is initialized when it&apos;s really not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2012-01-05 08:59:04 +0100</bug_when>
    <thetext>The exception messages you are referring to start w/ &apos;Catched&apos;,
meaning we have handled them and should not cause any harm.
Result is that no native JAR files are added to the cache.
A latter JNILibLoaderBase.loadLibrary() will not find them and just move on to the traditional
System.loadLibrary(libraryName).

But as you pointed out, commit 791dacb29bcd6d7ed161c6bd2abf7937c7d00691
missed the catch of IllegalArgumentException in Platform.loadGlueGenRTImpl(),
hence GlueGen native library wasn&apos;t loaded - great catch.

Latest commit 9a211fe6cfb4150d97b50325c1778b7f5d3419af
cleans up the determination whether we run from a JarURL
using the same logic and reusing JarUtil, instead of testing for file protocol only.
The commit also catches IllegalArgumentException in Platform.loadGlueGenRTImpl(),
hence the fall through should work as well.

I hope it&apos;s rock solid now, please verify.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>