diff options
Diffstat (limited to 'vm')
44 files changed, 908 insertions, 911 deletions
diff --git a/vm/reference/gnu/classpath/jdwp/VMFrame.java b/vm/reference/gnu/classpath/jdwp/VMFrame.java index 767a902ff..6419d3ee9 100644 --- a/vm/reference/gnu/classpath/jdwp/VMFrame.java +++ b/vm/reference/gnu/classpath/jdwp/VMFrame.java @@ -44,8 +44,8 @@ import gnu.classpath.jdwp.value.Value; /** * Reference implementation of VM hooks for JDWP Frame access. - * - * @author aluchko + * + * @author aluchko */ public class VMFrame @@ -54,22 +54,22 @@ public class VMFrame * Returns the size of a frame ID over JDWP */ public static final int SIZE = 8; - + //The thread this frame resides in private Thread thread; // The object this frame resides in private Object obj; - + // The current location of this frame private Location loc; - + // id of this frame private long id; - + /** * Create a new VMFrame object. - * + * * @param thr a Thread, the thread this frame is in * @param frame_id a long, the jframeID of this frame * @param frame_loc a Location, the location of this frame @@ -83,7 +83,7 @@ public class VMFrame loc = frame_loc; obj = frame_obj; } - + /** * Gets the current location of the frame. */ @@ -94,18 +94,18 @@ public class VMFrame /** * Returns the value of the variable in the given slot. - * + * * @param slot the slot containing the variable */ public native Value getValue(int slot, byte sig); /** - * Assigns the given variable to the given value. + * Assigns the given variable to the given value. * @param slot The slot which contains the variable * @param value The value to assign the variable to */ public native void setValue(int slot, Value value); - + /** * Get the thread this frame is in. */ diff --git a/vm/reference/gnu/classpath/jdwp/VMIdManager.java b/vm/reference/gnu/classpath/jdwp/VMIdManager.java index 9360e764d..ac3e05a7c 100644 --- a/vm/reference/gnu/classpath/jdwp/VMIdManager.java +++ b/vm/reference/gnu/classpath/jdwp/VMIdManager.java @@ -119,49 +119,49 @@ public class VMIdManager // Special case: arrays if (object.getClass ().isArray ()) - id = new ArrayId (); + id = new ArrayId (); else - { - // Loop through all classes until we hit baseclass - Class myClass; - for (myClass = object.getClass (); myClass != null; - myClass = myClass.getSuperclass ()) - { - Class clz = (Class) _idList.get (myClass); - if (clz != null) - { - try - { - id = (ObjectId) clz.newInstance (); - synchronized (_idLock) - { - id.setId (++_lastId); - } - id.setReference (obj); - return id; - } - catch (InstantiationException ie) - { - // This really should not happen - throw new RuntimeException ("cannot create new ID", ie); - } - catch (IllegalAccessException iae) - { - // This really should not happen - throw new RuntimeException ("illegal access of ID", iae); - } - } - } - - /* getSuperclass returned null and no matching ID type found. - So it must derive from Object. */ - id = new ObjectId (); - } + { + // Loop through all classes until we hit baseclass + Class myClass; + for (myClass = object.getClass (); myClass != null; + myClass = myClass.getSuperclass ()) + { + Class clz = (Class) _idList.get (myClass); + if (clz != null) + { + try + { + id = (ObjectId) clz.newInstance (); + synchronized (_idLock) + { + id.setId (++_lastId); + } + id.setReference (obj); + return id; + } + catch (InstantiationException ie) + { + // This really should not happen + throw new RuntimeException ("cannot create new ID", ie); + } + catch (IllegalAccessException iae) + { + // This really should not happen + throw new RuntimeException ("illegal access of ID", iae); + } + } + } + + /* getSuperclass returned null and no matching ID type found. + So it must derive from Object. */ + id = new ObjectId (); + } synchronized (_idLock) - { - id.setId (++_lastId); - } + { + id.setId (++_lastId); + } id.setReference (obj); return id; } @@ -178,19 +178,19 @@ public class VMIdManager ReferenceTypeId id; Class clazz = (Class) ref.get (); if (clazz == null) - return null; + return null; if (clazz.isArray ()) - id = new ArrayReferenceTypeId (); + id = new ArrayReferenceTypeId (); else if (clazz.isInterface ()) - id = new InterfaceReferenceTypeId (); + id = new InterfaceReferenceTypeId (); else - id = new ClassReferenceTypeId (); + id = new ClassReferenceTypeId (); id.setReference (ref); synchronized (_ridLock) - { - id.setId (++_lastRid); - } + { + id.setId (++_lastRid); + } return id; } } @@ -218,7 +218,7 @@ public class VMIdManager super (referent); _hash = referent.hashCode (); } - + /** * Constructs a new <code>ReferenceKey</code> object * with the given referent and reference queue. @@ -235,7 +235,7 @@ public class VMIdManager super (referent, queue); _hash = referent.hashCode (); } - + /** * Returns the hash code of the referent. * This seems hacky, but is required in order to use this class @@ -262,21 +262,21 @@ public class VMIdManager public boolean equals (Object obj) { if (obj instanceof ReferenceKey) - { - ReferenceKey ref = (ReferenceKey) obj; - - /* First check if the two references are the same. - If they are, that means we must be clearing GCd objects. */ - if (this == obj) - return true; - - return (ref.get () == get ()); - } - + { + ReferenceKey ref = (ReferenceKey) obj; + + /* First check if the two references are the same. + If they are, that means we must be clearing GCd objects. */ + if (this == obj) + return true; + + return (ref.get () == get ()); + } + return false; } } - + // instance of VMIdManager private static VMIdManager _idm = new VMIdManager (); @@ -322,9 +322,9 @@ public class VMIdManager Reference ref; while ((ref = _refQueue.poll ()) != null) { - ObjectId id = (ObjectId) _oidTable.get (ref); - _oidTable.remove (ref); - _idTable.remove (new Long (id.getId ())); + ObjectId id = (ObjectId) _oidTable.get (ref); + _oidTable.remove (ref); + _idTable.remove (new Long (id.getId ())); } } @@ -340,18 +340,18 @@ public class VMIdManager // Special case: null if (theObject == null) return new NullObjectId (); - + ReferenceKey ref = new ReferenceKey (theObject, _refQueue); ObjectId id = (ObjectId) _oidTable.get (ref); if (id == null) { - // update the tables -- this is an arbitrary place to put this - _update (); + // update the tables -- this is an arbitrary place to put this + _update (); - // Object not found. Make new id for it - id = IdFactory.newObjectId (ref); - _oidTable.put (ref, id); - _idTable.put (new Long (id.getId ()), id); + // Object not found. Make new id for it + id = IdFactory.newObjectId (ref); + _oidTable.put (ref, id); + _idTable.put (new Long (id.getId ()), id); } return id; @@ -371,11 +371,11 @@ public class VMIdManager // Special case: null if (id == 0) return new NullObjectId (); - + ObjectId oid = (ObjectId) _idTable.get (new Long (id)); if (oid == null) throw new InvalidObjectException (id); - + return oid; } @@ -399,10 +399,10 @@ public class VMIdManager ReferenceTypeId id = (ReferenceTypeId)_classTable.get (ref); if (id == null) { - // Object not found. Make new id for it - id = IdFactory.newReferenceTypeId (ref); - _classTable.put (ref, id); - _ridTable.put (new Long (id.getId ()), id); + // Object not found. Make new id for it + id = IdFactory.newReferenceTypeId (ref); + _classTable.put (ref, id); + _ridTable.put (new Long (id.getId ()), id); } return id; @@ -422,7 +422,7 @@ public class VMIdManager ReferenceTypeId rid = (ReferenceTypeId) _ridTable.get (new Long (id)); if (rid == null) throw new InvalidClassException (id); - + return rid; } diff --git a/vm/reference/gnu/classpath/jdwp/VMMethod.java b/vm/reference/gnu/classpath/jdwp/VMMethod.java index 6a2b04ecf..8e15a48d1 100644 --- a/vm/reference/gnu/classpath/jdwp/VMMethod.java +++ b/vm/reference/gnu/classpath/jdwp/VMMethod.java @@ -180,8 +180,8 @@ public class VMMethod { if (obj instanceof VMMethod) { - VMMethod m = (VMMethod) obj; - return (getId() == m.getId()); + VMMethod m = (VMMethod) obj; + return (getId() == m.getId()); } return false; diff --git a/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java b/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java index a780913cf..1fe0affc3 100644 --- a/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java +++ b/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java @@ -98,10 +98,10 @@ public class VMVirtualMachine ThreadGroup parent = group.getParent (); while (parent != null) { - group = parent; - parent = group.getParent (); + group = parent; + parent = group.getParent (); } - + // Get all the threads in the system int num = group.activeCount (); Thread[] threads = new Thread[num]; @@ -109,17 +109,17 @@ public class VMVirtualMachine for (int i = 0; i < num; ++i) { - Thread t = threads[i]; - if (t != null) - { - if (t.getThreadGroup () == jdwpGroup || t == current) - { - // Don't suspend the current thread or any JDWP thread - continue; - } - else - suspendThread (t); - } + Thread t = threads[i]; + if (t != null) + { + if (t.getThreadGroup () == jdwpGroup || t == current) + { + // Don't suspend the current thread or any JDWP thread + continue; + } + else + suspendThread (t); + } } // Now suspend the current thread @@ -153,10 +153,10 @@ public class VMVirtualMachine ThreadGroup parent = group.getParent (); while (parent != null) { - group = parent; - parent = group.getParent (); + group = parent; + parent = group.getParent (); } - + // Get all the threads in the system int num = group.activeCount (); Thread[] threads = new Thread[num]; @@ -164,17 +164,17 @@ public class VMVirtualMachine for (int i = 0; i < num; ++i) { - Thread t = threads[i]; - if (t != null) - { - if (t.getThreadGroup () == jdwpGroup || t == current) - { - // Don't resume the current thread or any JDWP thread - continue; - } - else - resumeThread (t); - } + Thread t = threads[i]; + if (t != null) + { + if (t.getThreadGroup () == jdwpGroup || t == current) + { + // Don't resume the current thread or any JDWP thread + continue; + } + else + resumeThread (t); + } } } @@ -186,7 +186,7 @@ public class VMVirtualMachine */ public static native int getSuspendCount(Thread thread) throws JdwpException; - + /** * Returns a Collection of all classes loaded in the VM */ @@ -236,7 +236,7 @@ public class VMVirtualMachine * @return a list of frames */ public static native ArrayList getFrames(Thread thread, int start, - int length) + int length) throws JdwpException; /** @@ -297,9 +297,9 @@ public class VMVirtualMachine * @return a result object containing the results of the invocation */ public static native MethodResult executeMethod (Object obj, Thread thread, - Class clazz, VMMethod method, - Value[] values, - int options) + Class clazz, VMMethod method, + Value[] values, + int options) throws JdwpException; /** diff --git a/vm/reference/gnu/java/lang/VMCPStringBuilder.java b/vm/reference/gnu/java/lang/VMCPStringBuilder.java index 8e137cd3f..c3a3784f3 100644 --- a/vm/reference/gnu/java/lang/VMCPStringBuilder.java +++ b/vm/reference/gnu/java/lang/VMCPStringBuilder.java @@ -59,16 +59,16 @@ final class VMCPStringBuilder { try { - cons = String.class.getDeclaredConstructor(new Class[] { char[].class, - Integer.TYPE, - Integer.TYPE, - Boolean.TYPE }); - cons.setAccessible(true); + cons = String.class.getDeclaredConstructor(new Class[] { char[].class, + Integer.TYPE, + Integer.TYPE, + Boolean.TYPE }); + cons.setAccessible(true); } catch (NoSuchMethodException e) { - throw (Error) - new InternalError("Could not get no-copy String constructor").initCause(e); + throw (Error) + new InternalError("Could not get no-copy String constructor").initCause(e); } } @@ -87,25 +87,25 @@ final class VMCPStringBuilder { try { - return (String) - cons.newInstance(new Object[] { value, Integer.valueOf(startIndex), - Integer.valueOf(count), - Boolean.valueOf(true) }); + return (String) + cons.newInstance(new Object[] { value, Integer.valueOf(startIndex), + Integer.valueOf(count), + Boolean.valueOf(true) }); } catch (InstantiationException e) { - throw (Error) - new InternalError("Could not instantiate no-copy String constructor").initCause(e); + throw (Error) + new InternalError("Could not instantiate no-copy String constructor").initCause(e); } catch (IllegalAccessException e) { - throw (Error) - new InternalError("Could not access no-copy String constructor").initCause(e); + throw (Error) + new InternalError("Could not access no-copy String constructor").initCause(e); } catch (InvocationTargetException e) { - throw (Error) - new InternalError("Error calling no-copy String constructor").initCause(e); + throw (Error) + new InternalError("Error calling no-copy String constructor").initCause(e); } } diff --git a/vm/reference/gnu/java/lang/VMInstrumentationImpl.java b/vm/reference/gnu/java/lang/VMInstrumentationImpl.java index eee94702d..5501f0f7f 100644 --- a/vm/reference/gnu/java/lang/VMInstrumentationImpl.java +++ b/vm/reference/gnu/java/lang/VMInstrumentationImpl.java @@ -48,14 +48,14 @@ import java.lang.instrument.Instrumentation; */ final class VMInstrumentationImpl { - + /** * Returns if the current JVM supports class redefinition - * + * * @return true if the current JVM supports class redefinition */ static native boolean isRedefineClassesSupported(); - + /** * Redefines classes given as parameters. The method has to call * the callTransformers from InstrumentationImpl @@ -63,8 +63,8 @@ final class VMInstrumentationImpl * @param inst an instrumentation object * @param definitions an array of bytecode<->class correspondance * - * @throws ClassNotFoundException if a class cannot be found - * @throws UnmodifiableClassException if a class cannot be modified + * @throws ClassNotFoundException if a class cannot be found + * @throws UnmodifiableClassException if a class cannot be modified * @throws UnsupportedOperationException if the JVM does not support * redefinition or the redefinition made unsupported changes * @throws ClassFormatError if a class file is not valid @@ -74,14 +74,14 @@ final class VMInstrumentationImpl * are unsupported * @throws ClassCircularityError if circularity occured with the new * classes - * @throws LinkageError if a linkage error occurs + * @throws LinkageError if a linkage error occurs */ static native void redefineClasses(Instrumentation inst, ClassDefinition[] definitions); - + /** * Get all the classes loaded by the JVM. - * + * * @return an array containing all the classes loaded by the JVM. The array * is empty if no class is loaded. */ @@ -89,9 +89,9 @@ final class VMInstrumentationImpl /** * Get all the classes loaded by a given class loader - * + * * @param loader the loader - * + * * @return an array containing all the classes loaded by the given loader. * The array is empty if no class was loaded by the loader. */ @@ -99,7 +99,7 @@ final class VMInstrumentationImpl /** * Get the size of an object. The object is not null - * + * * @param objectToSize the object * @return the size of the object */ diff --git a/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java index c1c7d13dd..ea4989741 100644 --- a/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java @@ -38,7 +38,7 @@ exception statement from your version. */ package gnu.java.lang.management; /** - * Provides access to information about the class loading + * Provides access to information about the class loading * behaviour of the current invocation of the virtual * machine. Instances of this bean are obtained by calling * {@link ManagementFactory#getClassLoadingMXBean()}. diff --git a/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java index b9b5bbcef..019af0ca4 100644 --- a/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java @@ -38,7 +38,7 @@ exception statement from your version. */ package gnu.java.lang.management; /** - * Provides access to information about the JIT + * Provides access to information about the JIT * compiler of the virtual machine, if one exists. * Instances of this bean are obtained by calling * {@link ManagementFactory#getCompilationMXBean()}, diff --git a/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java index 2a202849a..00861bc21 100644 --- a/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java @@ -70,7 +70,7 @@ final class VMGarbageCollectorMXBeanImpl * Note that the accumulated time may not change, even when the * collection count increases, if the time taken is sufficiently * short; this depends on the resolution of the timer used. - * + * * @param name the name of the garbage collector. * @return the accumulated number of milliseconds spent collecting, * or -1 if this is undefined. diff --git a/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java index eade26374..7f69bdfb7 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java @@ -126,29 +126,29 @@ final class VMMemoryMXBeanImpl ManagementFactory.getMemoryPoolMXBeans().iterator(); while (pools.hasNext()) { - MemoryPoolMXBean pool = (MemoryPoolMXBean) pools.next(); - if (pool.getType() == type) - { - MemoryUsage usage = pool.getUsage(); - if (init != -1) - { - long poolInit = usage.getInit(); - if (poolInit == -1) - init = -1; - else - init += poolInit; - } - committed += usage.getCommitted(); - used += usage.getUsed(); - if (max != -1) - { - long poolMax = usage.getMax(); - if (poolMax == -1) - max = -1; - else - max += poolMax; - } - } + MemoryPoolMXBean pool = (MemoryPoolMXBean) pools.next(); + if (pool.getType() == type) + { + MemoryUsage usage = pool.getUsage(); + if (init != -1) + { + long poolInit = usage.getInit(); + if (poolInit == -1) + init = -1; + else + init += poolInit; + } + committed += usage.getCommitted(); + used += usage.getUsed(); + if (max != -1) + { + long poolMax = usage.getMax(); + if (poolMax == -1) + max = -1; + else + max += poolMax; + } + } } return new MemoryUsage(init, used, committed, max); } diff --git a/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java index 0a4204a6d..477329f0a 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java @@ -56,10 +56,10 @@ import java.util.List; final class VMMemoryManagerMXBeanImpl { - /** + /** * Returns an array containing the names of the memory pools * this memory manager manages. - * + * * @param name the name of the memory manager. * @return an array containing the name of each memory pool * this manager is responsible for. @@ -70,14 +70,14 @@ final class VMMemoryManagerMXBeanImpl Iterator beans = ManagementFactory.getMemoryPoolMXBeans().iterator(); while (beans.hasNext()) { - MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next(); - String[] managers = bean.getMemoryManagerNames(); - for (int a = 0; a < managers.length; ++a) - if (managers[a].equals(name)) - { - managedPools.add(bean.getName()); - break; - } + MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next(); + String[] managers = bean.getMemoryManagerNames(); + for (int a = 0; a < managers.length; ++a) + if (managers[a].equals(name)) + { + managedPools.add(bean.getName()); + break; + } } return (String[]) managedPools.toArray(new String[managedPools.size()]); } diff --git a/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java index 723d4e897..36cd2586a 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java @@ -106,7 +106,7 @@ final class VMMemoryPoolMXBeanImpl static native MemoryUsage getPeakUsage(String name); /** - * Returns the type of memory used by the specified pool. + * Returns the type of memory used by the specified pool. * The value must be either "HEAP" or "NON_HEAP". * * @param name the name of the pool to obtain statistics on. @@ -149,7 +149,7 @@ final class VMMemoryPoolMXBeanImpl * @return the usage threshold count. */ static native long getUsageThresholdCount(String name); - + /** * Returns true if the specified pool is still valid i.e. * it is still in use by the virtual machine. @@ -158,7 +158,7 @@ final class VMMemoryPoolMXBeanImpl * @return true if the pool is valid. */ static native boolean isValid(String name); - + /** * Resets the peak usage level to the current usage level for * the specified pool. @@ -173,7 +173,7 @@ final class VMMemoryPoolMXBeanImpl * This is only called if this functionality is supported * by the virtual machine (i.e. the appropriate property, * <code>gnu.java.lang.management.CollectionUsageThresholdSupport</code>, - * is defined). + * is defined). * * @param name the name of the pool to set the threshold of. * @param threshold the new threshold level. @@ -185,7 +185,7 @@ final class VMMemoryPoolMXBeanImpl * This is only called if this functionality is supported * by the virtual machine (i.e. the appropriate property, * <code>gnu.java.lang.management.UsageThresholdSupport</code>, - * is defined). + * is defined). * * @param name the name of the pool to set the threshold of. * @param threshold the new threshold level. diff --git a/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java index 1c061aa93..33448d9d5 100644 --- a/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java @@ -40,7 +40,7 @@ package gnu.java.lang.management; import java.lang.management.ThreadInfo; /** - * Provides access to information about the threads + * Provides access to information about the threads * of the virtual machine. An instance of this bean is * obtained by calling * {@link ManagementFactory#getThreadMXBean()}. @@ -87,13 +87,13 @@ final class VMThreadMXBeanImpl filled = group.enumerate(threadList); while (filled == arraySize) { - arraySize *= 2; - threadList = new Thread[arraySize]; - filled = group.enumerate(threadList); + arraySize *= 2; + threadList = new Thread[arraySize]; + filled = group.enumerate(threadList); } return threadList; } - + /** * Returns the id of all live threads at the time of execution. * @@ -141,8 +141,8 @@ final class VMThreadMXBeanImpl int daemonCount = 0; for (int a = 0; a < filled; ++a) { - if (threadList[a].isDaemon()) - ++daemonCount; + if (threadList[a].isDaemon()) + ++daemonCount; } return daemonCount; } @@ -205,7 +205,7 @@ final class VMThreadMXBeanImpl * @return the corresponding <code>ThreadInfo</code>. */ static native ThreadInfo getThreadInfoForId(long id, int maxDepth); - + /** * Returns the number of nanoseconds of user time * the specified thread has used in total. This is @@ -217,7 +217,7 @@ final class VMThreadMXBeanImpl * the thread. */ static native long getThreadUserTime(long id); - + /** * Returns the total number of threads that have * been started over the lifetime of the virtual diff --git a/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java b/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java index 958c21874..da0f893cf 100644 --- a/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java +++ b/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -69,7 +69,7 @@ public final class VMPlainDatagramSocketImpl System.loadLibrary("javanet"); } } - + /** * Binds this socket to a particular port and interface * @@ -78,9 +78,9 @@ public final class VMPlainDatagramSocketImpl * @param addr the address to bind to * * @throws SocketException If an error occurs - */ + */ static native void bind(PlainDatagramSocketImpl socket, int port, - InetAddress addr) + InetAddress addr) throws SocketException; /** @@ -127,7 +127,7 @@ public final class VMPlainDatagramSocketImpl * * @param socket the socket object * @param addr the address to send to - * @param port the port to send to + * @param port the port to send to * @param buf the buffer to send * @param offset the offset of the data in the buffer to send * @param len the length of the data to send diff --git a/vm/reference/gnu/java/net/VMPlainSocketImpl.java b/vm/reference/gnu/java/net/VMPlainSocketImpl.java index 916f95930..c72e6a5eb 100644 --- a/vm/reference/gnu/java/net/VMPlainSocketImpl.java +++ b/vm/reference/gnu/java/net/VMPlainSocketImpl.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -62,7 +62,7 @@ public final class VMPlainSocketImpl private static final int CP_IP_TTL = 0x1E61; private final State nfd; - + /** * Static initializer to load native library. */ @@ -73,19 +73,19 @@ public final class VMPlainSocketImpl System.loadLibrary("javanet"); } } - + public VMPlainSocketImpl() { // XXX consider adding security check here. nfd = new State(); } - + public VMPlainSocketImpl(VMChannel channel) throws IOException { this(); nfd.setChannelFD(channel.getState()); } - + public State getState() { return nfd; @@ -144,7 +144,7 @@ public final class VMPlainSocketImpl else throw new IllegalArgumentException("option value type " + optionValue.getClass().getName()); - + try { setOption(nfd.getNativeFD(), optionId, value); @@ -156,7 +156,7 @@ public final class VMPlainSocketImpl throw se; } } - + private static native void setOption(int fd, int id, int value) throws SocketException; @@ -198,16 +198,16 @@ public final class VMPlainSocketImpl /** * Get a socket option. This implementation is only required to support * socket options that are boolean values, which include: - * + * * SocketOptions.IP_MULTICAST_LOOP * SocketOptions.SO_BROADCAST * SocketOptions.SO_KEEPALIVE * SocketOptions.SO_OOBINLINE * SocketOptions.SO_REUSEADDR * SocketOptions.TCP_NODELAY - * + * * and socket options that are integer values, which include: - * + * * SocketOptions.IP_TOS * SocketOptions.SO_LINGER * SocketOptions.SO_RCVBUF @@ -232,7 +232,7 @@ public final class VMPlainSocketImpl se.initCause(ioe); throw se; } - + switch (optionId) { case SocketOptions.IP_MULTICAST_LOOP: @@ -242,20 +242,20 @@ public final class VMPlainSocketImpl case SocketOptions.SO_REUSEADDR: case SocketOptions.TCP_NODELAY: return Boolean.valueOf(value != 0); - + case SocketOptions.IP_TOS: case SocketOptions.SO_LINGER: case SocketOptions.SO_RCVBUF: case SocketOptions.SO_SNDBUF: case SocketOptions.SO_TIMEOUT: return new Integer(value); - + default: throw new SocketException("getting option " + optionId + " not supported here"); } } - + private static native int getOption(int fd, int id) throws SocketException; /** @@ -264,7 +264,7 @@ public final class VMPlainSocketImpl * * The optionId is provided to make it possible that the native * implementation may do something different depending on whether - * the value is SocketOptions.IP_MULTICAST_IF or + * the value is SocketOptions.IP_MULTICAST_IF or * SocketOptions.IP_MULTICAST_IF2. */ public InetAddress getMulticastInterface(int optionId) @@ -284,7 +284,7 @@ public final class VMPlainSocketImpl private static native InetAddress getMulticastInterface(int fd, int optionId); - + /** * Binds this socket to the given local address and port. * @@ -306,11 +306,11 @@ public final class VMPlainSocketImpl else throw new SocketException ("unsupported address type"); } - + /** * Native bind function for IPv4 addresses. The addr array must be * exactly four bytes long. - * + * * VMs without native support need not implement this. * * @param fd The native file descriptor integer. @@ -320,11 +320,11 @@ public final class VMPlainSocketImpl */ private static native void bind(int fd, byte[] addr, int port) throws IOException; - + /** * Native bind function for IPv6 addresses. The addr array must be * exactly sixteen bytes long. - * + * * VMs without native support need not implement this. * * @param fd The native file descriptor integer. @@ -346,7 +346,7 @@ public final class VMPlainSocketImpl { listen(nfd.getNativeFD(), backlog); } - + /** * Native listen function. VMs without native support need not implement * this. @@ -366,11 +366,11 @@ public final class VMPlainSocketImpl else throw new IllegalArgumentException("unknown address type"); } - + private static native void join(int fd, byte[] addr) throws IOException; - + private static native void join6(int fd, byte[] addr) throws IOException; - + public void leave(InetAddress group) throws IOException { if (group instanceof Inet4Address) @@ -380,16 +380,16 @@ public final class VMPlainSocketImpl else throw new IllegalArgumentException("unknown address type"); } - + private static native void leave(int fd, byte[] addr) throws IOException; - + private static native void leave6(int fd, byte[] addr) throws IOException; public void joinGroup(InetSocketAddress addr, NetworkInterface netif) throws IOException { InetAddress address = addr.getAddress(); - + if (address instanceof Inet4Address) joinGroup(nfd.getNativeFD(), address.getAddress(), netif != null ? netif.getName() : null); @@ -399,13 +399,13 @@ public final class VMPlainSocketImpl else throw new IllegalArgumentException("unknown address type"); } - + private static native void joinGroup(int fd, byte[] addr, String ifname) throws IOException; - + private static native void joinGroup6(int fd, byte[] addr, String ifname) throws IOException; - + public void leaveGroup(InetSocketAddress addr, NetworkInterface netif) throws IOException { @@ -419,42 +419,42 @@ public final class VMPlainSocketImpl else throw new IllegalArgumentException("unknown address type"); } - + private static native void leaveGroup(int fd, byte[] addr, String ifname) throws IOException; - + private static native void leaveGroup6(int fd, byte[] addr, String ifname) throws IOException; - - + + public void shutdownInput() throws IOException { shutdownInput(nfd.getNativeFD()); } - + private static native void shutdownInput(int native_fd) throws IOException; - + public void shutdownOutput() throws IOException { shutdownOutput(nfd.getNativeFD()); } - + private static native void shutdownOutput(int native_fd) throws IOException; - + public void sendUrgentData(int data) throws IOException { sendUrgentData(nfd.getNativeFD(), data); } - + private static native void sendUrgentData(int natfive_fd, int data) throws IOException; - + public void close() throws IOException { nfd.close(); } - + // Inner classes. - + /** * Our wrapper for the native file descriptor. In this implementation, * it is a simple wrapper around {@link VMChannel.State}, to simplify @@ -463,38 +463,38 @@ public final class VMPlainSocketImpl public final class State { private VMChannel.State channelFd; - + State() { channelFd = null; } - + public boolean isValid() { if (channelFd != null) return channelFd.isValid(); return false; } - + public int getNativeFD() throws IOException { return channelFd.getNativeFD(); } - + public void setChannelFD(final VMChannel.State nfd) throws IOException { if (this.channelFd != null && this.channelFd.isValid()) throw new IOException("file descriptor already initialized"); this.channelFd = nfd; } - + public void close() throws IOException { if (channelFd == null) throw new IOException("invalid file descriptor"); channelFd.close(); } - + protected void finalize() throws Throwable { try @@ -509,4 +509,3 @@ public final class VMPlainSocketImpl } } } - diff --git a/vm/reference/gnu/java/nio/VMChannel.java b/vm/reference/gnu/java/nio/VMChannel.java index a9d1452b7..4494ff13c 100644 --- a/vm/reference/gnu/java/nio/VMChannel.java +++ b/vm/reference/gnu/java/nio/VMChannel.java @@ -53,7 +53,7 @@ import java.nio.MappedByteBuffer; /** * Native interface to support configuring of channel to run in a non-blocking * manner and support scatter/gather io operations. - * + * * @author Michael Barker <mike@middlesoft.co.uk> * */ @@ -61,12 +61,12 @@ public final class VMChannel { /** * Our reference implementation uses an integer to store the native - * file descriptor. Implementations without such support + * file descriptor. Implementations without such support */ private final State nfd; - + private Kind kind; - + public VMChannel() { // XXX consider adding security check here, so only Classpath @@ -74,14 +74,14 @@ public final class VMChannel this.nfd = new State(); kind = Kind.OTHER; } - + /** * This constructor is used by the POSIX reference implementation; * other virtual machines need not support it. - * + * * <strong>Important:</strong> do not call this in library code that is * not specific to Classpath's reference implementation. - * + * * @param native_fd The native file descriptor integer. * @throws IOException */ @@ -90,7 +90,7 @@ public final class VMChannel this(); this.nfd.setNativeFD(native_fd); } - + public State getState() { return nfd; @@ -105,62 +105,62 @@ public final class VMChannel } initIDs(); } - + public static VMChannel getStdin() throws IOException { return new VMChannel(stdin_fd()); } - + public static VMChannel getStdout() throws IOException { return new VMChannel(stdout_fd()); } - + public static VMChannel getStderr() throws IOException { return new VMChannel(stderr_fd()); } - + private static native int stdin_fd(); private static native int stdout_fd(); private static native int stderr_fd(); - + /** * Set the file descriptor to have the required blocking * setting. - * + * * @param blocking The blocking flag to set. */ public void setBlocking(boolean blocking) throws IOException { setBlocking(nfd.getNativeFD(), blocking); } - + private static native void setBlocking(int fd, boolean blocking) throws IOException; - + public int available() throws IOException { return available(nfd.getNativeFD()); } - + private static native int available(int native_fd) throws IOException; /** * Reads a byte buffer directly using the supplied file descriptor. - * + * * @param dst Direct Byte Buffer to read to. * @return Number of bytes read. - * @throws IOException If an error occurs or dst is not a direct buffers. + * @throws IOException If an error occurs or dst is not a direct buffers. */ public int read(ByteBuffer dst) throws IOException { return read(nfd.getNativeFD(), dst); } - + private static native int read(int fd, ByteBuffer dst) throws IOException; - + /** * Read a single byte. * @@ -171,19 +171,19 @@ public final class VMChannel { return read(nfd.getNativeFD()); } - + private static native int read(int fd) throws IOException; - + /** * Reads into byte buffers directly using the supplied file descriptor. * Assumes that the buffer list contains DirectBuffers. Will perform a * scattering read. - * + * * @param dsts An array direct byte buffers. * @param offset Index of the first buffer to read to. * @param length The number of buffers to read to. * @return Number of bytes read. - * @throws IOException If an error occurs or the dsts are not direct buffers. + * @throws IOException If an error occurs or the dsts are not direct buffers. */ public long readScattering(ByteBuffer[] dsts, int offset, int length) throws IOException @@ -193,11 +193,11 @@ public final class VMChannel return readScattering(nfd.getNativeFD(), dsts, offset, length); } - + private static native long readScattering(int fd, ByteBuffer[] dsts, int offset, int length) throws IOException; - + /** * Receive a datagram on this channel, returning the host address * that sent the datagram. @@ -228,18 +228,18 @@ public final class VMChannel int port = hostPort.getShort() & 0xFFFF; return new InetSocketAddress(Inet6Address.getByAddress(addr), port); } - + throw new SocketException("host address received with invalid length: " + hostlen); } - + private static native int receive (int fd, ByteBuffer dst, ByteBuffer address) throws IOException; /** * Writes from a direct byte bufer using the supplied file descriptor. * Assumes the buffer is a DirectBuffer. - * + * * @param src The source buffer. * @return Number of bytes written. * @throws IOException @@ -248,14 +248,14 @@ public final class VMChannel { return write(nfd.getNativeFD(), src); } - + private native int write(int fd, ByteBuffer src) throws IOException; /** * Writes from byte buffers directly using the supplied file descriptor. * Assumes the that buffer list constains DirectBuffers. Will perform * as gathering write. - * + * * @param srcs * @param offset * @param length @@ -267,13 +267,13 @@ public final class VMChannel { if (offset + length > srcs.length) throw new IndexOutOfBoundsException("offset + length > srcs.length"); - + // A gathering write is limited to 16 buffers; when writing, ensure // that we have at least one buffer with something in it in the 16 // buffer window starting at offset. while (!srcs[offset].hasRemaining() && offset < srcs.length) offset++; - + // There are no buffers with anything to write. if (offset == srcs.length) return 0; @@ -285,11 +285,11 @@ public final class VMChannel return writeGathering(nfd.getNativeFD(), srcs, offset, length); } - + private native long writeGathering(int fd, ByteBuffer[] srcs, int offset, int length) throws IOException; - + /** * Send a datagram to the given address. * @@ -311,15 +311,15 @@ public final class VMChannel else throw new SocketException("unrecognized inet address type"); } - + // Send to an IPv4 address. private static native int send(int fd, ByteBuffer src, byte[] addr, int port) throws IOException; - + // Send to an IPv6 address. private static native int send6(int fd, ByteBuffer src, byte[] addr, int port) throws IOException; - + /** * Write a single byte. * @@ -330,13 +330,13 @@ public final class VMChannel { write(nfd.getNativeFD(), b); } - + private static native void write(int fd, int b) throws IOException; - + private native static void initIDs(); // Network (socket) specific methods. - + /** * Create a new socket. This method will initialize the native file * descriptor state of this instance. @@ -356,7 +356,7 @@ public final class VMChannel kind = Kind.SOCK_DGRAM; nfd.setNativeFD(socket(stream)); } - + /** * Create a new socket, returning the native file descriptor. * @@ -382,7 +382,7 @@ public final class VMChannel int fd; InetAddress addr = saddr.getAddress(); - + // Translates an IOException into a SocketException to conform // to the throws clause. try @@ -402,13 +402,13 @@ public final class VMChannel timeout); throw new SocketException("unsupported internet address"); } - + private static native boolean connect(int fd, byte[] addr, int port, int timeout) throws SocketException; - + private static native boolean connect6(int fd, byte[] addr, int port, int timeout) throws SocketException; - + /** * Disconnect this channel, if it is a datagram socket. Disconnecting * a datagram channel will disassociate it from any address, so the @@ -424,9 +424,9 @@ public final class VMChannel throw new IOException("can only disconnect datagram channels"); disconnect(nfd.getNativeFD()); } - + private static native void disconnect(int fd) throws IOException; - + public InetSocketAddress getLocalAddress() throws IOException { if (!nfd.isValid()) @@ -451,7 +451,7 @@ public final class VMChannel } throw new SocketException("invalid address length"); } - + private static native int getsockname(int fd, ByteBuffer name) throws IOException; @@ -486,7 +486,7 @@ public final class VMChannel } throw new SocketException("invalid address length"); } - + /* * The format here is the peer address, followed by the port number. * The returned value is the length of the peer address; thus, there @@ -494,7 +494,7 @@ public final class VMChannel */ private static native int getpeername(int fd, ByteBuffer name) throws IOException; - + /** * Accept an incoming connection, returning a new VMChannel, or null * if the channel is nonblocking and no connection is pending. @@ -509,17 +509,17 @@ public final class VMChannel return null; return new VMChannel(new_fd); } - + private static native int accept(int native_fd) throws IOException; // File-specific methods. - + /** * Open a file at PATH, initializing the native state to operate on * that open file. - * + * * @param path The absolute file path. - * @throws IOException If the file cannot be opened, or if this + * @throws IOException If the file cannot be opened, or if this * channel was previously initialized. */ public void openFile(String path, int mode) throws IOException @@ -530,25 +530,25 @@ public final class VMChannel nfd.setNativeFD(fd); kind = Kind.FILE; } - + private static native int open(String path, int mode) throws IOException; - + public long position() throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); return position(nfd.getNativeFD()); } - + private static native long position(int fd) throws IOException; - + public void seek(long pos) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); seek(nfd.getNativeFD(), pos); } - + private static native void seek(int fd, long pos) throws IOException; public void truncate(long length) throws IOException @@ -557,9 +557,9 @@ public final class VMChannel throw new IOException("not a file"); truncate(nfd.getNativeFD(), length); } - + private static native void truncate(int fd, long len) throws IOException; - + public boolean lock(long pos, long len, boolean shared, boolean wait) throws IOException { @@ -567,27 +567,27 @@ public final class VMChannel throw new IOException("not a file"); return lock(nfd.getNativeFD(), pos, len, shared, wait); } - + private static native boolean lock(int fd, long pos, long len, boolean shared, boolean wait) throws IOException; - + public void unlock(long pos, long len) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); unlock(nfd.getNativeFD(), pos, len); } - + private static native void unlock(int fd, long pos, long len) throws IOException; - + public long size() throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); return size(nfd.getNativeFD()); } - + private static native long size(int fd) throws IOException; public MappedByteBuffer map(char mode, long position, int size) @@ -597,22 +597,22 @@ public final class VMChannel throw new IOException("not a file"); return map(nfd.getNativeFD(), mode, position, size); } - + private static native MappedByteBuffer map(int fd, char mode, long position, int size) throws IOException; - + public boolean flush(boolean metadata) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); return flush(nfd.getNativeFD(), metadata); } - + private static native boolean flush(int fd, boolean metadata) throws IOException; - + // Close. - + /** * Close this socket. The socket is also automatically closed when this * object is finalized. @@ -624,13 +624,13 @@ public final class VMChannel { nfd.close(); } - + static native void close(int native_fd) throws IOException; - + /** * <p>Provides a simple mean for the JNI code to find out whether the * current thread was interrupted by a call to Thread.interrupt().</p> - * + * * @return */ static boolean isThreadInterrupted() @@ -639,15 +639,15 @@ public final class VMChannel } // Inner classes. - + /** * A wrapper for a native file descriptor integer. This tracks the state - * of an open file descriptor, and ensures that - * + * of an open file descriptor, and ensures that + * * This class need not be fully supported by virtual machines; if a * virtual machine does not use integer file descriptors, or does and * wishes to hide that, then the methods of this class may be stubbed out. - * + * * System-specific classes that depend on access to native file descriptor * integers SHOULD declare this fact. */ @@ -656,31 +656,31 @@ public final class VMChannel private int native_fd; private boolean valid; private boolean closed; - + State() { native_fd = -1; valid = false; closed = false; } - + public boolean isValid() { return valid; } - + public boolean isClosed() { return closed; } - + public int getNativeFD() throws IOException { if (!valid) throw new IOException("invalid file descriptor"); return native_fd; } - + void setNativeFD(final int native_fd) throws IOException { if (valid) @@ -688,7 +688,7 @@ public final class VMChannel this.native_fd = native_fd; valid = true; } - + public void close() throws IOException { if (!valid) @@ -703,7 +703,7 @@ public final class VMChannel closed = true; } } - + public String toString() { if (closed) @@ -712,7 +712,7 @@ public final class VMChannel return "<<invalid>>"; return String.valueOf(native_fd); } - + protected void finalize() throws Throwable { try @@ -726,7 +726,7 @@ public final class VMChannel } } } - + /** * An enumeration of possible kinds of channel. */ @@ -734,16 +734,16 @@ public final class VMChannel { /** A streaming (TCP) socket. */ static final Kind SOCK_STREAM = new Kind(); - + /** A datagram (UDP) socket. */ static final Kind SOCK_DGRAM = new Kind(); - + /** A file. */ static final Kind FILE = new Kind(); - + /** Something else; not a socket or file. */ static final Kind OTHER = new Kind(); - + private Kind() { } } } diff --git a/vm/reference/gnu/java/nio/VMPipe.java b/vm/reference/gnu/java/nio/VMPipe.java index e5257c1cf..a36970452 100644 --- a/vm/reference/gnu/java/nio/VMPipe.java +++ b/vm/reference/gnu/java/nio/VMPipe.java @@ -57,7 +57,7 @@ final class VMPipe System.loadLibrary ("javanio"); } } - + /** * Create a pipe, consisting of a readable VMChannel and a writable * VMChannel. The readable channel is returned is the first element @@ -75,6 +75,6 @@ final class VMPipe pipe[1] = new VMChannel(fds[1]); return pipe; } - + private static native int[] pipe0() throws IOException; } diff --git a/vm/reference/gnu/java/nio/VMSelector.java b/vm/reference/gnu/java/nio/VMSelector.java index 488132d24..4d37c2c1c 100644 --- a/vm/reference/gnu/java/nio/VMSelector.java +++ b/vm/reference/gnu/java/nio/VMSelector.java @@ -1,4 +1,4 @@ -/* VMSelector.java -- +/* VMSelector.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,7 +50,7 @@ public final class VMSelector System.loadLibrary ("javanio"); } } - + // A timeout value of 0 means block forever. static native int select (int[] read, int[] write, int[] except, long timeout) diff --git a/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java b/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java index 28a021027..86faa097c 100644 --- a/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java +++ b/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java @@ -126,4 +126,4 @@ final class VMSecureRandom running = false; } } -}
\ No newline at end of file +} diff --git a/vm/reference/java/io/VMFile.java b/vm/reference/java/io/VMFile.java index 9f584af23..2af1e95c8 100644 --- a/vm/reference/java/io/VMFile.java +++ b/vm/reference/java/io/VMFile.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -61,7 +61,7 @@ final class VMFile System.loadLibrary("javaio"); } } - + /* * This native method does the actual work of getting the last file * modification time. It also does the existence check to avoid the @@ -120,38 +120,38 @@ final class VMFile * Gets the total bytes of the filesystem named by path. */ public static native long getTotalSpace(String path); - + /** * Gets the total free bytes of the filesystem named by path. */ public static native long getFreeSpace(String path); - + /** * Gets the available bytes of the filesystem named by path. */ public static native long getUsableSpace(String path); - + /** * Set the read permission of the file. */ public static synchronized native boolean setReadable(String path, - boolean readable, - boolean ownerOnly); - + boolean readable, + boolean ownerOnly); + /** * Set the write permission of the file. */ public static synchronized native boolean setWritable(String path, boolean writable, boolean ownerOnly); - + /** * Set the execute permission of the file. */ public static synchronized native boolean setExecutable(String path, boolean executable, boolean ownerOnly); - + /* * This native method does the actual check of whether or not a file * is a plain file or not. It also handles the existence check to @@ -163,7 +163,7 @@ final class VMFile * This native method checks file permissions for writing */ static synchronized native boolean canWrite(String path); - + /** * This methods checks if a directory can be written to. */ @@ -178,7 +178,7 @@ final class VMFile * This native method checks file permissions for execution */ static synchronized native boolean canExecute(String path); - + /* * This method does the actual check of whether or not a file is a * directory or not. It also handle the existence check to eliminate @@ -193,7 +193,7 @@ final class VMFile { return canWriteDirectory(path.getAbsolutePath()); } - + /** * This method returns an array of filesystem roots. Some operating systems * have volume oriented filesystem. This method provides a mechanism for @@ -207,9 +207,9 @@ final class VMFile */ static File[] listRoots() { - File[] roots = new File[1]; - roots[0] = new File("/"); - return roots; + File[] roots = new File[1]; + roots[0] = new File("/"); + return roots; } /** @@ -225,8 +225,8 @@ final class VMFile */ static boolean isHidden(String path) { - // FIXME: this only works on UNIX - return getName(path).startsWith("."); + // FIXME: this only works on UNIX + return getName(path).startsWith("."); } /** @@ -238,14 +238,14 @@ final class VMFile */ static String getName(String path) { - int pos = PlatformHelper.lastIndexOfSeparator(path); - if (pos == -1) - return path; - - if (PlatformHelper.endWithSeparator(path)) - return ""; - - return path.substring(pos + File.separator.length()); + int pos = PlatformHelper.lastIndexOfSeparator(path); + if (pos == -1) + return path; + + if (PlatformHelper.endWithSeparator(path)) + return ""; + + return path.substring(pos + File.separator.length()); } /** @@ -260,7 +260,7 @@ final class VMFile */ static String getAbsolutePath(String path) { - if (File.separatorChar == '\\' + if (File.separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not @@ -274,8 +274,8 @@ final class VMFile || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for - // each drive and a path like "G:foo\bar" would mean the - // absolute path "G:\wombat\foo\bar" if "\wombat" is the + // each drive and a path like "G:foo\bar" would mean the + // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try @@ -288,7 +288,7 @@ final class VMFile } // Note: this would return "C:\\." for the path "C:.", if "\" - // is the working folder on the C drive, but this is + // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); @@ -341,7 +341,7 @@ final class VMFile throws MalformedURLException { // On Win32, Sun's JDK returns URLs of the form "file:/c:/foo/bar.txt", - // while on UNIX, it returns URLs of the form "file:/foo/bar.txt". + // while on UNIX, it returns URLs of the form "file:/foo/bar.txt". if (File.separatorChar == '\\') return new URL ("file:/" + file.getAbsolutePath().replace ('\\', '/') + (file.isDirectory() ? "/" : "")); @@ -358,7 +358,7 @@ final class VMFile * "." and "..", and symbolic links. * <p> * Note that this method, unlike the other methods which return path - * names, can throw an IOException. This is because native method + * names, can throw an IOException. This is because native method * might be required in order to resolve the canonical path * * @exception IOException If an error occurs diff --git a/vm/reference/java/io/VMObjectInputStream.java b/vm/reference/java/io/VMObjectInputStream.java index be0f8eb52..10e1f34cb 100644 --- a/vm/reference/java/io/VMObjectInputStream.java +++ b/vm/reference/java/io/VMObjectInputStream.java @@ -48,7 +48,7 @@ final class VMObjectInputStream { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary("javaio"); + System.loadLibrary("javaio"); } } @@ -59,6 +59,6 @@ final class VMObjectInputStream * which is a super class of the given clazz. */ static native Object allocateObject(Class clazz, Class constr_clazz, - Constructor constructor) + Constructor constructor) throws InstantiationException; } diff --git a/vm/reference/java/io/VMObjectStreamClass.java b/vm/reference/java/io/VMObjectStreamClass.java index 77470fa80..fbaf7d6c8 100644 --- a/vm/reference/java/io/VMObjectStreamClass.java +++ b/vm/reference/java/io/VMObjectStreamClass.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -47,7 +47,7 @@ final class VMObjectStreamClass { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary("javaio"); + System.loadLibrary("javaio"); } } @@ -92,7 +92,7 @@ final class VMObjectStreamClass */ static native void setLongNative(Field field, Object obj, long val) throws InternalError; - + /** * Sets the value of the specified field. This method handles "int". * Warning ! The types are not truely checked here and final values may be @@ -102,9 +102,9 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setIntNative(Field field, Object obj, int val) + static native void setIntNative(Field field, Object obj, int val) throws InternalError; - + /** * Sets the value of the specified field. This method handles "short". * Warning ! The types are not truely checked here and final values may be @@ -114,7 +114,7 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setShortNative(Field field, Object obj, short val) + static native void setShortNative(Field field, Object obj, short val) throws InternalError; /** @@ -126,7 +126,7 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setCharNative(Field field, Object obj, char val) + static native void setCharNative(Field field, Object obj, char val) throws InternalError; /** @@ -138,7 +138,7 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setByteNative(Field field, Object obj, byte val) + static native void setByteNative(Field field, Object obj, byte val) throws InternalError; /** @@ -150,7 +150,7 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setBooleanNative(Field field, Object obj, boolean val) + static native void setBooleanNative(Field field, Object obj, boolean val) throws InternalError; /** @@ -162,8 +162,7 @@ final class VMObjectStreamClass * @param obj Instance which will have its field set. * @param val Value to put in the field. */ - static native void setObjectNative(Field field, Object obj, Object val) + static native void setObjectNative(Field field, Object obj, Object val) throws InternalError; - -} +} diff --git a/vm/reference/java/lang/VMClass.java b/vm/reference/java/lang/VMClass.java index 7e9620b4b..a0091c073 100644 --- a/vm/reference/java/lang/VMClass.java +++ b/vm/reference/java/lang/VMClass.java @@ -58,7 +58,7 @@ import java.lang.reflect.Modifier; * @author Tom Tromey (tromey@cygnus.com) * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ -final class VMClass +final class VMClass { // Only static methods. Cannot be instantiated. @@ -287,11 +287,11 @@ final class VMClass * <code>getName()</code> which follows the last ".". Anonymous * classes have no name, and so the result of calling this method is * "". The simple name of an array consists of the simple name of - * its component type, followed by "[]". Thus, an array with the + * its component type, followed by "[]". Thus, an array with the * component type of an anonymous class has a simple name of simply * "[]". * - * @param klass the class whose simple name should be returned. + * @param klass the class whose simple name should be returned. * @return the simple name for this class. */ static String getSimpleName(Class klass) @@ -300,7 +300,7 @@ final class VMClass return ""; if (isArray(klass)) { - return getComponentType(klass).getSimpleName() + "[]"; + return getComponentType(klass).getSimpleName() + "[]"; } String fullName = getName(klass); int pos = fullName.lastIndexOf("$"); @@ -308,9 +308,9 @@ final class VMClass pos = 0; else { - ++pos; - while (Character.isDigit(fullName.charAt(pos))) - ++pos; + ++pos; + while (Character.isDigit(fullName.charAt(pos))) + ++pos; } int packagePos = fullName.lastIndexOf(".", pos); if (packagePos == -1) @@ -346,7 +346,7 @@ final class VMClass * The canonical name for top-level classes, top-level interfaces and * primitive types is always the same as the fully-qualified name. * For array types, the canonical name is the canonical name of its - * component type with `[]' appended. + * component type with `[]' appended. * </p> * <p> * The canonical name of a member class always refers to the place where @@ -374,17 +374,17 @@ final class VMClass return null; if (isArray(klass)) { - String componentName = getComponentType(klass).getCanonicalName(); - if (componentName != null) - return componentName + "[]"; + String componentName = getComponentType(klass).getCanonicalName(); + if (componentName != null) + return componentName + "[]"; } if (isMemberClass(klass)) { - String memberName = getDeclaringClass(klass).getCanonicalName(); - if (memberName != null) - return memberName + "." + getSimpleName(klass); - else - return memberName; + String memberName = getDeclaringClass(klass).getCanonicalName(); + if (memberName != null) + return memberName + "." + getSimpleName(klass); + else + return memberName; } return getName(klass); } @@ -402,7 +402,7 @@ final class VMClass /** * Returns the constructor which immediately encloses the specified class. - * If the class is a top-level class, or a local or anonymous class + * If the class is a top-level class, or a local or anonymous class * immediately enclosed by a type definition, instance initializer * or static initializer, then <code>null</code> is returned. * @@ -416,7 +416,7 @@ final class VMClass /** * Returns the method which immediately encloses the specified class. If - * the class is a top-level class, or a local or anonymous class + * the class is a top-level class, or a local or anonymous class * immediately enclosed by a type definition, instance initializer * or static initializer, then <code>null</code> is returned. * @@ -460,7 +460,7 @@ final class VMClass /** * Returns true if the specified class represents an member class. * - * @param klass the klass to test. + * @param klass the klass to test. * @return true if the specified class represents an member class. * @since 1.5 */ diff --git a/vm/reference/java/lang/VMClassLoader.java b/vm/reference/java/lang/VMClassLoader.java index e56152d01..c1d462588 100644 --- a/vm/reference/java/lang/VMClassLoader.java +++ b/vm/reference/java/lang/VMClassLoader.java @@ -77,7 +77,7 @@ final class VMClassLoader /** jars from property java.boot.class.path */ static final HashMap bootjars = new HashMap(); - + /** * Converts the array string of native package names to @@ -87,18 +87,18 @@ final class VMClassLoader static { String[] packages = getBootPackages(); - + if( packages != null) { - String specName = + String specName = SystemProperties.getProperty("java.specification.name"); String vendor = SystemProperties.getProperty("java.specification.vendor"); String version = SystemProperties.getProperty("java.specification.version"); - + Package p; - + for(int i = 0; i < packages.length; i++) { p = new Package(packages[i], @@ -116,7 +116,7 @@ final class VMClassLoader } } - + /** * Helper to define a class using a string of bytes. This assumes that * the security checks have already been performed, if necessary. @@ -186,23 +186,23 @@ final class VMClassLoader Vector v = new Vector(); while (st.hasMoreTokens()) { - File file = new File(st.nextToken()); - if (file.isDirectory()) - { - try - { + File file = new File(st.nextToken()); + if (file.isDirectory()) + { + try + { File f = new File(file, name); if (!f.exists()) continue; v.add(new URL("file://" + f.getAbsolutePath())); - } - catch (MalformedURLException e) - { - throw new Error(e); - } - } - else if (file.isFile()) - { - ZipFile zip; + } + catch (MalformedURLException e) + { + throw new Error(e); + } + } + else if (file.isFile()) + { + ZipFile zip; synchronized(bootjars) { zip = (ZipFile) bootjars.get(file.getName()); @@ -210,31 +210,31 @@ final class VMClassLoader if(zip == null) { try - { + { zip = new ZipFile(file); synchronized(bootjars) { bootjars.put(file.getName(), zip); } - } - catch (IOException e) - { - continue; - } + } + catch (IOException e) + { + continue; + } + } + String zname = name.startsWith("/") ? name.substring(1) : name; + if (zip.getEntry(zname) == null) + continue; + try + { + v.add(new URL("jar:file://" + + file.getAbsolutePath() + "!/" + zname)); } - String zname = name.startsWith("/") ? name.substring(1) : name; - if (zip.getEntry(zname) == null) - continue; - try - { - v.add(new URL("jar:file://" - + file.getAbsolutePath() + "!/" + zname)); - } - catch (MalformedURLException e) - { - throw new Error(e); - } - } + catch (MalformedURLException e) + { + throw new Error(e); + } + } } return v.elements(); } @@ -297,9 +297,9 @@ final class VMClassLoader } - + /** - * Helper to get all packages from the bootstrap class loader. + * Helper to get all packages from the bootstrap class loader. * * @return all named packages, if any exist */ @@ -410,7 +410,7 @@ final class VMClassLoader static final Class defineClassWithTransformers(ClassLoader loader, String name, byte[] data, int offset, int len, ProtectionDomain pd) { - + if (instrumenter != null) { byte[] modifiedData = new byte[len]; @@ -419,7 +419,7 @@ final class VMClassLoader modifiedData = ((InstrumentationImpl)instrumenter).callTransformers(loader, jvmName, null, pd, modifiedData); - + return defineClass(loader, name, modifiedData, 0, modifiedData.length, pd); } diff --git a/vm/reference/java/lang/VMDouble.java b/vm/reference/java/lang/VMDouble.java index 58b3b45b4..8e523cd2e 100644 --- a/vm/reference/java/lang/VMDouble.java +++ b/vm/reference/java/lang/VMDouble.java @@ -46,7 +46,7 @@ import gnu.classpath.Configuration; */ /** - * Code relocated from java.lang.Double by + * Code relocated from java.lang.Double by * @author Dave Grove (groved@us.ibm.com) */ final class VMDouble @@ -59,7 +59,7 @@ final class VMDouble { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary("javalang"); + System.loadLibrary("javalang"); } initIDs(); diff --git a/vm/reference/java/lang/VMFloat.java b/vm/reference/java/lang/VMFloat.java index 26d89dc9d..ba523d697 100644 --- a/vm/reference/java/lang/VMFloat.java +++ b/vm/reference/java/lang/VMFloat.java @@ -46,7 +46,7 @@ import gnu.classpath.Configuration; */ /** - * Code relocated from java.lang.Float by + * Code relocated from java.lang.Float by * @author Dave Grove <groved@us.ibm.com> */ final class VMFloat diff --git a/vm/reference/java/lang/VMMath.java b/vm/reference/java/lang/VMMath.java index 4d3782454..dc5fd4207 100644 --- a/vm/reference/java/lang/VMMath.java +++ b/vm/reference/java/lang/VMMath.java @@ -47,7 +47,7 @@ class VMMath { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary("javalang"); + System.loadLibrary("javalang"); } } @@ -330,7 +330,7 @@ class VMMath * the original value is returned. The returned result must be within 1 ulp * of the exact result. For a finite value, <code>x</code>, the cube root * of <code>-x</code> is equal to the negation of the cube root - * of <code>x</code>. + * of <code>x</code>. * </p> * <p> * For a square root, use <code>sqrt</code>. For other roots, use @@ -347,7 +347,7 @@ class VMMath /** * <p> * Returns the hyperbolic cosine of the given value. For a value, - * <code>x</code>, the hyperbolic cosine is <code>(e<sup>x</sup> + + * <code>x</code>, the hyperbolic cosine is <code>(e<sup>x</sup> + * e<sup>-x</sup>)/2</code> * with <code>e</code> being <a href="#E">Euler's number</a>. The returned * result must be within 2.5 ulps of the exact result. @@ -357,7 +357,7 @@ class VMMath * returned. For either infinity, positive infinity is returned. * The hyperbolic cosine of zero must be 1.0. * </p> - * + * * @param a the numeric argument * @return the hyperbolic cosine of <code>a</code>. * @since 1.5 @@ -372,12 +372,12 @@ class VMMath * 1 ulp of the exact result, and results must be semi-monotonic. For finite * inputs, the returned value must be greater than or equal to -1.0. Once * a result enters within half a ulp of this limit, the limit is returned. - * </p> + * </p> * <p> * For <code>NaN</code>, positive infinity and zero, the original value * is returned. Negative infinity returns a result of -1.0 (the limit). * </p> - * + * * @param a the numeric argument * @return <code>e<sup>a</sup> - 1</code> * @since 1.5 @@ -396,7 +396,7 @@ class VMMath * is positive infinity. Otherwise, if either argument is <code>NaN</code>, * then <code>NaN</code> is returned. * </p> - * + * * @param a the first parameter. * @param b the second parameter. * @return the hypotenuse matching the supplied parameters. @@ -449,7 +449,7 @@ class VMMath /** * <p> * Returns the hyperbolic sine of the given value. For a value, - * <code>x</code>, the hyperbolic sine is <code>(e<sup>x</sup> - + * <code>x</code>, the hyperbolic sine is <code>(e<sup>x</sup> - * e<sup>-x</sup>)/2</code> * with <code>e</code> being <a href="#E">Euler's number</a>. The returned * result must be within 2.5 ulps of the exact result. @@ -458,7 +458,7 @@ class VMMath * If the supplied value is <code>NaN</code>, an infinity or a zero, then the * original value is returned. * </p> - * + * * @param a the numeric argument * @return the hyperbolic sine of <code>a</code>. * @since 1.5 @@ -468,7 +468,7 @@ class VMMath /** * <p> * Returns the hyperbolic tangent of the given value. For a value, - * <code>x</code>, the hyperbolic tangent is <code>(e<sup>x</sup> - + * <code>x</code>, the hyperbolic tangent is <code>(e<sup>x</sup> - * e<sup>-x</sup>)/(e<sup>x</sup> + e<sup>-x</sup>)</code> * (i.e. <code>sinh(a)/cosh(a)</code>) * with <code>e</code> being <a href="#E">Euler's number</a>. The returned @@ -483,7 +483,7 @@ class VMMath * value is returned. Positive infinity returns +1.0 and negative infinity * returns -1.0. * </p> - * + * * @param a the numeric argument * @return the hyperbolic tangent of <code>a</code>. * @since 1.5 diff --git a/vm/reference/java/lang/VMObject.java b/vm/reference/java/lang/VMObject.java index 1d1ec40b5..279f250c0 100644 --- a/vm/reference/java/lang/VMObject.java +++ b/vm/reference/java/lang/VMObject.java @@ -54,7 +54,7 @@ final class VMObject * @return the class of the Object. */ static native Class getClass(Object obj); - + /** * The VM is expected to make a field-for-field shallow copy of the * argument. Thus, the copy has the same runtime type as the argument. diff --git a/vm/reference/java/lang/VMProcess.java b/vm/reference/java/lang/VMProcess.java index 076e5999d..c41d7cc0c 100644 --- a/vm/reference/java/lang/VMProcess.java +++ b/vm/reference/java/lang/VMProcess.java @@ -85,17 +85,17 @@ final class VMProcess extends Process static int reapedExitValue; // Information about this process - int state; // current state of process - final String[] cmd; // copied from Runtime.exec() - final String[] env; // copied from Runtime.exec() - final File dir; // copied from Runtime.exec() - Throwable exception; // if process failed to start - long pid; // process id - OutputStream stdin; // process input stream - InputStream stdout; // process output stream - InputStream stderr; // process error stream - int exitValue; // process exit value - boolean redirect; // redirect stderr -> stdout + int state; // current state of process + final String[] cmd; // copied from Runtime.exec() + final String[] env; // copied from Runtime.exec() + final File dir; // copied from Runtime.exec() + Throwable exception; // if process failed to start + long pid; // process id + OutputStream stdin; // process input stream + InputStream stdout; // process output stream + InputStream stderr; // process error stream + int exitValue; // process exit value + boolean redirect; // redirect stderr -> stdout // // Dedicated thread that does all the fork()'ing and wait()'ing @@ -125,97 +125,97 @@ final class VMProcess extends Process { final LinkedList workList = VMProcess.workList; while (true) - { - - // Get the next process to spawn (if any) and spawn it. Spawn - // at most one at a time before checking for reapable children. - VMProcess process = null; - synchronized (workList) - { - if (!workList.isEmpty()) - process = (VMProcess)workList.removeFirst(); - } - - if (process != null) - spawn(process); - - - // Check for termination of active child processes - while (!activeMap.isEmpty() && VMProcess.nativeReap()) - { - long pid = VMProcess.reapedPid; - int exitValue = VMProcess.reapedExitValue; - process = (VMProcess)activeMap.remove(new Long(pid)); - if (process != null) - { - synchronized (process) - { - process.exitValue = exitValue; - process.state = TERMINATED; - process.notify(); - } - } - else - System.err.println("VMProcess WARNING reaped unknown process: " - + pid); - } - - - // If there are more new processes to create, go do that now. - // If there is nothing left to do, exit this thread. Otherwise, - // sleep a little while, and then check again for reapable children. - // We will get woken up immediately if there are new processes to - // spawn, but not if there are new children to reap. So we only - // sleep a short time, in effect polling while processes are active. - synchronized (workList) - { - if (!workList.isEmpty()) - continue; - if (activeMap.isEmpty()) - { - processThread = null; - break; - } - - try - { - workList.wait(MAX_REAP_DELAY); - } - catch (InterruptedException e) - { - /* ignore */ - } - } - } + { + + // Get the next process to spawn (if any) and spawn it. Spawn + // at most one at a time before checking for reapable children. + VMProcess process = null; + synchronized (workList) + { + if (!workList.isEmpty()) + process = (VMProcess)workList.removeFirst(); + } + + if (process != null) + spawn(process); + + + // Check for termination of active child processes + while (!activeMap.isEmpty() && VMProcess.nativeReap()) + { + long pid = VMProcess.reapedPid; + int exitValue = VMProcess.reapedExitValue; + process = (VMProcess)activeMap.remove(new Long(pid)); + if (process != null) + { + synchronized (process) + { + process.exitValue = exitValue; + process.state = TERMINATED; + process.notify(); + } + } + else + System.err.println("VMProcess WARNING reaped unknown process: " + + pid); + } + + + // If there are more new processes to create, go do that now. + // If there is nothing left to do, exit this thread. Otherwise, + // sleep a little while, and then check again for reapable children. + // We will get woken up immediately if there are new processes to + // spawn, but not if there are new children to reap. So we only + // sleep a short time, in effect polling while processes are active. + synchronized (workList) + { + if (!workList.isEmpty()) + continue; + if (activeMap.isEmpty()) + { + processThread = null; + break; + } + + try + { + workList.wait(MAX_REAP_DELAY); + } + catch (InterruptedException e) + { + /* ignore */ + } + } + } } // Spawn a process private void spawn(VMProcess process) { - + // Spawn the process and put it in our active map indexed by pid. // If the spawn operation fails, store the exception with the process. // In either case, wake up thread that created the process. synchronized (process) - { - try - { - process.nativeSpawn(process.cmd, process.env, process.dir, - process.redirect); - process.state = RUNNING; - activeMap.put(new Long(process.pid), process); - } + { + try + { + process.nativeSpawn(process.cmd, process.env, process.dir, + process.redirect); + process.state = RUNNING; + activeMap.put(new Long(process.pid), process); + } catch (ThreadDeath death) { throw death; } - catch (Throwable t) - { - process.state = TERMINATED; - process.exception = t; - } - process.notify(); - } + catch (Throwable t) + { + process.state = TERMINATED; + process.exception = t; + } + process.notify(); + } } } @@ -223,77 +223,77 @@ final class VMProcess extends Process private VMProcess(String[] cmd, String[] env, File dir, boolean redirect) throws IOException { - + // Initialize this process this.state = INITIAL; this.cmd = cmd; this.env = env; this.dir = dir; this.redirect = redirect; - + // Add process to the new process work list and wakeup processThread synchronized (workList) { - workList.add(this); - if (processThread == null) - { - processThread = new ProcessThread(); - processThread.setDaemon(true); - processThread.start(); - } - else - { - workList.notify(); - } + workList.add(this); + if (processThread == null) + { + processThread = new ProcessThread(); + processThread.setDaemon(true); + processThread.start(); + } + else + { + workList.notify(); + } } // Wait for processThread to spawn this process and update its state synchronized (this) { - while (state == INITIAL) - { - try - { - wait(); - } - catch (InterruptedException e) - { - /* ignore */ - } - } + while (state == INITIAL) + { + try + { + wait(); + } + catch (InterruptedException e) + { + /* ignore */ + } + } } // If spawning failed, rethrow the exception in this thread if (exception != null) { - exception.fillInStackTrace(); - if (exception instanceof IOException) - throw (IOException)exception; + exception.fillInStackTrace(); + if (exception instanceof IOException) + throw (IOException)exception; - if (exception instanceof Error) - throw (Error)exception; + if (exception instanceof Error) + throw (Error)exception; - if (exception instanceof RuntimeException) - throw (RuntimeException)exception; + if (exception instanceof RuntimeException) + throw (RuntimeException)exception; - throw new RuntimeException(exception); + throw new RuntimeException(exception); } } // Invoked by native code (from nativeSpawn()) to record process info. private void setProcessInfo(OutputStream stdin, - InputStream stdout, InputStream stderr, long pid) + InputStream stdout, InputStream stderr, long pid) { this.stdin = stdin; this.stdout = stdout; if (stderr == null) this.stderr = new InputStream() - { - public int read() throws IOException - { - return -1; - } - }; + { + public int read() throws IOException + { + return -1; + } + }; else this.stderr = stderr; this.pid = pid; @@ -308,7 +308,7 @@ final class VMProcess extends Process } static Process exec(List cmd, Map env, - File dir, boolean redirect) throws IOException + File dir, boolean redirect) throws IOException { String[] acmd = (String[]) cmd.toArray(new String[cmd.size()]); String[] aenv = new String[env.size()]; @@ -317,8 +317,8 @@ final class VMProcess extends Process Iterator iter = env.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - aenv[i++] = entry.getKey() + "=" + entry.getValue(); + Map.Entry entry = (Map.Entry) iter.next(); + aenv[i++] = entry.getKey() + "=" + entry.getValue(); } return new VMProcess(acmd, aenv, dir, redirect); @@ -359,17 +359,17 @@ final class VMProcess extends Process return; nativeKill(pid); - + while (state != TERMINATED) { - try - { - wait(); - } - catch (InterruptedException e) - { - /* ignore */ - } + try + { + wait(); + } + catch (InterruptedException e) + { + /* ignore */ + } } } @@ -381,7 +381,7 @@ final class VMProcess extends Process * @throws IOException if the O/S process could not be created. */ native void nativeSpawn(String[] cmd, String[] env, File dir, - boolean redirect) + boolean redirect) throws IOException; /** diff --git a/vm/reference/java/lang/VMRuntime.java b/vm/reference/java/lang/VMRuntime.java index b685b3512..0b58d5f44 100644 --- a/vm/reference/java/lang/VMRuntime.java +++ b/vm/reference/java/lang/VMRuntime.java @@ -50,7 +50,7 @@ final class VMRuntime /** * No instance is ever created. */ - private VMRuntime() + private VMRuntime() { } @@ -177,7 +177,7 @@ final class VMRuntime * @throws NullPointerException if cmd or env have null elements */ static Process exec(String[] cmd, String[] env, File dir) - throws IOException { + throws IOException { return VMProcess.exec(cmd, env, dir); } diff --git a/vm/reference/java/lang/VMString.java b/vm/reference/java/lang/VMString.java index 7e65eed98..e1fbf8390 100644 --- a/vm/reference/java/lang/VMString.java +++ b/vm/reference/java/lang/VMString.java @@ -47,7 +47,7 @@ import java.util.WeakHashMap; */ /** - * Code relocated from java.lang.String by + * Code relocated from java.lang.String by * @author Dave Grove <groved@us.ibm.com> */ final class VMString diff --git a/vm/reference/java/lang/VMSystem.java b/vm/reference/java/lang/VMSystem.java index bf46b27aa..52a3c1c9f 100644 --- a/vm/reference/java/lang/VMSystem.java +++ b/vm/reference/java/lang/VMSystem.java @@ -163,7 +163,7 @@ final class VMSystem * </p> * * @return the time of a system timer in nanoseconds. - * @since 1.5 + * @since 1.5 */ public static native long nanoTime(); @@ -178,18 +178,18 @@ final class VMSystem /** * Helper method which creates the standard input stream. * VM implementors may choose to construct these streams differently. - * This method can also return null if the stream is created somewhere + * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ static InputStream makeStandardInputStream() { return new BufferedInputStream(new FileInputStream(FileDescriptor.in)); } - + /** * Helper method which creates the standard output stream. * VM implementors may choose to construct these streams differently. - * This method can also return null if the stream is created somewhere + * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ static PrintStream makeStandardOutputStream() @@ -200,14 +200,14 @@ final class VMSystem /** * Helper method which creates the standard error stream. * VM implementors may choose to construct these streams differently. - * This method can also return null if the stream is created somewhere + * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ static PrintStream makeStandardErrorStream() { return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true); } - + /** * Gets the value of an environment variable. * Always returning null is a valid (but not very useful) implementation. diff --git a/vm/reference/java/lang/VMThread.java b/vm/reference/java/lang/VMThread.java index ff0ec6878..1b461a694 100644 --- a/vm/reference/java/lang/VMThread.java +++ b/vm/reference/java/lang/VMThread.java @@ -62,7 +62,7 @@ package java.lang; * or to implement some optional (and sometimes deprecated) behaviour. Default * implementations are provided but it is highly recommended to optimize them * for a specific VM. - * + * * @author Jeroen Frijters (jeroen@frijters.net) * @author Dalibor Topic (robilad@kaffe.org) */ @@ -93,7 +93,7 @@ final class VMThread */ private VMThread(Thread thread) { - this.thread = thread; + this.thread = thread; } /** @@ -103,48 +103,48 @@ final class VMThread */ private void run() { - try - { - try - { - running = true; - synchronized(thread) - { - Throwable t = thread.stillborn; - if(t != null) - { - thread.stillborn = null; - throw t; - } - } - thread.run(); - } - catch(Throwable t) - { - try - { - Thread.UncaughtExceptionHandler handler; - handler = thread.getUncaughtExceptionHandler(); - handler.uncaughtException(thread, t); - } - catch(Throwable ignore) - { - } - } - } - finally - { - // Setting runnable to false is partial protection against stop - // being called while we're cleaning up. To be safe all code in - // VMThread be unstoppable. - running = false; - thread.die(); - synchronized(this) - { - // release the threads waiting to join us - notifyAll(); - } - } + try + { + try + { + running = true; + synchronized(thread) + { + Throwable t = thread.stillborn; + if(t != null) + { + thread.stillborn = null; + throw t; + } + } + thread.run(); + } + catch(Throwable t) + { + try + { + Thread.UncaughtExceptionHandler handler; + handler = thread.getUncaughtExceptionHandler(); + handler.uncaughtException(thread, t); + } + catch(Throwable ignore) + { + } + } + } + finally + { + // Setting runnable to false is partial protection against stop + // being called while we're cleaning up. To be safe all code in + // VMThread be unstoppable. + running = false; + thread.die(); + synchronized(this) + { + // release the threads waiting to join us + notifyAll(); + } + } } /** @@ -158,9 +158,9 @@ final class VMThread */ static void create(Thread thread, long stacksize) { - VMThread vmThread = new VMThread(thread); - vmThread.start(stacksize); - thread.vmThread = vmThread; + VMThread vmThread = new VMThread(thread); + vmThread.start(stacksize); + thread.vmThread = vmThread; } /** @@ -170,7 +170,7 @@ final class VMThread */ String getName() { - return thread.name; + return thread.name; } /** @@ -181,7 +181,7 @@ final class VMThread */ void setName(String name) { - thread.name = name; + thread.name = name; } /** @@ -192,8 +192,8 @@ final class VMThread */ void setPriority(int priority) { - thread.priority = priority; - nativeSetPriority(priority); + thread.priority = priority; + nativeSetPriority(priority); } /** @@ -243,32 +243,32 @@ final class VMThread */ synchronized void join(long ms, int ns) throws InterruptedException { - // Round up - ms += (ns != 0) ? 1 : 0; - - // Compute end time, but don't overflow - long now = System.currentTimeMillis(); - long end = now + ms; - if (end < now) - end = Long.MAX_VALUE; - - // A VM is allowed to return from wait() without notify() having been - // called, so we loop to handle possible spurious wakeups. - while(thread.vmThread != null) - { - // We use the VMThread object to wait on, because this is a private - // object, so client code cannot call notify on us. - wait(ms); - if(ms != 0) - { - now = System.currentTimeMillis(); - ms = end - now; - if(ms <= 0) - { - break; - } - } - } + // Round up + ms += (ns != 0) ? 1 : 0; + + // Compute end time, but don't overflow + long now = System.currentTimeMillis(); + long end = now + ms; + if (end < now) + end = Long.MAX_VALUE; + + // A VM is allowed to return from wait() without notify() having been + // called, so we loop to handle possible spurious wakeups. + while(thread.vmThread != null) + { + // We use the VMThread object to wait on, because this is a private + // object, so client code cannot call notify on us. + wait(ms); + if(ms != 0) + { + now = System.currentTimeMillis(); + ms = end - now; + if(ms <= 0) + { + break; + } + } + } } /** @@ -276,7 +276,7 @@ final class VMThread * If you stop a Thread that has not yet started, the stop is ignored * (contrary to what the JDK documentation says). * <b>WARNING</b>This bypasses Java security, and can throw a checked - * exception which the call stack is unprepared to handle. Do not abuse + * exception which the call stack is unprepared to handle. Do not abuse * this power. * * <p>This is inherently unsafe, as it can interrupt synchronized blocks and @@ -290,12 +290,12 @@ final class VMThread */ void stop(Throwable t) { - // Note: we assume that we own the lock on thread - // (i.e. that Thread.stop() is synchronized) - if(running) - nativeStop(t); - else - thread.stillborn = t; + // Note: we assume that we own the lock on thread + // (i.e. that Thread.stop() is synchronized) + if(running) + nativeStop(t); + else + thread.stillborn = t; } /** @@ -383,33 +383,33 @@ final class VMThread // It's unclear if this is a bug in the implementation or the spec. // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203 if (ms == 0 && ns == 0) - { - if (Thread.interrupted()) - throw new InterruptedException(); - return; - } + { + if (Thread.interrupted()) + throw new InterruptedException(); + return; + } // Compute end time, but don't overflow long now = System.currentTimeMillis(); long end = now + ms; if (end < now) - end = Long.MAX_VALUE; + end = Long.MAX_VALUE; // A VM is allowed to return from wait() without notify() having been // called, so we loop to handle possible spurious wakeups. VMThread vt = Thread.currentThread().vmThread; synchronized (vt) - { - while (true) - { - vt.wait(ms, ns); - now = System.currentTimeMillis(); - if (now >= end) - break; - ms = end - now; - ns = 0; - } - } + { + while (true) + { + vt.wait(ms, ns); + now = System.currentTimeMillis(); + if (now >= end) + break; + ms = end - now; + ns = 0; + } + } } /** @@ -428,23 +428,23 @@ final class VMThread * @return true if the current thread is currently synchronized on obj * @throws NullPointerException if obj is null */ - static boolean holdsLock(Object obj) + static boolean holdsLock(Object obj) { /* Use obj.notify to check if the current thread holds * the monitor of the object. * If it doesn't, notify will throw an exception. */ - try - { - obj.notify(); - // okay, current thread holds lock - return true; - } + try + { + obj.notify(); + // okay, current thread holds lock + return true; + } catch (IllegalMonitorStateException e) - { - // it doesn't hold the lock - return false; - } + { + // it doesn't hold the lock + return false; + } } /** @@ -453,7 +453,7 @@ final class VMThread * "RUNNABLE", "TERMINATED", "TIMED_WAITING" or * "WAITING". * - * @return a string corresponding to one of the + * @return a string corresponding to one of the * thread enumeration states specified above. */ native String getState(); diff --git a/vm/reference/java/lang/reflect/VMConstructor.java b/vm/reference/java/lang/reflect/VMConstructor.java index dbed90388..c6f319026 100644 --- a/vm/reference/java/lang/reflect/VMConstructor.java +++ b/vm/reference/java/lang/reflect/VMConstructor.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -47,7 +47,7 @@ final class VMConstructor Class clazz; int slot; - /** + /** * This field allows us to refer back to the main constructor instance. * It is set by the constructor of Constructor. */ @@ -97,7 +97,7 @@ final class VMConstructor * is no Signature attribute, return null. */ native String getSignature(); - + /** * <p> * Return an array of arrays representing the annotations on each @@ -112,7 +112,7 @@ final class VMConstructor * The returned annotations are serialized. Changing the annotations has * no affect on the return value of future calls to this method. * </p> - * + * * @return an array of arrays which represents the annotations used on the * parameters of this constructor. The order of the array elements * matches the declaration order of the parameters. @@ -134,7 +134,7 @@ final class VMConstructor { if (!(o instanceof Constructor)) return false; - Constructor that = (Constructor)o; + Constructor that = (Constructor)o; if (clazz != that.getDeclaringClass()) return false; if (!Arrays.equals(getParameterTypes(), that.getParameterTypes())) diff --git a/vm/reference/java/lang/reflect/VMField.java b/vm/reference/java/lang/reflect/VMField.java index 53f384749..ee9239a8e 100644 --- a/vm/reference/java/lang/reflect/VMField.java +++ b/vm/reference/java/lang/reflect/VMField.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -45,8 +45,8 @@ final class VMField Class clazz; String name; int slot; - - /** + + /** * This field allows us to refer back to the main constructor instance. * It is set by the constructor of Field. */ @@ -512,7 +512,7 @@ final class VMField { if (!(o instanceof Field)) return false; - Field that = (Field)o; + Field that = (Field)o; if (clazz != that.getDeclaringClass()) return false; if (!name.equals(that.getName())) diff --git a/vm/reference/java/lang/reflect/VMMethod.java b/vm/reference/java/lang/reflect/VMMethod.java index f8574cd87..d8bb8b4a3 100644 --- a/vm/reference/java/lang/reflect/VMMethod.java +++ b/vm/reference/java/lang/reflect/VMMethod.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -48,7 +48,7 @@ final class VMMethod String name; int slot; - /** + /** * This field allows us to refer back to the main constructor instance. * It is set by the constructor of Field. */ @@ -129,7 +129,7 @@ final class VMMethod * The returned annotations are serialized. Changing the annotations has * no affect on the return value of future calls to this method. * </p> - * + * * @return an array of arrays which represents the annotations used on the * parameters of this method. The order of the array elements * matches the declaration order of the parameters. @@ -206,4 +206,3 @@ final class VMMethod native Annotation[] getDeclaredAnnotations(); } - diff --git a/vm/reference/java/net/VMNetworkInterface.java b/vm/reference/java/net/VMNetworkInterface.java index 63a29b16b..fca0c525a 100644 --- a/vm/reference/java/net/VMNetworkInterface.java +++ b/vm/reference/java/net/VMNetworkInterface.java @@ -64,7 +64,7 @@ final class VMNetworkInterface this.name = name; addresses = new HashSet(); } - + /** * Creates a dummy instance which represents any network * interface. @@ -81,15 +81,15 @@ final class VMNetworkInterface // Cannot happen. } } - + static { if (Configuration.INIT_LOAD_LIBRARY) System.loadLibrary("javanet"); - + initIds(); } - + private static native void initIds(); /** @@ -100,7 +100,7 @@ final class VMNetworkInterface */ public static native VMNetworkInterface[] getVMInterfaces() throws SocketException; - + private void addAddress(ByteBuffer addr) throws SocketException, UnknownHostException { diff --git a/vm/reference/java/nio/channels/VMChannels.java b/vm/reference/java/nio/channels/VMChannels.java index c833b6eec..05b1441c0 100644 --- a/vm/reference/java/nio/channels/VMChannels.java +++ b/vm/reference/java/nio/channels/VMChannels.java @@ -63,35 +63,35 @@ final class VMChannels { try { - Class[] argTypes = new Class[1]; - argTypes[0] = FileChannelImpl.class; - Constructor constructor = - streamClass.getDeclaredConstructor(argTypes); - constructor.setAccessible(true); - Object[] args = new Object[1]; - args[0] = ch; - return constructor.newInstance(args); + Class[] argTypes = new Class[1]; + argTypes[0] = FileChannelImpl.class; + Constructor constructor = + streamClass.getDeclaredConstructor(argTypes); + constructor.setAccessible(true); + Object[] args = new Object[1]; + args[0] = ch; + return constructor.newInstance(args); } catch (IllegalAccessException e) { - // Ignored. + // Ignored. } catch (InstantiationException e) { - // Ignored. + // Ignored. } catch (InvocationTargetException e) { - // Ignored. + // Ignored. } catch (NoSuchMethodException e) { - // Ignored. + // Ignored. } return null; } - + /** * Constructs a stream that reads bytes from the given channel. */ @@ -99,7 +99,7 @@ final class VMChannels { if (ch instanceof FileChannelImpl) return (FileInputStream) createStream(FileInputStream.class, ch); - + return new ChannelInputStream(ch); } @@ -110,7 +110,7 @@ final class VMChannels { if (ch instanceof FileChannelImpl) return (FileOutputStream) createStream(FileOutputStream.class, ch); - + return new ChannelOutputStream(ch); } } diff --git a/vm/reference/java/security/VMAccessController.java b/vm/reference/java/security/VMAccessController.java index da13c6889..9299e6f84 100644 --- a/vm/reference/java/security/VMAccessController.java +++ b/vm/reference/java/security/VMAccessController.java @@ -205,8 +205,8 @@ final class VMAccessController && method.equals ("doPrivileged")) { // If there was a call to doPrivileged with a supplied context, - // return that context. If using JAAS doAs*, it should be - // a context with a SubjectDomainCombiner + // return that context. If using JAAS doAs*, it should be + // a context with a SubjectDomainCombiner LinkedList l = (LinkedList) contexts.get(); if (l != null) context = (AccessControlContext) l.getFirst(); @@ -214,7 +214,7 @@ final class VMAccessController } // subject to getProtectionDomain RuntimePermission - ProtectionDomain domain = clazz.getProtectionDomain(); + ProtectionDomain domain = clazz.getProtectionDomain(); if (domain == null) continue; diff --git a/vm/reference/java/security/VMSecureRandom.java b/vm/reference/java/security/VMSecureRandom.java index 5eeb158bc..bea154977 100644 --- a/vm/reference/java/security/VMSecureRandom.java +++ b/vm/reference/java/security/VMSecureRandom.java @@ -126,4 +126,4 @@ final class VMSecureRandom running = false; } } -}
\ No newline at end of file +} diff --git a/vm/reference/java/util/VMTimeZone.java b/vm/reference/java/util/VMTimeZone.java index 992ecaf28..11061aa32 100644 --- a/vm/reference/java/util/VMTimeZone.java +++ b/vm/reference/java/util/VMTimeZone.java @@ -55,10 +55,10 @@ final class VMTimeZone { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary("javautil"); + System.loadLibrary("javautil"); } } - + /** * This method returns a time zone id string which is in the form * (standard zone name) or (standard zone name)(GMT offset) or @@ -104,67 +104,67 @@ final class VMTimeZone // Try to parse /etc/timezone. if (zone == null) { - tzid = readTimeZoneFile("/etc/timezone"); - if (tzid != null && !tzid.equals("")) - zone = TimeZone.getDefaultTimeZone(tzid); + tzid = readTimeZoneFile("/etc/timezone"); + if (tzid != null && !tzid.equals("")) + zone = TimeZone.getDefaultTimeZone(tzid); } - + // Try to parse /etc/localtime if (zone == null) { - zone = ZoneInfo.readTZFile((String) null, "/etc/localtime"); - if (zone != null) - { - // Try to find a more suitable ID for the /etc/localtime - // timezone. - // Sometimes /etc/localtime is a symlink to some - // /usr/share/zoneinfo/ file. - String id = null; - try - { - id = new File("/etc/localtime").getCanonicalPath(); - if (id != null) - { - String zoneinfo_dir - = SystemProperties.getProperty("gnu.java.util.zoneinfo.dir"); - if (zoneinfo_dir != null) - zoneinfo_dir - = new File(zoneinfo_dir - + File.separatorChar).getCanonicalPath(); - if (zoneinfo_dir != null && id.startsWith(zoneinfo_dir)) - { - int pos = zoneinfo_dir.length(); - while (pos < id.length() - && id.charAt(pos) == File.separatorChar) - pos++; - if (pos < id.length()) - id = id.substring(pos); - else - id = null; - } - else - id = null; - } - } - catch (IOException ioe) - { - id = null; - } + zone = ZoneInfo.readTZFile((String) null, "/etc/localtime"); + if (zone != null) + { + // Try to find a more suitable ID for the /etc/localtime + // timezone. + // Sometimes /etc/localtime is a symlink to some + // /usr/share/zoneinfo/ file. + String id = null; + try + { + id = new File("/etc/localtime").getCanonicalPath(); + if (id != null) + { + String zoneinfo_dir + = SystemProperties.getProperty("gnu.java.util.zoneinfo.dir"); + if (zoneinfo_dir != null) + zoneinfo_dir + = new File(zoneinfo_dir + + File.separatorChar).getCanonicalPath(); + if (zoneinfo_dir != null && id.startsWith(zoneinfo_dir)) + { + int pos = zoneinfo_dir.length(); + while (pos < id.length() + && id.charAt(pos) == File.separatorChar) + pos++; + if (pos < id.length()) + id = id.substring(pos); + else + id = null; + } + else + id = null; + } + } + catch (IOException ioe) + { + id = null; + } - if (id == null) - id = readSysconfigClockFile("/etc/sysconfig/clock"); + if (id == null) + id = readSysconfigClockFile("/etc/sysconfig/clock"); - if (id != null) - zone.setID(id); - } + if (id != null) + zone.setID(id); + } } // Try some system specific way if (zone == null) { - tzid = getSystemTimeZoneId(); - if (tzid != null && !tzid.equals("")) - zone = TimeZone.getDefaultTimeZone(tzid); + tzid = getSystemTimeZoneId(); + if (tzid != null && !tzid.equals("")) + zone = TimeZone.getDefaultTimeZone(tzid); } return zone; @@ -192,42 +192,42 @@ final class VMTimeZone InputStreamReader isr = null; try { - FileInputStream fis = new FileInputStream(f); - BufferedInputStream bis = new BufferedInputStream(fis); - isr = new InputStreamReader(bis); - - StringBuffer sb = new StringBuffer(); - int i = isr.read(); - while (i != -1) - { - char c = (char) i; - if (Character.isLetter(c) || Character.isDigit(c) - || c == '/' || c == '-' || c == '_') - { - sb.append(c); - i = isr.read(); - } - else - break; - } - return sb.toString(); + FileInputStream fis = new FileInputStream(f); + BufferedInputStream bis = new BufferedInputStream(fis); + isr = new InputStreamReader(bis); + + StringBuffer sb = new StringBuffer(); + int i = isr.read(); + while (i != -1) + { + char c = (char) i; + if (Character.isLetter(c) || Character.isDigit(c) + || c == '/' || c == '-' || c == '_') + { + sb.append(c); + i = isr.read(); + } + else + break; + } + return sb.toString(); } catch (IOException ioe) { - // Parse error, not a proper tzfile. - return null; + // Parse error, not a proper tzfile. + return null; } finally { - try - { - if (isr != null) - isr.close(); - } - catch (IOException ioe) - { - // Error while close, nothing we can do. - } + try + { + if (isr != null) + isr.close(); + } + catch (IOException ioe) + { + // Error while close, nothing we can do. + } } } @@ -248,48 +248,48 @@ final class VMTimeZone BufferedReader br = null; try { - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - br = new BufferedReader(new InputStreamReader(bis)); + FileInputStream fis = new FileInputStream(file); + BufferedInputStream bis = new BufferedInputStream(fis); + br = new BufferedReader(new InputStreamReader(bis)); - for (String line = br.readLine(); line != null; line = br.readLine()) - { - line = line.trim(); - if (line.length() < 8 || !line.startsWith("ZONE=")) - continue; - int posstart = 6; - int posend; - if (line.charAt(5) == '"') - posend = line.indexOf('"', 6); - else if (line.charAt(5) == '\'') - posend = line.indexOf('\'', 6); - else - { - posstart = 5; - posend = line.length(); - } - if (posend < 0) - return null; - return line.substring(posstart, posend); - } - return null; + for (String line = br.readLine(); line != null; line = br.readLine()) + { + line = line.trim(); + if (line.length() < 8 || !line.startsWith("ZONE=")) + continue; + int posstart = 6; + int posend; + if (line.charAt(5) == '"') + posend = line.indexOf('"', 6); + else if (line.charAt(5) == '\'') + posend = line.indexOf('\'', 6); + else + { + posstart = 5; + posend = line.length(); + } + if (posend < 0) + return null; + return line.substring(posstart, posend); + } + return null; } catch (IOException ioe) { - // Parse error, not a proper tzfile. - return null; + // Parse error, not a proper tzfile. + return null; } finally { - try - { - if (br != null) - br.close(); - } - catch (IOException ioe) - { - // Error while close, nothing we can do. - } + try + { + if (br != null) + br.close(); + } + catch (IOException ioe) + { + // Error while close, nothing we can do. + } } } diff --git a/vm/reference/sun/misc/Unsafe.java b/vm/reference/sun/misc/Unsafe.java index 5dee8cfef..e316bdb8d 100644 --- a/vm/reference/sun/misc/Unsafe.java +++ b/vm/reference/sun/misc/Unsafe.java @@ -76,7 +76,7 @@ public class Unsafe sm.checkPropertiesAccess(); return unsafe; } - + /** * Returns the memory address offset of the given static field. * The offset is merely used as a means to access a particular field @@ -272,7 +272,7 @@ public class Unsafe /** * Returns the offset of the first element for a given array class. * To access elements of the array class, this value may be used along - * with that returned by + * with that returned by * <a href="#arrayIndexScale"><code>arrayIndexScale</code></a>, * if non-zero. * @@ -287,7 +287,7 @@ public class Unsafe * Returns the scale factor used for addressing elements of the supplied * array class. Where a suitable scale factor can not be returned (e.g. * for primitive types), zero should be returned. The returned value - * can be used with + * can be used with * <a href="#arrayBaseOffset"><code>arrayBaseOffset</code></a> * to access elements of the class. * @@ -295,9 +295,9 @@ public class Unsafe * @return the scale factor, or zero if not supported for this array class. */ public native int arrayIndexScale(Class arrayClass); - + /** - * Releases the block on a thread created by + * Releases the block on a thread created by * <a href="#park"><code>park</code></a>. This method can also be used * to terminate a blockage caused by a prior call to <code>park</code>. * This operation is unsafe, as the thread must be guaranteed to be @@ -308,7 +308,7 @@ public class Unsafe public native void unpark(Object thread); /** - * Blocks the thread until a matching + * Blocks the thread until a matching * <a href="#unpark"><code>unpark</code></a> occurs, the thread is * interrupted or the optional timeout expires. If an <code>unpark</code> * call has already occurred, this also counts. A timeout value of zero diff --git a/vm/reference/sun/reflect/Reflection.java b/vm/reference/sun/reflect/Reflection.java index ef25ce71f..ddbb69d16 100644 --- a/vm/reference/sun/reflect/Reflection.java +++ b/vm/reference/sun/reflect/Reflection.java @@ -42,7 +42,7 @@ import gnu.classpath.VMStackWalker; public class Reflection { /** - * A stack-walking wrapper method used by the JSR 166 RI. + * A stack-walking wrapper method used by the JSR 166 RI. */ public static Class getCallerClass(int depth) { diff --git a/vm/reference/sun/reflect/misc/ReflectUtil.java b/vm/reference/sun/reflect/misc/ReflectUtil.java index 88a6f2515..aca365d6b 100644 --- a/vm/reference/sun/reflect/misc/ReflectUtil.java +++ b/vm/reference/sun/reflect/misc/ReflectUtil.java @@ -53,7 +53,7 @@ public class ReflectUtil /** * Check if the current thread is allowed to access the package of - * the declaringClass. + * the declaringClass. * * @param declaringClass class name to check access to * @throws SecurityException if permission is denied @@ -64,15 +64,15 @@ public class ReflectUtil SecurityManager sm; if ((sm = System.getSecurityManager()) != null) { - while (declaringClass.isArray()) - declaringClass = declaringClass.getComponentType(); - String name = declaringClass.getName(); - int i = name.lastIndexOf('.'); - if (i != -1) // if declaringClass is a member of a package - { - name = name.substring(0, i); - sm.checkPackageAccess(name); - } + while (declaringClass.isArray()) + declaringClass = declaringClass.getComponentType(); + String name = declaringClass.getName(); + int i = name.lastIndexOf('.'); + if (i != -1) // if declaringClass is a member of a package + { + name = name.substring(0, i); + sm.checkPackageAccess(name); + } } } |