Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Norbert Klasen
JLDAP
Commits
5158633a
Commit
5158633a
authored
Dec 12, 2003
by
Sunil Kumar
Browse files
fix empty attribute value defect
parent
dcd2dd22
Changes
1
Hide whitespace changes
Inline
Side-by-side
com/novell/ldap/util/LDIFReader.java
View file @
5158633a
...
...
@@ -509,30 +509,37 @@ public class LDIFReader implements LDAPReader {
// get attribute name
attrName
=
currentField
.
substring
(
0
,
index
);
// if attrName not existing in attrSet, add it
if
(
attrSet
.
getAttribute
(
attrName
)
==
null
)
{
// add it to attrSet with no value
attrSet
.
add
(
new
LDAPAttribute
(
attrName
));
}
if
(
currentField
.
length
()
>
index
+
1
)
{
// add attr value to attr
if
(
currentField
.
charAt
(
index
+
1
)==
':'
)
{
// base64 encoded attribute value
attrSet
.
getAttribute
(
attrName
).
addBase64Value
(
currentField
.
if
(
currentField
.
charAt
(
index
+
1
)==
':'
)
{
// base64 encoded attribute value
attrSet
.
getAttribute
(
attrName
).
addBase64Value
(
currentField
.
substring
(
index
+
2
));
}
else
if
(
currentField
.
charAt
(
index
+
1
)==
'<'
){
// file URL attribute value
attrSet
.
getAttribute
(
attrName
).
addBase64Value
(
currentField
.
}
else
if
(
currentField
.
charAt
(
index
+
1
)==
'<'
){
// file URL attribute value
attrSet
.
getAttribute
(
attrName
).
addBase64Value
(
currentField
.
substring
(
index
+
2
));
}
else
{
// string value
String
vals
=
currentField
.
substring
(
index
+
1
).
trim
();
attrSet
.
getAttribute
(
attrName
).
addValue
(
vals
);
// attrSet.getAttribute(attrName).addValue(currentField.
// substring(index+1));
}
}
else
{
// string value
String
vals
=
currentField
.
substring
(
index
+
1
).
trim
(
);
else
if
(
currentField
.
length
()
==
index
+
1
)
{
String
vals
=
new
String
(
""
);
attrSet
.
getAttribute
(
attrName
).
addValue
(
vals
);
// attrSet.getAttribute(attrName).addValue(currentField.
// substring(index+1));
}
}
...
...
@@ -855,9 +862,9 @@ public class LDIFReader implements LDAPReader {
// for case like attr: <value>
boolean
nonfile
=
false
;
String
fredir
=
line
.
substring
(
c
);
if
(
fredir
.
charAt
(
0
)
!=
'<'
){
if
(
fredir
.
length
()>
0
&&
fredir
.
charAt
(
0
)
!=
'<'
){
String
cstr
=
fredir
.
trim
();
if
(
cstr
.
charAt
(
0
)
==
'<'
){
if
(
cstr
.
length
()>
0
&&
cstr
.
charAt
(
0
)
==
'<'
){
nonfile
=
true
;
}
}
...
...
@@ -885,6 +892,14 @@ public class LDIFReader implements LDAPReader {
// return the trimed field
return
newBuf
;
}
else
if
(
line
.
length
()
==
c
){
StringBuffer
newBuf
=
new
StringBuffer
();
line
.
getChars
(
c
,
lastChar
+
1
,
newChars
,
charIndex
);
charIndex
+=
lastChar
-
c
+
1
;
newBuf
.
append
(
newChars
,
0
,
charIndex
);
return
newBuf
;
}
else
{
// there is no value specified
throw
new
LDAPLocalException
(
"com.novell.ldap.ldif_dsml."
+
"LDIFReader: a field contains no value after ':'. the "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment