aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util
Commit message (Collapse)AuthorAgeFilesLines
* IOUtil/JarUtil: DEBUG output on stderr not stdoutSven Gothel2013-11-272-26/+30
|
* 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-312-0/+68
| | | | and resource name (Remove Ubuntu fonts from jogl-all.jar, provide it separately to reduce footprint for the masses.)
* TempJarCache: Make 'initialization' query/flag thread safe, i.e. synchronize ↵Sven Gothel2013-10-241-4/+21
| | | | | | | if !isInit (dbl-check locking) - isInit must be set to 'true' _after_ actual initialization, so caller can be blocked until done - staticInitError must be volatile as well
* Fix Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' ↵Sven Gothel2013-10-233-29/+98
| | | | | | | | | 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-182-20/+115
| | | | | | | | | | | | | | | | | | | | | | | | | 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: add all missing @Override annotationsHarvey Harrison2013-10-177-0/+12
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-1733-912/+912
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* ArrayHashSet: Use final local vars if applicableSven Gothel2013-10-171-7/+7
|
* ArrayHashSet: Add @OverrideSven Gothel2013-10-171-0/+27
|
* Bug 820: Escape SPACE in filenames for URI ctor, use decoded URI components ↵Sven Gothel2013-10-072-13/+36
| | | | | | | | | | 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.
* VersionUtil.getPlatformInfo: include 'getOSVersionNumber()' beside it's ↵Sven Gothel2013-10-031-1/+1
| | | | string representation.
* PropertyAccess: Add trusted properties sun.java2d.opengl, ↵Sven Gothel2013-10-021-1/+8
| | | | sun.java2d.noddraw, sun.java2d.d3d, sun.awt.noerasebackground
* IOUtil/JarUtil: Add more detail debug information for URI transformation; ↵Sven Gothel2013-10-012-18/+41
| | | | IOUtil.toURL(..) handle exception at 'new File(uri)'
* Bug 845: Fix JNILibLoaderBase.addNativeJarLibsImpl(..) fat-jar case.Sven Gothel2013-10-011-1/+4
| | | | | | | | | | | 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-012-17/+40
| | | | | | | | | | | | | | | | '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-012-3/+35
| | | | native URI root and jar file.
* Fix Bug 843: Remove Platform's requirement and use of ↵Sven Gothel2013-10-013-81/+22
| | | | | | | | | 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.
* Bug 816: Add Platform.JAVA_VERSION_UPDATE - Allowing to determin whether JVM ↵Sven Gothel2013-09-221-1/+1
| | | | is >= 1.7.0u40
* *Ringbuffer: Remove Ringbuffer<T>.AllocEmptyArray interface to favor a more ↵Sven Gothel2013-08-243-144/+189
| | | | | | | | | | | | | | | simple approach; Split 'grow' into 'growEmpty' and 'growFull' - java.lang.reflect.Array can instantiate an array w/ a given array-type and length - array-type is Class<? extends T[]> - We either deduct the array-type via array.getClass(), or pass it (ctor for empty Ringbuffer). - Split 'growBuffer(T[] newElements, int amount, ..)' into: - 'growEmptyBuffer(T[] newElements)' - 'growFullBuffer(int amount)' Allowing a more clean API w/ simpler semantics.
* Add Ringbuffer interface an 2 implementations, synchronized (locking) ↵Sven Gothel2013-08-223-0/+996
| | | | | | | | | | | | | | | | | | | | | | | | SyncedRingbuffer and lock-free LFRingbuffer. SyncedRingbuffer is moved from JOGL to GlueGen, and generalized w/ common interface Ringbuffer to allow testing diff. implementations. - Added Ringbuffer.AllocEmptyArray factory interface, allowing to pass a constructor to construct the generic array. - Added functionality is growBuffer(..), allowing to either grow a full or empty buffer, using Ringbuffer.AllocEmptyArray. - Removed explicit 'clearRef' at get*(..), always clear the taken reference for better interface generalization. - Added LFRingbuffer, exposing lock-free get*(..) and put*(..) methods using the 'Always Keep One Slot Open' pattern using the read/write index as barriers only. - Ctor's copy an optional passed user array into the internal array, utilizing Ringbuffer.AllocEmptyArray. - Added unit tests.
* Remedy for Bug 782: Issue Debug.initSingleton() or Debug.debug(..) before ↵Sven Gothel2013-07-172-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | calling 'PropertyAccess.isPropertyDefined(propName, default)' through Debug class. Calling 'Debug.isPropertyDefined(propName, default)' may be 'optimized' to 'PropertyAccess.isPropertyDefined(propName, default)', which would skip the modules Debug's class initialization. Iff that happens, an AccessControlException may happen, due to requesting an insecure property, since modules own Debug class has not been added it's trusted prefixes from within it's init block yet. This seems to be a bug of the JVM .. to me, however .. the above description is the only able to explain the issue at hand. +++ Fix calls Debug class own static methods, either Debug.initSingleton() or Debug.debug(), before calling 'isPropertyDefined(propName, default)'. +++ Also mark Debug class static methods final! +++
* gluegen: remove unneeded casts to JarEntryHarvey Harrison2013-07-152-2/+2
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove redundant test for null relativePathHarvey Harrison2013-07-151-1/+1
| | | | | | We are inside a block where relativePath must be non-null, remove the redundant check Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove redundant assignment of tmpBaseDirHarvey Harrison2013-07-151-2/+0
| | | | | | - can only be null here, remove the entire else condition Signed-off-by: Harvey Harrison <[email protected]>
* Fix a typo (Retruns => Returns)Sylvestre Ledru2013-07-101-2/+2
|
* RunnableTask/FunctionTask run(): Write tExecuted in finally block, removing ↵Sven Gothel2013-07-092-8/+6
| | | | code redundancy and placing write at end of operation.
* Fix commit e46b51f75b550bc0faf70ae18f526d466d8180f3Sven Gothel2013-06-241-0/+3
| | | | Funny .. subclasses didn't compile in test compilation locally.
* SingletonInstance: Add stats about time/attempts, subtract real-time delta ↵Sven Gothel2013-06-241-10/+20
| | | | from remaining amount.
* Security: Tighten DynamicLinker*, NativeLibrary and DynamicLibraryBundle ↵Sven Gothel2013-06-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | access (2) - Completes 23341a2df2d2ea36784a16fa1db8bc7385351a12 - Replace 'DynamicLinker' interface w/ well documented one - All DynamicLinker methods are now considered secure, i.e.: - open/lookup and close utilize reference counting on handle via a hash map. - lookupSymbol(..) and close(..) impl. validate the passed library handle whether it's retrieved via open*. This is the fast path, not that expensive. - lookupSymbolGlobal(..) performs Check acccess of 'new RuntimePermission("loadLibrary.*")' if SecurityManager is installed. This is the slow path. - DynamicLibraryBundleInfo now reflects the security requirements, i.e. whether priviledged access is needed.
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-193-63/+153
| | | | | | | | | | | | | | | | | | | | | | | | 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)' ++
* GlueGen (Compile Time): Add 'CStruct' Annotation Processor (APT) to ↵Sven Gothel2013-06-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'gluegen' C Structs on-the-fly (2-pass actually). Convenient annotation processing (APT) hooked to 'javac' (1.6) via gluegen.jar META-INF service provider 'javax.annotation.processing.Processor' -> 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor'. Am implicit APT / JAVAC would be possible, however - to have a proper process the unit test utilizes an explicit 2 pass run: <!-- Annotation Processor Only - First --> <javac destdir="${build_t.java}"> <classpath refid="junit.compile.classpath"/> <compilerarg value="-proc:only"/> <compilerarg value="-J-Djogamp.gluegen.structgen.debug"/> <compilerarg value="-J-Djogamp.gluegen.structgen.output=${build_t.gen}/classes"/> <src path="${test.base.dir}/com/jogamp/gluegen/test/junit/structgen"/> </javac> <!-- Javac Only - Second --> <javac destdir="${build_t.java}"> <classpath refid="junit.compile.classpath"/> <compilerarg value="-proc:none"/> <src path="${test.base.dir}"/> <src path="${build_t.gen}" /> </javac> Original code from Michael Bien's 'superglue' git://github.com/mbien/superglue.git, finally merged to GlueGen (as once intended). Note: The APT javac pass requires to use 'gluegen.jar' instead of 'gluegen-rt.jar' ! The 2-pass process also alows using the runtime gluegen-rt.jar and hence ensures clean namespace check at compilation.
* Bug 752: Review Code Vulnerabilities (Permission Checks of new exposed code ↵Sven Gothel2013-06-114-138/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 part1b: Add IOUtil.getRelativeOf(URL, ..), wrapper for URI for ↵Sven Gothel2013-06-091-0/+12
| | | | convenience (JOGL ShaderCode) and bwd. compatibility
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-093-275/+295
| | | | to remove DNS Lookups etc ..
* Enhance VersionNumber*: Use only RegExp and cache default (no wrapped ↵Sven Gothel2013-05-312-28/+191
| | | | whitespace tokenizer); String match: Store end-of-match and flag defined components.
* VersionNumber*: Add static final 'zeroVersion' for convenience and identity.Sven Gothel2013-04-262-1/+8
|
* VersionNumber: Add API doc, use final int values, remove protected 'nop' ↵Sven Gothel2013-04-162-21/+94
| | | | ctor; Add VersionNumberString [extends VersionNumber] which additionally holds the orig. string value.
* IntBitfield: Add bit-count, O(1) per int-element, using HAKEM.Sven Gothel2013-04-111-0/+26
|
* IntBitfield: Add optimization path w/ int bitCount bitfield range. Replace ↵Sven Gothel2013-04-111-12/+60
| | | | '* 32' -> '<< 5', same for division.
* gluegen: use enhanced for-loops in ArrayHashSetHarvey Harrison2013-04-031-10/+9
| | | | | | | | | | | | Fixes an infinite loop in addAll due to the following line: mod = mod || add(iter.next()) ; After the first successful add, mod will be true and thereafter iter.next will never be called again, due to || shortcutting. the loop will then run forever as any further elements will never be taken from the iterator, so hasNext will always be true. Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: use explicit ArrayList constructor to avoid @SuppressWarnings and ↵Harvey Harrison2013-04-031-4/+2
| | | | | | | | | clone() ArrayList.clone does _not_ make a shallow copy, a new internal array is allocated. As such, there is nearly no benefit to using clone(). Signed-off-by: Harvey Harrison <[email protected]>
* ArrayHashSet: Add ctor w/ initialCapacity and (initialCapacity, loadFactor)Sven Gothel2013-04-011-4/+24
|
* VersionUtil: add getManifest(.., String[] extensions) variant, allowing ↵Sven Gothel2013-03-281-5/+30
| | | | detection of multiple ordered extensions
* Revert version.timestamp to yyyyMMdd only, i.e. w/o HHmmSven Gothel2013-03-281-2/+2
| | | | | Changes in hour/minute is not only overkill, but may confuse our aggregation scripts, which compare versions. Out nodes time daemon may not be in synchronized that well.
* Bug 588: Adding jogamp.version property, i.e. 2.0.2-rc-<TIMESTAMP> used for ↵Sven Gothel2013-03-281-0/+25
| | | | | | | | | | | | Manifest ; Common jogamp_int_version for Android. Until 2.0.2 gets released, the version string is 2.0.2-rc-<TIMESTAMP> and used in the Manifest for IMPLEMENTATION_VERSION. The previous build version name of IMPLEMENTATION_VERSION goes into the new tag IMPLEMENTATION_BUILD. Further more, we use a common jogamp_int_version for Android, to make life more easy.
* Function- RunnableTask: Clear runnableException @ start for re-entry; Fix ↵Sven Gothel2013-03-183-11/+39
| | | | tExecuted (@ exception); Add debug property 'jogamp.debug.TaskBase.TraceSource', to dump ctor stack trace @ exception.
* Function- RunnableTask: Add PrintStream 'exceptionOut' argument allowing non ↵Sven Gothel2013-03-184-19/+45
| | | | | | | blocking exceptions to be shown. Exceptions occuring on non blocking off-thread tasks shall at least be made visible while not allowed to crash the system.
* Fix Long*HashMap impl. of IntIntHashMap: Better 64bit hash value, using new ↵Sven Gothel2013-03-122-12/+79
| | | | | | HashUtil. Introduce markup: /*keyHash*/(.*)/*keyHash*/ allowing Long*HashMap to inject hash function for 64bit value.
* Promote AWTEDTExecutor to public package com.jogamp.common.util.awt ; ↵Sven Gothel2013-02-281-0/+110
| | | | Exclude java.part.awt in android gluegen-rt.