diff options
Diffstat (limited to 'src/java/jogamp/common')
29 files changed, 217 insertions, 223 deletions
diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java index 6dc2098..4f3b673 100644 --- a/src/java/jogamp/common/Debug.java +++ b/src/java/jogamp/common/Debug.java @@ -75,7 +75,7 @@ public class Debug extends PropertyAccess { return debugAll; } - public static final boolean debug(String subcomponent) { + public static final boolean debug(final String subcomponent) { return debugAll() || isPropertyDefined("jogamp.debug." + subcomponent, true); } } diff --git a/src/java/jogamp/common/jvm/JVMUtil.java b/src/java/jogamp/common/jvm/JVMUtil.java index e655654..76f8ea5 100644 --- a/src/java/jogamp/common/jvm/JVMUtil.java +++ b/src/java/jogamp/common/jvm/JVMUtil.java @@ -54,12 +54,12 @@ public class JVMUtil { private static final boolean DEBUG = Debug.debug("JVMUtil"); static { - ByteBuffer buffer = Buffers.newDirectByteBuffer(64); + final ByteBuffer buffer = Buffers.newDirectByteBuffer(64); if( ! initialize(buffer) ) { throw new RuntimeException("Failed to initialize the JVMUtil "+Thread.currentThread().getName()); } if(DEBUG) { - Exception e = new Exception("JVMUtil.initSingleton() .. initialized "+Thread.currentThread().getName()); + final Exception e = new Exception("JVMUtil.initSingleton() .. initialized "+Thread.currentThread().getName()); e.printStackTrace(); } } diff --git a/src/java/jogamp/common/os/AndroidUtils.java b/src/java/jogamp/common/os/AndroidUtils.java index bb09ba9..299dbc5 100644 --- a/src/java/jogamp/common/os/AndroidUtils.java +++ b/src/java/jogamp/common/os/AndroidUtils.java @@ -58,7 +58,7 @@ public class AndroidUtils { * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)}, * otherwise the found package version code of <code>packageName</code> is returned. */ - public static final int getPackageInfoVersionCode(String packageName) { + public static final int getPackageInfoVersionCode(final String packageName) { if(null != androidGetPackageInfoVersionCodeMethod) { return ((Integer) ReflectionUtil.callMethod(null, androidGetPackageInfoVersionCodeMethod, packageName)).intValue(); } @@ -70,7 +70,7 @@ public class AndroidUtils { * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)}, * otherwise the found package version name of <code>packageName</code> is returned. */ - public static final String getPackageInfoVersionName(String packageName) { + public static final String getPackageInfoVersionName(final String packageName) { if(null != androidGetPackageInfoVersionNameMethod) { return (String) ReflectionUtil.callMethod(null, androidGetPackageInfoVersionNameMethod, packageName); } diff --git a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java index 09057f8..b293776 100644 --- a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java @@ -44,17 +44,17 @@ public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl { private static final int RTLD_GLOBAL = 0x00002; @Override - public final long openLibraryLocal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryLocal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_LOCAL, debug); } @Override - public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryGlobal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug); } @Override - public final long lookupSymbolGlobal(String symbolName) throws SecurityException { + public final long lookupSymbolGlobal(final String symbolName) throws SecurityException { return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName); } diff --git a/src/java/jogamp/common/os/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java index dde4d5c..392d906 100644 --- a/src/java/jogamp/common/os/DynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java @@ -41,7 +41,7 @@ import com.jogamp.common.util.LongObjectHashMap; private final LongObjectHashMap libHandle2Name = new LongObjectHashMap( 16 /* initialCapacity */ ); protected static final class LibRef { - public LibRef(String name) { + public LibRef(final String name) { this.name = name; this.refCount = 1; } @@ -57,11 +57,11 @@ import com.jogamp.common.util.LongObjectHashMap; private int refCount; } - protected final synchronized LibRef getLibRef(long handle) { + protected final synchronized LibRef getLibRef(final long handle) { return (LibRef) libHandle2Name.get(handle); } - protected final synchronized LibRef incrLibRefCount(long handle, String libName) { + protected final synchronized LibRef incrLibRefCount(final long handle, final String libName) { LibRef libRef = getLibRef(handle); if( null == libRef ) { libRef = new LibRef(libName); @@ -75,8 +75,8 @@ import com.jogamp.common.util.LongObjectHashMap; return libRef; } - protected final synchronized LibRef decrLibRefCount(long handle) { - LibRef libRef = getLibRef(handle); + protected final synchronized LibRef decrLibRefCount(final long handle) { + final LibRef libRef = getLibRef(handle); if( null != libRef ) { if( 0 == libRef.decrRefCount() ) { libHandle2Name.remove(handle); diff --git a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java index b2f0f31..0fdfc8b 100644 --- a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java @@ -42,17 +42,17 @@ public final class MacOSXDynamicLinkerImpl extends UnixDynamicLinkerImpl { private static final int RTLD_GLOBAL = 0x00008; @Override - public final long openLibraryLocal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryLocal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_LOCAL, debug); } @Override - public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryGlobal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug); } @Override - public final long lookupSymbolGlobal(String symbolName) throws SecurityException { + public final long lookupSymbolGlobal(final String symbolName) throws SecurityException { return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName); } diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java index 254cda2..e62c914 100644 --- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java +++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java @@ -131,11 +131,11 @@ public class MachineDescriptionRuntime { private static MachineDescription getRuntimeImpl() { try { Platform.initSingleton(); // loads native gluegen-rt library - } catch (UnsatisfiedLinkError err) { + } catch (final UnsatisfiedLinkError err) { return null; } - int pointerSizeInBytes = getPointerSizeInBytesImpl(); + final int pointerSizeInBytes = getPointerSizeInBytesImpl(); switch(pointerSizeInBytes) { case 4: case 8: diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java index 1b9128d..61a5369 100644 --- a/src/java/jogamp/common/os/PlatformPropsImpl.java +++ b/src/java/jogamp/common/os/PlatformPropsImpl.java @@ -106,7 +106,7 @@ public abstract class PlatformPropsImpl { usOff = 1; } if( 0 < usIdx ) { - final String buildS = Platform.JAVA_VERSION.substring(usIdx+usOff); + final String buildS = PlatformPropsImpl.JAVA_VERSION.substring(usIdx+usOff); final VersionNumber update = new VersionNumber(buildS); JAVA_VERSION_UPDATE = update.getMajor(); } else { @@ -251,7 +251,7 @@ public abstract class PlatformPropsImpl { Class.forName("java.nio.LongBuffer"); Class.forName("java.nio.DoubleBuffer"); return true; - } catch(ClassNotFoundException ex) { + } catch(final ClassNotFoundException ex) { // continue with Java SE check } @@ -259,9 +259,9 @@ public abstract class PlatformPropsImpl { } private static final boolean queryIsLittleEndianImpl() { - ByteBuffer tst_b = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT); // 32bit in native order - IntBuffer tst_i = tst_b.asIntBuffer(); - ShortBuffer tst_s = tst_b.asShortBuffer(); + final ByteBuffer tst_b = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT); // 32bit in native order + final IntBuffer tst_i = tst_b.asIntBuffer(); + final ShortBuffer tst_s = tst_b.asShortBuffer(); tst_i.put(0, 0x0A0B0C0D); return 0x0C0D == tst_s.get(0); } @@ -356,7 +356,7 @@ public abstract class PlatformPropsImpl { if( null != file ) { res = queryABITypeImpl(file, cpuType, abiType); } - } catch(Throwable t) { + } catch(final Throwable t) { if(DEBUG) { t.printStackTrace(); } @@ -408,7 +408,7 @@ public abstract class PlatformPropsImpl { abiType[0] = ABIType.GENERIC_ABI; } res = eh; - } catch(Throwable t) { + } catch(final Throwable t) { if(DEBUG) { System.err.println("Caught: "+t.getMessage()); t.printStackTrace(); @@ -417,7 +417,7 @@ public abstract class PlatformPropsImpl { if(null != in) { try { in.close(); - } catch (IOException e) { } + } catch (final IOException e) { } } } if(DEBUG) { @@ -428,7 +428,7 @@ public abstract class PlatformPropsImpl { private static boolean checkFileReadAccess(final File file) { try { return file.isFile() && file.canRead(); - } catch (Throwable t) { } + } catch (final Throwable t) { } return false; } private static File findSysLib(final String libName) { diff --git a/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java b/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java index f2aa360..f929e03 100644 --- a/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java @@ -38,17 +38,17 @@ public final class PosixDynamicLinkerImpl extends UnixDynamicLinkerImpl { private static final int RTLD_GLOBAL = 0x00100; @Override - public final long openLibraryLocal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryLocal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_LOCAL, debug); } @Override - public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException { + public final long openLibraryGlobal(final String pathname, final boolean debug) throws SecurityException { return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug); } @Override - public final long lookupSymbolGlobal(String symbolName) throws SecurityException { + public final long lookupSymbolGlobal(final String symbolName) throws SecurityException { return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName); } } diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java index 7a0e3b0..59be76c 100644 --- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java @@ -49,7 +49,7 @@ import com.jogamp.common.util.SecurityUtil; /** Interface to C language function: <br> <code> void * dlsym(void * , const char * ); </code> */ protected static native long dlsym(long arg0, java.lang.String arg1); - protected final long openLibraryImpl(String pathname, int dlSymFlags, boolean debug) throws SecurityException { + protected final long openLibraryImpl(final String pathname, final int dlSymFlags, final boolean debug) throws SecurityException { SecurityUtil.checkLinkPermission(pathname); final long handle = dlopen(pathname, dlSymFlags); if( 0 != handle ) { @@ -60,7 +60,7 @@ import com.jogamp.common.util.SecurityUtil; return handle; } - protected final long lookupSymbolGlobalImpl(long dlSymGlobalFlag, String symbolName) throws SecurityException { + protected final long lookupSymbolGlobalImpl(final long dlSymGlobalFlag, final String symbolName) throws SecurityException { SecurityUtil.checkAllLinkPermission(); final long addr = dlsym(dlSymGlobalFlag, symbolName); if(DEBUG_LOOKUP) { @@ -70,7 +70,7 @@ import com.jogamp.common.util.SecurityUtil; } @Override - public final long lookupSymbol(long libraryHandle, String symbolName) throws IllegalArgumentException { + public final long lookupSymbol(final long libraryHandle, final String symbolName) throws IllegalArgumentException { if( null == getLibRef( libraryHandle ) ) { throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); } @@ -82,7 +82,7 @@ import com.jogamp.common.util.SecurityUtil; } @Override - public final void closeLibrary(long libraryHandle) throws IllegalArgumentException { + public final void closeLibrary(final long libraryHandle) throws IllegalArgumentException { if( null == decrLibRefCount( libraryHandle ) ) { throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); } diff --git a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java index 76bb2f8..de69d0c 100644 --- a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java @@ -44,27 +44,27 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl { private static native long LoadLibraryW(java.lang.String lpLibFileName); @Override - public final long openLibraryLocal(String libraryName, boolean debug) throws SecurityException { + public final long openLibraryLocal(final String libraryName, final boolean debug) throws SecurityException { // How does that work under Windows ? // Don't know .. so it's an alias for the time being return openLibraryGlobal(libraryName, debug); } @Override - public final long openLibraryGlobal(String libraryName, boolean debug) throws SecurityException { + public final long openLibraryGlobal(final String libraryName, final boolean debug) throws SecurityException { SecurityUtil.checkLinkPermission(libraryName); final long handle = LoadLibraryW(libraryName); if( 0 != handle ) { incrLibRefCount(handle, libraryName); } else if ( DEBUG || debug ) { - int err = GetLastError(); + final int err = GetLastError(); System.err.println("LoadLibraryW \""+libraryName+"\" failed, error code: 0x"+Integer.toHexString(err)+", "+err); } return handle; } @Override - public final long lookupSymbolGlobal(String symbolName) throws SecurityException { + public final long lookupSymbolGlobal(final String symbolName) throws SecurityException { SecurityUtil.checkAllLinkPermission(); if(DEBUG_LOOKUP) { System.err.println("lookupSymbolGlobal: Not supported on Windows"); @@ -74,7 +74,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl { } @Override - public final long lookupSymbol(long libraryHandle, String symbolName) throws IllegalArgumentException { + public final long lookupSymbol(final long libraryHandle, final String symbolName) throws IllegalArgumentException { if( null == getLibRef( libraryHandle ) ) { throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); } @@ -97,7 +97,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl { } @Override - public final void closeLibrary(long libraryHandle) throws IllegalArgumentException { + public final void closeLibrary(final long libraryHandle) throws IllegalArgumentException { if( null == decrLibRefCount( libraryHandle ) ) { throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); } diff --git a/src/java/jogamp/common/os/android/AndroidUtilsImpl.java b/src/java/jogamp/common/os/android/AndroidUtilsImpl.java index fc8d606..8dcdd6f 100644 --- a/src/java/jogamp/common/os/android/AndroidUtilsImpl.java +++ b/src/java/jogamp/common/os/android/AndroidUtilsImpl.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -36,39 +36,39 @@ import android.util.Log; public class AndroidUtilsImpl { private static boolean DEBUG = false; - - public static final PackageInfo getPackageInfo(String packageName) { + + public static final PackageInfo getPackageInfo(final String packageName) { return getPackageInfo(StaticContext.getContext(), packageName); } - - public static final PackageInfo getPackageInfo(Context ctx, String packageName) { + + public static final PackageInfo getPackageInfo(final Context ctx, final String packageName) { if(null != ctx) { try { final PackageInfo pi = ctx.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA); if(DEBUG) Log.d(MD.TAG, "getPackageInfo("+packageName+"): "+pi); return pi; - } catch (Exception e) { if(DEBUG) { Log.d(MD.TAG, "getPackageInfo("+packageName+")", e); } } + } catch (final Exception e) { if(DEBUG) { Log.d(MD.TAG, "getPackageInfo("+packageName+")", e); } } } if(DEBUG) Log.d(MD.TAG, "getPackageInfo("+packageName+"): NULL"); return null; } - - public static final int getPackageInfoVersionCode(String packageName) { + + public static final int getPackageInfoVersionCode(final String packageName) { final PackageInfo pInfo = getPackageInfo(packageName); return ( null != pInfo ) ? pInfo.versionCode : -1 ; } - - public static final String getPackageInfoVersionName(String packageName) { + + public static final String getPackageInfoVersionName(final String packageName) { final PackageInfo pInfo = getPackageInfo(packageName); final String s = ( null != pInfo ) ? pInfo.versionName : null ; if(DEBUG) Log.d(MD.TAG, "getPackageInfoVersionName("+packageName+"): "+s); return s; } - + /** - * @return null if no Android Context is registered - * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)}, - * otherwise the context relative world readable <code>temp</code> directory returned. + * @return null if no Android Context is registered + * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)}, + * otherwise the context relative world readable <code>temp</code> directory returned. */ public static File getTempRoot() throws SecurityException, RuntimeException @@ -86,5 +86,5 @@ public class AndroidUtilsImpl { } return null; } - + } diff --git a/src/java/jogamp/common/os/android/GluegenVersionActivity.java b/src/java/jogamp/common/os/android/GluegenVersionActivity.java index 5db3213..c216867 100644 --- a/src/java/jogamp/common/os/android/GluegenVersionActivity.java +++ b/src/java/jogamp/common/os/android/GluegenVersionActivity.java @@ -28,6 +28,8 @@ package jogamp.common.os.android; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; @@ -42,7 +44,7 @@ public class GluegenVersionActivity extends Activity { TextView tv = null; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(MD.TAG, "onCreate - S"); super.onCreate(savedInstanceState); StaticContext.init(this.getApplicationContext()); @@ -54,7 +56,7 @@ public class GluegenVersionActivity extends Activity { scroller.addView(tv); setContentView(scroller); - tv.setText(VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+Platform.NEWLINE); + tv.setText(VersionUtil.getPlatformInfo()+PlatformPropsImpl.NEWLINE+GlueGenVersion.getInstance()+PlatformPropsImpl.NEWLINE+PlatformPropsImpl.NEWLINE); Log.d(MD.TAG, "onCreate - X"); } @@ -63,7 +65,7 @@ public class GluegenVersionActivity extends Activity { Log.d(MD.TAG, "onStart - S"); super.onStart(); if(null != tv) { - tv.append("> started"+Platform.NEWLINE); + tv.append("> started"+PlatformPropsImpl.NEWLINE); } Log.d(MD.TAG, "onStart - X"); } @@ -73,7 +75,7 @@ public class GluegenVersionActivity extends Activity { Log.d(MD.TAG, "onRestart - S"); super.onRestart(); if(null != tv) { - tv.append("> restarted"+Platform.NEWLINE); + tv.append("> restarted"+PlatformPropsImpl.NEWLINE); } Log.d(MD.TAG, "onRestart - X"); } @@ -82,7 +84,7 @@ public class GluegenVersionActivity extends Activity { public void onResume() { Log.d(MD.TAG, "onResume - S"); if(null != tv) { - tv.append("> resumed"+Platform.NEWLINE); + tv.append("> resumed"+PlatformPropsImpl.NEWLINE); } super.onResume(); Log.d(MD.TAG, "onResume - X"); @@ -92,7 +94,7 @@ public class GluegenVersionActivity extends Activity { public void onPause() { Log.d(MD.TAG, "onPause - S"); if(null != tv) { - tv.append("> paused"+Platform.NEWLINE); + tv.append("> paused"+PlatformPropsImpl.NEWLINE); } super.onPause(); // Log.d(MD.TAG, "onPause - x"); @@ -104,7 +106,7 @@ public class GluegenVersionActivity extends Activity { public void onStop() { Log.d(MD.TAG, "onStop - S"); if(null != tv) { - tv.append("> stopped"+Platform.NEWLINE); + tv.append("> stopped"+PlatformPropsImpl.NEWLINE); } super.onStop(); Log.d(MD.TAG, "onStop - X"); @@ -114,7 +116,7 @@ public class GluegenVersionActivity extends Activity { public void onDestroy() { Log.d(MD.TAG, "onDestroy - S"); if(null != tv) { - tv.append("> destroyed"+Platform.NEWLINE); + tv.append("> destroyed"+PlatformPropsImpl.NEWLINE); } Log.d(MD.TAG, "onDestroy - x"); StaticContext.clear(); diff --git a/src/java/jogamp/common/os/android/MD.java b/src/java/jogamp/common/os/android/MD.java index d6a2e48..4d0d631 100644 --- a/src/java/jogamp/common/os/android/MD.java +++ b/src/java/jogamp/common/os/android/MD.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. diff --git a/src/java/jogamp/common/os/android/StaticContext.java b/src/java/jogamp/common/os/android/StaticContext.java index 359e603..5585407 100644 --- a/src/java/jogamp/common/os/android/StaticContext.java +++ b/src/java/jogamp/common/os/android/StaticContext.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -34,27 +34,27 @@ import android.view.ViewGroup; public class StaticContext { private static Context appContext = null; private static ViewGroup contentViewGroup = null; - + private static boolean DEBUG = false; - + /** * Register Android application context for static usage. - * + * * @param appContext mandatory application Context * @throws RuntimeException if the context is already registered. */ - public static final synchronized void init(Context appContext) { + public static final synchronized void init(final Context appContext) { init(appContext, null); } - + /** * Register Android application context w/ a ViewGroup for static usage. - * + * * @param appContext mandatory application Context * @param contentViewGroup optional ViewGroup acting as the Window's ContentView, usually a FrameLayout instance. * @throws RuntimeException if the context is already registered. */ - public static final synchronized void init(Context appContext, ViewGroup contentViewGroup) { + public static final synchronized void init(final Context appContext, final ViewGroup contentViewGroup) { if(null != StaticContext.appContext) { throw new RuntimeException("Context already set"); } @@ -62,7 +62,7 @@ public class StaticContext { StaticContext.appContext = appContext; StaticContext.contentViewGroup = contentViewGroup; } - + /** * Unregister the Android application Context and ViewGroup */ @@ -71,15 +71,15 @@ public class StaticContext { appContext = null; contentViewGroup = null; } - + /** * Return the registered Android application Context * @return */ public static final synchronized Context getContext() { return appContext; - } - + } + /** * Return the registered Android ViewGroup acting as the Window's ContentView * @return diff --git a/src/java/jogamp/common/os/elf/Ehdr.java b/src/java/jogamp/common/os/elf/Ehdr.java index d787f67..e12ef4f 100644 --- a/src/java/jogamp/common/os/elf/Ehdr.java +++ b/src/java/jogamp/common/os/elf/Ehdr.java @@ -3,10 +3,6 @@ package jogamp.common.os.elf; -import java.nio.*; - -import com.jogamp.gluegen.runtime.*; -import com.jogamp.common.os.*; import com.jogamp.common.nio.*; import jogamp.common.os.MachineDescriptionRuntime; @@ -41,11 +37,11 @@ public class Ehdr { return create(Buffers.newDirectByteBuffer(size())); } - public static Ehdr create(java.nio.ByteBuffer buf) { + public static Ehdr create(final java.nio.ByteBuffer buf) { return new Ehdr(buf); } - Ehdr(java.nio.ByteBuffer buf) { + Ehdr(final java.nio.ByteBuffer buf) { accessor = new StructAccessor(buf); } @@ -53,14 +49,14 @@ public class Ehdr { return accessor.getBuffer(); } - public Ehdr setE_ident(byte[] val) { + public Ehdr setE_ident(final byte[] val) { accessor.setBytesAt(e_ident_offset[mdIdx], val); return this; } public byte[] getE_ident() { return accessor.getBytesAt(e_ident_offset[mdIdx], new byte[16]); } - public Ehdr setE_type(short val) { + public Ehdr setE_type(final short val) { accessor.setShortAt(e_type_offset[mdIdx], val); return this; } @@ -69,7 +65,7 @@ public class Ehdr { return accessor.getShortAt(e_type_offset[mdIdx]); } - public Ehdr setE_machine(short val) { + public Ehdr setE_machine(final short val) { accessor.setShortAt(e_machine_offset[mdIdx], val); return this; } @@ -78,7 +74,7 @@ public class Ehdr { return accessor.getShortAt(e_machine_offset[mdIdx]); } - public Ehdr setE_version(int val) { + public Ehdr setE_version(final int val) { accessor.setIntAt(e_version_offset[mdIdx], val); return this; } @@ -87,7 +83,7 @@ public class Ehdr { return accessor.getIntAt(e_version_offset[mdIdx]); } - public Ehdr setE_entry(long val) { + public Ehdr setE_entry(final long val) { accessor.setLongAt(e_entry_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -96,7 +92,7 @@ public class Ehdr { return accessor.getLongAt(e_entry_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_phoff(long val) { + public Ehdr setE_phoff(final long val) { accessor.setLongAt(e_phoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -105,7 +101,7 @@ public class Ehdr { return accessor.getLongAt(e_phoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_shoff(long val) { + public Ehdr setE_shoff(final long val) { accessor.setLongAt(e_shoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -114,7 +110,7 @@ public class Ehdr { return accessor.getLongAt(e_shoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_flags(int val) { + public Ehdr setE_flags(final int val) { accessor.setIntAt(e_flags_offset[mdIdx], val); return this; } @@ -123,7 +119,7 @@ public class Ehdr { return accessor.getIntAt(e_flags_offset[mdIdx]); } - public Ehdr setE_ehsize(short val) { + public Ehdr setE_ehsize(final short val) { accessor.setShortAt(e_ehsize_offset[mdIdx], val); return this; } @@ -132,7 +128,7 @@ public class Ehdr { return accessor.getShortAt(e_ehsize_offset[mdIdx]); } - public Ehdr setE_phentsize(short val) { + public Ehdr setE_phentsize(final short val) { accessor.setShortAt(e_phentsize_offset[mdIdx], val); return this; } @@ -141,7 +137,7 @@ public class Ehdr { return accessor.getShortAt(e_phentsize_offset[mdIdx]); } - public Ehdr setE_phnum(short val) { + public Ehdr setE_phnum(final short val) { accessor.setShortAt(e_phnum_offset[mdIdx], val); return this; } @@ -150,7 +146,7 @@ public class Ehdr { return accessor.getShortAt(e_phnum_offset[mdIdx]); } - public Ehdr setE_shentsize(short val) { + public Ehdr setE_shentsize(final short val) { accessor.setShortAt(e_shentsize_offset[mdIdx], val); return this; } @@ -159,7 +155,7 @@ public class Ehdr { return accessor.getShortAt(e_shentsize_offset[mdIdx]); } - public Ehdr setE_shnum(short val) { + public Ehdr setE_shnum(final short val) { accessor.setShortAt(e_shnum_offset[mdIdx], val); return this; } @@ -168,7 +164,7 @@ public class Ehdr { return accessor.getShortAt(e_shnum_offset[mdIdx]); } - public Ehdr setE_shstrndx(short val) { + public Ehdr setE_shstrndx(final short val) { accessor.setShortAt(e_shstrndx_offset[mdIdx], val); return this; } diff --git a/src/java/jogamp/common/os/elf/ElfHeader.java b/src/java/jogamp/common/os/elf/ElfHeader.java index f12ccad..3447107 100644 --- a/src/java/jogamp/common/os/elf/ElfHeader.java +++ b/src/java/jogamp/common/os/elf/ElfHeader.java @@ -358,7 +358,7 @@ public class ElfHeader { public static final short EM_MICROBLAZE = 189; public static final short EM_CUDA = 190; - public static final boolean isIdentityValid(byte[] ident) { + public static final boolean isIdentityValid(final byte[] ident) { return ELFMAG0 == ident[0] && ELFMAG1 == ident[1] && ELFMAG2 == ident[2] && @@ -381,7 +381,7 @@ public class ElfHeader { * @throws IOException if reading from the given input stream fails or less then ELF Header size bytes * @throws IllegalArgumentException if the given input stream does not represent an ELF Header */ - public static ElfHeader read(RandomAccessFile in) throws IOException, IllegalArgumentException { + public static ElfHeader read(final RandomAccessFile in) throws IOException, IllegalArgumentException { final int eh_sz = Ehdr.size(); final byte[] buf = new byte[eh_sz]; readBytes (in, buf, 0, eh_sz); @@ -394,7 +394,7 @@ public class ElfHeader { * @throws IllegalArgumentException if the given buffer does not represent an ELF Header * @throws IOException */ - ElfHeader(java.nio.ByteBuffer buf, RandomAccessFile in) throws IllegalArgumentException, IOException { + ElfHeader(final java.nio.ByteBuffer buf, final RandomAccessFile in) throws IllegalArgumentException, IOException { d = Ehdr.create(buf); if( !isIdentityValid(d.getE_ident()) ) { throw new IllegalArgumentException("Buffer is not an ELF Header"); @@ -530,7 +530,7 @@ public class ElfHeader { } /** Returns the 1st occurence of matching SectionHeader {@link SectionHeader#getType() type}, or null if not exists. */ - public final SectionHeader getSectionHeader(int type) { + public final SectionHeader getSectionHeader(final int type) { for(int i=0; i<sht.length; i++) { final SectionHeader sh = sht[i]; if( sh.getType() == type ) { @@ -541,7 +541,7 @@ public class ElfHeader { } /** Returns the 1st occurence of matching SectionHeader {@link SectionHeader#getName() name}, or null if not exists. */ - public final SectionHeader getSectionHeader(String name) { + public final SectionHeader getSectionHeader(final String name) { for(int i=0; i<sht.length; i++) { final SectionHeader sh = sht[i]; if( sh.getName().equals(name) ) { @@ -589,7 +589,7 @@ public class ElfHeader { ", abi[os "+getOSABI()+", vers "+getOSABIVersion()+"], flags["+toHexString(getFlags())+armFlagsS+"], type "+getType()+", sh-num "+sht.length+"]"; } - final SectionHeader[] readSectionHeaderTable(RandomAccessFile in) throws IOException, IllegalArgumentException { + final SectionHeader[] readSectionHeaderTable(final RandomAccessFile in) throws IOException, IllegalArgumentException { // positioning { final long off = d.getE_shoff(); // absolute offset @@ -607,7 +607,7 @@ public class ElfHeader { // Read 1st table 1st and use it's sh_size final byte[] buf0 = new byte[size]; readBytes(in, buf0, 0, size); - SectionHeader sh0 = new SectionHeader(buf0, 0, size, 0); + final SectionHeader sh0 = new SectionHeader(buf0, 0, size, 0); num = (int) sh0.d.getSh_size(); if( 0 >= num ) { throw new IllegalArgumentException("EHdr sh_num == 0 and 1st SHdr size == 0"); diff --git a/src/java/jogamp/common/os/elf/IOUtils.java b/src/java/jogamp/common/os/elf/IOUtils.java index 57b7a48..62b47db 100644 --- a/src/java/jogamp/common/os/elf/IOUtils.java +++ b/src/java/jogamp/common/os/elf/IOUtils.java @@ -36,11 +36,11 @@ import com.jogamp.common.util.Bitstream; class IOUtils { static final long MAX_INT_VALUE = ( Integer.MAX_VALUE & 0xffffffffL ) ; - static String toHexString(int i) { return "0x"+Integer.toHexString(i); } + static String toHexString(final int i) { return "0x"+Integer.toHexString(i); } - static String toHexString(long i) { return "0x"+Long.toHexString(i); } + static String toHexString(final long i) { return "0x"+Long.toHexString(i); } - static int shortToInt(short s) { + static int shortToInt(final short s) { return s & 0x0000ffff; } @@ -57,7 +57,7 @@ class IOUtils { in.readFully(out, offset, len); } - static void seek(final RandomAccessFile in, long newPos) throws IOException { + static void seek(final RandomAccessFile in, final long newPos) throws IOException { in.seek(newPos); } @@ -83,7 +83,7 @@ class IOUtils { * @return the parsed string * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>. */ - static String getString(final byte[] sb, final int offset, final int remaining, int[] offset_post) throws IndexOutOfBoundsException { + static String getString(final byte[] sb, final int offset, final int remaining, final int[] offset_post) throws IndexOutOfBoundsException { Bitstream.checkBounds(sb, offset, remaining); int strlen = 0; for(; strlen < remaining && sb[strlen + offset] != 0; strlen++) { } @@ -102,7 +102,7 @@ class IOUtils { * @return the number of parsed strings * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>. */ - static int getStringCount(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException { + static int getStringCount(final byte[] sb, final int offset, final int remaining) throws IndexOutOfBoundsException { Bitstream.checkBounds(sb, offset, remaining); int strnum=0; for(int i=0; i < remaining; i++) { @@ -120,7 +120,7 @@ class IOUtils { * @return the parsed strings * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>. */ - public static String[] getStrings(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException { + public static String[] getStrings(final byte[] sb, final int offset, final int remaining) throws IndexOutOfBoundsException { final int strnum = getStringCount(sb, offset, remaining); // System.err.println("XXX: strnum "+strnum+", sb_off "+sb_off+", sb_len "+sb_len); diff --git a/src/java/jogamp/common/os/elf/Section.java b/src/java/jogamp/common/os/elf/Section.java index 01dc62b..29dc209 100644 --- a/src/java/jogamp/common/os/elf/Section.java +++ b/src/java/jogamp/common/os/elf/Section.java @@ -33,7 +33,7 @@ public class Section { public int offset; public int length; - Section(SectionHeader sh, byte[] data, int offset, int length) { + Section(final SectionHeader sh, final byte[] data, final int offset, final int length) { this.sh = sh; this.data = data; this.offset = offset; diff --git a/src/java/jogamp/common/os/elf/SectionArmAttributes.java b/src/java/jogamp/common/os/elf/SectionArmAttributes.java index db6710a..91e8c31 100644 --- a/src/java/jogamp/common/os/elf/SectionArmAttributes.java +++ b/src/java/jogamp/common/os/elf/SectionArmAttributes.java @@ -48,7 +48,7 @@ public class SectionArmAttributes extends Section { * Returns true if value is either {@link #ABI_VFP_ARGS_IS_VFP_VARIANT} or {@link #ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT} * @param v ULEB128 Value from {@link Tag#ABI_VFP_args} attribute */ - public static final boolean abiVFPArgsAcceptsVFPVariant(byte v) { + public static final boolean abiVFPArgsAcceptsVFPVariant(final byte v) { return ABI_VFP_ARGS_IS_VFP_VARIANT == v || ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT == v; } @@ -113,7 +113,7 @@ public class SectionArmAttributes extends Section { return null; } - Tag(int id, Type type){ + Tag(final int id, final Type type){ this.id = id; this.type = type; } @@ -123,7 +123,7 @@ public class SectionArmAttributes extends Section { public final Tag tag; private final Object value; - Attribute(Tag tag, Object value) { + Attribute(final Tag tag, final Object value) { this.tag = tag; this.value = value; } @@ -158,7 +158,7 @@ public class SectionArmAttributes extends Section { public final String vendor; public final List<Attribute> attributes; - VendorAttributes(String vendor, List<Attribute> attributes) { + VendorAttributes(final String vendor, final List<Attribute> attributes) { this.vendor = vendor; this.attributes = attributes; } @@ -170,7 +170,7 @@ public class SectionArmAttributes extends Section { } public final List<VendorAttributes> vendorAttributesList; - SectionArmAttributes(SectionHeader sh, byte[] data, int offset, int length) throws IndexOutOfBoundsException, IllegalArgumentException { + SectionArmAttributes(final SectionHeader sh, final byte[] data, final int offset, final int length) throws IndexOutOfBoundsException, IllegalArgumentException { super(sh, data, offset, length); this.vendorAttributesList = parse(data, offset, length); } @@ -180,7 +180,7 @@ public class SectionArmAttributes extends Section { return "SectionArmAttributes["+super.toSubString()+", "+vendorAttributesList.toString()+"]"; } - public final Attribute get(Tag tag) { + public final Attribute get(final Tag tag) { for(int i=0; i<vendorAttributesList.size(); i++) { final List<Attribute> attributes = vendorAttributesList.get(i).attributes; for(int j=0; j<attributes.size(); j++) { @@ -193,11 +193,11 @@ public class SectionArmAttributes extends Section { return null; } - public final List<Attribute> get(String vendor) { + public final List<Attribute> get(final String vendor) { return get(vendorAttributesList, vendor); } - static final List<Attribute> get(final List<VendorAttributes> vendorAttributesList, String vendor) { + static final List<Attribute> get(final List<VendorAttributes> vendorAttributesList, final String vendor) { for(int i=0; i<vendorAttributesList.size(); i++) { final VendorAttributes vas = vendorAttributesList.get(i); if( vas.vendor.equals(vendor) ) { @@ -232,7 +232,7 @@ public class SectionArmAttributes extends Section { final String vendor; { - int[] i_post = new int[] { 0 }; + final int[] i_post = new int[] { 0 }; vendor = getString(in, i, secLen - 4, i_post); i = i_post[0]; } @@ -240,7 +240,7 @@ public class SectionArmAttributes extends Section { final List<Attribute> attributes = new ArrayList<Attribute>(); while(i < secLen) { - int[] i_post = new int[] { 0 }; + final int[] i_post = new int[] { 0 }; parseSub(in, i, secLen - i, i_post, attributes); i = i_post[0]; } @@ -268,7 +268,7 @@ public class SectionArmAttributes extends Section { * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>. * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data. */ - static void parseSub(final byte[] in, final int offset, final int remaining, int[] offset_post, List<Attribute> attributes) throws IndexOutOfBoundsException, IllegalArgumentException { + static void parseSub(final byte[] in, final int offset, final int remaining, final int[] offset_post, final List<Attribute> attributes) throws IndexOutOfBoundsException, IllegalArgumentException { Bitstream.checkBounds(in, offset, remaining); // Starts w/ sub-section Tag @@ -299,7 +299,7 @@ public class SectionArmAttributes extends Section { switch(tag.type) { case NTBS: { - int[] i_post = new int[] { 0 }; + final int[] i_post = new int[] { 0 }; final String value = getString(in, i, subSecLen + offset - i, i_post); attributes.add(new Attribute(tag, value)); i = i_post[0]; diff --git a/src/java/jogamp/common/os/elf/SectionHeader.java b/src/java/jogamp/common/os/elf/SectionHeader.java index 8a83b61..20a40a5 100644 --- a/src/java/jogamp/common/os/elf/SectionHeader.java +++ b/src/java/jogamp/common/os/elf/SectionHeader.java @@ -174,13 +174,13 @@ public class SectionHeader { /** Public access to the raw elf section header */ public final Shdr d; - private int idx; + private final int idx; private String name; - SectionHeader(byte[] buf, int offset, int length, int sectionIdx) { + SectionHeader(final byte[] buf, final int offset, final int length, final int sectionIdx) { this( ByteBuffer.wrap(buf, 0, buf.length), sectionIdx ); } - SectionHeader(java.nio.ByteBuffer buf, int idx) { + SectionHeader(final java.nio.ByteBuffer buf, final int idx) { d = Shdr.create(buf); this.idx = idx; name = null; @@ -231,7 +231,7 @@ public class SectionHeader { * @throws IOException if read error occurs * @throws IllegalArgumentException if section offset or size mismatch including size > {@link Integer#MAX_VALUE} */ - public Section readSection(RandomAccessFile in) throws IOException, IllegalArgumentException { + public Section readSection(final RandomAccessFile in) throws IOException, IllegalArgumentException { final int s_size = long2Int(d.getSh_size()); if( 0 == s_size || 0 > s_size ) { throw new IllegalArgumentException("Shdr["+idx+"] has invalid int size: "+d.getSh_size()+" -> "+s_size); @@ -251,7 +251,7 @@ public class SectionHeader { * @throws IllegalArgumentException if section offset or size mismatch including size > {@link Integer#MAX_VALUE} * @throws IllegalArgumentException if requested read length is > section size */ - public Section readSection(RandomAccessFile in, byte[] b, int b_off, int r_len) throws IOException, IllegalArgumentException { + public Section readSection(final RandomAccessFile in, final byte[] b, final int b_off, final int r_len) throws IOException, IllegalArgumentException { final int s_size = long2Int(d.getSh_size()); if( 0 == s_size || 0 > s_size ) { throw new IllegalArgumentException("Shdr["+idx+"] has invalid int size: "+d.getSh_size()+" -> "+s_size); @@ -262,7 +262,7 @@ public class SectionHeader { return readSectionImpl(in, b, b_off, r_len); } - Section readSectionImpl(RandomAccessFile in, byte[] b, int b_off, int r_len) throws IOException, IllegalArgumentException { + Section readSectionImpl(final RandomAccessFile in, final byte[] b, final int b_off, final int r_len) throws IOException, IllegalArgumentException { final long s_off = d.getSh_offset(); seek(in, s_off); readBytes(in, b, b_off, r_len); diff --git a/src/java/jogamp/common/os/elf/Shdr.java b/src/java/jogamp/common/os/elf/Shdr.java index 5465b3d..d31aec2 100644 --- a/src/java/jogamp/common/os/elf/Shdr.java +++ b/src/java/jogamp/common/os/elf/Shdr.java @@ -3,10 +3,6 @@ package jogamp.common.os.elf; -import java.nio.*; - -import com.jogamp.gluegen.runtime.*; -import com.jogamp.common.os.*; import com.jogamp.common.nio.*; import jogamp.common.os.MachineDescriptionRuntime; @@ -37,11 +33,11 @@ public class Shdr { return create(Buffers.newDirectByteBuffer(size())); } - public static Shdr create(java.nio.ByteBuffer buf) { + public static Shdr create(final java.nio.ByteBuffer buf) { return new Shdr(buf); } - Shdr(java.nio.ByteBuffer buf) { + Shdr(final java.nio.ByteBuffer buf) { accessor = new StructAccessor(buf); } @@ -49,7 +45,7 @@ public class Shdr { return accessor.getBuffer(); } - public Shdr setSh_name(int val) { + public Shdr setSh_name(final int val) { accessor.setIntAt(sh_name_offset[mdIdx], val); return this; } @@ -58,7 +54,7 @@ public class Shdr { return accessor.getIntAt(sh_name_offset[mdIdx]); } - public Shdr setSh_type(int val) { + public Shdr setSh_type(final int val) { accessor.setIntAt(sh_type_offset[mdIdx], val); return this; } @@ -67,7 +63,7 @@ public class Shdr { return accessor.getIntAt(sh_type_offset[mdIdx]); } - public Shdr setSh_flags(long val) { + public Shdr setSh_flags(final long val) { accessor.setLongAt(sh_flags_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -76,7 +72,7 @@ public class Shdr { return accessor.getLongAt(sh_flags_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_addr(long val) { + public Shdr setSh_addr(final long val) { accessor.setLongAt(sh_addr_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -85,7 +81,7 @@ public class Shdr { return accessor.getLongAt(sh_addr_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_offset(long val) { + public Shdr setSh_offset(final long val) { accessor.setLongAt(sh_offset_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -94,7 +90,7 @@ public class Shdr { return accessor.getLongAt(sh_offset_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_size(long val) { + public Shdr setSh_size(final long val) { accessor.setLongAt(sh_size_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -103,7 +99,7 @@ public class Shdr { return accessor.getLongAt(sh_size_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_link(int val) { + public Shdr setSh_link(final int val) { accessor.setIntAt(sh_link_offset[mdIdx], val); return this; } @@ -112,7 +108,7 @@ public class Shdr { return accessor.getIntAt(sh_link_offset[mdIdx]); } - public Shdr setSh_info(int val) { + public Shdr setSh_info(final int val) { accessor.setIntAt(sh_info_offset[mdIdx], val); return this; } @@ -121,7 +117,7 @@ public class Shdr { return accessor.getIntAt(sh_info_offset[mdIdx]); } - public Shdr setSh_addralign(long val) { + public Shdr setSh_addralign(final long val) { accessor.setLongAt(sh_addralign_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } @@ -130,7 +126,7 @@ public class Shdr { return accessor.getLongAt(sh_addralign_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_entsize(long val) { + public Shdr setSh_entsize(final long val) { accessor.setLongAt(sh_entsize_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } diff --git a/src/java/jogamp/common/util/locks/LockDebugUtil.java b/src/java/jogamp/common/util/locks/LockDebugUtil.java index ee0a8e8..6f7ee63 100644 --- a/src/java/jogamp/common/util/locks/LockDebugUtil.java +++ b/src/java/jogamp/common/util/locks/LockDebugUtil.java @@ -64,13 +64,13 @@ public class LockDebugUtil { } } - public static void dumpRecursiveLockTrace(PrintStream out) { + public static void dumpRecursiveLockTrace(final PrintStream out) { if(Lock.DEBUG) { - List<Throwable> ls = getRecursiveLockTrace(); + final List<Throwable> ls = getRecursiveLockTrace(); if(null!=ls && ls.size()>0) { int j=0; out.println("TLSLockedStacks: locks "+ls.size()); - for(Iterator<Throwable> i=ls.iterator(); i.hasNext(); j++) { + for(final Iterator<Throwable> i=ls.iterator(); i.hasNext(); j++) { out.print(j+": "); i.next().printStackTrace(out); } diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java b/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java index f49e406..c930dff 100644 --- a/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java +++ b/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java @@ -43,7 +43,7 @@ import com.jogamp.common.util.locks.RecursiveLock; public class RecursiveLockImpl01CompleteFair implements RecursiveLock { private static class WaitingThread { - WaitingThread(Thread t) { + WaitingThread(final Thread t) { thread = t; signaledByUnlock = false; } @@ -59,11 +59,11 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { private final Thread getOwner() { return getExclusiveOwnerThread(); } - private final void setOwner(Thread t) { + private final void setOwner(final Thread t) { setExclusiveOwnerThread(t); } - private final void setLockedStack(Throwable s) { - List<Throwable> ls = LockDebugUtil.getRecursiveLockTrace(); + private final void setLockedStack(final Throwable s) { + final List<Throwable> ls = LockDebugUtil.getRecursiveLockTrace(); if(s==null) { ls.remove(lockedStack); } else { @@ -78,7 +78,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { /** stack trace of the lock, only used if DEBUG */ private Throwable lockedStack = null; } - private Sync sync = new Sync(); + private final Sync sync = new Sync(); public RecursiveLockImpl01CompleteFair() { } @@ -102,7 +102,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { } @Override - public final boolean isOwner(Thread thread) { + public final boolean isOwner(final Thread thread) { synchronized(sync) { return sync.getOwner() == thread ; } @@ -155,7 +155,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { } throw new RuntimeException("Waited "+TIMEOUT+"ms for: "+toString()+" - "+threadName(Thread.currentThread())); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException("Interrupted", e); } } @@ -187,14 +187,14 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { } // enqueue at the start - WaitingThread wCur = new WaitingThread(cur); + final WaitingThread wCur = new WaitingThread(cur); sync.queue.add(0, wCur); do { final long t0 = System.currentTimeMillis(); try { sync.wait(timeout); timeout -= System.currentTimeMillis() - t0; - } catch (InterruptedException e) { + } catch (final InterruptedException e) { if( !wCur.signaledByUnlock ) { sync.queue.remove(wCur); // O(n) throw e; // propagate interruption not send by unlock @@ -255,7 +255,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { } @Override - public final void unlock(Runnable taskAfterUnlockBeforeNotify) { + public final void unlock(final Runnable taskAfterUnlockBeforeNotify) { synchronized(sync) { validateLocked(); final Thread cur = Thread.currentThread(); @@ -314,6 +314,6 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock { private final String syncName() { return "<"+Integer.toHexString(this.hashCode())+", "+Integer.toHexString(sync.hashCode())+">"; } - private final String threadName(Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } + private final String threadName(final Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } } diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java b/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java index 8c9f720..132a9a2 100644 --- a/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java +++ b/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java @@ -72,11 +72,11 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { return getExclusiveOwnerThread(); } @Override - public boolean isOwner(Thread t) { + public boolean isOwner(final Thread t) { return getExclusiveOwnerThread()==t; } @Override - public final void setOwner(Thread t) { + public final void setOwner(final Thread t) { setExclusiveOwnerThread(t); } @Override @@ -84,8 +84,8 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { return lockedStack; } @Override - public final void setLockedStack(Throwable s) { - List<Throwable> ls = LockDebugUtil.getRecursiveLockTrace(); + public final void setLockedStack(final Throwable s) { + final List<Throwable> ls = LockDebugUtil.getRecursiveLockTrace(); if(s==null) { ls.remove(lockedStack); } else { @@ -96,9 +96,9 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { @Override public final int getHoldCount() { return holdCount; } @Override - public void incrHoldCount(Thread t) { holdCount++; } + public void incrHoldCount(final Thread t) { holdCount++; } @Override - public void decrHoldCount(Thread t) { holdCount--; } + public void decrHoldCount(final Thread t) { holdCount--; } @Override public final int getQSz() { return qsz; } @@ -117,7 +117,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { protected final Sync sync; - public RecursiveLockImpl01Unfairish(Sync sync) { + public RecursiveLockImpl01Unfairish(final Sync sync) { this.sync = sync; } @@ -144,7 +144,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { } @Override - public final boolean isOwner(Thread thread) { + public final boolean isOwner(final Thread thread) { synchronized(sync) { return sync.isOwner(thread); } @@ -197,7 +197,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { } throw new RuntimeException("Waited "+TIMEOUT+"ms for: "+toString()+" - "+threadName(Thread.currentThread())); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException("Interrupted", e); } } @@ -270,7 +270,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { } @Override - public void unlock(Runnable taskAfterUnlockBeforeNotify) { + public void unlock(final Runnable taskAfterUnlockBeforeNotify) { synchronized(sync) { validateLocked(); final Thread cur = Thread.currentThread(); @@ -315,6 +315,6 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock { /* package */ final String syncName() { return "<"+Integer.toHexString(this.hashCode())+", "+Integer.toHexString(sync.hashCode())+">"; } - /* package */ final String threadName(Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } + /* package */ final String threadName(final Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } } diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java index f3dfa42..badaa72 100644 --- a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java +++ b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java @@ -10,7 +10,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { volatile Thread owner = null; ReentrantLock lock; - public RecursiveLockImplJava5(boolean fair) { + public RecursiveLockImplJava5(final boolean fair) { lock = new ReentrantLock(fair); } @@ -20,14 +20,14 @@ public class RecursiveLockImplJava5 implements RecursiveLock { if(!tryLock(TIMEOUT)) { throw new RuntimeException("Waited "+TIMEOUT+"ms for: "+threadName(owner)+" - "+threadName(Thread.currentThread())+", with count "+getHoldCount()+", lock: "+this); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException("Interrupted", e); } owner = Thread.currentThread(); } @Override - public boolean tryLock(long timeout) throws InterruptedException { + public boolean tryLock(final long timeout) throws InterruptedException { if(lock.tryLock(timeout, TimeUnit.MILLISECONDS)) { owner = Thread.currentThread(); return true; @@ -41,7 +41,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { } @Override - public void unlock(Runnable taskAfterUnlockBeforeNotify) { + public void unlock(final Runnable taskAfterUnlockBeforeNotify) { validateLocked(); owner = null; if(null!=taskAfterUnlockBeforeNotify) { @@ -66,7 +66,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { } @Override - public boolean isOwner(Thread thread) { + public boolean isOwner(final Thread thread) { return lock.isLocked() && owner == thread; } @@ -91,5 +91,5 @@ public class RecursiveLockImplJava5 implements RecursiveLock { return lock.getQueueLength(); } - private String threadName(Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } + private String threadName(final Thread t) { return null!=t ? "<"+t.getName()+">" : "<NULL>" ; } } diff --git a/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java b/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java index 7a386d6..77f73d8 100644 --- a/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java +++ b/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java @@ -44,14 +44,14 @@ public class RecursiveThreadGroupLockImpl01Unfairish holdCountAdditionOwner = 0; } @Override - public final void incrHoldCount(Thread t) { + public final void incrHoldCount(final Thread t) { super.incrHoldCount(t); if(!isOriginalOwner(t)) { holdCountAdditionOwner++; } } @Override - public final void decrHoldCount(Thread t) { + public final void decrHoldCount(final Thread t) { super.decrHoldCount(t); if(!isOriginalOwner(t)) { holdCountAdditionOwner--; @@ -61,11 +61,11 @@ public class RecursiveThreadGroupLockImpl01Unfairish return holdCountAdditionOwner; } - public final boolean isOriginalOwner(Thread t) { + public final boolean isOriginalOwner(final Thread t) { return super.isOwner(t); } @Override - public final boolean isOwner(Thread t) { + public final boolean isOwner(final Thread t) { if(getExclusiveOwnerThread()==t) { return true; } @@ -80,7 +80,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish public final int getAddOwnerCount() { return threadNum; } - public final void addOwner(Thread t) throws IllegalArgumentException { + public final void addOwner(final Thread t) throws IllegalArgumentException { if(null == threads) { if(threadNum>0) { throw new InternalError("XXX"); @@ -106,7 +106,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish threadNum=0; } - public final void removeOwner(Thread t) throws IllegalArgumentException { + public final void removeOwner(final Thread t) throws IllegalArgumentException { for (int i = 0 ; i < threadNum ; i++) { if (threads[i] == t) { threadNum--; @@ -119,7 +119,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish } String addOwnerToString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for(int i=0; i<threadNum; i++) { if(i>0) { sb.append(", "); @@ -145,14 +145,14 @@ public class RecursiveThreadGroupLockImpl01Unfairish } @Override - public final boolean isOriginalOwner(Thread thread) { + public final boolean isOriginalOwner(final Thread thread) { synchronized(sync) { return ((ThreadGroupSync)sync).isOriginalOwner(thread) ; } } @Override - public final void addOwner(Thread t) throws RuntimeException, IllegalArgumentException { + public final void addOwner(final Thread t) throws RuntimeException, IllegalArgumentException { validateLocked(); final Thread cur = Thread.currentThread(); final ThreadGroupSync tgSync = (ThreadGroupSync)sync; @@ -166,7 +166,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish } @Override - public final void unlock(Runnable taskAfterUnlockBeforeNotify) { + public final void unlock(final Runnable taskAfterUnlockBeforeNotify) { synchronized(sync) { final Thread cur = Thread.currentThread(); final ThreadGroupSync tgSync = (ThreadGroupSync)sync; @@ -182,7 +182,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish while ( tgSync.getAdditionalOwnerHoldCount() > 0 ) { try { sync.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { // regular wake up! } } @@ -205,7 +205,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish } @Override - public final void removeOwner(Thread t) throws RuntimeException, IllegalArgumentException { + public final void removeOwner(final Thread t) throws RuntimeException, IllegalArgumentException { validateLocked(); ((ThreadGroupSync)sync).removeOwner(t); } diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java index a3d3ac9..44a5d28 100644 --- a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java +++ b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java @@ -41,11 +41,11 @@ public class SingletonInstanceFileLock extends SingletonInstance { static { String s = null; try { - File tmpFile = File.createTempFile("TEST", "tst"); - String absTmpFile = tmpFile.getCanonicalPath(); + final File tmpFile = File.createTempFile("TEST", "tst"); + final String absTmpFile = tmpFile.getCanonicalPath(); tmpFile.delete(); s = absTmpFile.substring(0, absTmpFile.lastIndexOf(File.separator)); - } catch (IOException ex) { + } catch (final IOException ex) { ex.printStackTrace(); } temp_file_path = s; @@ -55,17 +55,17 @@ public class SingletonInstanceFileLock extends SingletonInstance { return temp_file_path; } - public static String getCanonicalTempLockFilePath(String basename) { + public static String getCanonicalTempLockFilePath(final String basename) { return getCanonicalTempPath() + File.separator + basename; } - public SingletonInstanceFileLock(long poll_ms, String lockFileBasename) { + public SingletonInstanceFileLock(final long poll_ms, final String lockFileBasename) { super(poll_ms); file = new File ( getCanonicalTempLockFilePath ( lockFileBasename ) ); setupFileCleanup(); } - public SingletonInstanceFileLock(long poll_ms, File lockFile) { + public SingletonInstanceFileLock(final long poll_ms, final File lockFile) { super(poll_ms); file = lockFile ; setupFileCleanup(); @@ -96,7 +96,7 @@ public class SingletonInstanceFileLock extends SingletonInstance { if (fileLock != null) { return true; } - } catch (Exception e) { + } catch (final Exception e) { System.err.println(infoPrefix()+" III "+getName()+" - Unable to create and/or lock file"); e.printStackTrace(); } @@ -118,7 +118,7 @@ public class SingletonInstanceFileLock extends SingletonInstance { file.delete(); } return true; - } catch (Exception e) { + } catch (final Exception e) { System.err.println(infoPrefix()+" EEE "+getName()+" - Unable to remove lock file"); e.printStackTrace(); } finally { diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java index a1ca2ff..b1b42c3 100644 --- a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java +++ b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java @@ -40,30 +40,30 @@ public class SingletonInstanceServerSocket extends SingletonInstance { private final Server singletonServer; private final String fullName; - public SingletonInstanceServerSocket(long poll_ms, int portNumber) { + public SingletonInstanceServerSocket(final long poll_ms, final int portNumber) { super(poll_ms); // Gather the local InetAddress, loopback is prioritized InetAddress ilh = null; try { ilh = InetAddress.getByName(null); // loopback - } catch (UnknownHostException e1) { } + } catch (final UnknownHostException e1) { } if(null == ilh) { try { ilh = InetAddress.getByName("localhost"); if(null!=ilh && !ilh.isLoopbackAddress()) { ilh = null; } - } catch (UnknownHostException e1) { } + } catch (final UnknownHostException e1) { } } if(null == ilh) { try { ilh = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 } ); if(null!=ilh && !ilh.isLoopbackAddress()) { ilh = null; } - } catch (UnknownHostException e) { } + } catch (final UnknownHostException e) { } } if(null == ilh) { try { ilh = InetAddress.getLocalHost(); - } catch (UnknownHostException e) { } + } catch (final UnknownHostException e) { } } if(null == ilh) { throw new RuntimeException(infoPrefix()+" EEE Could not determine local InetAddress"); @@ -97,11 +97,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance { } // check if other JVM's locked the server socket .. - Socket clientSocket = singletonServer.connect(); + final Socket clientSocket = singletonServer.connect(); if(null != clientSocket) { try { clientSocket.close(); - } catch (IOException e) { } + } catch (final IOException e) { } return false; } @@ -124,11 +124,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance { private volatile boolean shallQuit = false; private volatile boolean alive = false; - private Object syncOnStartStop = new Object(); + private final Object syncOnStartStop = new Object(); private ServerSocket serverSocket = null; private Thread serverThread = null; // allowing kill() to force-stop last server-thread - public Server(InetAddress localInetAddress, int portNumber) { + public Server(final InetAddress localInetAddress, final int portNumber) { this.localInetAddress = localInetAddress; this.portNumber = portNumber; } @@ -145,11 +145,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance { serverThread.start(); try { syncOnStartStop.wait(); - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { ie.printStackTrace(); } } - boolean ok = isBound(); + final boolean ok = isBound(); if(!ok) { shutdown(); } @@ -164,7 +164,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { connect(); try { syncOnStartStop.wait(); - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { ie.printStackTrace(); } } @@ -188,14 +188,14 @@ public class SingletonInstanceServerSocket extends SingletonInstance { if(null != serverThread) { try { serverThread.stop(); - } catch(Throwable t) { } + } catch(final Throwable t) { } } if(null != serverSocket) { try { final ServerSocket ss = serverSocket; serverSocket = null; ss.close(); - } catch (Throwable t) { } + } catch (final Throwable t) { } } } @@ -208,7 +208,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { public final Socket connect() { try { return new Socket(localInetAddress, portNumber); - } catch (Exception e) { } + } catch (final Exception e) { } return null; } @@ -227,7 +227,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { serverSocket = new ServerSocket(portNumber, 1, localInetAddress); serverSocket.setReuseAddress(true); // reuse same port w/ subsequent instance, i.e. overcome TO state when JVM crashed alive = true; - } catch (IOException e) { + } catch (final IOException e) { System.err.println(infoPrefix()+" III - Unable to install ServerSocket: "+e.getMessage()); shallQuit = true; } finally { @@ -239,7 +239,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { try { final Socket clientSocket = serverSocket.accept(); clientSocket.close(); - } catch (IOException ioe) { + } catch (final IOException ioe) { System.err.println(infoPrefix()+" EEE - Exception during accept: " + ioe.getMessage()); } } @@ -249,7 +249,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { if(null != serverSocket) { serverSocket.close(); } - } catch (IOException e) { + } catch (final IOException e) { System.err.println(infoPrefix()+" EEE - Exception during close: " + e.getMessage()); } finally { serverSocket = null; |