Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (107)
9060eceb
Adding travis.yml (#1)
Sep 04, 2018
4c460811
Added .copr/Makefile
Mar 15, 2019
a8de829a
Add timestamp and commit-id for automated COPR builds
Mar 29, 2019
802d4864
Fixing minor issue with COPR automated builds
Apr 01, 2019
c61e45ec
Updating travis container image and COPR repo
May 06, 2019
a2bd08bf
Updated Travis script to install LDAP server for testing
May 13, 2019
41a0bd43
Added basic tools test
May 13, 2019
11b775da
Added generics for LDAPAttribute.getStringValues()
May 20, 2019
5f39d273
Added generics for LDAPAttribute.getByteValues()
May 20, 2019
cec189a6
Added generics for LDAPAttributeSet.getAttributes()
May 20, 2019
6bedc2b1
Added generics for LDAPMessageQueueImpl._messageQueue
May 20, 2019
907ed67b
Added generics for LDAPMessageQueueImpl._requestList
May 20, 2019
b25f8ab9
Added generics for LDAPSchema._changeList
May 20, 2019
adef5ea2
Added generics for Class
May 20, 2019
905f5c03
Added generics for LDAPAttribute.getStringValues() (part 2)
May 20, 2019
2c18f28c
Added generics for LDAPAttribute.getByteValues() (part 2)
May 20, 2019
e0f5531b
Added generics for LDAPAttributeSet
May 20, 2019
c2fe145f
Added generics for LDAPSchema.objectClasses
May 20, 2019
1772b1a8
Added generics for LDAPSchema.attributes
May 20, 2019
d4f0c28a
Added generics for LDAPSchema._objectClasses
May 20, 2019
1da841ea
Added generics for LDAPSchema._attributes
May 20, 2019
2925deb2
Updated version number to 4.21.0
May 20, 2019
cf1d4973
Added generics for Comparators
May 20, 2019
46417065
Added generics for LDAPConnThread._requests
May 20, 2019
29d38faf
Added generics for LDAPConnThread._messages
May 20, 2019
f308bb3a
Added generics for LDAPConnThread._registered
May 20, 2019
198272fe
Added generics for LDAPConnThread.m_requests
May 20, 2019
01add668
Added generics for LDAPConnThread.m_messages
May 20, 2019
2768e84f
Added generics for LDAPConnThread.m_registered
May 20, 2019
07c65bbd
Added generics for LDAPConnection._threadConnTable
May 20, 2019
d65f2498
Added generics for LDAPConnection._attachedList
May 20, 2019
da4a8268
Added generics for LDAPConnection._responseControlTable
May 20, 2019
294d32c0
Added generics for LDAPConnection.m_responseControlTable
May 20, 2019
178ed639
Added generics for LDAPConnection.m_properties
May 20, 2019
c8a8197e
Added generics for LDAPMessageQueue.m_messageQueue
May 20, 2019
71463d58
Added generics for LDAPMessageQueue.m_requestList
May 20, 2019
66fcff07
Added generics for LDAPConnection.m_responseListeners
May 20, 2019
37bd4b96
Added generics for LDAPConnection.m_searchListeners
May 20, 2019
22171717
Added generics for LDAPConnection._matchingRules
May 20, 2019
6c0f1a52
Added generics for LDAPSchema._matchingRuleUses
May 20, 2019
babba778
Added generics for LDAPSchema._syntaxes
May 20, 2019
aaf73a5c
Added generics for LDAPSchema._structureRulesByName
May 20, 2019
2c90a3ac
Added generics for LDAPSchema._structureRulesById
May 20, 2019
693967e2
Added generics for LDAPSchema._contentRules
May 20, 2019
dbfabe8f
Added generics for LDAPSchema._nameForms
May 20, 2019
28837c95
Added generics for LDAPSchema._IDToElement
May 20, 2019
31a47eb3
Fixed warnings in LDAPSchema
May 20, 2019
9b9483e1
Added generics for Constructors
May 21, 2019
b40e4633
Fixed warnings in AttributesImpl
May 21, 2019
79670429
Added generics for Attributes.getAll()
May 21, 2019
cdecfd04
Added generics for Attribute.getAll()
May 21, 2019
6359f330
Added generics for LDAPSchemaElement.properties
May 21, 2019
83a5f983
Added generics for LDAPSchemaElement.novalsTable
May 21, 2019
42a00035
Added generics for LDAPUrl
May 21, 2019
41934f4e
Added generics for RDN
May 21, 2019
2c4dacf7
Fixed warnings in LDAPSaslBind
May 21, 2019
8cdbb4d9
Added generics for LDAPCache.m_orderedStruct
May 21, 2019
4718fbc4
Added generics for LDAPCache.m_cache
May 21, 2019
fdf87502
Added generics for LDAPSearchResults
May 21, 2019
ec8a3e6c
Fixed warnings in LDAPConnection
May 21, 2019
cc8d6f74
Fixed warnings in LDAPObjectClassSchema
May 21, 2019
10dcc5ef
Added generics for LDAPSchema.matchingRules
May 21, 2019
739e3388
Added generics for LDAPSchema.syntaxes
May 21, 2019
00299d5a
Added generics for LDAPSchema.structureRulesByName
May 21, 2019
64d8168e
Added generics for LDAPSchema.structureRulesById
May 21, 2019
b614ac5b
Added generics for LDAPSchema.contentRules
May 21, 2019
adec3150
Added generics for LDAPSchema.nameForms
May 21, 2019
6fae746d
Fixed warnings in LDAPSchema
May 21, 2019
b1d954b0
Fixed warnings in LDAPConnSetupMgr
May 22, 2019
8556b8fb
Refactored LDAPRebindAuth
May 23, 2019
851a4725
Added generics for ClientFactory._mechanismTable
May 30, 2019
893c2aa8
Added generics in SaslClientFactory
May 30, 2019
88eec845
Added generics in LDAPSaslBind
May 30, 2019
90eaeb90
Fixed warnings in LDAPSaslBind
May 30, 2019
8244cf4e
Added generics in LDAPConnection
May 30, 2019
64b02a9c
Added generics in LdapContextImpl
May 30, 2019
f9065a9a
Added generics in LdapService
May 30, 2019
406efb36
Added generics in BaseSearchEnum
May 30, 2019
702f1a55
Added generics in ResponseControls
May 30, 2019
50ed3fed
Added generics for LDAPSearchResults.exceptions
May 30, 2019
11a75759
Added generics for LDAPSearchResults.referralResults
May 30, 2019
708029c2
Added generics for LDAPSearchResults.entries
May 30, 2019
e44f05e0
Fixed warnings in LDAPConnection
May 30, 2019
60ce2b02
Added SLF4J logging
May 31, 2019
f6e02a68
Added generics in ShareableEnv
May 31, 2019
8e4a8a29
Added generics in ContextEnv
May 31, 2019
ac10a86c
Fixed warnings in LdapContextImpl
May 31, 2019
6e8a3dae
Added generics in LdapReferralException
May 31, 2019
d9d0bfe7
Added generics in LDAPConstraints
May 31, 2019
f3023e2c
Added generics in LDAPControl
May 31, 2019
cbb90d48
Added generics in GetOpt
May 31, 2019
d83bcced
Added generics in LDAPCache
May 31, 2019
7b3872c1
Added LDAPConnThread.close()
Jun 03, 2019
597ea579
Fixed warnings in DSMLWriter
Jun 03, 2019
0222466e
Added generics in LDAPObjectClassSchema
Jun 03, 2019
27484000
Added generics in LDAPSchemaElement
Jun 03, 2019
315af9c2
Fixed warnings in DirContextAdapter
Jun 03, 2019
774814aa
Fixed warnings in DynamicInvoker
Jun 03, 2019
7aa0012f
Fixed warnings in LDAPSSLSocketWrapFactory
Jun 03, 2019
ba98758f
Added generics in SchemaElement
Jun 03, 2019
Expand all
Show whitespace changes
Inline
Side-by-side
.classpath
View file @
9af4491a
...
...
@@ -6,6 +6,8 @@
<classpathentry
kind=
"src"
path=
"java-sdk/ldapfilter"
/>
<classpathentry
kind=
"src"
path=
"java-sdk/ldapjdk"
/>
<classpathentry
kind=
"src"
path=
"java-sdk/ldapsp"
/>
<classpathentry
kind=
"src"
path=
"java-sdk/tools"
/>
<classpathentry
kind=
"lib"
path=
"/usr/lib/java/jss4.jar"
/>
<classpathentry
kind=
"lib"
path=
"/usr/share/java/slf4j/slf4j-api.jar"
/>
<classpathentry
kind=
"output"
path=
"build/classes"
/>
</classpath>
.copr/Makefile
0 → 100644
View file @
9af4491a
srpm
:
dnf
install
-y
git
./build.sh
--with-timestamp
--with-commit-id
srpm
if
[[
"
${
outdir
}
"
!=
""
]]
;
then
\
mv
${
HOME
}
/build/ldapjdk/SRPMS/
*
${
outdir
};
\
fi
.travis.yml
0 → 100644
View file @
9af4491a
# BEGIN COPYRIGHT BLOCK
# (C) 2018 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
services
:
-
docker
env
:
-
FEDORA=29
-
FEDORA=30
install
:
-
docker pull registry.fedoraproject.org/fedora:$FEDORA
-
docker run
--name container
--hostname server.example.com
--tmpfs /tmp
--tmpfs /run
--volume /sys/fs/cgroup:/sys/fs/cgroup:ro
--volume $(pwd):/root/ldapjdk
--detach
-i
registry.fedoraproject.org/fedora:$FEDORA
"/usr/sbin/init"
-
docker exec container /root/ldapjdk/travis/container-init.sh
-
docker exec container dnf install -y dnf-plugins-core rpm-build
-
docker exec container dnf copr -y enable @pki/master
-
docker exec container dnf builddep -y --spec /root/ldapjdk/ldapjdk.spec
-
docker exec container /root/ldapjdk/build.sh --with-timestamp --with-commit-id rpm
-
docker exec container rpm -Uvh /root/build/ldapjdk/RPMS/*
-
docker exec container dnf install -y 389-ds-base 389-ds-base-legacy-tools
script
:
-
docker exec container /root/ldapjdk/travis/ds-create.sh
-
docker exec container /root/ldapjdk/travis/tools-test.sh
-
docker exec container /root/ldapjdk/travis/ds-remove.sh
after_script
:
-
docker kill container
-
docker rm container
java-sdk/build.xml
View file @
9af4491a
...
...
@@ -64,6 +64,7 @@
<property
name=
"build"
value=
"build"
/>
<property
name=
"dist"
value=
"dist"
/>
<property
name=
"jss.lib"
value=
"/usr/lib/java/jss4.jar"
/>
<property
name=
"slf4j.lib"
value=
"/usr/share/java/slf4j/slf4j-api.jar"
/>
<!-- the following is to setup the correct info for sun jsse which
is jdk dependent -->
...
...
@@ -185,22 +186,22 @@
<!-- Compile the java jdk code from ${src} into ${dest} -->
<javac
srcdir=
"${basedir}/ldapjdk/com"
destdir=
"${jdk.dist}"
excludes=
"cvs/**"
classpath=
"${jsselibs}"
classpath=
"${jsselibs}
:${slf4j.lib}
"
/>
<javac
srcdir=
"${basedir}/ldapjdk/netscape"
destdir=
"${jdk.dist}"
excludes=
"cvs/**"
classpath=
"${jsselibs}"
classpath=
"${jsselibs}
:${slf4j.lib}
"
/>
<javac
srcdir=
"${basedir}/tools"
destdir=
"${jdk.dist}"
excludes=
"cvs/**"
classpath=
"${jsselibs}"
classpath=
"${jsselibs}
:${slf4j.lib}
"
/>
</target>
<target
name=
"build-filter"
depends=
"init,build-jdk"
>
<javac
srcdir=
"${basedir}/ldapfilter"
destdir=
"${filter.dist}"
excludes=
"cvs/**"
classpath=
"${jdk.dist}:${jsselibs}"
classpath=
"${jdk.dist}:${jsselibs}
:${slf4j.lib}
"
/>
</target>
...
...
@@ -208,7 +209,7 @@
<!-- Compile the java jdk bean code from ${src} into ${dest} -->
<javac
srcdir=
"${basedir}/ldapbeans"
destdir=
"${jdk.dist}"
excludes=
"cvs/**"
classpath=
"${jsselibs}"
classpath=
"${jsselibs}
:${slf4j.lib}
"
/>
</target>
...
...
@@ -216,7 +217,7 @@
<!-- Compile the java code from ${src} into ${dest} -->
<javac
srcdir=
"${basedir}/ldapsp"
destdir=
"${jndi.dist}"
excludes=
"cvs/**"
classpath=
"${jsselibs}:${basedir}/ldapsp/lib/jndi.jar"
classpath=
"${jsselibs}:${basedir}/ldapsp/lib/jndi.jar
:${slf4j.lib}
"
/>
</target>
...
...
@@ -231,14 +232,14 @@
author=
"true"
version=
"true"
use=
"true"
classpath=
"${basedir}/ldapjdk:${jss.lib}:${basedir}/ldapjdk/lib/jss32_stub.jar:${basedir}/ldapbeans"
classpath=
"${basedir}/ldapjdk:${jss.lib}:${basedir}/ldapjdk/lib/jss32_stub.jar:${basedir}/ldapbeans
:${slf4j.lib}
"
additionalparam=
"-Xdoclint:none"
>
</javadoc>
<javadoc
packagenames=
"com.netscape.jndi.ldap.controls.*"
sourcepath=
"${basedir}/ldapsp"
destdir=
"${doc.dist}/ldapsp"
classpath=
"${jndi.dist}:${basedir}/ldapsp:${basedir}/ldapsp/lib/jndi.jar"
classpath=
"${jndi.dist}:${basedir}/ldapsp:${basedir}/ldapsp/lib/jndi.jar
:${slf4j.lib}
"
author=
"true"
version=
"true"
use=
"true"
...
...
java-sdk/ietfldap/org/ietf/ldap/DynamicInvoker.java
View file @
9af4491a
...
...
@@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.lang.reflect.
*
;
import
java.lang.reflect.
Method
;
import
java.util.Hashtable
;
/**
...
...
@@ -52,7 +52,7 @@ class DynamicInvoker {
String
[]
argNames
)
throws
LDAPException
{
try
{
java
.
lang
.
reflect
.
Method
m
=
getMethod
(
packageName
,
Method
m
=
getMethod
(
packageName
,
methodName
,
argNames
);
if
(
m
!=
null
)
{
...
...
@@ -83,14 +83,14 @@ class DynamicInvoker {
}
}
String
key
=
packageName
+
"."
+
methodName
+
"."
+
suffix
;
if
(
(
method
=
(
Method
)(
m_methodLookup
.
get
(
key
))
)
!=
null
)
{
if
((
method
=
m_methodLookup
.
get
(
key
))
!=
null
)
{
return
method
;
}
Class
c
=
Class
.
forName
(
packageName
);
Class
<?>
c
=
Class
.
forName
(
packageName
);
Method
[]
m
=
c
.
getMethods
();
for
(
int
i
=
0
;
i
<
m
.
length
;
i
++
)
{
Class
[]
params
=
m
[
i
].
getParameterTypes
();
Class
<?>
[]
params
=
m
[
i
].
getParameterTypes
();
if
(
m
[
i
].
getName
().
equals
(
methodName
)
&&
signatureCorrect
(
params
,
args
))
{
m_methodLookup
.
put
(
key
,
m
[
i
]
);
...
...
@@ -106,7 +106,7 @@ class DynamicInvoker {
}
}
static
private
boolean
signatureCorrect
(
Class
params
[],
static
private
boolean
signatureCorrect
(
Class
<?>
params
[],
String
args
[]
)
{
if
(
args
==
null
)
{
return
true
;
...
...
@@ -127,5 +127,5 @@ class DynamicInvoker {
return
true
;
}
private
static
Hashtable
m_methodLookup
=
new
Hashtable
();
private
static
Hashtable
<
String
,
Method
>
m_methodLookup
=
new
Hashtable
<>
();
}
java-sdk/ietfldap/org/ietf/ldap/LDAPAttribute.java
View file @
9af4491a
...
...
@@ -37,9 +37,16 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.io.*
;
import
java.util.*
;
import
org.ietf.ldap.ber.stream.*
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.util.Enumeration
;
import
java.util.StringTokenizer
;
import
java.util.Vector
;
import
org.ietf.ldap.ber.stream.BERElement
;
import
org.ietf.ldap.ber.stream.BEROctetString
;
import
org.ietf.ldap.ber.stream.BERSequence
;
import
org.ietf.ldap.ber.stream.BERSet
;
/**
* Represents the name and values of an attribute in an entry.
...
...
@@ -68,7 +75,7 @@ public class LDAPAttribute implements Cloneable, Serializable {
values
=
new
Object
[
attr
.
values
.
length
];
for
(
int
i
=
0
;
i
<
attr
.
values
.
length
;
i
++)
{
values
[
i
]
=
new
byte
[((
byte
[])
attr
.
values
[
i
]).
length
];
System
.
arraycopy
(
(
byte
[])
attr
.
values
[
i
],
0
,
(
byte
[])
values
[
i
],
0
,
System
.
arraycopy
(
attr
.
values
[
i
],
0
,
values
[
i
],
0
,
((
byte
[])
attr
.
values
[
i
]).
length
);
}
}
...
...
@@ -150,8 +157,8 @@ public class LDAPAttribute implements Cloneable, Serializable {
* Returns an enumerator for the string values of an attribute.
* @return enumerator for the string values.
*/
public
Enumeration
getStringValues
()
{
Vector
v
=
new
Vector
();
public
Enumeration
<
String
>
getStringValues
()
{
Vector
<
String
>
v
=
new
Vector
<>
();
synchronized
(
this
)
{
try
{
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
...
...
@@ -199,12 +206,12 @@ public class LDAPAttribute implements Cloneable, Serializable {
* @return a set of attribute values. Each element in the enumeration
* is of type <CODE>byte[]</CODE>.
*/
public
Enumeration
getByteValues
()
{
Vector
v
=
new
Vector
();
public
Enumeration
<
byte
[]>
getByteValues
()
{
Vector
<
byte
[]>
v
=
new
Vector
<>
();
synchronized
(
this
)
{
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
if
(
values
[
i
]
!=
null
)
{
v
.
addElement
(
values
[
i
]);
v
.
addElement
(
(
byte
[])
values
[
i
]);
}
else
{
v
.
addElement
(
new
byte
[
0
]
);
}
...
...
@@ -225,7 +232,7 @@ public class LDAPAttribute implements Cloneable, Serializable {
try
{
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
b
[
i
]
=
new
byte
[((
byte
[])(
values
[
i
])).
length
];
System
.
arraycopy
(
(
byte
[])
values
[
i
],
0
,
(
byte
[])
b
[
i
],
0
,
System
.
arraycopy
(
values
[
i
],
0
,
b
[
i
],
0
,
((
byte
[])(
values
[
i
])).
length
);
}
}
catch
(
Exception
e
)
{
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPAttributeSchema.java
View file @
9af4491a
...
...
@@ -37,8 +37,6 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.util.*
;
/**
* The definition of an attribute type in the schema.
* <A HREF="http://www.ietf.org/rfc/rfc2252.txt"
...
...
@@ -385,8 +383,7 @@ public class LDAPAttributeSchema extends LDAPSchemaElement {
* @return <code>true</code> if collective
*/
public
boolean
isCollective
()
{
return
(
properties
!=
null
)
?
properties
.
containsKey
(
COLLECTIVE
)
:
false
;
return
properties
!=
null
?
properties
.
containsKey
(
COLLECTIVE
)
:
false
;
}
/**
...
...
@@ -396,8 +393,7 @@ public class LDAPAttributeSchema extends LDAPSchemaElement {
* <code>false</code> if multi-valued.
*/
public
boolean
isSingleValued
()
{
return
(
properties
!=
null
)
?
properties
.
containsKey
(
SINGLE
)
:
false
;
return
properties
!=
null
?
properties
.
containsKey
(
SINGLE
)
:
false
;
}
/**
...
...
@@ -406,9 +402,7 @@ public class LDAPAttributeSchema extends LDAPSchemaElement {
* @return <code>true</code> if modifiable by users
*/
public
boolean
isUserModifiable
()
{
return
(
properties
!=
null
)
?
!
properties
.
containsKey
(
NO_USER_MODIFICATION
)
:
true
;
return
properties
!=
null
?
!
properties
.
containsKey
(
NO_USER_MODIFICATION
)
:
true
;
}
/**
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPAttributeSet.java
View file @
9af4491a
...
...
@@ -38,10 +38,11 @@
package
org.ietf.ldap
;
import
java.io.Serializable
;
import
java.util.*
;
import
org.ietf.ldap.client.*
;
import
org.ietf.ldap.client.opers.*
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Set
;
import
java.util.StringTokenizer
;
/**
* Represents a set of attributes (for example, the set of attributes
...
...
@@ -50,9 +51,9 @@ import org.ietf.ldap.client.opers.*;
* @version 1.0
* @see org.ietf.ldap.LDAPAttribute
*/
public
class
LDAPAttributeSet
implements
Cloneable
,
Serializable
,
Set
{
public
class
LDAPAttributeSet
implements
Cloneable
,
Serializable
,
Set
<
LDAPAttribute
>
{
static
final
long
serialVersionUID
=
5018474561697778100L
;
HashMap
_attrHash
=
null
;
HashMap
<
String
,
LDAPAttribute
>
_attrHash
=
null
;
LDAPAttribute
[]
_attrs
=
new
LDAPAttribute
[
0
];
/* If there are less attributes than this in the set, it's not worth
creating a Hashtable - faster and cheaper most likely to do string
...
...
@@ -101,12 +102,12 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
* @param attr attribute to add to this set
* @return true if this set changed as a result of the call
*/
public
synchronized
boolean
add
(
Object
attr
)
{
public
synchronized
boolean
add
(
LDAPAttribute
attr
)
{
if
(
attr
instanceof
LDAPAttribute
)
{
if
(
contains
(
attr
)
)
{
return
false
;
}
LDAPAttribute
attrib
=
(
LDAPAttribute
)
attr
;
LDAPAttribute
attrib
=
attr
;
LDAPAttribute
[]
vals
=
new
LDAPAttribute
[
_attrs
.
length
+
1
];
for
(
int
i
=
0
;
i
<
_attrs
.
length
;
i
++
)
{
vals
[
i
]
=
_attrs
[
i
];
...
...
@@ -129,14 +130,14 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
* @param attrs attributes to add to this set
* @return true if any attribute was added
*/
public
synchronized
boolean
addAll
(
Collection
attrs
)
{
public
synchronized
boolean
addAll
(
Collection
<?
extends
LDAPAttribute
>
attrs
)
{
if
(
attrs
==
null
)
{
return
false
;
}
boolean
present
=
true
;
Iterator
it
=
attrs
.
iterator
();
Iterator
<?
extends
LDAPAttribute
>
it
=
attrs
.
iterator
();
while
(
it
.
hasNext
()
)
{
Object
attr
=
it
.
next
();
LDAPAttribute
attr
=
it
.
next
();
if
(
!
contains
(
attr
)
)
{
present
=
true
;
add
(
attr
);
...
...
@@ -192,9 +193,9 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
* @param attrs attributes whose presence in this set is to be tested
* @return true if the attribute set contains the specified attributes
*/
public
boolean
containsAll
(
Collection
attrs
)
{
public
boolean
containsAll
(
Collection
<?>
attrs
)
{
if
(
_attrHash
!=
null
)
{
Iterator
it
=
attrs
.
iterator
();
Iterator
<?>
it
=
attrs
.
iterator
();
while
(
it
.
hasNext
()
)
{
if
(
!
_attrHash
.
containsValue
(
it
.
next
()
)
)
{
return
false
;
...
...
@@ -256,7 +257,7 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
*
* @return an iterator over the attributes in this attribute set
*/
public
Iterator
iterator
()
{
public
Iterator
<
LDAPAttribute
>
iterator
()
{
return
_attrHash
.
values
().
iterator
();
}
...
...
@@ -296,12 +297,12 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
* @param attrs the attributes to remove
* @return true if any attribute was removed
*/
public
boolean
removeAll
(
Collection
attrs
)
{
public
boolean
removeAll
(
Collection
<?>
attrs
)
{
if
(
attrs
==
null
)
{
return
false
;
}
boolean
present
=
true
;
Iterator
it
=
attrs
.
iterator
();
Iterator
<?>
it
=
attrs
.
iterator
();
while
(
it
.
hasNext
()
)
{
Object
attr
=
it
.
next
();
if
(
!
contains
(
attr
)
)
{
...
...
@@ -320,21 +321,21 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
* @return true if the attribute set was changed as a result of the
* operation
*/
public
boolean
retainAll
(
Collection
attrs
)
{
HashMap
newmap
=
new
HashMap
();
Iterator
it
=
attrs
.
iterator
();
public
boolean
retainAll
(
Collection
<?>
attrs
)
{
HashMap
<
String
,
LDAPAttribute
>
newmap
=
new
HashMap
<>
();
Iterator
<?>
it
=
attrs
.
iterator
();
while
(
it
.
hasNext
()
)
{
Object
attr
=
it
.
next
();
if
(
attr
instanceof
LDAPAttribute
)
{
newmap
.
put
(
((
LDAPAttribute
)
attr
).
getName
().
toLowerCase
(),
attr
);
(
LDAPAttribute
)
attr
);
}
}
if
(
newmap
.
equals
(
_attrHash
)
)
{
return
false
;
}
else
{
_attrHash
=
newmap
;
_attrs
=
(
LDAPAttribute
[])
_attrHash
.
values
().
toArray
(
_attrs
=
_attrHash
.
values
().
toArray
(
new
LDAPAttribute
[
0
]
);
return
true
;
}
...
...
@@ -428,12 +429,12 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
String
[]
searchTypes
=
new
String
[
st
.
countTokens
()];
int
i
=
0
;
while
(
st
.
hasMoreTokens
()
)
{
searchTypes
[
i
]
=
(
String
)
st
.
nextToken
();
searchTypes
[
i
]
=
st
.
nextToken
();
i
++;
}
Iterator
it
=
_attrHash
.
values
().
iterator
();
Iterator
<
LDAPAttribute
>
it
=
_attrHash
.
values
().
iterator
();
while
(
it
.
hasNext
()
)
{
LDAPAttribute
attr
=
(
LDAPAttribute
)
it
.
next
();
LDAPAttribute
attr
=
it
.
next
();
if
(
attr
.
hasSubtypes
(
searchTypes
)
)
attrs
.
add
(
new
LDAPAttribute
(
attr
)
);
}
...
...
@@ -457,7 +458,7 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
if
(
attrName
==
null
)
{
return
null
;
}
else
if
(
_attrHash
!=
null
)
{
return
(
LDAPAttribute
)
_attrHash
.
get
(
attrName
.
toLowerCase
()
);
return
_attrHash
.
get
(
attrName
.
toLowerCase
()
);
}
else
{
for
(
int
i
=
0
;
i
<
_attrs
.
length
;
i
++
)
{
if
(
attrName
.
equalsIgnoreCase
(
_attrs
[
i
].
getName
())
)
{
...
...
@@ -475,7 +476,7 @@ public class LDAPAttributeSet implements Cloneable, Serializable, Set {
if
(
(
_attrHash
==
null
)
&&
(
force
||
(
_attrs
.
length
>=
ATTR_COUNT_REQUIRES_HASH
))
)
{
if
(
_attrHash
==
null
)
{
_attrHash
=
new
HashMap
();
_attrHash
=
new
HashMap
<>
();
}
else
{
_attrHash
.
clear
();
}
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPCache.java
View file @
9af4491a
...
...
@@ -37,12 +37,14 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.
util.*
;
import
java.
io.*
;
import
org.ietf.ldap.client.*
;
import
org.ietf.ldap.util.*
;
import
java.
io.Serializable
;
import
java.
util.Enumeration
;
import
java.util.Hashtable
;
import
java.util.Vector
;
import
java.util.zip.CRC32
;
import
org.ietf.ldap.util.DN
;
/**
* <CODE>LDAPCache</CODE> represents an in-memory cache that you can use
* to reduce the number of search requests sent to the LDAP server.
...
...
@@ -132,7 +134,7 @@ public class LDAPCache implements Serializable {
* of all entries, followed by the actual search result entries (of type
* LDAPEntry).
*/
private
Hashtable
m_cache
;
private
Hashtable
<
Long
,
Vector
<
Object
>>
m_cache
;
/**
* A list of cached entries ordered by time (augments m_cache). Each
...
...
@@ -144,7 +146,7 @@ public class LDAPCache implements Serializable {
* exceeds the cache available space, the extra space is made by removing
* existing cached results in the order of their entry in the cache.
*/
private
Vector
m_orderedStruct
;
private
Vector
<
Vector
<
Long
>>
m_orderedStruct
;
private
long
m_timeToLive
;
private
long
m_maxSize
;
...
...
@@ -299,11 +301,11 @@ public class LDAPCache implements Serializable {
DN
dn2
=
new
DN
(
dn
);
Enumeration
e
=
m_cache
.
keys
();
Enumeration
<
Long
>
e
=
m_cache
.
keys
();
while
(
e
.
hasMoreElements
())
{
Long
key
=
(
Long
)
e
.
nextElement
();
Vector
val
=
(
Vector
)
m_cache
.
get
(
key
);
Long
key
=
e
.
nextElement
();
Vector
<
Object
>
val
=
m_cache
.
get
(
key
);
// LDAPEntries start at idx 1, at idx 0 is a Long
// (size of all LDAPEntries returned by search())
...
...
@@ -330,13 +332,13 @@ public class LDAPCache implements Serializable {
if
(
j
<
size2
)
{
for
(
int
k
=
0
;
k
<
m_orderedStruct
.
size
();
k
++)
{
Vector
v
=
(
Vector
)
m_orderedStruct
.
elementAt
(
k
);
if
(
key
.
equals
(
(
Long
)
v
.
elementAt
(
0
)))
{
Vector
<
Long
>
v
=
m_orderedStruct
.
elementAt
(
k
);
if
(
key
.
equals
(
v
.
elementAt
(
0
)))
{
m_orderedStruct
.
removeElementAt
(
k
);
break
;
}
}
Vector
entry
=
(
Vector
)
m_cache
.
remove
(
key
);
Vector
<
Object
>
entry
=
m_cache
.
remove
(
key
);
m_remainingSize
+=
((
Long
)
entry
.
firstElement
()).
longValue
();
if
(
m_debug
)
System
.
out
.
println
(
"DEBUG: Successfully removed entry ->"
+
key
);
...
...
@@ -476,10 +478,8 @@ public class LDAPCache implements Serializable {
* @param key the key for the cache entry
* @return the cache entry.
*/
synchronized
Object
getEntry
(
Long
key
)
{
Object
obj
=
null
;
obj
=
m_cache
.
get
(
key
);
synchronized
Vector
<
Object
>
getEntry
(
Long
key
)
{
Vector
<
Object
>
obj
=
m_cache
.
get
(
key
);
m_totalOpers
++;
if
(
m_debug
)
{
...
...
@@ -503,7 +503,7 @@ public class LDAPCache implements Serializable {
*/
synchronized
void
flushEntries
()
{
Vector
v
=
null
;
Vector
<
Long
>
v
=
null
;
boolean
delete
=
false
;
long
currTime
=
System
.
currentTimeMillis
();
...
...
@@ -513,14 +513,14 @@ public class LDAPCache implements Serializable {
if
(
m_orderedStruct
.
size
()
<=
0
)
break
;
v
=
(
Vector
)
m_orderedStruct
.
firstElement
();
long
diff
=
currTime
-
((
Long
)
v
.
elementAt
(
1
)
)
.
longValue
();
v
=
m_orderedStruct
.
firstElement
();
long
diff
=
currTime
-
v
.
elementAt
(
1
).
longValue
();
if
(
diff
>=
m_timeToLive
)
{
Long
key
=
(
Long
)
v
.
elementAt
(
0
);
Long
key
=
v
.
elementAt
(
0
);
if
(
m_debug
)
System
.
out
.
println
(
"DEBUG: Timer flush entry whose key is "
+
key
);
Vector
entry
=
(
Vector
)
m_cache
.
remove
(
key
);
Vector
<
Object
>
entry
=
m_cache
.
remove
(
key
);
m_remainingSize
+=
((
Long
)
entry
.
firstElement
()).
longValue
();
// always delete the first one
...
...
@@ -551,7 +551,7 @@ public class LDAPCache implements Serializable {
if
(
m_cache
.
get
(
key
)
!=
null
)
return
false
;
Vector
v
=
(
Vector
)
value
;
Vector
<
Object
>
v
=
(
Vector
<
Object
>
)
value
;
long
size
=
((
Long
)
v
.
elementAt
(
0
)).
longValue
();
if
(
size
>
m_maxSize
)
{
...
...
@@ -565,9 +565,9 @@ public class LDAPCache implements Serializable {
// cache
if
(
size
>
m_remainingSize
)
{
while
(
true
)
{
Vector
element
=
(
Vector
)
m_orderedStruct
.
firstElement
();
Long
str
=
(
Long
)
element
.
elementAt
(
0
);
Vector
val
=
(
Vector
)
m_cache
.
remove
(
str
);
Vector
<
Long
>
element
=
m_orderedStruct
.
firstElement
();
Long
str
=
element
.
elementAt
(
0
);
Vector
<
Object
>
val
=
m_cache
.
remove
(
str
);
if
(
m_debug
)
System
.
out
.
println
(
"DEBUG: The spare size of the cache is not big enough "
+
"to hold the new entry, deleting the entry whose key -> "
+
str
);
...
...
@@ -582,7 +582,7 @@ public class LDAPCache implements Serializable {
m_remainingSize
-=
size
;
m_cache
.
put
(
key
,
v
);
Vector
element
=
new
Vector
(
2
);
Vector
<
Long
>
element
=
new
Vector
<>
(
2
);
element
.
addElement
(
key
);
element
.
addElement
(
new
Long
(
System
.
currentTimeMillis
()));
m_orderedStruct
.
addElement
(
element
);
...
...
@@ -615,9 +615,9 @@ public class LDAPCache implements Serializable {
m_timer
=
new
TTLTimer
(
this
);
}
Vector
v
=
(
Vector
)
m_orderedStruct
.
firstElement
();
Vector
<
Long
>
v
=
m_orderedStruct
.
firstElement
();
long
currTime
=
System
.
currentTimeMillis
();
long
creationTime
=
((
Long
)
v
.
elementAt
(
1
)
)
.
longValue
();
long
creationTime
=
v
.
elementAt
(
1
).
longValue
();
long
timeout
=
creationTime
+
m_timeToLive
-
currTime
;
if
(
timeout
>
0
)
{
m_timer
.
start
(
timeout
);
...
...
@@ -690,12 +690,12 @@ public class LDAPCache implements Serializable {
*/
private
void
init
(
long
ttl
,
long
size
)
{
m_cache
=
new
Hashtable
();
m_cache
=
new
Hashtable
<>
();
m_timeToLive
=
ttl
*
1000
;
m_maxSize
=
size
;
m_remainingSize
=
size
;
m_dns
=
null
;
m_orderedStruct
=
new
Vector
();
m_orderedStruct
=
new
Vector
<>
();
}
/**
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPCheckComm.java
View file @
9af4491a
...
...
@@ -64,7 +64,7 @@ class LDAPCheckComm {
}
else
if
(
sec
.
toString
().
startsWith
(
"netscape.security.AppletSecurity"
))
{
/* Running as applet. Is PrivilegeManager around? */
try
{
Class
c
=
Class
.
forName
(
classPackage
);
Class
<?>
c
=
Class
.
forName
(
classPackage
);
java
.
lang
.
reflect
.
Method
[]
m
=
c
.
getMethods
();
for
(
int
i
=
0
;
i
<
m
.
length
;
i
++
)
{
if
(
m
[
i
].
getName
().
equals
(
name
)
)
{
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPCompareAttrNames.java
View file @
9af4491a
...
...
@@ -38,8 +38,10 @@
package
org.ietf.ldap
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.text.*
;
import
java.text.Collator
;
import
java.util.Comparator
;
import
java.util.Iterator
;
import
java.util.Locale
;
/**
* Compares LDAP entries based on one or more attribute values.
...
...
@@ -54,8 +56,8 @@ import java.text.*;
* @see LDAPSearchResults#sort
*/
public
class
LDAPCompareAttrNames
implements
Comparator
,
Serializable
{
public
class
LDAPCompareAttrNames
<
E
>
implements
Comparator
<
E
>
,
Serializable
{
static
final
long
serialVersionUID
=
-
2567450425231175944L
;
private
String
_attrs
[];
...
...
@@ -283,9 +285,9 @@ public class LDAPCompareAttrNames
*/
int
attrGreater
(
LDAPEntry
entry1
,
LDAPEntry
entry2
,
int
attrPos
)
{
Iterator
attrSet1
=
Iterator
<
LDAPAttribute
>
attrSet1
=
entry1
.
getAttributeSet
().
iterator
();
Iterator
attrSet2
=
Iterator
<
LDAPAttribute
>
attrSet2
=
entry2
.
getAttributeSet
().
iterator
();
String
value1
=
null
;
...
...
@@ -294,20 +296,20 @@ public class LDAPCompareAttrNames
boolean
ascending
=
_ascending
[
attrPos
];
while
(
attrSet2
.
hasNext
()
)
{
LDAPAttribute
currAttr
=
(
LDAPAttribute
)(
attrSet2
.
next
()
)
;
LDAPAttribute
currAttr
=
attrSet2
.
next
();
if
(
!
attrName
.
equalsIgnoreCase
(
currAttr
.
getName
())
)
{
continue
;
}
value2
=
(
String
)(
currAttr
.
getStringValues
().
nextElement
()
)
;
value2
=
currAttr
.
getStringValues
().
nextElement
();
break
;
}
while
(
attrSet1
.
hasNext
()
)
{
LDAPAttribute
currAttr
=
(
LDAPAttribute
)(
attrSet1
.
next
()
)
;
LDAPAttribute
currAttr
=
attrSet1
.
next
();
if
(
!
attrName
.
equalsIgnoreCase
(
currAttr
.
getName
())
)
{
continue
;
}
value1
=
(
String
)(
currAttr
.
getStringValues
().
nextElement
()
)
;
value1
=
currAttr
.
getStringValues
().
nextElement
();
break
;
}
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPConnThread.java
View file @
9af4491a
...
...
@@ -37,14 +37,24 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.
util.*
;
import
org.ietf.ldap.client.*
;
import
org.ietf.ldap.client.opers.*
;
import
org.ietf.ldap.ber.s
tream
.*
;
import
org.ietf.ldap.util.*
;
import
java.io.
*
;
import
java.net.
*
;
import
java.
io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.IOException
;
import
java.io.InputS
tream
;
import
java.io.OutputStream
;
import
java.io.
PrintWriter
;
import
java.net.
Socket
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Enumeration
;
import
java.util.Hashtable
;
import
java.util.Vector
;
import
org.ietf.ldap.ber.stream.BERElement
;
import
org.ietf.ldap.client.JDAPBERTagDecoder
;
import
org.ietf.ldap.client.opers.JDAPAbandonRequest
;
import
org.ietf.ldap.client.opers.JDAPProtocolOp
;
import
org.ietf.ldap.client.opers.JDAPUnbindRequest
;
/**
* Multiple LDAPConnection clones can share a single physical connection,
...
...
@@ -79,9 +89,9 @@ class LDAPConnThread extends Thread {
transient
private
static
int
_highMsgId
;
transient
private
InputStream
_serverInput
;
transient
private
OutputStream
_serverOutput
;
transient
private
Hashtable
_requests
;
transient
private
Hashtable
_messages
=
null
;
transient
private
Vector
_registered
;
transient
private
Hashtable
<
Integer
,
LDAPMessageQueue
>
_requests
;
transient
private
Hashtable
<
Integer
,
Vector
<
Object
>>
_messages
=
null
;
transient
private
Vector
<
LDAPConnection
>
_registered
;
transient
private
boolean
_disconnected
=
false
;
transient
private
LDAPCache
_cache
=
null
;
transient
private
boolean
_doRun
=
true
;
...
...
@@ -112,8 +122,8 @@ class LDAPConnThread extends Thread {
throws
LDAPException
{
super
(
"LDAPConnThread "
+
connMgr
.
getHost
()
+
":"
+
connMgr
.
getPort
()
);
_requests
=
new
Hashtable
();
_registered
=
new
Vector
();
_requests
=
new
Hashtable
<>
();
_registered
=
new
Vector
<>
();
_connMgr
=
connMgr
;
_socket
=
connMgr
.
getSocket
();
setCache
(
cache
);
...
...
@@ -207,7 +217,7 @@ class LDAPConnThread extends Thread {
*/
synchronized
void
setCache
(
LDAPCache
cache
)
{
_cache
=
cache
;
_messages
=
(
_cache
!=
null
)
?
new
Hashtable
()
:
null
;
_messages
=
(
_cache
!=
null
)
?
new
Hashtable
<>
()
:
null
;
}
/**
...
...
@@ -366,7 +376,7 @@ class LDAPConnThread extends Thread {
* Cancel all outstanding requests
*/
if
(
_requests
!=
null
)
{
Enumeration
requests
=
_requests
.
elements
();
Enumeration
<
LDAPMessageQueue
>
requests
=
_requests
.
elements
();
while
(
requests
.
hasMoreElements
()
)
{
LDAPMessageQueueImpl
queue
=
(
LDAPMessageQueueImpl
)
requests
.
nextElement
();
...
...
@@ -383,12 +393,12 @@ class LDAPConnThread extends Thread {
*/
if
(
_registered
!=
null
)
{
Vector
registerCopy
=
(
Vector
)
_registered
.
clone
();
Vector
<
LDAPConnection
>
registerCopy
=
(
Vector
<
LDAPConnection
>
)
_registered
.
clone
();
Enumeration
cancelled
=
registerCopy
.
elements
();
Enumeration
<
LDAPConnection
>
cancelled
=
registerCopy
.
elements
();
while
(
cancelled
.
hasMoreElements
()
)
{
LDAPConnection
c
=
(
LDAPConnection
)
cancelled
.
nextElement
();
LDAPConnection
c
=
cancelled
.
nextElement
();
c
.
deregisterConnection
();
}
}
...
...
@@ -411,9 +421,9 @@ class LDAPConnThread extends Thread {
return
;
}
Enumeration
queues
=
_requests
.
elements
();
Enumeration
<
LDAPMessageQueue
>
queues
=
_requests
.
elements
();
while
(
queues
.
hasMoreElements
()
)
{
LDAPMessageQueue
l
=
(
LDAPMessageQueue
)
queues
.
nextElement
();
LDAPMessageQueue
l
=
queues
.
nextElement
();
// If there are any threads waiting for a regular response
// message, we have to go read the next incoming message
...
...
@@ -582,7 +592,7 @@ class LDAPConnThread extends Thread {
LDAPMessage
msg
,
int
size
)
{
Integer
messageID
=
new
Integer
(
msg
.
getMessageID
()
);
Long
key
=
l
.
getKey
();
Vector
v
=
null
;
Vector
<
Object
>
v
=
null
;
if
(
(
_cache
==
null
)
||
(
key
==
null
)
)
{
return
;
...
...
@@ -592,9 +602,9 @@ class LDAPConnThread extends Thread {
// Get the vector containing the LDAPMessages for the specified
// messageID
v
=
(
Vector
)
_messages
.
get
(
messageID
);
v
=
_messages
.
get
(
messageID
);
if
(
v
==
null
)
{
_messages
.
put
(
messageID
,
v
=
new
Vector
()
);
_messages
.
put
(
messageID
,
v
=
new
Vector
<>
()
);
v
.
addElement
(
new
Long
(
0
)
);
}
...
...
@@ -629,9 +639,9 @@ class LDAPConnThread extends Thread {
// If a search reference is received disable caching of
// this search request
v
=
(
Vector
)
_messages
.
get
(
messageID
);
v
=
_messages
.
get
(
messageID
);
if
(
v
==
null
)
{
_messages
.
put
(
messageID
,
v
=
new
Vector
()
);
_messages
.
put
(
messageID
,
v
=
new
Vector
<>
()
);
}
else
{
v
.
removeAllElements
();
...
...
@@ -645,13 +655,13 @@ class LDAPConnThread extends Thread {
// is not disabled due to the entry size or referrals
boolean
fail
=
((
LDAPResponse
)
msg
).
getResultCode
()
>
0
;
v
=
(
Vector
)
_messages
.
remove
(
messageID
);
v
=
_messages
.
remove
(
messageID
);
if
(
!
fail
)
{
// If v is null, meaning there are no search results from the
// server
if
(
v
==
null
)
{
v
=
new
Vector
();
v
=
new
Vector
<>
();
v
.
addElement
(
new
Long
(
0
));
}
...
...
@@ -701,7 +711,7 @@ class LDAPConnThread extends Thread {
LDAPException
.
OTHER
)
);
return
null
;
}
return
(
LDAPMessageQueue
)
_requests
.
put
(
new
Integer
(
id
),
toNotify
);
return
_requests
.
put
(
new
Integer
(
id
),
toNotify
);
}
/**
...
...
@@ -719,7 +729,7 @@ class LDAPConnThread extends Thread {
try
{
// notify each queue that the server is down.
Enumeration
requests
=
_requests
.
elements
();
Enumeration
<
LDAPMessageQueue
>
requests
=
_requests
.
elements
();
while
(
requests
.
hasMoreElements
()
)
{
LDAPMessageQueueImpl
queue
=
(
LDAPMessageQueueImpl
)
requests
.
nextElement
();
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPConnection.java
View file @
9af4491a
This diff is collapsed.
Click to expand it.
java-sdk/ietfldap/org/ietf/ldap/LDAPConstraints.java
View file @
9af4491a
...
...
@@ -58,7 +58,7 @@ public class LDAPConstraints implements Cloneable, Serializable {
private
boolean
referrals
=
false
;
private
int
_time_limit
=
0
;
private
LDAPControl
[]
_serverControls
=
null
;
private
Hashtable
_properties
=
null
;
private
Hashtable
<
String
,
Object
>
_properties
=
null
;
/**
* Constructs an <CODE>LDAPConstraints</CODE> object that specifies
...
...
@@ -261,7 +261,7 @@ public class LDAPConstraints implements Cloneable, Serializable {
*/
public
void
setProperty
(
String
name
,
Object
value
)
throws
LDAPException
{
if
(
_properties
==
null
)
{
_properties
=
new
Hashtable
();
_properties
=
new
Hashtable
<>
();
}
_properties
.
put
(
name
,
value
);
}
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPControl.java
View file @
9af4491a
...
...
@@ -37,13 +37,26 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.io.*
;
import
java.util.*
;
import
java.lang.reflect.*
;
import
org.ietf.ldap.ber.stream.*
;
import
org.ietf.ldap.client.*
;
import
org.ietf.ldap.util.*
;
import
org.ietf.ldap.controls.*
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Hashtable
;
import
org.ietf.ldap.ber.stream.BERBoolean
;
import
org.ietf.ldap.ber.stream.BERElement
;
import
org.ietf.ldap.ber.stream.BEROctetString
;
import
org.ietf.ldap.ber.stream.BERSequence
;
import
org.ietf.ldap.ber.stream.BERTag
;
import
org.ietf.ldap.client.JDAPBERTagDecoder
;
import
org.ietf.ldap.controls.LDAPEntryChangeControl
;
import
org.ietf.ldap.controls.LDAPPasswordExpiredControl
;
import
org.ietf.ldap.controls.LDAPPasswordExpiringControl
;
import
org.ietf.ldap.controls.LDAPSortControl
;
import
org.ietf.ldap.controls.LDAPVirtualListResponse
;
import
org.ietf.ldap.util.LDIF
;
/**
* Represents arbitrary control data that can be used with a
...
...
@@ -262,7 +275,7 @@ public class LDAPControl implements Cloneable, Serializable {
* implement the <CODE>LDAPControl(String oid, boolean critical, byte[] value)
* </CODE> constructor.
*/
public
static
void
register
(
String
oid
,
Class
controlClass
)
public
static
void
register
(
String
oid
,
Class
<?>
controlClass
)
throws
LDAPException
{
if
(
controlClass
==
null
)
{
...
...
@@ -270,7 +283,7 @@ public class LDAPControl implements Cloneable, Serializable {
}
// 1. make sure controlClass is a subclass of LDAPControl
Class
superClass
=
controlClass
;
Class
<?>
superClass
=
controlClass
;
while
(
superClass
!=
LDAPControl
.
class
&&
superClass
!=
null
)
{
superClass
=
superClass
.
getSuperclass
();
}
...
...
@@ -280,7 +293,7 @@ public class LDAPControl implements Cloneable, Serializable {
"LDAPControl"
,
LDAPException
.
PARAM_ERROR
);
// 2. make sure controlClass has the proper constructor
Class
[]
cparams
=
{
String
.
class
,
boolean
.
class
,
byte
[].
class
};
Class
<?>
[]
cparams
=
{
String
.
class
,
boolean
.
class
,
byte
[].
class
};
try
{
controlClass
.
getConstructor
(
cparams
);
}
catch
(
NoSuchMethodException
e
)
{
...
...
@@ -291,7 +304,7 @@ public class LDAPControl implements Cloneable, Serializable {
// 3. check if the hash table exists
if
(
_controlClassHash
==
null
)
{
_controlClassHash
=
new
Hashtable
();
_controlClassHash
=
new
Hashtable
<>
();
}
// 4. add the controlClass
...
...
@@ -306,12 +319,12 @@ public class LDAPControl implements Cloneable, Serializable {
* @see org.ietf.ldap.LDAPControl#register
*
*/
protected
static
Class
lookupControlClass
(
String
oid
)
{
protected
static
Class
<?>
lookupControlClass
(
String
oid
)
{
if
(
_controlClassHash
==
null
)
{
return
null
;
}
return
(
Class
)
_controlClassHash
.
get
(
oid
);
return
_controlClassHash
.
get
(
oid
);
}
/**
...
...
@@ -330,14 +343,14 @@ public class LDAPControl implements Cloneable, Serializable {
boolean
critical
,
byte
[]
value
)
{
Class
controlClass
=
lookupControlClass
(
oid
);
Class
<?>
controlClass
=
lookupControlClass
(
oid
);
if
(
controlClass
==
null
)
{
return
new
LDAPControl
(
oid
,
critical
,
value
);
}
Class
[]
cparams
=
{
String
.
class
,
boolean
.
class
,
byte
[].
class
};
Constructor
creator
=
null
;
Class
<?>
[]
cparams
=
{
String
.
class
,
boolean
.
class
,
byte
[].
class
};
Constructor
<?>
creator
=
null
;
try
{
creator
=
controlClass
.
getConstructor
(
cparams
);
}
catch
(
NoSuchMethodException
e
)
{
...
...
@@ -502,7 +515,7 @@ public class LDAPControl implements Cloneable, Serializable {
private
String
_oid
;
protected
boolean
_critical
=
false
;
protected
byte
[]
_value
=
null
;
static
private
Hashtable
_controlClassHash
=
null
;
static
private
Hashtable
<
String
,
Class
<?>>
_controlClassHash
=
null
;
static
{
try
{
LDAPControl
.
register
(
LDAPPasswordExpiringControl
.
EXPIRING
,
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPDITContentRuleSchema.java
View file @
9af4491a
...
...
@@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.util.
*
;
import
java.util.
Vector
;
/**
* The definition of a DIT content rule in the schema.
...
...
@@ -201,33 +201,33 @@ public class LDAPDITContentRuleSchema extends LDAPSchemaElement {
Object
o
=
properties
.
get
(
MAY
);
if
(
o
!=
null
)
{
if
(
o
instanceof
Vector
)
{
may
=
(
Vector
)
o
;
may
=
(
Vector
<
String
>
)
o
;
}
else
{
may
.
addElement
(
o
);
may
.
addElement
(
(
String
)
o
);
}
}
o
=
properties
.
get
(
MUST
);
if
(
o
!=
null
)
{
if
(
o
instanceof
Vector
)
{
must
=
(
Vector
)
o
;
must
=
(
Vector
<
String
>
)
o
;
}
else
{
must
.
addElement
(
o
);
must
.
addElement
(
(
String
)
o
);
}
}
o
=
properties
.
get
(
NOT
);
if
(
o
!=
null
)
{
if
(
o
instanceof
Vector
)
{
not
=
(
Vector
)
o
;
not
=
(
Vector
<
String
>
)
o
;
}
else
{
not
.
addElement
(
o
);
not
.
addElement
(
(
String
)
o
);
}
}
o
=
properties
.
get
(
AUX
);
if
(
o
!=
null
)
{
if
(
o
instanceof
Vector
)
{
aux
=
(
Vector
)
o
;
aux
=
(
Vector
<
String
>
)
o
;
}
else
{
aux
.
addElement
(
o
);
aux
.
addElement
(
(
String
)
o
);
}
}
}
...
...
@@ -330,10 +330,10 @@ public class LDAPDITContentRuleSchema extends LDAPSchemaElement {
* @param vals values for list
* @return a String with a list of values.
*/
protected
String
vectorToList
(
Vector
vals
)
{
protected
String
vectorToList
(
Vector
<
String
>
vals
)
{
String
val
=
"( "
;
for
(
int
i
=
0
;
i
<
vals
.
size
();
i
++
)
{
val
+=
(
String
)
vals
.
elementAt
(
i
)
+
' '
;
val
+=
vals
.
elementAt
(
i
)
+
' '
;
if
(
i
<
(
vals
.
size
()
-
1
)
)
{
val
+=
"$ "
;
}
...
...
@@ -372,8 +372,8 @@ public class LDAPDITContentRuleSchema extends LDAPSchemaElement {
NOT
};
private
Vector
must
=
new
Vector
();
private
Vector
may
=
new
Vector
();
private
Vector
aux
=
new
Vector
();
private
Vector
not
=
new
Vector
();
private
Vector
<
String
>
must
=
new
Vector
<>
();
private
Vector
<
String
>
may
=
new
Vector
<>
();
private
Vector
<
String
>
aux
=
new
Vector
<>
();
private
Vector
<
String
>
not
=
new
Vector
<>
();
}
java-sdk/ietfldap/org/ietf/ldap/LDAPException.java
View file @
9af4491a
...
...
@@ -37,10 +37,11 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.util.*
;
import
org.ietf.ldap.client.*
;
import
org.ietf.ldap.client.opers.*
;
import
java.io.*
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.util.Hashtable
;
import
java.util.Locale
;
import
java.util.PropertyResourceBundle
;
/**
* Indicates that an error has occurred. An <CODE>LDAPException</CODE>
...
...
@@ -599,7 +600,7 @@ public class LDAPException extends Exception
private
String
matchedDN
=
null
;
private
Throwable
rootException
=
null
;
private
Locale
m_locale
=
Locale
.
getDefault
();
private
static
Hashtable
cacheResource
=
new
Hashtable
();
private
static
Hashtable
<
String
,
PropertyResourceBundle
>
cacheResource
=
new
Hashtable
<>
();
private
static
final
String
baseName
=
"org/ietf/ldap/errors/ErrorCodes"
;
/**
...
...
@@ -1056,7 +1057,7 @@ public class LDAPException extends Exception
try
{
String
localeStr
=
locale
.
toString
();
PropertyResourceBundle
p
=
(
PropertyResourceBundle
)
cacheResource
.
get
(
localeStr
);
cacheResource
.
get
(
localeStr
);
if
(
p
==
null
)
{
p
=
LDAPResourceBundle
.
getBundle
(
baseName
);
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPMatchingRuleSchema.java
View file @
9af4491a
...
...
@@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.util.
*
;
import
java.util.
Vector
;
/**
* The definition of a matching rule in the schema.
...
...
@@ -184,7 +184,7 @@ public class LDAPMatchingRuleSchema extends LDAPAttributeSchema {
if
(
use
!=
null
)
{
parseValue
(
use
);
}
Vector
v
=
(
Vector
)
properties
.
get
(
"APPLIES"
);
Vector
<
String
>
v
=
(
Vector
<
String
>
)
properties
.
get
(
"APPLIES"
);
if
(
v
!=
null
)
{
_attributes
=
new
String
[
v
.
size
()];
v
.
copyInto
(
_attributes
);
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPMatchingRuleUseSchema.java
View file @
9af4491a
...
...
@@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
package
org.ietf.ldap
;
import
java.util.
*
;
import
java.util.
Vector
;
/**
* The definition of a matching rule use in the schema.
...
...
@@ -154,7 +154,7 @@ public class LDAPMatchingRuleUseSchema extends LDAPAttributeSchema {
public
LDAPMatchingRuleUseSchema
(
String
use
)
{
attrName
=
"matchingruleuse"
;
parseValue
(
use
);
Vector
v
=
(
Vector
)
properties
.
get
(
"APPLIES"
);
Vector
<
String
>
v
=
(
Vector
<
String
>
)
properties
.
get
(
"APPLIES"
);
if
(
v
!=
null
)
{
_attributes
=
new
String
[
v
.
size
()];
v
.
copyInto
(
_attributes
);
...
...
java-sdk/ietfldap/org/ietf/ldap/LDAPMessageQueueImpl.java
View file @
9af4491a
...
...
@@ -76,8 +76,8 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
/**
* Internal variables
*/
protected
/*
LDAPMessage
*/
ArrayList
_messageQueue
=
new
ArrayList
(
1
);
private
/*
RequestEntry
*/
ArrayList
_requestList
=
new
ArrayList
(
1
);
protected
ArrayList
<
LDAPMessage
>
_messageQueue
=
new
ArrayList
<>
(
1
);
private
ArrayList
<
RequestEntry
>
_requestList
=
new
ArrayList
<>
(
1
);
private
LDAPException
_exception
;
/* For network errors */
private
boolean
_asynchOp
;
...
...
@@ -112,7 +112,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
synchronized
public
int
[]
getMessageIDs
()
{
int
[]
ids
=
new
int
[
_requestList
.
size
()];
for
(
int
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
i
);
RequestEntry
entry
=
_requestList
.
get
(
i
);
ids
[
i
]
=
entry
.
id
;
}
return
ids
;
...
...
@@ -134,7 +134,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
}
// Dequeue the first entry
LDAPMessage
msg
=
(
LDAPMessage
)
_messageQueue
.
get
(
0
);
LDAPMessage
msg
=
_messageQueue
.
get
(
0
);
_messageQueue
.
remove
(
0
);
// Has the operation completed?
...
...
@@ -249,16 +249,16 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
synchronized
(
this
)
{
LDAPMessageQueueImpl
mq
=
(
LDAPMessageQueueImpl
)
mq2
;
synchronized
(
mq
)
{
ArrayList
queue2
=
mq
.
getAllMessages
();
ArrayList
<
LDAPMessage
>
queue2
=
mq
.
getAllMessages
();
for
(
int
i
=
0
;
i
<
queue2
.
size
();
i
++
)
{
_messageQueue
.
add
(
queue2
.
get
(
i
)
);
}
if
(
mq
.
getException
()
!=
null
)
{
_exception
=
mq
.
getException
();
}
ArrayList
list2
=
mq
.
getAllRequests
();
ArrayList
<
RequestEntry
>
list2
=
mq
.
getAllRequests
();
for
(
int
i
=
0
;
i
<
list2
.
size
();
i
++
)
{
RequestEntry
entry
=
(
RequestEntry
)
list2
.
get
(
i
);
RequestEntry
entry
=
list2
.
get
(
i
);
_requestList
.
add
(
entry
);
// Notify LDAPConnThread to redirect mq2 designated
// responses to this mq
...
...
@@ -285,7 +285,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
if
(
i
>
0
)
{
sb
.
append
(
","
);
}
sb
.
append
(
((
RequestEntry
)
_requestList
.
get
(
i
)
)
.
id
);
sb
.
append
(
_requestList
.
get
(
i
).
id
);
}
sb
.
append
(
"} messageCount="
+
_messageQueue
.
size
()
);
...
...
@@ -304,7 +304,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
synchronized
LDAPMessage
getMessageForID
(
int
msgid
,
boolean
remove
)
{
LDAPMessage
msg
=
null
;
for
(
int
i
=
0
;
i
<
_messageQueue
.
size
();
i
++
)
{
msg
=
(
LDAPMessage
)
_messageQueue
.
get
(
i
);
msg
=
_messageQueue
.
get
(
i
);
if
(
msg
.
getMessageID
()
==
msgid
)
{
if
(
remove
)
{
_messageQueue
.
remove
(
i
);
...
...
@@ -344,7 +344,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
// Search for an instance of LDAPResponse
for
(
int
i
=
_messageQueue
.
size
()-
1
;
i
>=
0
;
i
--
)
{
Object
msg
=
_messageQueue
.
get
(
i
);
LDAPMessage
msg
=
_messageQueue
.
get
(
i
);
if
(
msg
instanceof
LDAPResponse
)
{
// Dequeue the entry and return
...
...
@@ -377,7 +377,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
long
minTimeToComplete
=
Long
.
MAX_VALUE
;
long
now
=
System
.
currentTimeMillis
();
for
(
int
i
=
0
;
i
<
_requestList
.
size
();
i
++
)
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
i
);
RequestEntry
entry
=
_requestList
.
get
(
i
);
// time limit exceeded ?
if
(
entry
.
timeToComplete
<=
now
)
{
...
...
@@ -438,9 +438,9 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
*
* @return vector of messages
*/
synchronized
ArrayList
getAllMessages
()
{
ArrayList
result
=
_messageQueue
;
_messageQueue
=
new
ArrayList
(
1
);
synchronized
ArrayList
<
LDAPMessage
>
getAllMessages
()
{
ArrayList
<
LDAPMessage
>
result
=
_messageQueue
;
_messageQueue
=
new
ArrayList
<>
(
1
);
return
result
;
}
...
...
@@ -450,9 +450,9 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
*
* @return vector of requests
*/
synchronized
ArrayList
getAllRequests
()
{
ArrayList
result
=
_requestList
;
_requestList
=
new
ArrayList
(
1
);
synchronized
ArrayList
<
RequestEntry
>
getAllRequests
()
{
ArrayList
<
RequestEntry
>
result
=
_requestList
;
_requestList
=
new
ArrayList
<>
(
1
);
return
result
;
}
...
...
@@ -522,7 +522,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
private
int
removeAllMessages
(
int
id
)
{
int
removeCount
=
0
;
for
(
int
i
=
(
_messageQueue
.
size
()-
1
);
i
>=
0
;
i
--
)
{
LDAPMessage
msg
=
(
LDAPMessage
)
_messageQueue
.
get
(
i
);
LDAPMessage
msg
=
_messageQueue
.
get
(
i
);
if
(
msg
.
getMessageID
()
==
id
)
{
_messageQueue
.
remove
(
i
);
removeCount
++;
...
...
@@ -581,7 +581,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
*/
synchronized
RequestEntry
getRequestEntry
(
int
id
)
{
for
(
int
i
=
0
;
i
<
_requestList
.
size
();
i
++
)
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
i
);
RequestEntry
entry
=
_requestList
.
get
(
i
);
if
(
id
==
entry
.
id
)
{
return
entry
;
}
...
...
@@ -600,8 +600,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
if
(
reqCnt
==
0
)
{
return
-
1
;
}
else
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
reqCnt
-
1
);
RequestEntry
entry
=
_requestList
.
get
(
reqCnt
-
1
);
return
entry
.
id
;
}
}
...
...
@@ -644,7 +643,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
*/
synchronized
boolean
removeRequest
(
int
id
)
{
for
(
int
i
=
0
;
i
<
_requestList
.
size
();
i
++
)
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
i
);
RequestEntry
entry
=
_requestList
.
get
(
i
);
if
(
id
==
entry
.
id
)
{
_requestList
.
remove
(
i
);
removeAllMessages
(
id
);
...
...
@@ -664,7 +663,7 @@ class LDAPMessageQueueImpl implements Serializable, LDAPMessageQueue {
synchronized
int
removeAllRequests
(
LDAPConnThread
connThread
)
{
int
removeCount
=
0
;
for
(
int
i
=
(
_requestList
.
size
()-
1
);
i
>=
0
;
i
--
)
{
RequestEntry
entry
=
(
RequestEntry
)
_requestList
.
get
(
i
);
RequestEntry
entry
=
_requestList
.
get
(
i
);
if
(
connThread
==
entry
.
connThread
)
{
_requestList
.
remove
(
i
);
removeCount
++;
...
...
Prev
1
2
3
4
5
6
Next