mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-11 07:28:36 +00:00
8149740: NPEs when executing some HotSpotConstantReflectionProvider with null args
Reviewed-by: twisti, dnsimon
This commit is contained in:
parent
bf33c21af5
commit
a23b1b586f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -77,7 +77,7 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
||||
|
||||
@Override
|
||||
public Integer readArrayLength(JavaConstant array) {
|
||||
if (array.getJavaKind() != JavaKind.Object || array.isNull()) {
|
||||
if (array == null || array.getJavaKind() != JavaKind.Object || array.isNull()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -134,12 +134,12 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
||||
|
||||
@Override
|
||||
public JavaConstant readArrayElement(JavaConstant array, int index) {
|
||||
if (array.getJavaKind() != JavaKind.Object || array.isNull()) {
|
||||
if (array == null || array.getJavaKind() != JavaKind.Object || array.isNull()) {
|
||||
return null;
|
||||
}
|
||||
Object a = ((HotSpotObjectConstantImpl) array).object();
|
||||
|
||||
if (index < 0 || index >= Array.getLength(a)) {
|
||||
if (!a.getClass().isArray() || index < 0 || index >= Array.getLength(a)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
||||
|
||||
@Override
|
||||
public JavaConstant boxPrimitive(JavaConstant source) {
|
||||
if (!source.getJavaKind().isPrimitive() || !isBoxCached(source)) {
|
||||
if (source == null || !source.getJavaKind().isPrimitive() || !isBoxCached(source)) {
|
||||
return null;
|
||||
}
|
||||
return HotSpotObjectConstantImpl.forObject(source.asBoxedPrimitive());
|
||||
@ -193,7 +193,7 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
||||
|
||||
@Override
|
||||
public JavaConstant unboxPrimitive(JavaConstant source) {
|
||||
if (!source.getJavaKind().isObject()) {
|
||||
if (source == null || !source.getJavaKind().isObject()) {
|
||||
return null;
|
||||
}
|
||||
if (source.isNull()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user