-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
21
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
> java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
This code is fine:
===
// we are happy if this cooLoginID/password combo can simply bind correctly
try (var ignored = new AutoCloseableInitialLdapContext(bindEnvironment, connCtls)) {
res = true;
} catch (NamingException e) {
log.warn("canBind(username: {}, usernameWithDomain: {}, password: {}) suffered exception while binding: {}", username, usernameWithDomain, password, e.toString());
res = false;
}
===
THIS code results in runtime error:
===
// we are happy if this cooLoginID/password combo can simply bind correctly
try (var _ = new AutoCloseableInitialLdapContext(bindEnvironment, connCtls)) {
res = true;
} catch (NamingException e) {
log.warn("canBind(username: {}, usernameWithDomain: {}, password: {}) suffered exception while binding: {}", username, usernameWithDomain, password, e.toString());
res = false;
}
===
ONLY change: relace 'ignored' with '_'.
In the first case, javap.exe -verbose -p -l -c .\MY.class, shows the LocalVariableTable with 'ignored'
===
LocalVariableTable:
Start Length Slot Name Signature
226 8 7 res Z
223 33 8 ignored Ltce/ad/AutoCloseableInitialLdapContext;
256 3 7 res Z
261 37 8 e Ljavax/naming/NamingException;
0 335 0 this Ltce/ad/EnergexActiveDirectoryAuthenticationManager;
0 335 1 username Ljava/lang/String;
0 335 2 usernameWithDomain Ljava/lang/String;
0 335 3 password Ljava/lang/String;
69 266 4 principal Ljava/lang/String;
90 245 5 bindEnvironment Ljava/util/Hashtable;
208 127 6 I
298 37 7 res Z
===
In teh latter case:
===
LocalVariableTable:
Start Length Slot Name Signature
226 8 7 res Z
223 33 8 Ltce/ad/AutoCloseableInitialLdapContext;
256 3 7 res Z
261 37 8 e Ljavax/naming/NamingException;
0 335 0 this Ltce/ad/EnergexActiveDirectoryAuthenticationManager;
0 335 1 username Ljava/lang/String;
0 335 2 usernameWithDomain Ljava/lang/String;
0 335 3 password Ljava/lang/String;
69 266 4 principal Ljava/lang/String;
90 245 5 bindEnvironment Ljava/util/Hashtable;
208 127 6 I
298 37 7 res Z
===
NOt sure if this is significant?
CUSTOMER SUBMITTED WORKAROUND :
don't use _ in try with resources...
> java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
This code is fine:
===
// we are happy if this cooLoginID/password combo can simply bind correctly
try (var ignored = new AutoCloseableInitialLdapContext(bindEnvironment, connCtls)) {
res = true;
} catch (NamingException e) {
log.warn("canBind(username: {}, usernameWithDomain: {}, password: {}) suffered exception while binding: {}", username, usernameWithDomain, password, e.toString());
res = false;
}
===
THIS code results in runtime error:
===
// we are happy if this cooLoginID/password combo can simply bind correctly
try (var _ = new AutoCloseableInitialLdapContext(bindEnvironment, connCtls)) {
res = true;
} catch (NamingException e) {
log.warn("canBind(username: {}, usernameWithDomain: {}, password: {}) suffered exception while binding: {}", username, usernameWithDomain, password, e.toString());
res = false;
}
===
ONLY change: relace 'ignored' with '_'.
In the first case, javap.exe -verbose -p -l -c .\MY.class, shows the LocalVariableTable with 'ignored'
===
LocalVariableTable:
Start Length Slot Name Signature
226 8 7 res Z
223 33 8 ignored Ltce/ad/AutoCloseableInitialLdapContext;
256 3 7 res Z
261 37 8 e Ljavax/naming/NamingException;
0 335 0 this Ltce/ad/EnergexActiveDirectoryAuthenticationManager;
0 335 1 username Ljava/lang/String;
0 335 2 usernameWithDomain Ljava/lang/String;
0 335 3 password Ljava/lang/String;
69 266 4 principal Ljava/lang/String;
90 245 5 bindEnvironment Ljava/util/Hashtable;
208 127 6 I
298 37 7 res Z
===
In teh latter case:
===
LocalVariableTable:
Start Length Slot Name Signature
226 8 7 res Z
223 33 8 Ltce/ad/AutoCloseableInitialLdapContext;
256 3 7 res Z
261 37 8 e Ljavax/naming/NamingException;
0 335 0 this Ltce/ad/EnergexActiveDirectoryAuthenticationManager;
0 335 1 username Ljava/lang/String;
0 335 2 usernameWithDomain Ljava/lang/String;
0 335 3 password Ljava/lang/String;
69 266 4 principal Ljava/lang/String;
90 245 5 bindEnvironment Ljava/util/Hashtable;
208 127 6 I
298 37 7 res Z
===
NOt sure if this is significant?
CUSTOMER SUBMITTED WORKAROUND :
don't use _ in try with resources...
- duplicates
-
JDK-8313323 javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class
- Resolved
-
JDK-8317002 Combination of javac flags produce broken bytecode in compiler output
- Closed