Uploaded image for project: 'Hibernate Validator'
  1. HV-970

Avoid accessing package javax.xml.stream.* when not working with XML descriptors

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.0.Beta1
    • Component/s: engine
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      As XmlParserHelper is always loaded, also if actually there is no XML configuration, a NoClassDefFoundError is raised on Android, which does not have the javax.xml.stream.* package.

      Stacktrace:

      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory;
      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.XmlParserHelper.<init>(XmlParserHelper.java:66)
      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.ValidationXmlParser.<init>(ValidationXmlParser.java:60)
      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287)
      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361)
      02-19 12:19:40.202    6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214)
      

      Java setup:

      validator = Validation.byProvider(HibernateValidator.class).providerResolver(new ValidationProviderResolver() {
          @Override
          public List<ValidationProvider<?>> getValidationProviders()
          {
              List<ValidationProvider<?>> list = new ArrayList<ValidationProvider<?>>();
              list.add(new HibernateValidator());
              return list;
          }
      }).configure().buildValidatorFactory().getValidator();
      

      Gradle setup:

      compile 'org.hibernate:hibernate-validator:5.1.3.Final'
      compile 'javax.el:javax.el-api:2.2.4'
      compile 'org.glassfish.web:javax.el:2.2.4'
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: