src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


 186 
 187     public boolean equals(GSSNameSpi other) throws GSSException {
 188         if (!(other instanceof GSSNameElement)) {
 189             return false;
 190         }
 191         return cStub.compareName(pName, ((GSSNameElement)other).pName);
 192     }
 193 
 194     public boolean equals(Object other) {
 195         if (!(other instanceof GSSNameElement)) {
 196             return false;
 197         }
 198         try {
 199             return equals((GSSNameElement) other);
 200         } catch (GSSException ex) {
 201             return false;
 202         }
 203     }
 204 
 205     public int hashCode() {
 206         return new Long(pName).hashCode();
 207     }
 208 
 209     public byte[] export() throws GSSException {
 210         byte[] nameVal = cStub.exportName(pName);
 211 
 212         // Need to strip off the mech Oid portion of the exported
 213         // bytes since GSSNameImpl class will subsequently add it.
 214         int pos = 0;
 215         if ((nameVal[pos++] != 0x04) ||
 216             (nameVal[pos++] != 0x01))
 217             throw new GSSException(GSSException.BAD_NAME);
 218 
 219         int mechOidLen  = (((0xFF & nameVal[pos++]) << 8) |
 220                            (0xFF & nameVal[pos++]));
 221         ObjectIdentifier temp = null;
 222         try {
 223             DerInputStream din = new DerInputStream(nameVal, pos,
 224                                                     mechOidLen);
 225             temp = new ObjectIdentifier(din);
 226         } catch (IOException e) {




 186 
 187     public boolean equals(GSSNameSpi other) throws GSSException {
 188         if (!(other instanceof GSSNameElement)) {
 189             return false;
 190         }
 191         return cStub.compareName(pName, ((GSSNameElement)other).pName);
 192     }
 193 
 194     public boolean equals(Object other) {
 195         if (!(other instanceof GSSNameElement)) {
 196             return false;
 197         }
 198         try {
 199             return equals((GSSNameElement) other);
 200         } catch (GSSException ex) {
 201             return false;
 202         }
 203     }
 204 
 205     public int hashCode() {
 206         return Long.valueOf(pName).hashCode();
 207     }
 208 
 209     public byte[] export() throws GSSException {
 210         byte[] nameVal = cStub.exportName(pName);
 211 
 212         // Need to strip off the mech Oid portion of the exported
 213         // bytes since GSSNameImpl class will subsequently add it.
 214         int pos = 0;
 215         if ((nameVal[pos++] != 0x04) ||
 216             (nameVal[pos++] != 0x01))
 217             throw new GSSException(GSSException.BAD_NAME);
 218 
 219         int mechOidLen  = (((0xFF & nameVal[pos++]) << 8) |
 220                            (0xFF & nameVal[pos++]));
 221         ObjectIdentifier temp = null;
 222         try {
 223             DerInputStream din = new DerInputStream(nameVal, pos,
 224                                                     mechOidLen);
 225             temp = new ObjectIdentifier(din);
 226         } catch (IOException e) {