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