Fri, 22 Nov 2013 21:11:19 +0100
8010935: Better XML handling
8027378: Two closed/javax/xml/8005432 fails with jdk7u51b04
8028382: Two javax/xml/8005433 tests still fail after the fix JDK-8028147
Summary: base fix + fixes for test regressions; fix also reviewed by Maxim Soloviev, Alexander Fomin
Reviewed-by: mchung, mgrebac, mullan
mkos@450 | 1 | /* |
mkos@450 | 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
mkos@450 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mkos@450 | 4 | * |
mkos@450 | 5 | * This code is free software; you can redistribute it and/or modify it |
mkos@450 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mkos@450 | 7 | * published by the Free Software Foundation. Oracle designates this |
mkos@450 | 8 | * particular file as subject to the "Classpath" exception as provided |
mkos@450 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
mkos@450 | 10 | * |
mkos@450 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mkos@450 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mkos@450 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mkos@450 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
mkos@450 | 15 | * accompanied this code). |
mkos@450 | 16 | * |
mkos@450 | 17 | * You should have received a copy of the GNU General Public License version |
mkos@450 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
mkos@450 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mkos@450 | 20 | * |
mkos@450 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
mkos@450 | 22 | * or visit www.oracle.com if you need additional information or have any |
mkos@450 | 23 | * questions. |
mkos@450 | 24 | */ |
mkos@450 | 25 | |
mkos@450 | 26 | package com.sun.xml.internal.ws.spi.db; |
mkos@450 | 27 | |
mkos@450 | 28 | import com.sun.xml.internal.bind.v2.model.nav.Navigator; |
mkos@450 | 29 | |
mkos@450 | 30 | import java.lang.reflect.Field; |
mkos@450 | 31 | import java.lang.reflect.InvocationTargetException; |
mkos@450 | 32 | import java.lang.reflect.Method; |
mkos@450 | 33 | import java.lang.reflect.Type; |
mkos@450 | 34 | import java.util.logging.Level; |
mkos@450 | 35 | import java.util.logging.Logger; |
mkos@450 | 36 | |
mkos@450 | 37 | /** |
mkos@450 | 38 | * Utils class. |
mkos@450 | 39 | * |
mkos@450 | 40 | * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. |
mkos@450 | 41 | * |
mkos@450 | 42 | * Has *package private* access to avoid inappropriate usage. |
mkos@450 | 43 | */ |
mkos@450 | 44 | /* package */ final class Utils { |
mkos@450 | 45 | |
mkos@450 | 46 | private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); |
mkos@450 | 47 | |
mkos@450 | 48 | /** |
mkos@450 | 49 | * static ReflectionNavigator field to avoid usage of reflection every time we use it. |
mkos@450 | 50 | */ |
mkos@450 | 51 | /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR; |
mkos@450 | 52 | |
mkos@450 | 53 | static { // we statically initializing REFLECTION_NAVIGATOR property |
mkos@450 | 54 | Class refNav = null; |
mkos@450 | 55 | try { |
mkos@450 | 56 | refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); |
mkos@450 | 57 | //noinspection unchecked |
mkos@450 | 58 | Method getInstance = refNav.getDeclaredMethod("getInstance"); |
mkos@450 | 59 | getInstance.setAccessible(true); |
mkos@450 | 60 | //noinspection unchecked |
mkos@450 | 61 | REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); |
mkos@450 | 62 | } catch (ClassNotFoundException e) { |
mkos@450 | 63 | e.printStackTrace(); |
mkos@450 | 64 | throw new IllegalStateException("Can't find ReflectionNavigator class"); |
mkos@450 | 65 | } catch (InvocationTargetException e) { |
mkos@450 | 66 | e.printStackTrace(); |
mkos@450 | 67 | throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); |
mkos@450 | 68 | } catch (NoSuchMethodException e) { |
mkos@450 | 69 | e.printStackTrace(); |
mkos@450 | 70 | throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); |
mkos@450 | 71 | } catch (IllegalAccessException e) { |
mkos@450 | 72 | e.printStackTrace(); |
mkos@450 | 73 | throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); |
mkos@450 | 74 | } catch (SecurityException e) { |
mkos@450 | 75 | LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); |
mkos@450 | 76 | throw e; |
mkos@450 | 77 | } |
mkos@450 | 78 | } |
mkos@450 | 79 | |
mkos@450 | 80 | /** |
mkos@450 | 81 | * private constructor to avoid util class instantiating |
mkos@450 | 82 | */ |
mkos@450 | 83 | private Utils() { |
mkos@450 | 84 | } |
mkos@450 | 85 | } |