A DESCRIPTION OF THE PROBLEM :
When Class.forName is called with a name which is invalid, the class name reported by the ClassNotFoundException exception uses the JVM notation of the class (replacing periods with slashes). This can be irritating because Class.forName normally reports the requested class name in the ClassNotFoundException.
The following lists the passed in class name string, and the class name reported by ClassNotFoundException in the line below it.
Working as expected:
"Ldoes.not.Exist"
-> "Ldoes.not.Exist"
"Ldoes.not/Exist;"
-> "Ldoes.not/Exist;"
"does.not/Exist"
-> "does.not/Exist"
"does.not Exist"
-> "does.not Exist"
"[Ldoes.not.Exist;"
-> "does.not.Exist"
Component type does not exist
Not working as expected:
"does.not.Exist;"
-> "does/not/Exist;"
Converted '.' -> '/'
"does.not.Exist["
-> "does/not/Exist["
Converted '.' -> '/'
"java.lang.String\u0000"
-> "java/lang/String "
Converted '.' -> '/'
"[".repeat(256) + "Ldoes.not.Exist;"
-> "...[[Ldoes/not/Exist;"
Converted '.' -> '/'
When Class.forName is called with a name which is invalid, the class name reported by the ClassNotFoundException exception uses the JVM notation of the class (replacing periods with slashes). This can be irritating because Class.forName normally reports the requested class name in the ClassNotFoundException.
The following lists the passed in class name string, and the class name reported by ClassNotFoundException in the line below it.
Working as expected:
"Ldoes.not.Exist"
-> "Ldoes.not.Exist"
"Ldoes.not/Exist;"
-> "Ldoes.not/Exist;"
"does.not/Exist"
-> "does.not/Exist"
"does.not Exist"
-> "does.not Exist"
"[Ldoes.not.Exist;"
-> "does.not.Exist"
Component type does not exist
Not working as expected:
"does.not.Exist;"
-> "does/not/Exist;"
Converted '.' -> '/'
"does.not.Exist["
-> "does/not/Exist["
Converted '.' -> '/'
"java.lang.String\u0000"
-> "java/lang/String "
Converted '.' -> '/'
"[".repeat(256) + "Ldoes.not.Exist;"
-> "...[[Ldoes/not/Exist;"
Converted '.' -> '/'