Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
openldap
JLDAP
Commits
51af83eb
Commit
51af83eb
authored
Jan 29, 2003
by
Steve Sonntag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo split of wrong lines, generated DSML is invalid
parent
7357a04d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
32 deletions
+6
-32
com/novell/ldap/util/DSMLWriter.java
com/novell/ldap/util/DSMLWriter.java
+6
-32
No files found.
com/novell/ldap/util/DSMLWriter.java
View file @
51af83eb
/* **************************************************************************
* $Novell: DSMLWriter.java,v 1.3
4
2003/01/2
8
2
3:52:25
$
* $Novell: DSMLWriter.java,v 1.3
3
2003/01/2
2
2
2:30:27
$
*
* Copyright (C) 2002 Novell, Inc. All Rights Reserved.
*
...
...
@@ -44,7 +44,6 @@ public class DSMLWriter implements LDAPWriter {
"<batchRequest xmlns=\"urn:oasis:names:tc:DSML:2:0:core\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
;
private
static
final
String
BATCH_RESPONSE_START
=
"<batchResponse xmlns=\"urn:oasis:names:tc:DSML:2:0:core\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
;
private
int
MAX_DOC_WIDTH
=
75
;
/**
* Initializes this writer by opening the specified file to write DSML into.
...
...
@@ -550,10 +549,6 @@ public class DSMLWriter implements LDAPWriter {
/**
* Used to write an attribute and its values.
*
* <p>If the value to be written is over MAX_DOC_WIDTH characters AND
* newLines is set to true, then the value will be wrapped</p>
*
* @param attr Attribute to be written.
*/
private
void
writeAttribute
(
LDAPAttribute
attr
)
throws
IOException
...
...
@@ -566,42 +561,22 @@ public class DSMLWriter implements LDAPWriter {
byte
bytevalues
[][]
=
attr
.
getByteValueArray
();
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++){
newLine
(
4
);
String
toWrite
;
if
(
Base64
.
isValidUTF8
(
bytevalues
[
i
],
false
)){
out
.
write
(
"<value>"
);
newLine
(
0
);
toWrite
=
value
s
[
i
]
;
out
.
write
(
values
[
i
]
);
out
.
write
(
"</
value
>"
)
;
}
else
{
// Base 64 encode this
out
.
write
(
"<value xsi:type=\"xsd:base64Binary\">"
);
newLine
(
0
);
toWrite
=
Base64
.
encode
(
byte
value
s
[
i
]
);
out
.
write
(
Base64
.
encode
(
bytevalues
[
i
])
);
out
.
write
(
"</
value
>"
);
}
int
lineLength
=
toWrite
.
length
();
//test it the value should be wrapped
if
(
(
this
.
indent
==
false
)
||
(
lineLength
<=
this
.
MAX_DOC_WIDTH
)
)
{
out
.
write
(
toWrite
);
}
else
{
//Add new lines into each attribute value
int
offset
=
0
;
while
(
(
lineLength
-
offset
)
>
this
.
MAX_DOC_WIDTH
){
out
.
write
(
toWrite
,
offset
,
this
.
MAX_DOC_WIDTH
);
newLine
(
0
);
offset
+=
this
.
MAX_DOC_WIDTH
;
}
out
.
write
(
toWrite
,
offset
,
lineLength
-
offset
);
newLine
(
4
);
}
out
.
write
(
"</value>"
);
}
newLine
(
3
);
out
.
write
(
"</attr>"
);
return
;
}
/**
* Tests the current state with a new message that is either a response or
* request. If the state is NEW_BATCH, check_state will print an
...
...
@@ -663,8 +638,7 @@ public class DSMLWriter implements LDAPWriter {
* make output more readable.
*
* <p>For efficiency, useIndent is set to false by default. The size of an
* indentation can be set using the method <tt>setIndent</tt>. This also
* will cause attributes over 76 characters to be continued on a new line.
* indentation can be set using the method <tt>setIndent</tt>.
* @param useIndent Indicates whether indentation and newlines should be
* written to make the output DSML more readable.
* @see #setIndent
...
...
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