-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b06
The following code in the "Controls" section does not compile
```
// Perform update
Context ctx = ectx.createSubsubcontext("cn=newobj");
// Get response controls
Control[] respCtls = ectx.getResponseControls();
if (respCtls != null) {
// Find the one we want
for (int i = 0; i < respCtls; i++) {
if(respCtls[i] instanceof ChangeIDControl) {
ChangeIDControl cctl = (ChangeIDControl)respCtls[i];
System.out.println(cctl.getChangeID());
}
}
}```
It will give an error message similar to "Operator '<' cannot be applied to 'int', 'javax.naming.ldap.Control[]'".
This (^) isn't a direct copy from the javac error but rather an assumption based on my understanding.
We should change `for (int i = 0; i < respCtls; i++) {` to `for (int i = 0; i < respCtls.length; i++) {`
```
// Perform update
Context ctx = ectx.createSubsubcontext("cn=newobj");
// Get response controls
Control[] respCtls = ectx.getResponseControls();
if (respCtls != null) {
// Find the one we want
for (int i = 0; i < respCtls; i++) {
if(respCtls[i] instanceof ChangeIDControl) {
ChangeIDControl cctl = (ChangeIDControl)respCtls[i];
System.out.println(cctl.getChangeID());
}
}
}```
It will give an error message similar to "Operator '<' cannot be applied to 'int', 'javax.naming.ldap.Control[]'".
This (^) isn't a direct copy from the javac error but rather an assumption based on my understanding.
We should change `for (int i = 0; i < respCtls; i++) {` to `for (int i = 0; i < respCtls.length; i++) {`
- links to
-
Commit openjdk/jdk/6a472797
-
Review(master) openjdk/jdk/19529