aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/jvm
Commit message (Collapse)AuthorAgeFilesLines
* JNILibLoaderBase.loadLibraryInternal(): Produce own detailed exception if ↵Sven Gothel2023-01-231-3/+6
| | | | | | lib couldn't be loaded (avoid showing misleading orig exception) .. and detail some debug output. Both, own exception and debug output expose NativeLibrary.getSystemEnvLibraryPaths()
* Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()Sven Gothel2023-01-141-2/+2
|
* Bug 1367: Make TempFileCache & TempJarCache even if temp folder can't handle ↵Sven Gothel2019-04-031-1/+1
| | | | executables
* Bug 1366 - Use String.format((Locale)null, "..." ..) avoiding Locale output ↵Sven Gothel2019-03-301-2/+3
| | | | for System related Operations
* Bug 1145, Bug 1172: Add performance counter for native-jar lookup: Property ↵Sven Gothel2015-08-181-3/+25
| | | | 'jogamp.debug.JNILibLoader.Perf'
* Bug 1145: JNILibLoaderBase.addNativeJarLibsImpl: Proper order: #1 ↵Sven Gothel2015-08-181-48/+50
| | | | | | | single-slim-jar, #2 fat-jar, #3 Classpath + TAG.class We shall attempt the official recommendation of deployment first (single-slim-jar) not wasting time trying a 'nativeLibraryPath' lookup within the classpath.
* Bug 1172: TempJarCache: Only copy native library files from ↵Sven Gothel2015-08-181-19/+23
| | | | | | | | 'natives/os.and.arch', reducing JAR search. Since all native libraries are now contained within 'natives/os.and.arch', we don't need to search the whole JAR file anymore but simply can copy the content of the defined folder - if existing.
* Bug 1194: NativeLibrary: Remove dangerous search paths using the JRE ↵Xerxes Rånby2015-08-121-1/+1
| | | | | | | | | | | | | | | | extension mechanism NativeLibrary: API change: Removed searchSystemPathFirst argument to the open and enumerateLibraryPaths methods. Removed the generic sun.boot.library.path system path and the MacOS specific Frameworks paths from enumerateLibraryPaths. JNILibLoaderBase, PlatformPropsImpl & TestElfReader01: Updated to handle the NativeLibrary API change. This change will prevent JogAmp modules to pickup and load unsupported and old SUN JOGL 1 natives that may have been deployed with the JRE.
* Bug 1063: Complete Uri impl. and adoption throughout GlueGenSven Gothel2014-09-081-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Uri: - Add error correction (fix) of path at ctor in case a a contained Uri is requested from an opaque one. The latter might come from URI/URL and is not properly encoded! See Uri.PARSE_HINT_FIX_PATH - Simplify conversion methods: - valueOf(URI/URL): Re-encode only if not opaque - getNativeFilePath() -> toFile() - Move IOUtil Uri related constants to class Uri - Add DEBUG and DEBUG_SHOWFIX - Complete adoption of URI -> Uri changes - IOUtil, JarUtil and TempJarCache still holds some left over deprecated methods, which will be removed after officially starting 2.3.0 (JOGL dependencies) - Otherwise not URI utilization left - Tests - Cleaned ip TestUri01 and TestUri03Resolving - TestUri03Resolving also tests URL -> Uri, and hence mentioned Uri.PARSE_HINT_FIX_PATH
* Bug 1024: Add fallback for native-jar-file location via classpathSven Gothel2014-07-111-5/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In situations, where the native-jar file is not located within the same parent URI as it's java-jar file, our location mechanism fails. This patch adds a classloader based native-jar file location mechanism as a fallback, requiring the native jar file to be included in the users CLASSPATH. Classloader based location algorithm in JNILibLoaderBase.addNativeJarLibsImpl(..): - Extract the 'module-name' from the given classFromJavaJar's package name, i.e. the last package-part: 'jogamp.common.Debug' -> 'common' Hence it is important to pass a 'classFromJavaJar', which last package segment reflects the module-name! - <os.and.arch> -> <os_and_arch_dot>, e.g. linux-amd64 -> linux.amd64 (linux/amd64) - Locate class 'jogamp.nativetag.<module-name>.<os_and_arch_dot>.TAG', e.g. 'jogamp.nativetag.common.linux.amd64.TAG' - Use located class's JarFile URI .. continue as usual Injection of above mentioned TAG class via gluegen-cpptasks-base.xml macro 'native.tag.jar': - Creates dummy TAG.java code - Compiles TAG.java - Creates the native-jar file Example: <native.tag.jar objdir="${build}/obj" nativejarfile="${build}/gluegen-rt-natives-${os.and.arch}.jar" manifestfile="${build}/Manifest-rt-natives.temp" module="common" includelibs="*gluegen-rt.${native.library.suffix}" /> Note that the manifest file uses a matching Extension-Name: Extension-Name: jogamp.nativetag.common
* Cleanup JNILibLoaderBase: Use Platform NEWLINE, remove obsolete notice of ↵Sven Gothel2014-07-111-21/+26
| | | | | | | '[-noawt,-mobile,-core,-android]?' in API-doc, ... - rename addNativeJarLibsWhenInitialized(..) -> addNativeJarLibsWithTempJarCache(..) to fix grammar and expose proper semantics.
* Merge remote-tracking branch 'github-mark/master' (Bug 1023, Bug 1024)Sven Gothel2014-07-051-137/+129
|\ | | | | | | | | | | | | | | | | Conflicts: src/java/com/jogamp/common/jvm/JNILibLoaderBase.java src/java/com/jogamp/common/os/Platform.java src/junit/com/jogamp/common/util/TestTempJarCache.java (re-injected that api-doc of addNativeJarLibsImpl)
| * Do not keep re-indexing into the same array.Mark Raynsford2014-06-301-4/+4
| |
| * StringBuilder message parameter was unused.Mark Raynsford2014-06-301-4/+3
| |
| * Clean up native library loading and remove the ability to strip prefixes.Mark Raynsford2014-06-301-109/+131
| | | | | | | | | | Bug: 1023 Bug: 1024
| * Remove unused addNativeJarLibs() method; the only consumer was a unit testMark Raynsford2014-06-261-39/+0
| | | | | | | | of the method.
* | Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-031-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
* | Fix 'typo' in messages: 'Catched' -> 'Caught'Sven Gothel2014-06-281-2/+2
|/
* gluegen: add all missing @Override annotationsHarvey Harrison2013-10-171-0/+3
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-171-48/+48
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* JNILibLoaderBase.addNativeJarLibsImpl(..): Cleanup debug message creation.Sven Gothel2013-10-011-13/+10
|
* Bug 845: Fix JNILibLoaderBase.addNativeJarLibsImpl(..) fat-jar case.Sven Gothel2013-10-011-15/+31
| | | | | | | | | | | Always use the jar-basename when calling TempJarCache.addNativeLibs(..), otherwise it is mapped and loaded multiple times leading to different native libraries. Simplify addNativeJarLibsImpl(..) argument semantics by passing complete jarBasename and nativeJarBasename (w/ suffix). Added manual test scripts validating [gluegen + jogl] usage with multi (Bug 843) and fat (Bug 845) jar configurations.
* Bug 845: Add support for one big-fat jar file [java classes plus all native ↵Sven Gothel2013-10-011-14/+31
| | | | | | | | | | | | | | | | 'os.and.arch' libraries] JNILibLoaderBase.addNativeJarLibsImpl(..): If the modules's jar file contains the folder 'natives/<os.and.arch>/' we assume a big-fat jar and attempt to load all native libraries from the same. The test for above folder is performed via the class ClassLoader's getResource(..) and is considered inexpensive. If the folder exists and native libraries could be loaded, the method returns successfull. Otherwise, the 'slim' jar file is attempted to be loaded, even if such folder exist.
* Fix Bug 844: Cannot ctor URI w/ scheme alone, use string-based concatenation ↵Sven Gothel2013-10-011-3/+7
| | | | native URI root and jar file.
* Fix Bug 810: Moved Julien Gouesse's fix to GlueGen to solve JOGL's optional ↵Sven Gothel2013-09-021-14/+60
| | | | module dependencies, added more API doc.
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | compatible w/ file scheme. Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823). The URI encoded path cannot be read by File I/O (if file scheme), since the latter requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space). The encoded URL is produced if calling 'uri.toURL()' and hence the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'. Tested w/ - synthetic URI/URL coposition (unit test) - manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl. +++ Misc.: - 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)' ++
* Bug 752: Review Code Vulnerabilities (Permission Checks of new exposed code ↵Sven Gothel2013-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and privileged access) This review focuses on how we perform permission checks, or better - do we circumvent some assuming full privileges ? Some native methods do need extra permission validation, i.e. loading native libraries. Further more AccessController.doPrivileged(..) shall not cover generic code exposing a critical feature to the user. Further more .. we should rely on the SecuritManager, i.e. AccessControlContext's 'checkPermission(Permission)' code to comply w/ fine grained permission access. It is also possible to have full permission w/o having any certificates (-> policy file). +++ We remove implicit AccessController.doPrivileged(..) from within our trusted code for generic methods, like Property access, temp. files. +++ SecurityUtil: - Remove 'getCommonAccessControlContext(Class<?> clz)', which returned a local AccessControlContext for later restriction if the passed class contains all certificates as the 'trusted' GlueGen class has. - Simply expose convenient permission check methods relying on SecurityManager / AccessControlContext. PropertyAccess: - 'protected static void addTrustedPrefix(..)' requires AllPermissions if SecurityManager is installed. - Remove implicit doPrivileged(..) triggered by passed AccessControlContext instance, only leave it for trusted prefixes. IOUtil: - Remove all doPrivileged(..) - Elevation shall be performed by caller. DynamicLinker: - 'public long openLibraryLocal(..)' and 'public long openLibraryGlobal(..)' may throw SecurityException, if a SecurityManager is installed and the dyn. link permission is not granted in the calling code. Implemented in their respective Unix, OSX and Windows manifestation. Caller has to elevate privileges via 'doPrivileged(..) {}' ! +++ Tests: - Property access - File access - Native library loading Manual Applet test (unsigned, but w/ SecurityManager and policy file): > gluegen/test/applet Applet has been tested w/ signed JAR w/ Firefox and Java7 on GNU/Linux as well. Manual Application test (unsigned, but w/ SecurityManager and policy file): com.jogamp.junit.sec.TestSecIOUtil01 - Run w/ SecurityManager and policy file: - gluegen/scripts/runtest-secmgr.sh - Run w/o SecurityManager: - gluegen/scripts/runtest.sh
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-091-20/+21
| | | | to remove DNS Lookups etc ..
* GlueGen: NativeLibrary Fix, JNILibLoaderBase EnhancementSven Gothel2013-01-301-33/+71
| | | | | | | | | | | | | | | | | | | - NativeLibrary Fix - enumerateLibraryPaths(..): - Properly iterate through all prefix _and_ suffix. - Make public for JNILibLoaderBase.loadLibraryInternal(..) - isValidNativeLibraryName(..): - Stop iterating through prefix, if previously found but suffix doesn't match. - JNILibLoaderBase.loadLibraryInternal(..) Enhancement - Mark customLibLoader FIXME: remove (we will get rid of jnlp.launcher.class) - If System.load(TempJarCache) and System.loadLibrary(plainLibName) fails, use NativeLibrary.enumerateLibraryPaths() w/ System.load(..) as last resort. Tested on Linux x86_64 Java6 and OSX Java7 manually, no regressions expected.
* Fix Bug 608: Push down TempJarCache.findLibrary(..) from ↵Sven Gothel2012-10-251-13/+1
| | | | | | | JNILibLoaderBase.loadLibraryInternal() to NativeLibrary.findLibrary(..) This allows using TempJarCache (if used/initialized) for native 'tool' libraries as well. This is the case of JOAL's attempt to load the provided 'libopenal.so'
* JNILibLoaderBase: Fix NPE in DEBUG mode if null == stripBasenameSuffixes (JOCL)Sven Gothel2012-08-261-1/+1
|
* Implement Bug #598 - JOGL ALL JAR File Change incl. it's Native Jar URL ↵Sven Gothel2012-06-261-40/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Derivation +++ JNILibLoaderBase.addNativeJarLibs(..): Add API doc JNILibLoaderBase: "addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)" -> "addNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker, String[] stripBasenameSuffixes)" Derive the 'all' (1st choice) native JAR URL solely on the given class's JAR URL. Examples: JOCL: // only: jocl.jar -> jocl-natives-'os.and.arch'.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null ); JOGL: final ClassLoader cl = GLProfile.class.getClassLoader(); // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar, // jogl-core.jar -> jogl-natives-<os.and.arch>.jar, // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available) final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } ); Efficiency / Performance: - Reduced JAR URL lookup calls JarUtil.getJarURL(..) - JNILibLoaderBase, Platform, JarUtil - Attempt loading Jar files (native, class, ..) only once - TempJarCache Code Cleanup (IOUtil, JarUtil, : - IOException if not found - IllegalArgumentException if null argument +++ jogamp.android-launcher.jar -> jogamp-android-launcher.jar +++
* Fix TempFileCache/LauncherTempFileCache (regression commit: ↵v2.0-rc9Sven Gothel2012-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | 1468286bf569a493e4fdb887d5f3732f88c8cec3) 'update' scenario in same JVM instance. TempFileCache/LauncherTempFileCache were using the system property 'jnlp.jogamp.tmp.cache.root', if set. However, in case one JVM launched an old GlueGen (Applet) and then launching a new GlueGen (Applet) w/ a new tmpDir location, the property is still set but the tmpRootDir location does not exist. This patch tolerates this situation and cont. setting a new tmpRootDir. Example: JVM1.GlueGen1 tmpDir: /tmp/, tmpRootDir: /tmp/jogamp.tmp.cache_000000/ JVM1.GlueGen2 tmpDir: /tmp/jogamp_0000/, tmpRootDir: /tmp/jogamp_0000/file_cache/ Misc: - IOUtil: Always use 'jogamp_xxxx' as the sys-temp subfolder for tmpDir - JNILibLoaderBase: Remove unised import - TempJarCache.validateCertificates(): Add OK DEBUG output.
* Fix Platform static initialization interdependencies w/ GlueGen native ↵Sven Gothel2012-06-181-1/+2
| | | | | | | | | | | | library loading Some Platform field declarations and it's static initialization has been delegated to it's new abstract super class PlatformPropsImpl to solve static initialization interdependencies w/ the GlueGen native library loading and it's derived information {@link #getMachineDescription()}, {@link #is32Bit()}, ..<br> This mechanism is preferred in this case to avoid synchronization and locking and allow better performance accessing the mentioned fields/methods.
* Fix commit cc76889a6fe96cffb91c9a3aa7934878c0ecd97e: ↵Sven Gothel2012-05-041-1/+1
| | | | System.loadLibrary(libraryPath) -> System.load(libraryPath)
* Use ClassLoader to find JNI native libraries. ClassLoader was only used for ↵Sven Gothel2012-05-041-24/+54
| | | | | | | | | | | tool native libraries. NativeLibrary: Expose 'String findLibrary(String libName, ClassLoader loader)', allowing utilization of System.load(loader.findLibrary(libName)). JNILibLoaderBase.loadLibrary(): Add optional ClassLoader argument, used to locate the library DynamicLibraryBundle: Use DynamicLibraryInfo's ClassLoader to find native libraries (tool + jni)
* SecurityUtil: Generalize cert validation and AccessControlContext query; ↵Sven Gothel2012-03-131-46/+50
| | | | | | | | | | | | | | | | | | PropertyAccess: Fix security code, grant access to common 'trusted' properties - SecurityUtil - Generalize cert validation for JAR and property access - Grant access to common AccessControlContext for 'same' cert - PropertyAccess: - Fix security code: Passing the current AccessControlContext from the caller didn't include priviledges. - Grant access to common 'trusted' properties, which removes the need of passing the AccessControlContext for general properties like 'jnlp.', 'jogamp.' .. - Enable registering 'trusted' properties, when caller's cert is 'same'
* Intro.: PropertyAccess ; Added safe PropertyAccess for JNILibLoaderBase, ↵Sven Gothel2012-03-131-2/+3
| | | | | | | | | | | | | | | | | Platform, IOUtil, .. - Intro.: PropertyAccess - Base class of all Debug impl, reduces redundancies. - jnlpAlias'ed trusted property is queried within local AccessControlContext to avoid 'JRE' implementation differences (should not be required). - throw NPE and IllegalArgumentException for invalid property key - Added safe PropertyAccess - JNILibLoaderBase: sun.jnlp.applet.launcher - Platform: jogamp.gluegen.UseTempJarCache - IOUtil: java.io.tmpdir
* JNILibLoaderBaser.addNativeJarLibs(..): Catch all Exception (also ↵Sven Gothel2011-12-181-7/+11
| | | | IllegalArgumentException) - solves case using plain class instead of JAR file
* TempJarCache/JNILibLoaderBase: Identify the Jar files by their URL within ↵Sven Gothel2011-12-011-5/+1
| | | | our lifecycle. JarFile's hash almost always differs.
* Refine TempJarCache/JNILibLoaderBase ; Add TempFileCache destroy() for instance.Sven Gothel2011-12-011-13/+21
| | | | | | | | JNILibLoaderBase's 'addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)' now just attempts to load the 'all' variant, and will continue w/ atomics if not successful (ie not available). It skips the validation of a 'allJavaJarPrefix', ie validating the 'classFromJavaJar holding JAR file, which allows GLUEGEN/JOGL classes to be contained in JAR files other than the original.
* JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. ↵Sven Gothel2011-11-291-3/+3
| | | | | | | | Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)'
* JNILibLoaderBase: Add convenient method to addNativeJarLibs for 'all' and ↵Sven Gothel2011-09-241-1/+38
| | | | 'atomic' variants
* Better DEBUG outputSven Gothel2011-09-231-8/+8
|
* Moved JVMUtil to private package; Invoke JVMUtil.initSingleton() from ↵Sven Gothel2011-09-231-75/+0
| | | | Platform static init after loading native library.
* TempJarCache/JNILibLoaderBase: Validate the to be loader JarFile's ↵Sven Gothel2011-09-231-0/+30
| | | | Certificates if caller has any. Add Convenient JNILibLoaderBase.addNativeJarLibs(..) method.
* gluegen-rt lib loading: Moved to Platform static init incl. ↵Sven Gothel2011-09-221-3/+2
| | | | | | | | | | | | | | | | TempJarCache.bootstrapNativeLib(..) usage - Moving to Platform solves former interdependencies between GlueGenJNILibLoader/Platform - TempJarCache is being setup w/ bootstraping the gluegen-rt native lib jar file. Interesting here is that when using Oracle's JRE w/ Applets/JNLP the current dbg output is: gluegen-rt: url-root http://risa/deployment/test/jau02s/jar/ gluegen-rt: nativeJarURL jar:http://risa/deployment/test/jau02s/jar/gluegen-rt-natives-linux-amd64.jar!/ gluegen-rt: nativeJar /home/sven/.java/deployment/cache/6.0/49/3c6d1e31-2c90f42e IE the JRE implementation already deduces the online link to the Applet/JNLP cache. This makes the implementation much simpler, ie. same for application and Applets/JNLP. Have to verify w/ other Java impl. sure - and add same logic for the JOGL part.
* JNILibLoaderBase/TempJarCache: Prepare for loadLibrary(..) out of cached JARsSven Gothel2011-09-221-1/+18
| | | | | | - JNILibLoaderBase: If TempJarCache is active, try find native library in cached JARs - TempJarCache: Add bootstrabNativeLib(..) allowing bootstraping gluegen-rt from JAR w/o needing it - JARUtil: minor edits (final)
* Unify JNI Library Loading into JNILibLoaderBase and use it for the ↵Sven Gothel2011-09-212-20/+30
| | | | | | | | gluegen-rt native lib as well - removed redundance - move proper JNLPAppletLauncher custom libloader code into JNILibLoaderBase - prepares for new JAR temp cache ..
* Remove redundant: NativeLibrary.ensureNativeLibLoaded()Sven Gothel2011-09-201-1/+2
|