-
Bug
-
Resolution: Fixed
-
P4
-
8u25
-
b44
-
x86_64
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085571 | emb-9 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
JDK-8087036 | 8u65 | Hannes Wallnoefer | P4 | Resolved | Fixed | b01 |
JDK-8074525 | 8u60 | Hannes Wallnoefer | P4 | Resolved | Fixed | b08 |
JDK-8138522 | emb-8u65 | Unassigned | P4 | Resolved | Fixed | b01 |
JDK-8076950 | emb-8u60 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 x64
A DESCRIPTION OF THE PROBLEM :
Nashorn returns 'null' when externally binded array is called with key concatenated from several strings
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the script above
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
array value returned
ACTUAL -
null returned whithout actually calling getMember
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Java: VarsAdapter is a simple AbstractJSObject binded to the javascript context as "vars"
public class VarsAdapter extends AbstractJSObject
{
@Override
public Object getMember(String name)
{
return name;
}
}
javascript:
var o = 6;
print( '1: price_'+o);
print( '2: '+vars['price_'+o]);
print( '3: '+vars['price_6']);
print( '4: '+vars[('price_'+o).toString()]);
output:
1: price_6
2: null
3: price_6
4: price_6
line 2 is incorrect. Debugger shows that getMember is never invoked when concatenated string is used as key.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
use .toString() after string concatenation
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 x64
A DESCRIPTION OF THE PROBLEM :
Nashorn returns 'null' when externally binded array is called with key concatenated from several strings
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the script above
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
array value returned
ACTUAL -
null returned whithout actually calling getMember
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Java: VarsAdapter is a simple AbstractJSObject binded to the javascript context as "vars"
public class VarsAdapter extends AbstractJSObject
{
@Override
public Object getMember(String name)
{
return name;
}
}
javascript:
var o = 6;
print( '1: price_'+o);
print( '2: '+vars['price_'+o]);
print( '3: '+vars['price_6']);
print( '4: '+vars[('price_'+o).toString()]);
output:
1: price_6
2: null
3: price_6
4: price_6
line 2 is incorrect. Debugger shows that getMember is never invoked when concatenated string is used as key.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
use .toString() after string concatenation
- backported by
-
JDK-8074525 Nashorn bug retrieving array property after key string concatenation
- Resolved
-
JDK-8076950 Nashorn bug retrieving array property after key string concatenation
- Resolved
-
JDK-8085571 Nashorn bug retrieving array property after key string concatenation
- Resolved
-
JDK-8087036 Nashorn bug retrieving array property after key string concatenation
- Resolved
-
JDK-8138522 Nashorn bug retrieving array property after key string concatenation
- Resolved