aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/JarUtil.java
Commit message (Collapse)AuthorAgeFilesLines
* JarUtil.getRelativeOf(): Make'cutOffInclSubDir' optional, i.e. ignore if ↵Sven Gothel2023-05-201-6/+15
| | | | null in case no sub-directory is desired
* IOUtil.copyStream2{File|Stream)(..): Drop unused and misleading ↵Sven Gothel2023-05-041-1/+1
| | | | 'totalNumBytes' argument, since we have no user-feedback callback passed.
* iOS: Initial iOS support commit: build.xml targets, java code-path etcSven Gothel2019-06-171-1/+1
| | | | | | | | | | | | Current build system for JogAmp iOS Build is: - Build Machine: OSX Mojave 10.14 - Using own (still proprietary) OpenJDK 9 iOS Build - OpenJDK 1.8 (This will be replaced by OpenJDK 11 soon) - Xcode 10.2
* Remove deprectated classes and methodsSven Gothel2015-10-151-14/+0
|
* Bug 1243 - Fix IOUtil.cleanPathString(..) special case ; Allow IOUtil and ↵Sven Gothel2015-10-031-3/+3
| | | | | | | | | | | | | | | | | Uri to handle relative path Fix IOUtil.cleanPathString(..) special case: Special case '/a/./../b' -> '/b' requires to resolve './' before '../'. Allow IOUtil and Uri to handle relative path: - IOUtil.getParentOf(..) - IOUtil.cleanPathString(..) Handle cases: 'a/./../b' -> 'b' '.././b' -> '../b' - Uri: Handle null scheme
* Bug 1063: Complete Uri impl. and adoption throughout GlueGenSven Gothel2014-09-081-177/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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 1063 - Utilize own Uri and Uri.Encoded class w/ proper encoding and ↵Sven Gothel2014-09-071-0/+2
| | | | | | | | | | | | differentiating encoded/decoded variants by type [Part 1] - Add immutable com.jogamp.common.net.Uri class impl. RFC 2396 w/ encoding of RFC 3986 - Class Uri.Encoded is used to represent encoded parts - IOUtil: Remove unused methods (residing in Uri) and mark others deprecated (will move to Uri) - Adopt usage of Uri: This must be completet in follow-up commits!
* Bug 908: Fix URI/URL double encoding, ensuring encoded/decoded variants are ↵Sven Gothel2014-09-071-22/+22
| | | | | | | | | | | | | | | | | | | | used properly (Added unit test) Bug 908 was caused by confusing URI encoded parts (e.g. scheme-specific-part) and it's decoded variant. This especially happened due to: - the fact, that the encoded and unencoded variant uses the same String type, - the URI/URL decoding differs, is not complete (e.g. %20 .. SPACE remains in decoded part), - and does not comply w/ RFC 2396 and RFC 3986 (encoding), e.g. not all RESERVED chars are encoded. In branch 'v2.3.0_branch', we will introduce our own Uri and Uri.Encoded class to solve above issue by replacing all URI usage w/ Uri. - Backporting results of own Uri class introduction in branch 'v2.3.0_branch' - Ensure the encoded URI parts are used where required, i.e. IOUtil.compose(..) etc - TestNetIOURIReservedCharsBug908: Automated test, launching GlueGen jar file from an <i>odd pathname</i>.
* Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-031-38/+38
| | | | | | | | | | | | | | | 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
* IOUtil.toURL(..) Apply decodeFromURI(uri.getPath()) if file-scheme; Add ↵Sven Gothel2013-11-281-1/+1
| | | | | | | | | | | | | | | | | | | IOUtil.decodeURIToFilePath(..) for native usage. Refine comments, API doc. toURL(..): Apply space conversion, decodeFromURI(..), on file-scheme path, ensuring decoded space. ++ Add decodeURIToFilePath(String uriPath) and decodeURIToFilePath(URI uri) Both methods shall simplify decoding a file-URI for native platform usage. Tested in TestIOUtilURIHandling +++
* JARUtil/IOUtil: Reuse IOUtil.JAR_SCHEME_SEPARATOR (now a char); Add DEBUG to ↵Sven Gothel2013-11-271-6/+11
| | | | JarUtil.getJarEntry(..)
* IOUtil/JarUtil: DEBUG output on stderr not stdoutSven Gothel2013-11-271-10/+10
|
* JarUtil: Use common strings for exceptions (same as used in IOUtil)Sven Gothel2013-11-271-2/+2
|
* Bug 754 - JarUtil: Add method to generate resource URI from class's Jar URI ↵Sven Gothel2013-10-311-0/+66
| | | | and resource name (Remove Ubuntu fonts from jogl-all.jar, provide it separately to reduce footprint for the masses.)
* Fix Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' ↵Sven Gothel2013-10-231-0/+28
| | | | | | | | | on 'PluginProcess.app' - IOUtil.getTempDir(..): Don't test executable caps on OSX for java_io_tmpdir - JarUtil.extract(..): Issue native fixNativeLibAttribs(..) on OSX for native library files, i.e. remove xattr 'com.apple.quarantine'
* Fix Bug 857: GlueGen produces erroneous file URI on Windows, which breaks ↵Sven Gothel2013-10-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Netbeans's JarURLStreamHandler - 'URL IOUtil.toURL(URI)' - Needs to encode the file-path portion on Windows(*) if exists. The file-path here shall only be encoded as follows: - backslash -> slash - ensure starting with slash (*) We perform above action for all OS, if 'false == File.separator.equals("/")' - Added high verbosity in DEBUG mode to easy debugging for future cases .. - Cleanup URI/URL unit tests, i.e. split URLCompositionTest into: - TestIOUtilURICompose - TestIOUtilURIHandling (Now covers Bug 857 as well) - TestUrisWithAssetHandler - TestURIQueryProps Tested all unit tests manually on GNU/Linux and Windows w/ JRE 7u45
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-171-89/+89
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Bug 820: Escape SPACE in filenames for URI ctor, use decoded URI components ↵Sven Gothel2013-10-071-7/+7
| | | | | | | | | | when compiling new URI. Add IOUtil: - String encodeToURI(String) - String decodeFromURI(String) Both only handle escaping of SPACE only. Determine whether other chars need to be treated.
* IOUtil/JarUtil: Add more detail debug information for URI transformation; ↵Sven Gothel2013-10-011-7/+12
| | | | IOUtil.toURL(..) handle exception at 'new File(uri)'
* Bug 845: Add support for one big-fat jar file [java classes plus all native ↵Sven Gothel2013-10-011-10/+29
| | | | | | | | | | | | | | | | '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-0/+13
| | | | native URI root and jar file.
* Fix Bug 843: Remove Platform's requirement and use of ↵Sven Gothel2013-10-011-1/+3
| | | | | | | | | TempJarCache.bootstrapNativeLib(), allowing versatile use of 1st native jar file (big-java-jar w/ big-native-jar) The remaining Platform dependency existed in IOUtil.copyStream2Stream(..), used by JarUtil.extract(..), i.e. the MachineDescription's PAGE_SIZE. Solved by using a const buffer size of 4096 bytes.
* gluegen: remove unneeded casts to JarEntryHarvey Harrison2013-07-151-1/+1
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-191-48/+39
| | | | | | | | | | | | | | | | | | | | | | | | 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)' ++
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-091-132/+139
| | | | to remove DNS Lookups etc ..
* Minor edits to JarUtil.Resolver functionality: Exception types, avoiding ↵Sven Gothel2013-02-211-21/+40
| | | | duplicate processing of strings etc.
* Add security checks to resolver methods.Wade Walker2013-02-171-4/+26
|
* Make JarUtil work with custom classloadersWade Walker2013-02-111-1/+23
| | | | | | | | Added the ability for users to set a "resolver" in JarUtil that lets it find resources that are loaded by a custom classloader. This is needed in OSGi apps (like Eclipse RCP apps), since OSGi resources do not have simple jar: URLs (they use a custom protocol called bundleresource:).
* Implement Bug #598 - JOGL ALL JAR File Change incl. it's Native Jar URL ↵Sven Gothel2012-06-261-121/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 +++
* SecurityUtil: Generalize cert validation and AccessControlContext query; ↵Sven Gothel2012-03-131-14/+8
| | | | | | | | | | | | | | | | | | 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'
* Further fix for bug 537 - Catch IllegalArgumentException in ↵Sven Gothel2012-01-051-14/+52
| | | | Platform.loadGlueGenRTImpl(), Reuse JarUtil (same methodology) to determine whether we run from JarURL
* JarUtil (Fix Bug 522): Handle case where given URL doesn't contain any '/' ↵Sven Gothel2011-11-291-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (eg. Eclipse 'rsrc:' case) - Use ':' as 'path' delimiter in case no path via '/' is given. +++ Manual tested w/ Eclipse: Preparations: =============== 1) Set up a vanilla eclipse (3.7.0) workspace 2) Add the JOGL User Library: - Window.Preference - Java.Build_Path.User_Libraries: + JOGL + gluegen-rt.jar + jogl.all.jar + gluegen-rt-natives-linux-amd64.jar + jogl-all-natives-linux-amd64.jar You may add all other native JARs here. Note that these are not required in the CLASSPATH by JOGL, however, they are required by Eclipse to export your project as a Runnable JAR File. 3) New test project - Right-click your project in the Package Explorer and click "Properties". - Select "Java Build Path" and click the "Libraries" tab. + JOGL - Add some simple code .. - Run as Java Application .. Test-1: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Copy required libraries into a sub-folder next to the generated JAR Result: Works! ./lala01.jar ./lala01_lib/jogl.all.jar ./lala01_lib/jogl-all-natives-linux-amd64.jar ./lala01_lib/... etc .. Test-2: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Package required libraries into generated JAR Result: Works! ./lala02.jar: Manifest-Version: 1.0 Rsrc-Class-Path: ./ gluegen-rt-natives-linux-amd64.jar gluegen-rt.jar jogl-all-natives-linux-amd64.jar jogl.all.jar Class-Path: . Rsrc-Main-Class: Test01 Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
* JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. ↵Sven Gothel2011-11-291-38/+179
| | | | | | | | Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)'
* NativeLib: Fix OSX lib name detection; JarUtil extract: at copy entry, mkdir ↵Sven Gothel2011-09-241-2/+15
| | | | of parent if !exist
* Better DEBUG outputSven Gothel2011-09-231-21/+24
|
* TempJarCache/JNILibLoaderBase: Validate the to be loader JarFile's ↵Sven Gothel2011-09-231-31/+49
| | | | Certificates if caller has any. Add Convenient JNILibLoaderBase.addNativeJarLibs(..) method.
* JNILibLoaderBase/TempJarCache: Prepare for loadLibrary(..) out of cached JARsSven Gothel2011-09-221-7/+5
| | | | | | - 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)
* Enhancements / New utils: JarUtil, TempFileCache and TempJarCacheSven Gothel2011-09-191-0/+347
JarUtil: Utility to handle Jar files and it's content, incl. extracting it's entries TempFileCache: Utility to have a save temporary file cache per JVM and per instance, eg. per ClassLoader. The temp cache is cleaned up with the next usage of TempFileCache, which solves the troubles of JVM bugs and situations where the JVM is not able to close and delete open temp files. TempJarCache: Utility to cache Jar files temporary (using TempFileCache) and access it's content. This class is suitable to implement a URLClassLoader or similar resource loading facilities. All tested w/ TestTempJarCache