I'm getting the exception when trying to run my command line application:
Java Lang.ExceptionInInitializerErg Hibernate.validator.engine.ConfigurationImpl & Lt; Clinit & gt; (Configreshnimplkjawa 52) on org.hibernate.validator.HibernateValidator.createGenericConfiguration (HibernateValidator.java:43) on javax.validation. Validation by $ GenericBootstrapImpl .configure (Manykrnkjawagosh 69): java.lang.StringIndexOutOfBoundsException: String index out of range: at -2 java.lang.String.substring (String.java1937) on org.hibernate.validator.util . Edition. & Lt; Clinit & gt; (Version. Java39) ... 34 more Am I doing something wrong? Please suggest.
It is weird that I main with a class in ohvuVersion Paste the relevant parts of the initialization block of constant and added the logging traces of some poor:
public class versionTest {public static zero main (string [ ] Args) {class clazz = org.hibernate.validator.util.version.class; String class file name = clazz.getSimpleName () + ".class"; System.out.println (string.format ("% - 16s:% s", "classFileName", classFileName)); String classfilepath = clause.date canonicalnonym (). Replace ('.', '/') + ".class"; System.out.println (string.format ("% - 16s:% s", "classFilePath", class filepath)); String pathToThisClass = clazz.getResource (classFileName) .toString (); System.out.println (string.format ("% - 16s:% s", "Pathtoyclass", pathtoyclass)); // This `org.hibernate.validator.util.version` string path line 39 pathToManifest = pathToThisClass.substring (0, pathToThisClass.indexOf (classFilePath) - 1) +" /META-INF/MANIFEST.MF "; System.out.println (String.format ("% - 16s:% s", "Pathpromannafenst", Pathometmanified)); }} And here I get it when I run:
classFileName: version.class classFilePath: org / hibernate / validator / util / version class Path: This type: Jar: File: / Home / Pascal /. M2 / repository / org / bubernate / bbnnet-validator / 4.0.2. GA / BBnet-validator-4.0.2.GA.jar! / Org / hibernate / Vlidator / Util / Vrshnkclas Pttomnifest: jar: file: /hom/paskl/km2/ripojitri/org/haibrnet/haibrnet-vlidator/4k0k2kg/haibrnet-vlidator-4k0k2. GA.jar! / META- INF / MANIFEST.MF In your case, StringIndexOutOfBoundsException: String index gives class out: -2 suggest that:
PathToThisClass.indexOf (classFilePath) -1 is coming back, so pathToThisClass.substring (0, -2) < / Code> Call in fact is wrong.
And this means that org / hibernate / validator / util / version.class is not part of pathToThisClass which you get . I do not have complete details but it should be related to the fact that you are using the forest-jar.
Can you run the test class above and update your question with output?
Comments
Post a Comment