aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com/jogamp/common/os')
-rw-r--r--src/junit/com/jogamp/common/os/TestElfReader01.java50
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); }
+
}