From c0b2c2b0e68ab6e7b91cbc489eb0c095193ff3aa Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Mon, 22 Jun 2015 13:30:21 -0700 Subject: [PATCH] 8129499: Structure of java/rmi/activation/rmidViaInheritedChannel tests masks exception Check for rmid == null before dereferencing the variable. Reviewed-by: rriggs, chegar --- .../InheritedChannelNotServerSocket.java | 6 ++++-- .../rmidViaInheritedChannel/RmidViaInheritedChannel.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java index 837c5979da4..a6eae1d6e5e 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -126,7 +126,9 @@ public class InheritedChannelNotServerSocket { if (obj != null) { UnicastRemoteObject.unexportObject(obj, true); } - rmid.cleanup(); + if (rmid != null) { + rmid.cleanup(); + } } } diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java index c570b6c8adc..e34af8c88cc 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -125,7 +125,9 @@ public class RmidViaInheritedChannel implements Callback { if (obj != null) { UnicastRemoteObject.unexportObject(obj, true); } - rmid.cleanup(); + if (rmid != null) { + rmid.cleanup(); + } } }