Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2149

Adding wrong constraint type causes data inconsistency

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.0.0.Alpha1
    • 3.6.0.Final
    • JCR
    • None
    • Hide
      • Create a new namespace (not neccesary)
      • Create a new node type template
      • Create a new property defintion and link it to the node type
      • Make sure this property definition is of type LONG
      • Apply a constraint into this property definition, but make sure it is of a non-LONG type, f.e. "test'
      • Register the node type
      • Try to do any JCR action, and this exception will occur (f.e. unregistering the node type)
      Show
      Create a new namespace (not neccesary) Create a new node type template Create a new property defintion and link it to the node type Make sure this property definition is of type LONG Apply a constraint into this property definition, but make sure it is of a non-LONG type, f.e. "test' Register the node type Try to do any JCR action, and this exception will occur (f.e. unregistering the node type)

    Description

      When I try to add a new nodetype with for example the type as LONG, I try to add another property definition with constraints. But now I add this constraint as a non-long type (f.e. a simple string like 'hello'). I expected to receive an exception.
      However the registration succeeds (validation?) and now I try to unregister the node type, or any other JCR action, Modeshape completely blocks due to the NumberFormatException. I believe the registration of the node type should fail.

      java.lang.NumberFormatException: For input string: "fqdsf"  
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)  
        at java.lang.Long.parseLong(Long.java:410)  
        at java.lang.Long.parseLong(Long.java:468)  
        at org.modeshape.jcr.JcrPropertyDefinition$LongConstraintChecker.parseValue(JcrPropertyDefinition.java:846)  
        at org.modeshape.jcr.JcrPropertyDefinition$LongConstraintChecker.parseValue(JcrPropertyDefinition.java:826)  
        at org.modeshape.jcr.JcrPropertyDefinition$RangeConstraintChecker.parseValueConstraint(JcrPropertyDefinition.java:692)  
        at org.modeshape.jcr.JcrPropertyDefinition$RangeConstraintChecker.<init>(JcrPropertyDefinition.java:620)  
        at org.modeshape.jcr.JcrPropertyDefinition$LongConstraintChecker.<init>(JcrPropertyDefinition.java:831)  
        at org.modeshape.jcr.JcrPropertyDefinition.createChecker(JcrPropertyDefinition.java:470)  
        at org.modeshape.jcr.JcrPropertyDefinition.getMinimumValue(JcrPropertyDefinition.java:332)  
        at org.modeshape.jcr.NodeTypeSchemata.addAllNodesTable(NodeTypeSchemata.java:230)  
        at org.modeshape.jcr.NodeTypeSchemata.<init>(NodeTypeSchemata.java:138)  
        at org.modeshape.jcr.RepositoryNodeTypeManager.getRepositorySchemata(RepositoryNodeTypeManager.java:293)  
        at org.modeshape.jcr.JcrRepository$RepositoryMonitorFactory.indexingMonitor(JcrRepository.java:1917)  
        at org.modeshape.jcr.JcrRepository$RepositoryMonitorFactory.createMonitor(JcrRepository.java:1912)  
        at org.modeshape.jcr.txn.Transactions.newMonitor(Transactions.java:243)  
        at org.modeshape.jcr.txn.SynchronizedTransactions$SynchronizedTransaction.<init>(SynchronizedTransactions.java:165)  
        at org.modeshape.jcr.txn.SynchronizedTransactions.begin(SynchronizedTransactions.java:77)  
        at org.modeshape.jcr.cache.RepositoryCache.runInTransaction(RepositoryCache.java:468)  
        at org.modeshape.jcr.cache.RepositoryCache.workspace(RepositoryCache.java:836)  
        at org.modeshape.jcr.cache.RepositoryCache.getWorkspaceCache(RepositoryCache.java:1047)  
        at org.modeshape.jcr.JcrSession.<init>(JcrSession.java:180)  
        at org.modeshape.jcr.JcrXaSession.<init>(JcrXaSession.java:49)  
        at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:693)  
        at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:155)  
        at be.admb.jcr.modeshape.manager.jcr.impl.JcrSessionFactory.getSession(JcrSessionFactory.java:77)  
        at be.admb.jcr.modeshape.manager.jcr.util.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:77)  
        at be.admb.jcr.modeshape.manager.jcr.util.SessionFactoryUtils.getSession(SessionFactoryUtils.java:109)  
        at be.admb.jcr.modeshape.manager.jcr.impl.JcrTemplate.execute(JcrTemplate.java:77)  
        at be.admb.jcr.modeshape.manager.dao.impl.JcrDaoImpl.getCompleteNode(JcrDaoImpl.java:77)  
        at be.admb.jcr.modeshape.manager.service.impl.JcrServiceImpl.getNode(JcrServiceImpl.java:67)  
      

      I believe this issue is not only applied on the LONG type but also other types. I think the validation is the issue.

      A data wipe is neccesary to let Modeshape run again.
      Reproducible log and error in unit test using file system, directory gets cleaned up after every tearDown.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            bjornbal Bjorn Bal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: