/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class is used to ensure that a resource bundle loadable by a classloader
* is on the caller's stack, but not on the classpath or TCCL. It tests that
* Logger.getLogger() can load the bundle via the immediate caller's classloader
*
* @author Jim Gish
*/
public class IndirectlyLoadABundle {
// Make sure we can find it via the URLClassLoader
+ " as expected. Test config problem");
}
// But it shouldn't be available via the system classloader
if (testForValidResourceSetup(myCL)) {
+ " able to. Test config problem");
}
if (actual != yetAnotherResourceCL) {
}
try {
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
// Test getAnonymousLogger()
if (actual != loadItUpCL) {
throw new Exception("LoadItUp1 was loaded by an unexpected CL: "
+ actual);
}
String.class);
try {
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
// test getLogger("NestedLogger2"); followed by
// getLogger("NestedLogger2", rbName) to see if the bundle is found
//
} else {
throw new Exception("TEST FAILED: first call to getLogger() failed "
+ " in IndirectlyLoadABundle."
+ "testGetLoggerGetLoggerWithBundle");
}
}
// Find out where we are running from so we can setup the URLClassLoader URLs
// test.src and test.classes will be set if running in jtreg, but probably
// not otherwise
// Allow for both jtreg and standalone cases here
return urls;
}
// Test getLogger("foo"); getLogger("foo", "rbName");
// First do the getLogger() call with no bundle name
if (actual != getLoggerCL) {
throw new Exception("LoadItUp1 was loaded by an unexpected CL: "
+ actual);
}
if (bundleName != null) {
String.class,
String.class);
try {
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
} else {
String.class);
try {
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
}
// First make sure the test environment is setup properly and the bundle
// actually exists
}
}