diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/junit/com/jogamp/common/os/TestElfReader01.java | |
parent | eb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting 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
Diffstat (limited to 'src/junit/com/jogamp/common/os/TestElfReader01.java')
-rw-r--r-- | src/junit/com/jogamp/common/os/TestElfReader01.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/junit/com/jogamp/common/os/TestElfReader01.java b/src/junit/com/jogamp/common/os/TestElfReader01.java index 9e0c939..bc6aef1 100644 --- a/src/junit/com/jogamp/common/os/TestElfReader01.java +++ b/src/junit/com/jogamp/common/os/TestElfReader01.java @@ -26,15 +26,15 @@ public class TestElfReader01 extends JunitTracer { public static String GNU_LINUX_SELF_EXE = "/proc/self/exe"; public static String ARM_HF_EXE = "tst-exe-armhf"; public static String ARM_SF_EXE = "tst-exe-arm"; - - private static boolean checkFileReadAccess(File file) { + + private static boolean checkFileReadAccess(final File file) { try { return file.isFile() && file.canRead(); - } catch (Throwable t) { } + } catch (final Throwable t) { } return false; - } - static File findJVMLib(String libName) { - ClassLoader cl = TestElfReader01.class.getClassLoader(); + } + static File findJVMLib(final String libName) { + final ClassLoader cl = TestElfReader01.class.getClassLoader(); final List<String> possibleLibPaths = NativeLibrary.enumerateLibraryPaths(libName, libName, libName, true, cl); for(int i=0; i<possibleLibPaths.size(); i++) { final String libPath = possibleLibPaths.get(i); @@ -47,17 +47,17 @@ public class TestElfReader01 extends JunitTracer { } return null; } - + @Test public void testGNULinuxSelfExe () throws IOException { if( OSType.LINUX == Platform.getOSType() ) { - File f = new File(GNU_LINUX_SELF_EXE); + final File f = new File(GNU_LINUX_SELF_EXE); if( checkFileReadAccess(f) ) { testElfHeaderImpl(f, false); } } } - + @Test public void testJavaLib () throws IOException { File jvmLib = findJVMLib("java"); @@ -68,15 +68,15 @@ public class TestElfReader01 extends JunitTracer { testElfHeaderImpl(jvmLib, false); } } - - void testElfHeaderImpl(File file, boolean fileOutSections) throws IOException { + + void testElfHeaderImpl(final File file, final boolean fileOutSections) throws IOException { System.err.println("Test file "+file.getAbsolutePath()); - RandomAccessFile in = new RandomAccessFile(file, "r"); + final RandomAccessFile in = new RandomAccessFile(file, "r"); try { final ElfHeader eh; try { eh = ElfHeader.read(in); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Probably not an ELF file - or not in current format: (caught) "+e.getMessage()); e.printStackTrace(); return; @@ -91,7 +91,7 @@ public class TestElfReader01 extends JunitTracer { System.err.println("SH size "+eh.sht[0].d.getBuffer().limit()); } { - SectionHeader sh = eh.getSectionHeader(SectionHeader.SHT_ARM_ATTRIBUTES); + final SectionHeader sh = eh.getSectionHeader(SectionHeader.SHT_ARM_ATTRIBUTES); boolean abiVFPArgsAcceptsVFPVariant = false; if( null != sh ) { final SectionArmAttributes sArmAttrs = (SectionArmAttributes) sh.readSection(in); @@ -116,12 +116,12 @@ public class TestElfReader01 extends JunitTracer { in.close(); } } - - static void dumpSection(RandomAccessFile in, SectionHeader sh, String name, boolean fileOut) throws IllegalArgumentException, IOException { + + static void dumpSection(final RandomAccessFile in, final SectionHeader sh, final String name, final boolean fileOut) throws IllegalArgumentException, IOException { final Section s = sh.readSection(in); if(fileOut) { - File outFile = new File("ElfSection-"+sh.getIndex()+"-"+name); - OutputStream out = new BufferedOutputStream(new FileOutputStream(outFile)); + final File outFile = new File("ElfSection-"+sh.getIndex()+"-"+name); + final OutputStream out = new BufferedOutputStream(new FileOutputStream(outFile)); try { out.write(s.data, s.offset, s.length); } finally { @@ -130,13 +130,13 @@ public class TestElfReader01 extends JunitTracer { } System.err.println(name+": read "+s.length+", "+s); } - - public static void main(String args[]) throws IOException { - String tstname = TestElfReader01.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = TestElfReader01.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - - static String toHexString(int i) { return "0x"+Integer.toHexString(i); } - static String toHexString(long i) { return "0x"+Long.toHexString(i); } - + + static String toHexString(final int i) { return "0x"+Integer.toHexString(i); } + static String toHexString(final long i) { return "0x"+Long.toHexString(i); } + } |