jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
changeset 45853 bfa06be36a17
parent 42806 35843e3d5ef1
equal deleted inserted replaced
45852:aa0a2d22981d 45853:bfa06be36a17
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   188         try {
   188         try {
   189             Class<?> providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
   189             Class<?> providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
   190             if (!type.isAssignableFrom(providerClass)) {
   190             if (!type.isAssignableFrom(providerClass)) {
   191                 throw new ClassCastException(className + " cannot be cast to " + type.getName());
   191                 throw new ClassCastException(className + " cannot be cast to " + type.getName());
   192             }
   192             }
   193             Object instance = providerClass.newInstance();
   193             Object instance = providerClass.getConstructor().newInstance();
   194             final ClassLoader clD = cl;
   194             final ClassLoader clD = cl;
   195             dPrint(()->"created new instance of " + providerClass +
   195             dPrint(()->"created new instance of " + providerClass +
   196                        " using ClassLoader: " + clD);
   196                        " using ClassLoader: " + clD);
   197             return type.cast(instance);
   197             return type.cast(instance);
   198         }
   198         }