SchemaFactoryFinder.java (670:71dd8f764942) SchemaFactoryFinder.java (757:fcb2520aef55)
1/*
2 * Copyright (c) 2003, 2013, 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 404 unchanged lines hidden (view full) ---

413 throw new SchemaFactoryConfigurationError(
414 "Provider for " + SERVICE_CLASS + " cannot be created", error);
415 }
416 }
417
418 private static final Class<SchemaFactory> SERVICE_CLASS = SchemaFactory.class;
419
420
1/*
2 * Copyright (c) 2003, 2013, 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 404 unchanged lines hidden (view full) ---

413 throw new SchemaFactoryConfigurationError(
414 "Provider for " + SERVICE_CLASS + " cannot be created", error);
415 }
416 }
417
418 private static final Class<SchemaFactory> SERVICE_CLASS = SchemaFactory.class;
419
420
421 // Used for debugging purposes
421 private static String which( Class<?> clazz ) {
422 private static String which( Class<?> clazz ) {
422 return which( clazz.getName(), clazz.getClassLoader() );
423 return ss.getClassSource(clazz);
423 }
424 }
424
425 /**
426 * <p>Search the specified classloader for the given classname.</p>
427 *
428 * @param classname the fully qualified name of the class to search for
429 * @param loader the classloader to search
430 *
431 * @return the source location of the resource, or null if it wasn't found
432 */
433 private static String which(String classname, ClassLoader loader) {
434
435 String classnameAsResource = classname.replace('.', '/') + ".class";
436
437 if( loader==null ) loader = ClassLoader.getSystemClassLoader();
438
439 //URL it = loader.getResource(classnameAsResource);
440 URL it = ss.getResourceAsURL(loader, classnameAsResource);
441 if (it != null) {
442 return it.toString();
443 } else {
444 return null;
445 }
446 }
447}
425}