jdk/test/java/util/ResourceBundle/Bug4168625Test.java
author ohair
Wed, 26 May 2010 20:28:04 -0700
changeset 5551 327690766109
parent 5506 202f599c92aa
child 5801 8008ed6e4a37
permissions -rw-r--r--
6956202: Fix a few missed rebranding issues, please contact lines etc. Reviewed-by: jjg, darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
    @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
    @summary test Resource Bundle for bug 4168625
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
    @build Bug4168625Class Bug4168625Getter Bug4168625Resource Bug4168625Resource3 Bug4168625Resource3_en Bug4168625Resource3_en_CA Bug4168625Resource3_en_IE Bug4168625Resource3_en_US Bug4168625Resource2_en_US Bug4168625Resource2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
    @run main/timeout=600 Bug4168625Test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
    @bug 4168625
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * (C) Copyright IBM Corp. 1999 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * This software is the confidential and proprietary information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * of Sun Microsystems, Inc. ("Confidential Information").  You
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * shall not disclose such Confidential Information and shall use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * it only in accordance with the terms of the license agreement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * you entered into with Sun.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * The original version of this source code and documentation is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * copyrighted and owned by IBM. These materials are provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * under terms of a License Agreement between IBM and Sun.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * This technology is protected by multiple US and International
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * patents. This notice and attribution to IBM may not be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *  This test tries to correct three efficiency problems with the caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *  mechanism of ResourceBundle.  All tests assume that none of the bundles
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *  have been previously loaded and cached.  It also allows concurrent loads
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *  of resource bundles to be performed if the bundles are unrelated (ex. a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *  load of a local system resource by one thread while another thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *  doing a slow load over a network).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
public class Bug4168625Test extends RBTestFmwk {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        new Bug4168625Test().run(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Verify that getBundle will do something reasonable when part of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * resource hierarchy is missing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public void testMissingParent() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        final Locale oldDefault = Locale.getDefault();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        Locale.setDefault(new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            final Locale loc = new Locale("jf", "jf");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            ResourceBundle bundle = ResourceBundle.getBundle("Bug4168625Resource2", loc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            final String s1 = bundle.getString("name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            if (!s1.equals("Bug4168625Resource2_en_US")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                errln("getBundle did not find leaf bundle: "+bundle.getClass().getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            final String s2 = bundle.getString("baseName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            if (!s2.equals("Bug4168625Resource2")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                errln("getBundle did not set up proper inheritance chain");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            Locale.setDefault(oldDefault);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *  Previous versions of ResourceBundle have had the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *  caching behavior.  Assume the classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *  Bug4168625Resource_fr_FR, Bug4168625Resource_fr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *  Bug4168625Resource_en_US, and Bug4168625Resource_en don't
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *  exist.  The class Bug4168625Resource does.  Assume the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *  locale is en_US.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *  getBundle("Bug4168625Resource", new Locale("fr", "FR"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *      -->try to load Bug4168625Resource_fr_FR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *      -->try to load Bug4168625Resource_fr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *      -->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *      -->try to load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *      -->load Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *      -->cache Bug4168625Resource as Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *      -->cache Bug4168625Resource as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *      -->cache Bug4168625Resource as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *      -->return Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *  getBundle("Bug4168625Resource", new Locale("fr", "FR"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *      -->try to load Bug4168625Resource_fr_FR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *      -->try to load Bug4168625Resource_fr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *      -->find cached Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *      -->return Bug4168625Resource_en_US (which is realy Bug4168625Resource)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *  The second call causes two loads for Bug4168625Resource_fr_FR and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *  Bug4168625Resource_en which have already been tried and failed.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *  two loads should have been cached as Bug4168625Resource by the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *  call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *  The following, more efficient behavior is desired:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *  getBundle("Bug4168625Resource", new Locale("fr", "FR"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *      -->try to load Bug4168625Resource_fr_FR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *      -->try to load Bug4168625Resource_fr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *      -->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *      -->try to load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *      -->load Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *      -->cache Bug4168625Resource as Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *      -->cache Bug4168625Resource as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *      -->cache Bug4168625Resource as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *      -->cache Bug4168625Resource as Bug4168625Resource_fr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *      -->cache Bug4168625Resource as Bug4168625Resource_fr_FR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *      -->return Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *  getBundle("Bug4168625Resource", new Locale("fr", "FR"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *      -->find cached Bug4168625Resource_fr_FR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *      -->return Bug4168625Resource_en_US (which is realy Bug4168625Resource)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public void testCacheFailures() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        checkResourceLoading("Bug4168625Resource", new Locale("fr", "FR"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     *  Previous versions of ResourceBundle have had the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *  caching behavior.  Assume the current locale is locale is en_US.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *  The classes Bug4168625Resource_en_US, and Bug4168625Resource_en don't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *  exist.  The class Bug4168625Resource does.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *  getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *      -->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *      -->try to load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     *      -->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *      -->try to load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *      -->load Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *      -->cache Bug4168625Resource as Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *      -->cache Bug4168625Resource as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *      -->cache Bug4168625Resource as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *      -->return Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *  The redundant loads of Bug4168625Resource_en_US and Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *  should not occur.  The desired behavior is as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *  getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *      -->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *      -->try to load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *      -->load Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *      -->cache Bug4168625Resource as Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *      -->cache Bug4168625Resource as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *      -->cache Bug4168625Resource as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *      -->return Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public void testRedundantLoads() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        checkResourceLoading("Bug4168625Resource", Locale.getDefault());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Ensure that resources are only loaded once and are cached correctly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    private void checkResourceLoading(String resName, Locale l) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        final Loader loader = new Loader( new String[] { "Bug4168625Class" }, new String[] { "Bug4168625Resource3_en_US", "Bug4168625Resource3_en_CA" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        final Class c = loader.loadClass("Bug4168625Class");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        final String resClassName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        if (l.toString().length() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            resClassName = resName+"_"+l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            resClassName = resName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        Object bundle = test.getResourceBundle(resName, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        loader.logClasses("Initial lookup of "+resClassName+" generated the following loads:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        final Vector lastLoad = new Vector(loader.loadedClasses.size());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        boolean dups = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        for (int i = loader.loadedClasses.size() - 1; i >= 0 ; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            final Object item = loader.loadedClasses.elementAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            loader.loadedClasses.removeElementAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            if (loader.loadedClasses.contains(item)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                logln("Resource loaded more than once: "+item);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                dups = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                lastLoad.addElement(item);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        if (dups) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            errln("ResourceBundle loaded some classes multiple times");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        loader.loadedClasses.removeAllElements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        bundle = test.getResourceBundle(resName, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        loader.logClasses("Second lookup of "+resClassName+" generated the following loads:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        dups = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        for (int i = 0; i < loader.loadedClasses.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            Object item = loader.loadedClasses.elementAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            if (lastLoad.contains(item)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                logln("ResourceBundle did not cache "+item+" correctly");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                dups = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        if (dups) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            errln("Resource bundle not caching some classes properly");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *  Previous versions of ResourceBundle exhibited the following caching behavior.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *  Assume the class Bug4168625Resource_en exists. Bug4168625Resource_en_US does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *  not.  Two threads, ThreadA and ThreadB both try to get the same bundle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     *  ThreadA.getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *      A-->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *  ThreadB.getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *      B-->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *      B-->load Bug4168625Resource_en (#1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *      A-->load Bug4168625Resource_en (#2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *      A-->cache Bug4168625Resource_en (#2) as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *      A-->cache Bug4168625Resource_en (#2) as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *      A-->return Bug4168625Resource_en (#2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *      B-->cache Bug4168625Resource_en (#1) as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *      B-->cache Bug4168625Resource_en (#1) as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     *      B-->return Bug4168625Resource_en (#1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     *  Both threads try and fail to load Bug4168625Resource_en_US.  Both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *  threads load Bug4168625Resource_en.  Both threads get their own copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *  of the Bug4168625Resource_en resource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *  The desired behavior is as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *  ThreadA.getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *      A-->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *  ThreadB.getBundle("Bug4168625Resource", new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *      B-->try to load Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *      B-->load Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     *      A-->load Bug4168625Resource_en (block in ResourceBundle.getBundle)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     *      B-->cache Bug4168625Resource_en as Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *      B-->cache Bug4168625Resource_en as Bug4168625Resource_en_US
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *      A-->return Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *      B-->return Bug4168625Resource_en
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *  Note that both threads return the same bundle object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public void testConcurrentLoading1() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        final Loader loader = new Loader( new String[] { "Bug4168625Class" }, new String[] { "Bug4168625Resource3_en_US", "Bug4168625Resource3_en_CA" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        final Class c = loader.loadClass("Bug4168625Class");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        final Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            //both threads want the same resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        ConcurrentLoadingThread thread1 = new ConcurrentLoadingThread(loader, test, new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        ConcurrentLoadingThread thread2 = new ConcurrentLoadingThread(loader, test, new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        thread1.start();            //start thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        loader.waitForNotify(1);    //wait for thread1 to do getBundle & block in loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        thread2.start();            //start second thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        loader.waitForNotify(2, 1000);  //wait until thread2 blocks somewhere in getBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        thread1.ping();             //continue both threads
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        thread2.ping();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        thread1.join();             //wait unitl both threads complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        thread2.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            //Now, examine the class loads that were done.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        loader.logClasses("Classes loaded after completion of both threads:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        boolean dups = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        for (int i = loader.loadedClasses.size() - 1; i >= 0 ; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            final Object item = loader.loadedClasses.elementAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            loader.loadedClasses.removeElementAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            if (loader.loadedClasses.contains(item)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                logln("Resource loaded more than once: "+item);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                dups = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        if (dups) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            errln("ResourceBundle loaded some classes multiple times");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    private class ConcurrentLoadingThread extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        private Loader loader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        public Object bundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        private Bug4168625Getter test;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        private Locale locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        private String resourceName = "Bug4168625Resource3";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        public ConcurrentLoadingThread(Loader loader, Bug4168625Getter test, Locale l, String resourceName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            this.loader = loader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
            this.test = test;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            this.locale = l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            this.resourceName = resourceName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        public ConcurrentLoadingThread(Loader loader, Bug4168625Getter test, Locale l) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            this.loader = loader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            this.test = test;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            this.locale = l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                logln(">>"+threadName()+">run");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                bundle = test.getResourceBundle(resourceName, locale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                errln("TEST CAUGHT UNEXPECTED EXCEPTION: "+e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                logln("<<"+threadName()+"<run");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        public synchronized void waitUntilPinged() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            logln(">>"+threadName()+">waitUntilPinged");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            loader.notifyEveryone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                wait(30000);    //wait 30 seconds max.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            } catch (InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                logln("Test deadlocked.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            logln("<<"+threadName()+"<waitUntilPinged");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        public synchronized void ping() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            logln(">>"+threadName()+">ping "+threadName(this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            notifyAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            logln("<<"+threadName()+"<ping "+threadName(this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * This test ensures that multiple resources can be loading at the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * time as long as they don't depend on each other in some way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    public void testConcurrentLoading2() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        final Loader loader = new Loader( new String[] { "Bug4168625Class" }, new String[] { "Bug4168625Resource3_en_US", "Bug4168625Resource3_en_CA" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        final Class c = loader.loadClass("Bug4168625Class");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        final Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        ConcurrentLoadingThread thread1 = new ConcurrentLoadingThread(loader, test, new Locale("en", "CA"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        ConcurrentLoadingThread thread2 = new ConcurrentLoadingThread(loader, test, new Locale("en", "IE"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        thread1.start();            //start thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        loader.waitForNotify(1);    //wait for thread1 to do getBundle & block in loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        thread2.start();            //start second thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        thread2.join(1000);         //wait until thread2 blocks somewhere in getBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            //Thread1 should be blocked inside getBundle at the class loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            //Thread2 should have completed its getBundle call and terminated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        if (!thread1.isAlive() || thread2.isAlive()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            errln("ResourceBundle.getBundle not allowing legal concurrent loads");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        thread1.ping();             //continue thread1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        thread1.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        thread2.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * This test ensures that a resource loads correctly (with all its parents)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * when memory is very low (ex. the cache gets purged during a load).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    public void testLowMemoryLoad() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        final String[] classToLoad = { "Bug4168625Class" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        final String[] classToWait = { "Bug4168625Resource3_en_US","Bug4168625Resource3_en","Bug4168625Resource3" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        final Loader loader = new Loader(classToLoad, classToWait);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        final Class c = loader.loadClass("Bug4168625Class");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        final Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        causeResourceBundleCacheFlush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        ConcurrentLoadingThread thread1 = new ConcurrentLoadingThread(loader, test, new Locale("en", "US"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        thread1.start();            //start thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        loader.waitForNotify(1);    //wait for thread1 to do getBundle(en_US) & block in loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        causeResourceBundleCacheFlush();    //cause a cache flush
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        thread1.ping();             //kick thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        loader.waitForNotify(2);    //wait for thread1 to do getBundle(en) & block in loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        causeResourceBundleCacheFlush();    //cause a cache flush
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        thread1.ping();             //kick thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        loader.waitForNotify(3);    //wait for thread1 to do getBundle(en) & block in loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        causeResourceBundleCacheFlush();    //cause a cache flush
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        thread1.ping();             //kick thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        thread1.ping();             //kick thread 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        thread1.join(1000);         //wait until thread2 blocks somewhere in getBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        ResourceBundle bundle = (ResourceBundle)thread1.bundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        String s1 = bundle.getString("Bug4168625Resource3_en_US");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        String s2 = bundle.getString("Bug4168625Resource3_en");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        String s3 = bundle.getString("Bug4168625Resource3");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        if ((s1 == null) || (s2 == null) || (s3 == null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            errln("Bundle not constructed correctly.  The parent chain is incorrect.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * A simple class loader that loads classes from the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * working directory.  The loader will block the current thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * of execution before it returns when it tries to load
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * the class "Bug4168625Resource3_en_US".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    private static final String CLASS_PREFIX = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    private static final String CLASS_SUFFIX = ".class";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    private static final class SimpleLoader extends ClassLoader {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        private boolean network = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        public SimpleLoader() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            this.network = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        public SimpleLoader(boolean simulateNetworkLoad) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            this.network = simulateNetworkLoad;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        public Class loadClass(final String className, final boolean resolveIt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            Class result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
            synchronized (this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                result = findLoadedClass(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                if (result == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                    if (network) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                             Thread.sleep(100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                        } catch (java.lang.InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                    result = super.findSystemClass(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                    if ((result != null) && resolveIt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                        resolveClass(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    private final class Loader extends ClassLoader {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        public final Vector loadedClasses = new Vector();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        private String[] classesToLoad;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        private String[] classesToWaitFor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        public Loader() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
            classesToLoad = new String[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
            classesToWaitFor = new String[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        public Loader(final String[] classesToLoadIn, final String[] classesToWaitForIn) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            classesToLoad = classesToLoadIn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            classesToWaitFor = classesToWaitForIn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
         * Load a class.  Files we can load take preference over ones the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
         * can load.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        private byte[] getClassData(final String className) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            boolean shouldLoad = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            for (int i = classesToLoad.length-1; i >= 0; --i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                if (className.equals(classesToLoad[i])) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
                    shouldLoad = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            if (shouldLoad) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                final String name = CLASS_PREFIX+className+CLASS_SUFFIX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                    final InputStream fi = this.getClass().getClassLoader().getResourceAsStream(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                    final byte[] result = new byte[fi.available()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                    fi.read(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                    return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                    logln("Error loading test class: "+name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                    logln(e.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                    return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
         * Load a class.  Files we can load take preference over ones the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
         * can load.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
        public Class loadClass(final String className, final boolean resolveIt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
                throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            Class result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            synchronized (this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
                logln(">>"+threadName()+">load "+className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
                loadedClasses.addElement(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
                result = findLoadedClass(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
                if (result == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                    final byte[] classData = getClassData(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
                    if (classData == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                        //we don't have a local copy of this one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                        logln("Loading system class: "+className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                        result = loadFromSystem(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                        result = defineClass(classData, 0, classData.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
                        if (result == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
                            //there was an error defining the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                            result = loadFromSystem(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                    if ((result != null) && resolveIt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                        resolveClass(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            for (int i = classesToWaitFor.length-1; i >= 0; --i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                if (className.equals(classesToWaitFor[i])) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
                    rendezvous();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
            logln("<<"+threadName()+"<load "+className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
            return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
         * Delegate loading to the system loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        private Class loadFromSystem(String className) throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
            return super.findSystemClass(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        public void logClasses(String title) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
            logln(title);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
            for (int i = 0; i < loadedClasses.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
                logln("    "+loadedClasses.elementAt(i));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            logln("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        public int notifyCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        public int waitForNotify(int count) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
            return waitForNotify(count, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        public synchronized int waitForNotify(int count, long time) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            logln(">>"+threadName()+">waitForNotify");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
            if (count > notifyCount) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                    wait(time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
                } catch (InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
                logln("  count("+count+") > notifyCount("+notifyCount+")");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
            logln("<<"+threadName()+"<waitForNotify");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            return notifyCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        private synchronized void notifyEveryone() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
            logln(">>"+threadName()+">notifyEveryone");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
            notifyCount++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            notifyAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
            logln("<<"+threadName()+"<notifyEveryone");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        private void rendezvous() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
            final Thread current = Thread.currentThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
            if (current instanceof ConcurrentLoadingThread) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                ((ConcurrentLoadingThread)current).waitUntilPinged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    private static String threadName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        return threadName(Thread.currentThread());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    private static String threadName(Thread t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
        String temp = t.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        int ndx = temp.indexOf("Thread[");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
        temp = temp.substring(ndx + "Thread[".length());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
        ndx = temp.indexOf(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        temp = temp.substring(0, ndx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        return temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    /** Fill memory to force all SoftReferences to be GCed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    private void causeResourceBundleCacheFlush() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        logln("Filling memory...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        int allocationSize = 1024;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        Vector memoryHog = new Vector();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                memoryHog.addElement(new byte[allocationSize]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
                allocationSize *= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
        } catch (Throwable e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
            logln("Caught "+e+" filling memory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
        } finally{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
            memoryHog = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
            System.gc();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        logln("last allocation size: " + allocationSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     *  NOTE: this problem is not externally testable and can only be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     *  verified through code inspection unless special code to force
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     *  a task switch is inserted into ResourceBundle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     *  The class Bug4168625Resource_sp exists.  It's parent bundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     *  (Bug4168625Resource) contains a resource string with the tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     *  "language" but Bug4168625Resource_sp does not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     *  Assume two threads are executing, ThreadA and ThreadB and they both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     *  load a resource Bug4168625Resource with from sp locale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     *  ResourceBundle.getBundle adds a bundle to the bundle cache (in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     *  findBundle) before it sets the bundle's parent (in getBundle after
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     *  returning from findBundle).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     *  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     *  ThreadA.getBundle("Bug4168625Resource", new Locale("sp"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     *      A-->load Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     *      A-->find cached Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     *      A-->cache Bug4168625Resource_sp as Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     *  ThreadB.getBundle("Bug4168625Resource", new Locale("sp"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     *      B-->find cached Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     *      B-->return Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     *  ThreadB.bundle.getString("language");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     *      B-->try to find "language" in Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     *      B-->Bug4168625Resource_sp does not have a parent, so return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     *  ThreadB.System.out.println("Some unknown country");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     *      A-->set parent of Bug4168625Resource_sp to Bug4168625Resource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     *      A-->return Bug4168625Resource_sp (the same bundle ThreadB got)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     *  ThreadA.bundle.getString("language");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     *      A-->try to find "language" in Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     *      A-->try to find "language" in Bug4168625Resource (parent of Bug4168625Resource_sp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     *      A-->return the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     *  ThreadA.System.out.println("Langauge = "+country);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     *  ThreadB.bundle.getString("language");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     *      B-->try to find "language" in Bug4168625Resource_sp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     *      B-->try to find "language" in Bug4168625Resource (parent of Bug4168625Resource_sp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     *      B-->return the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     *  ThreadB.System.out.println("Langauge = "+country);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     *  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     *  <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     *  Note that the first call to getString() by ThreadB returns null, but the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     *  returns a value.  Thus to ThreadB, the bundle appears to change.  ThreadA gets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     *  the expected results right away.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
}