8011157: Improve CORBA portablility

Fix also reviewed by Alexander Fomin

Reviewed-by: alanb, coffeys, skoivu
This commit is contained in:
Mark Sheppard 2013-06-14 15:49:54 +01:00
parent 73c5ae165c
commit ae96f935a2
3 changed files with 21 additions and 7 deletions

View File

@ -130,11 +130,13 @@ $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class
$(RMIC) -classpath "$(CLASSDESTDIR)" \ $(RMIC) -classpath "$(CLASSDESTDIR)" \
-d $(CLASSDESTDIR) \ -d $(CLASSDESTDIR) \
-iiop -v1.2 \ -iiop -v1.2 \
-emitPermissionCheck \
$(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%)) $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%))
$(RMIC) $(HOTSPOT_INTERPRETER_FLAG) -classpath "$(CLASSDESTDIR)" \ $(RMIC) $(HOTSPOT_INTERPRETER_FLAG) -classpath "$(CLASSDESTDIR)" \
-d $(CLASSDESTDIR) \ -d $(CLASSDESTDIR) \
-iiop -v1.2 \ -iiop -v1.2 \
-standardPackage \ -standardPackage \
-emitPermissionCheck \
$(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%)) $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%))
@$(java-vm-cleanup) @$(java-vm-cleanup)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -298,11 +298,15 @@ public class RequiredModelMBean
RequiredModelMBean.class.getName(), RequiredModelMBean.class.getName(),
"setModelMBeanInfo(ModelMBeanInfo)", "setModelMBeanInfo(ModelMBeanInfo)",
"Setting ModelMBeanInfo to " + printModelMBeanInfo(mbi)); "Setting ModelMBeanInfo to " + printModelMBeanInfo(mbi));
int noOfNotifications = 0;
if (mbi.getNotifications() != null) {
noOfNotifications = mbi.getNotifications().length;
}
MODELMBEAN_LOGGER.logp(Level.FINER, MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(), RequiredModelMBean.class.getName(),
"setModelMBeanInfo(ModelMBeanInfo)", "setModelMBeanInfo(ModelMBeanInfo)",
"ModelMBeanInfo notifications has " + "ModelMBeanInfo notifications has " +
(mbi.getNotifications()).length + " elements"); noOfNotifications + " elements");
} }
modelMBeanInfo = (ModelMBeanInfo)mbi.clone(); modelMBeanInfo = (ModelMBeanInfo)mbi.clone();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,6 +61,7 @@ import java.rmi.server.RemoteRef;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -128,7 +129,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
Map<String, ?> environment) { Map<String, ?> environment) {
if (rmiServer == null && address == null) throw new if (rmiServer == null && address == null) throw new
IllegalArgumentException("rmiServer and jmxServiceURL both null"); IllegalArgumentException("rmiServer and jmxServiceURL both null");
initTransients(); initTransients();
this.rmiServer = rmiServer; this.rmiServer = rmiServer;
@ -2370,13 +2370,21 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
} }
} }
private static RMIConnection shadowIiopStub(Object stub) private static RMIConnection shadowIiopStub(Object stub)
throws InstantiationException, IllegalAccessException { throws InstantiationException, IllegalAccessException {
Object proxyStub = proxyStubClass.newInstance(); Object proxyStub = null;
try {
proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
return proxyStubClass.newInstance();
}
});
} catch (PrivilegedActionException e) {
throw new InternalError();
}
IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub)); IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub));
return (RMIConnection) proxyStub; return (RMIConnection) proxyStub;
} }
private static RMIConnection getConnection(RMIServer server, private static RMIConnection getConnection(RMIServer server,
Object credentials, Object credentials,
boolean checkStub) boolean checkStub)