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"; exceptions.add(new AttributeNotFoundException())84 exceptions.add(new AttributeNotFoundException()); exceptions.add(new BadAttributeValueExpException(mes))85 exceptions.add(new BadAttributeValueExpException(mes)); exceptions.add(new BadBinaryOpValueExpException(new StringValueExp(mes)))86 exceptions.add(new BadBinaryOpValueExpException(new StringValueExp(mes))); exceptions.add(new BadStringOperationException(mes))87 exceptions.add(new BadStringOperationException(mes)); exceptions.add(new InstanceAlreadyExistsException())88 exceptions.add(new InstanceAlreadyExistsException()); exceptions.add(new InstanceNotFoundException())89 exceptions.add(new InstanceNotFoundException()); exceptions.add(new IntrospectionException())90 exceptions.add(new IntrospectionException()); exceptions.add(new InvalidApplicationException(mes))91 exceptions.add(new InvalidApplicationException(mes)); exceptions.add(new InvalidAttributeValueException())92 exceptions.add(new InvalidAttributeValueException()); exceptions.add(new JMException())93 exceptions.add(new JMException()); exceptions.add(new JMRuntimeException())94 exceptions.add(new JMRuntimeException()); exceptions.add(new ListenerNotFoundException())95 exceptions.add(new ListenerNotFoundException()); exceptions.add(new MalformedObjectNameException())96 exceptions.add(new MalformedObjectNameException()); exceptions.add(new MBeanException(new Exception(mes), mes))97 exceptions.add(new MBeanException(new Exception(mes), mes)); exceptions.add(new MBeanRegistrationException(new Exception(mes), mes))98 exceptions.add(new MBeanRegistrationException(new Exception(mes), mes)); exceptions.add(new NotCompliantMBeanException())99 exceptions.add(new NotCompliantMBeanException()); exceptions.add(new OperationsException())100 exceptions.add(new OperationsException()); exceptions.add(new ReflectionException(new Exception(mes), mes))101 exceptions.add(new ReflectionException(new Exception(mes), mes)); exceptions.add(new RuntimeErrorException(new Error(mes), mes))102 exceptions.add(new RuntimeErrorException(new Error(mes), mes)); exceptions.add(new RuntimeMBeanException(new RuntimeException(mes), mes))103 exceptions.add(new RuntimeMBeanException(new RuntimeException(mes), mes)); exceptions.add(new RuntimeOperationsException(new RuntimeException(mes), mes))104 exceptions.add(new RuntimeOperationsException(new RuntimeException(mes), mes)); exceptions.add(new ServiceNotFoundException())105 exceptions.add(new ServiceNotFoundException()); exceptions.add(new InvalidTargetObjectTypeException())106 exceptions.add(new InvalidTargetObjectTypeException()); exceptions.add(new XMLParseException())107 exceptions.add(new XMLParseException()); exceptions.add(new MonitorSettingException())108 exceptions.add(new MonitorSettingException()); exceptions.add(new InvalidKeyException())109 exceptions.add(new InvalidKeyException()); exceptions.add(new InvalidOpenTypeException())110 exceptions.add(new InvalidOpenTypeException()); exceptions.add(new KeyAlreadyExistsException())111 exceptions.add(new KeyAlreadyExistsException()); exceptions.add(new OpenDataException())112 exceptions.add(new OpenDataException()); exceptions.add(new InvalidRelationIdException())113 exceptions.add(new InvalidRelationIdException()); exceptions.add(new InvalidRelationServiceException())114 exceptions.add(new InvalidRelationServiceException()); exceptions.add(new InvalidRelationTypeException())115 exceptions.add(new InvalidRelationTypeException()); exceptions.add(new InvalidRoleInfoException())116 exceptions.add(new InvalidRoleInfoException()); exceptions.add(new InvalidRoleValueException())117 exceptions.add(new InvalidRoleValueException()); exceptions.add(new RelationException())118 exceptions.add(new RelationException()); exceptions.add(new RelationNotFoundException())119 exceptions.add(new RelationNotFoundException()); exceptions.add(new RelationServiceNotRegisteredException())120 exceptions.add(new RelationServiceNotRegisteredException()); exceptions.add(new RelationTypeNotFoundException())121 exceptions.add(new RelationTypeNotFoundException()); exceptions.add(new RoleInfoNotFoundException())122 exceptions.add(new RoleInfoNotFoundException()); exceptions.add(new RoleNotFoundException())123 exceptions.add(new RoleNotFoundException()); exceptions.add(new JMXProviderException())124 exceptions.add(new JMXProviderException()); exceptions.add(new JMXServerErrorException(mes, new Error(mes)))125 exceptions.add(new JMXServerErrorException(mes, new Error(mes))); ExceptionTest.Utils.debug(ExceptionTest.Utils.DEBUG_STANDARD, R + R + exceptions.size() + R)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 } 132