|
| 1 | +/* |
| 2 | + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + */ |
| 23 | + |
| 24 | +import java.util.ArrayList; |
| 25 | +import javax.management.AttributeNotFoundException; |
| 26 | +import javax.management.BadAttributeValueExpException; |
| 27 | +import javax.management.BadBinaryOpValueExpException; |
| 28 | +import javax.management.BadStringOperationException; |
| 29 | +import javax.management.InstanceAlreadyExistsException; |
| 30 | +import javax.management.InstanceNotFoundException; |
| 31 | +import javax.management.IntrospectionException; |
| 32 | +import javax.management.InvalidApplicationException; |
| 33 | +import javax.management.InvalidAttributeValueException; |
| 34 | +import javax.management.JMException; |
| 35 | +import javax.management.JMRuntimeException; |
| 36 | +import javax.management.ListenerNotFoundException; |
| 37 | +import javax.management.MBeanException; |
| 38 | +import javax.management.MBeanRegistrationException; |
| 39 | +import javax.management.MalformedObjectNameException; |
| 40 | +import javax.management.NotCompliantMBeanException; |
| 41 | +import javax.management.OperationsException; |
| 42 | +import javax.management.ReflectionException; |
| 43 | +import javax.management.RuntimeErrorException; |
| 44 | +import javax.management.RuntimeMBeanException; |
| 45 | +import javax.management.RuntimeOperationsException; |
| 46 | +import javax.management.ServiceNotFoundException; |
| 47 | +import javax.management.StringValueExp; |
| 48 | +import javax.management.modelmbean.InvalidTargetObjectTypeException; |
| 49 | +import javax.management.modelmbean.XMLParseException; |
| 50 | +import javax.management.monitor.MonitorSettingException; |
| 51 | +import javax.management.openmbean.InvalidKeyException; |
| 52 | +import javax.management.openmbean.InvalidOpenTypeException; |
| 53 | +import javax.management.openmbean.KeyAlreadyExistsException; |
| 54 | +import javax.management.openmbean.OpenDataException; |
| 55 | +import javax.management.relation.InvalidRelationIdException; |
| 56 | +import javax.management.relation.InvalidRelationServiceException; |
| 57 | +import javax.management.relation.InvalidRelationTypeException; |
| 58 | +import javax.management.relation.InvalidRoleInfoException; |
| 59 | +import javax.management.relation.InvalidRoleValueException; |
| 60 | +import javax.management.relation.RelationException; |
| 61 | +import javax.management.relation.RelationNotFoundException; |
| 62 | +import javax.management.relation.RelationServiceNotRegisteredException; |
| 63 | +import javax.management.relation.RelationTypeNotFoundException; |
| 64 | +import javax.management.relation.RoleInfoNotFoundException; |
| 65 | +import javax.management.relation.RoleNotFoundException; |
| 66 | +import javax.management.remote.JMXProviderException; |
| 67 | +import javax.management.remote.JMXServerErrorException; |
| 68 | + |
| 69 | +/** |
| 70 | + * |----- Original Description Coming From Tonga Original Source Code -------| |
| 71 | + * | | |
| 72 | + * | That class creates an ArrayList and fill it with an instance of each of | |
| 73 | + * | the Exception class of the JMX API. | |
| 74 | + * | It's dedicated to use by ExceptionTest. | |
| 75 | + * |-------------------------------------------------------------------------| |
| 76 | + */ |
| 77 | +public class ExceptionFactory { |
| 78 | + |
| 79 | + public static final ArrayList<Exception> exceptions = |
| 80 | + new ArrayList<Exception>(); |
| 81 | + |
| 82 | + static { |
| 83 | + String mes = "SQE"; |
| 84 | + exceptions.add(new AttributeNotFoundException()); |
| 85 | + exceptions.add(new BadAttributeValueExpException(mes)); |
| 86 | + exceptions.add(new BadBinaryOpValueExpException(new StringValueExp(mes))); |
| 87 | + exceptions.add(new BadStringOperationException(mes)); |
| 88 | + exceptions.add(new InstanceAlreadyExistsException()); |
| 89 | + exceptions.add(new InstanceNotFoundException()); |
| 90 | + exceptions.add(new IntrospectionException()); |
| 91 | + exceptions.add(new InvalidApplicationException(mes)); |
| 92 | + exceptions.add(new InvalidAttributeValueException()); |
| 93 | + exceptions.add(new JMException()); |
| 94 | + exceptions.add(new JMRuntimeException()); |
| 95 | + exceptions.add(new ListenerNotFoundException()); |
| 96 | + exceptions.add(new MalformedObjectNameException()); |
| 97 | + exceptions.add(new MBeanException(new Exception(mes), mes)); |
| 98 | + exceptions.add(new MBeanRegistrationException(new Exception(mes), mes)); |
| 99 | + exceptions.add(new NotCompliantMBeanException()); |
| 100 | + exceptions.add(new OperationsException()); |
| 101 | + exceptions.add(new ReflectionException(new Exception(mes), mes)); |
| 102 | + exceptions.add(new RuntimeErrorException(new Error(mes), mes)); |
| 103 | + exceptions.add(new RuntimeMBeanException(new RuntimeException(mes), mes)); |
| 104 | + exceptions.add(new RuntimeOperationsException(new RuntimeException(mes), mes)); |
| 105 | + exceptions.add(new ServiceNotFoundException()); |
| 106 | + exceptions.add(new InvalidTargetObjectTypeException()); |
| 107 | + exceptions.add(new XMLParseException()); |
| 108 | + exceptions.add(new MonitorSettingException()); |
| 109 | + exceptions.add(new InvalidKeyException()); |
| 110 | + exceptions.add(new InvalidOpenTypeException()); |
| 111 | + exceptions.add(new KeyAlreadyExistsException()); |
| 112 | + exceptions.add(new OpenDataException()); |
| 113 | + exceptions.add(new InvalidRelationIdException()); |
| 114 | + exceptions.add(new InvalidRelationServiceException()); |
| 115 | + exceptions.add(new InvalidRelationTypeException()); |
| 116 | + exceptions.add(new InvalidRoleInfoException()); |
| 117 | + exceptions.add(new InvalidRoleValueException()); |
| 118 | + exceptions.add(new RelationException()); |
| 119 | + exceptions.add(new RelationNotFoundException()); |
| 120 | + exceptions.add(new RelationServiceNotRegisteredException()); |
| 121 | + exceptions.add(new RelationTypeNotFoundException()); |
| 122 | + exceptions.add(new RoleInfoNotFoundException()); |
| 123 | + exceptions.add(new RoleNotFoundException()); |
| 124 | + exceptions.add(new JMXProviderException()); |
| 125 | + exceptions.add(new JMXServerErrorException(mes, new Error(mes))); |
| 126 | + ExceptionTest.Utils.debug(ExceptionTest.Utils.DEBUG_STANDARD, |
| 127 | + "DataFactory::updateMap: Initialized" + |
| 128 | + " an ArrayList with the " + |
| 129 | + exceptions.size() + " exceptions of the JMX API"); |
| 130 | + } |
| 131 | +} |
0 commit comments