summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java
index 0aa0ca6..ad41e7a 100644
--- a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java
+++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookupUtils.java
@@ -6,9 +6,9 @@ package com.c2kernel.lookup.ldap;
//import netscape.ldap.*;
//import netscape.ldap.util.*;
-import com.c2kernel.common.ObjectAlreadyExists;
+import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.utils.Logger;
import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet;
@@ -30,7 +30,7 @@ final public class LDAPLookupUtils
static final char[] META_CHARS = {'+', '=', '"', ',', '<', '>', ';', '/'};
static final String[] META_ESCAPED = {"2B", "3D", "22", "2C", "3C", "3E", "3B", "2F"};
static public LDAPEntry getEntry(LDAPConnection ld, String dn,int dereference)
- throws ObjectNotFound
+ throws ObjectNotFoundException
{
try {
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
@@ -39,9 +39,9 @@ final public class LDAPLookupUtils
LDAPEntry thisEntry = ld.read(dn,searchCons);
if (thisEntry != null) return thisEntry;
} catch (LDAPException ex) {
- throw new ObjectNotFound("LDAP Exception for dn:"+dn+": \n"+ex.getMessage());
+ throw new ObjectNotFoundException("LDAP Exception for dn:"+dn+": \n"+ex.getMessage());
}
- throw new ObjectNotFound(dn+" does not exist");
+ throw new ObjectNotFoundException(dn+" does not exist");
}
@@ -72,26 +72,26 @@ final public class LDAPLookupUtils
//Given a DN, return an LDAP Entry
static public LDAPEntry getEntry(LDAPConnection ld, String dn)
- throws ObjectNotFound
+ throws ObjectNotFoundException
{
return getEntry(ld, dn, LDAPSearchConstraints.DEREF_NEVER);
}
- static public String getFirstAttributeValue(LDAPEntry anEntry, String attribute) throws ObjectNotFound
+ static public String getFirstAttributeValue(LDAPEntry anEntry, String attribute) throws ObjectNotFoundException
{
LDAPAttribute attr = anEntry.getAttribute(attribute);
if (attr==null)
- throw new ObjectNotFound("No attributes named '"+attribute+"'");
+ throw new ObjectNotFoundException("No attributes named '"+attribute+"'");
return (String)attr.getStringValues().nextElement();
}
- static public String[] getAllAttributeValues(LDAPEntry anEntry, String attribute) throws ObjectNotFound
+ static public String[] getAllAttributeValues(LDAPEntry anEntry, String attribute) throws ObjectNotFoundException
{
LDAPAttribute attr = anEntry.getAttribute(attribute);
if (attr!=null)
return attr.getStringValueArray();
- throw new ObjectNotFound("No attributes named '"+attribute+"'");
+ throw new ObjectNotFoundException("No attributes named '"+attribute+"'");
}
@@ -108,24 +108,24 @@ final public class LDAPLookupUtils
}
return false;
}
- static public boolean hasOneAttributeValue(LDAPEntry anEntry, String attribute) throws ObjectNotFound
+ static public boolean hasOneAttributeValue(LDAPEntry anEntry, String attribute) throws ObjectNotFoundException
{
int j =0;
LDAPAttribute attr = anEntry.getAttribute(attribute);
if (attr==null)
- throw new ObjectNotFound("No attributes named '"+attribute+"'");
+ throw new ObjectNotFoundException("No attributes named '"+attribute+"'");
j=attr.size();
return j==1;
}
//this is for a single-valued attribute
static public void setAttributeValue(LDAPConnection ld, LDAPEntry anEntry, String attribute, String newValue)
- throws ObjectNotFound, ObjectCannotBeUpdated
+ throws ObjectNotFoundException, ObjectCannotBeUpdated
{
try {
if (!hasOneAttributeValue(anEntry, attribute))
throw new ObjectCannotBeUpdated("Attribute "+attribute + " of entry " + anEntry.getDN()+" has more than one value");
- } catch (ObjectNotFound ex) {
+ } catch (ObjectNotFoundException ex) {
addAttributeValue(ld, anEntry, attribute, newValue);
}
try
@@ -186,7 +186,7 @@ final public class LDAPLookupUtils
}
static public void addEntry(LDAPConnection ld,LDAPEntry myEntry)
- throws ObjectAlreadyExists, LDAPException
+ throws ObjectAlreadyExistsException, LDAPException
{
try
{
@@ -194,7 +194,7 @@ final public class LDAPLookupUtils
}
catch( LDAPException ex ) {
if (ex.getResultCode() == LDAPException.ENTRY_ALREADY_EXISTS)
- throw new ObjectAlreadyExists("Entry already present." + myEntry.getDN());
+ throw new ObjectAlreadyExistsException("Entry already present." + myEntry.getDN());
throw ex;
}
}