This avoids a possible NPE when the byteorder system property is not
set.
2007-02-15 Roman Kennke <[EMAIL PROTECTED]>
* java/nio/ByteOrder.java
(nativeOrder): Avoid NPE when comparing a system property.
/Roman
Index: java/nio/ByteOrder.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/ByteOrder.java,v
retrieving revision 1.11
diff -u -1 -5 -r1.11 ByteOrder.java
--- java/nio/ByteOrder.java 2 Jul 2005 20:32:39 -0000 1.11
+++ java/nio/ByteOrder.java 15 Feb 2007 10:37:16 -0000
@@ -49,31 +49,31 @@
*/
public static final ByteOrder BIG_ENDIAN = new ByteOrder();
/**
* Constant indicating little endian byte order.
*/
public static final ByteOrder LITTLE_ENDIAN = new ByteOrder();
/**
* Returns the native byte order of the platform currently running.
*
* @return the native byte order
*/
public static ByteOrder nativeOrder()
{
- return (System.getProperty ("gnu.cpu.endian").equals("big")
+ return ("big".equals(System.getProperty("gnu.cpu.endian"))
? BIG_ENDIAN : LITTLE_ENDIAN);
}
/**
* Returns a string representation of the byte order.
*
* @return the string
*/
public String toString()
{
return this == BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN";
}
// This class can only be instantiated here.
private ByteOrder()