1 7 8 package javax.naming.ldap; 9 10 import java.io.IOException ; 11 import javax.naming.*; 12 import javax.naming.directory.*; 13 import com.sun.jndi.ldap.Ber; 14 import com.sun.jndi.ldap.BerDecoder; 15 import com.sun.jndi.ldap.LdapCtx; 16 17 62 final public class SortResponseControl extends BasicControl { 63 64 68 public static final String OID = "1.2.840.113556.1.4.474"; 69 70 private static final long serialVersionUID = 5142939176006310877L; 71 72 77 private int resultCode = 0; 78 79 84 private String badAttrId = null; 85 86 97 public SortResponseControl(String id, boolean criticality, byte[] value) 98 throws IOException { 99 100 super(id, criticality, value); 101 102 BerDecoder ber = new BerDecoder(value, 0, value.length); 104 105 ber.parseSeq(null); 106 resultCode = ber.parseEnumeration(); 107 if ((ber.bytesLeft() > 0) && (ber.peekByte() == Ber.ASN_CONTEXT)) { 108 badAttrId = ber.parseStringWithTag(Ber.ASN_CONTEXT, true, null); 109 } 110 } 111 112 118 public boolean isSorted() { 119 return (resultCode == 0); } 121 122 127 public int getResultCode() { 128 return resultCode; 129 } 130 131 137 public String getAttributeID() { 138 return badAttrId; 139 } 140 141 147 public NamingException getException() { 148 149 return LdapCtx.mapErrorCode(resultCode, null); 150 } 151 } 152 | Popular Tags |