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

Modeshape CND Parsing Fails in the Turkish Locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.4.0.Final
    • 5.3.0.Final
    • None
    • None

      Modeshape login fails with the following RepositoryException when running with the default Locale language set to Turkish (tr):

      javax.jcr.RepositoryException: Error while starting 'simple' repository: null
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:631)
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:590)
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:136)
      	at modeshape.TurkishLocaleBug.main(TurkishLocaleBug.java:31)
      Caused by: java.lang.NullPointerException
      	at org.modeshape.jcr.NodeTypes.<init>(NodeTypes.java:321)
      	at org.modeshape.jcr.NodeTypes.with(NodeTypes.java:379)
      	at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:529)
      	at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1132)
      	at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:936)
      	at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:372)
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:629)
      	... 3 more
      

      The NPE is caused by a missing ntUnstructuredType.

      The ntUnstructuredType is missing because the jsr_283_builtins.cnd is failing to parse.

      The parsing failure is getting masked by what looks like a recurrence of MODE-1400. Basically, in JcrRepository fails to check the reported problems of the previous call to importBuiltins at line 1131.

      The parsing failure itself is caused by an unknown token failure on the "multiple" token in the CND file. This is due to the "Turkish Locale Bug" (http://mattryall.net/blog/2009/02/the-infamous-turkish-locale-bug). The lowercase "i" (\u0069) in the Turkish locale does not map to the latin uppercase "I" (\u0049), but to \u0130.

      Hacking a local versions of TokenStream and CndImporter to use String.toLowerCase(Locale.ENGLISH) and String.toUpperCase(Locale.ENGLISH) seem to allow Modeshape to at least startup and seems to work.

      Probably a more thorough review of the Modeshape code base for use of these methods would need to be done to guarantee Modeshape truly works in the Turkish locale.

      Attached is a sample gradle project showing the problem.

              hchiorean Horia Chiorean (Inactive)
              mbachmann Matthew Bachmann (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: