equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1994, 2011, 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 |
1624 * <tt>null</tt> if not found |
1624 * <tt>null</tt> if not found |
1625 * |
1625 * |
1626 * @since 1.2 |
1626 * @since 1.2 |
1627 */ |
1627 */ |
1628 protected Package getPackage(String name) { |
1628 protected Package getPackage(String name) { |
|
1629 Package pkg; |
1629 synchronized (packages) { |
1630 synchronized (packages) { |
1630 Package pkg = packages.get(name); |
1631 pkg = packages.get(name); |
1631 if (pkg == null) { |
1632 } |
1632 if (parent != null) { |
1633 if (pkg == null) { |
1633 pkg = parent.getPackage(name); |
1634 if (parent != null) { |
1634 } else { |
1635 pkg = parent.getPackage(name); |
1635 pkg = Package.getSystemPackage(name); |
1636 } else { |
|
1637 pkg = Package.getSystemPackage(name); |
|
1638 } |
|
1639 if (pkg != null) { |
|
1640 synchronized (packages) { |
|
1641 Package pkg2 = packages.get(name); |
|
1642 if (pkg2 == null) { |
|
1643 packages.put(name, pkg); |
|
1644 } else { |
|
1645 pkg = pkg2; |
|
1646 } |
1636 } |
1647 } |
1637 if (pkg != null) { |
1648 } |
1638 packages.put(name, pkg); |
1649 } |
1639 } |
1650 return pkg; |
1640 } |
|
1641 return pkg; |
|
1642 } |
|
1643 } |
1651 } |
1644 |
1652 |
1645 /** |
1653 /** |
1646 * Returns all of the <tt>Packages</tt> defined by this class loader and |
1654 * Returns all of the <tt>Packages</tt> defined by this class loader and |
1647 * its ancestors. </p> |
1655 * its ancestors. </p> |