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

CND syntax errors not reported by registerNodeTypes()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 2.8.0.Final, 3.0.0.Alpha2
    • 2.7.0.Final
    • JCR
    • None
    • Hide

      With this CND file:

      <local = 'http://local.domain/local'>
      [local:A] mixin
      - local:title (STRING) xx
      

      and this code to load it. No errors are given but no nodes are loaded either.

      JcrEngine engine = null;
      
              try
              {
                  InputStream      myConfigStream = TestLoadCND.class.getClassLoader().getResourceAsStream("modeshape-config.xml");
                  JcrConfiguration config         = new JcrConfiguration().loadFrom(myConfigStream);
                  engine = config.build();
                  engine.start();
      
                  Repository      repository      = engine.getRepository("CPF repository");
                  Session         session         = repository.login();
                  Workspace       workspace       = session.getWorkspace();
                  NodeTypeManager nodeTypeManager = (NodeTypeManager) workspace.getNodeTypeManager();
                  System.out.println("Parse the cnd file");
      
                  InputStream myCndStream = TestLoadCND.class.getClassLoader().getResourceAsStream("syntaxError.cnd");
                  nodeTypeManager.registerNodeTypes(myCndStream, false);
                  System.out.println("File parsed");
                  System.out.println("List the new nodes");
      
                  NodeTypeIterator it = nodeTypeManager.getAllNodeTypes();
      
                  while(it.hasNext())
                  {
                      Object   o  = it.next();
                      NodeType nt = (NodeType) o;
                      printNodeDetails(nt, false);
                  }
              }
              catch(Throwable e)
              {
                  System.out.println("Error parsing cnd: " + e.getMessage());
                  e.printStackTrace();
              }
      
      Show
      With this CND file: <local = 'http://local.domain/local'> [local:A] mixin - local:title (STRING) xx and this code to load it. No errors are given but no nodes are loaded either. JcrEngine engine = null; try { InputStream myConfigStream = TestLoadCND.class.getClassLoader().getResourceAsStream("modeshape-config.xml"); JcrConfiguration config = new JcrConfiguration().loadFrom(myConfigStream); engine = config.build(); engine.start(); Repository repository = engine.getRepository("CPF repository"); Session session = repository.login(); Workspace workspace = session.getWorkspace(); NodeTypeManager nodeTypeManager = (NodeTypeManager) workspace.getNodeTypeManager(); System.out.println("Parse the cnd file"); InputStream myCndStream = TestLoadCND.class.getClassLoader().getResourceAsStream("syntaxError.cnd"); nodeTypeManager.registerNodeTypes(myCndStream, false); System.out.println("File parsed"); System.out.println("List the new nodes"); NodeTypeIterator it = nodeTypeManager.getAllNodeTypes(); while(it.hasNext()) { Object o = it.next(); NodeType nt = (NodeType) o; printNodeDetails(nt, false); } } catch(Throwable e) { System.out.println("Error parsing cnd: " + e.getMessage()); e.printStackTrace(); }

    Description

      When NodeTypeManager.registerNodeTypes() is called with a CND file that contains a syntax error then the error is not reported and no nodes are registered. A full description of the problem is given in this thread

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            bwallis42_jira Brian Wallis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: