diff options
Diffstat (limited to 'gnu/java/security/OID.java')
-rw-r--r-- | gnu/java/security/OID.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gnu/java/security/OID.java b/gnu/java/security/OID.java index c6b977e00..2a5355490 100644 --- a/gnu/java/security/OID.java +++ b/gnu/java/security/OID.java @@ -1,5 +1,5 @@ /* OID.java -- numeric representation of an object identifier - Copyright (C) 2003, 2004, 2005, 2006, 2014 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2014, 2015 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -125,7 +125,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable { if (components == null || components.length == 0) throw new IllegalArgumentException(); - this.components = (int[]) components.clone(); + this.components = components.clone(); this.relative = relative; } @@ -221,7 +221,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable */ public OID(byte[] encoded, boolean relative) throws IOException { - der = (byte[]) encoded.clone(); + der = encoded.clone(); this.relative = relative; try { @@ -245,7 +245,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable */ public int[] getIDs() { - return (int[]) components.clone(); + return components.clone(); } /** @@ -269,7 +269,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable encodeSubID(bout, components[i]); der = bout.toByteArray(); } - return (byte[]) der.clone(); + return der.clone(); } /** @@ -321,6 +321,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable * * @return The copy. */ + @Override public Object clone() { try @@ -355,21 +356,19 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable * * @return The string representation. */ + @Override public String toString() { if (strRep != null) return strRep; - else + CPStringBuilder buf = new CPStringBuilder(); + for (int i = 0; i < components.length; i++) { - CPStringBuilder buf = new CPStringBuilder(); - for (int i = 0; i < components.length; i++) - { - buf.append((long) components[i] & 0xFFFFFFFFL); - if (i < components.length - 1) - buf.append('.'); - } - return (strRep = buf.toString()); + buf.append(components[i] & 0xFFFFFFFFL); + if (i < components.length - 1) + buf.append('.'); } + return (strRep = buf.toString()); } /** @@ -377,6 +376,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable * * @return The hash code. */ + @Override public int hashCode() { int ret = 0; @@ -390,6 +390,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable * * @return Whether or not this OID equals the other. */ + @Override public boolean equals(Object o) { if (!(o instanceof OID)) @@ -410,6 +411,7 @@ public class OID implements Cloneable, Comparable<OID>, java.io.Serializable * argument. * @throws ClassCastException If <i>o</i> is not an OID. */ + @Override public int compareTo(OID o) { if (equals(o)) |