Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8232622: Technical debt in BadAttributeValueExpException
Reviewed-by: dfuchs, sspitsyn
  • Loading branch information
Roger Riggs committed Feb 20, 2020
1 parent b4ffe4d commit 2d93a28447de4fa692a6282a0ba1e7d99c7c068b
Showing with 4 additions and 15 deletions.
  1. +4 −15 src/java.management/share/classes/javax/management/BadAttributeValueExpException.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@@ -48,7 +48,7 @@ public class BadAttributeValueExpException extends Exception {
* for example, the string value can be the return of {@code attribute.toString()}
*/
@SuppressWarnings("serial") // See handling in constructor and readObject
private Object val;
private String val;

/**
* Constructs a BadAttributeValueExpException using the specified Object to
@@ -72,19 +72,8 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
ObjectInputStream.GetField gf = ois.readFields();
Object valObj = gf.get("val", null);

if (valObj == null) {
val = null;
} else if (valObj instanceof String) {
val= valObj;
} else if (System.getSecurityManager() == null
|| valObj instanceof Long
|| valObj instanceof Integer
|| valObj instanceof Float
|| valObj instanceof Double
|| valObj instanceof Byte
|| valObj instanceof Short
|| valObj instanceof Boolean) {
val = valObj.toString();
if (valObj instanceof String || valObj == null) {
val = (String)valObj;
} else { // the serialized object is from a version without JDK-8019292 fix
val = System.identityHashCode(valObj) + "@" + valObj.getClass().getName();
}

0 comments on commit 2d93a28

Please sign in to comment.