src/share/classes/sun/management/DiagnosticCommandImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2013, 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 82,106 ****
this.info = info;
this.permission = null;
Exception cause = null;
if (info.getPermissionClass() != null) {
try {
! Class c = Class.forName(info.getPermissionClass());
if (info.getPermissionAction() == null) {
try {
! Constructor constructor = c.getConstructor(String.class);
permission = (Permission) constructor.newInstance(info.getPermissionName());
} catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException ex) {
cause = ex;
}
}
if (permission == null) {
try {
! Constructor constructor = c.getConstructor(String.class, String.class);
permission = (Permission) constructor.newInstance(
info.getPermissionName(),
info.getPermissionAction());
} catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException
--- 82,106 ----
this.info = info;
this.permission = null;
Exception cause = null;
if (info.getPermissionClass() != null) {
try {
! Class<?> c = Class.forName(info.getPermissionClass());
if (info.getPermissionAction() == null) {
try {
! Constructor<?> constructor = c.getConstructor(String.class);
permission = (Permission) constructor.newInstance(info.getPermissionName());
} catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException ex) {
cause = ex;
}
}
if (permission == null) {
try {
! Constructor<?> constructor = c.getConstructor(String.class, String.class);
permission = (Permission) constructor.newInstance(
info.getPermissionName(),
info.getPermissionAction());
} catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException
*** 156,166 ****
@Override
public MBeanInfo getMBeanInfo() {
SortedSet<MBeanOperationInfo> operations = new TreeSet<>(new OperationInfoComparator());
Map<String, Wrapper> wrappersmap;
if (!isSupported) {
! wrappersmap = (Map<String, Wrapper>) Collections.EMPTY_MAP;
} else {
try {
String[] command = getDiagnosticCommands();
DiagnosticCommandInfo[] info = getDiagnosticCommandInfo(command);
MBeanParameterInfo stringArgInfo[] = new MBeanParameterInfo[]{
--- 156,166 ----
@Override
public MBeanInfo getMBeanInfo() {
SortedSet<MBeanOperationInfo> operations = new TreeSet<>(new OperationInfoComparator());
Map<String, Wrapper> wrappersmap;
if (!isSupported) {
! wrappersmap = Collections.emptyMap();
} else {
try {
String[] command = getDiagnosticCommands();
DiagnosticCommandInfo[] info = getDiagnosticCommandInfo(command);
MBeanParameterInfo stringArgInfo[] = new MBeanParameterInfo[]{
*** 187,197 ****
// wrappers fails, the diagnostic command is just ignored
// and won't appear in the DynamicMBean
}
}
} catch (IllegalArgumentException | UnsupportedOperationException e) {
! wrappersmap = (Map<String, Wrapper>) Collections.EMPTY_MAP;
}
}
wrappers = Collections.unmodifiableMap(wrappersmap);
HashMap<String, Object> map = new HashMap<>();
map.put("immutableInfo", "false");
--- 187,197 ----
// wrappers fails, the diagnostic command is just ignored
// and won't appear in the DynamicMBean
}
}
} catch (IllegalArgumentException | UnsupportedOperationException e) {
! wrappersmap = Collections.emptyMap();
}
}
wrappers = Collections.unmodifiableMap(wrappersmap);
HashMap<String, Object> map = new HashMap<>();
map.put("immutableInfo", "false");