-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0, 1.2.1
-
generic, x86
-
generic, windows_nt
Name: nl37777 Date: 12/08/98
when i have both A.class and a.properties in the current directory and try to use ResourceBundle.getBundle("a") to try to load a.properties, the following exception occured:
Exception in thread "main" java.lang.NoClassDefFoundError: a (wrong name: A)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:403)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:101)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$1(URLClassLoader.java:216)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:280)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:275)
at java.lang.ClassLoader.loadClass(ClassLoader.java:237)
at java.util.ResourceBundle.findBundle(Compiled Code)
at java.util.ResourceBundle.getBundle(Compiled Code)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:334)
at ListResources.<init>(ListResources.java:5)
at ListResources.main(ListResources.java:9)
i guess the it is somehow confused by case ('a' and 'A') here but this problem doesn't exists in jdk1.1.x, only in 1.2
(Review ID: 47514)
======================================================================
Name: krT82822 Date: 04/24/99
The documentation on ResourceBundle.getBundle() implies that if
I dont provide a ResourceBundle class that it will fallback to a
properties file of the same name, or isolated within a Locale.
Well, I've done something very simple and unfortunately, the JDK
seems to be getting an Error (hence the no trap). Is there
something obvious I am missing here, the source code for the
class in question follows the stack trace.
Exception in thread "main" java.lang.NoClassDefFoundError: Inspector (wrong name
: com/spiders/scatter/inspector/Inspector)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:403)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:101)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$1(URLClassLoader.java:216)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:280)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:275)
at java.lang.ClassLoader.loadClass(ClassLoader.java:237)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:504)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:416)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:348)
at com.spiders.scatter.inspector.Inspector.main(Inspector.java:95)
--- source code ---
package com.spiders.scatter.inspector ;
import java.awt.* ;
import java.awt.event.* ;
import java.beans.* ;
import java.util.* ;
import java.net.* ;
import javax.swing.* ;
import javax.swing.event.* ;
public class Inspector
implements InspectorConst
{
private static ResourceBundle resources ;
/**
* Search the resources for the label string identified by name.
* If none can be found then return null.
* @param nm Name of the resource
*/
public final static String getResourceLabel( String nm ) {
return( getResourceString( nm + labelSuffix ) ) ;
}
/**
* Search the resources for the string identified by name. If none
* can be found then return null.
* @param nm Name of the resource
*/
public final static String getResourceString( String nm ) {
try {
return( resources.getString( nm ) ) ;
} catch( MissingResourceException xx ) {
return( null ) ;
}
}
/**
* Locate the resource identified by the key. If none can be
* found then return null.
*/
public final static URL getResource( String key ) {
String name = getResourceString( key ) ;
if ( name != null ) {
return( Inspector.getResource( name ) ) ;
}
return( null ) ;
}
/**
* Application entry point
*/
public static void main( String[] args ) {
Locale locale = Locale.getDefault() ;
System.out.println( locale.toString() ) ;
/**
* Load the resource bundle
*/
try {
resources = ResourceBundle.getBundle( "Inspector", locale ) ;
} catch( MissingResourceException xx ) {
System.err.println( "Inspector.properties not found" ) ;
System.exit( 1 ) ;
}
}
}
(Review ID: 57448)
======================================================================
- duplicates
-
JDK-4255366 ResourceBundle.getBundle should document ClassCastException case
-
- Closed
-