Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-553

Add NameMapper#getOakName that never returns null

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.6
    • core
    • None

    Description

      we keep adding methods that convert a jcrName into an oak-name
      and throw an exception if the value returned by NameMapper#getOakName is
      null. instead of duplicating code i would like to add a second flavor
      of the method that throws if the the jcrName cannot be resolved to an oak
      name.

      i even suspect that most usages of the getOakName call that don't throw
      in case of null-value are susceptible to NPE. but we can still review those
      and possible replace them with the save method call.

      proposed patch for the interface:

      /**
           * Returns the Oak name for the specified JCR name. In contrast to
           * {@link #getOakName(String)} this method will throw a {@code NamespaceException}
           * if the JCR name is invalid and cannot be resolved.
           *
           * @param jcrName The JCR name to be converted.
           * @return A valid Oak name.
           * @throws NamespaceException If the JCR name cannot be resolved.
           */
          @Nonnull
          String getValidOakName(@Nonnull String jcrName) throws NamespaceException;
      

      Attachments

        1. OAK-553_test.patch
          6 kB
          Angela Schreiber
        2. OAK-553.patch
          23 kB
          Angela Schreiber

        Activity

          People

            Unassigned Unassigned
            angela Angela Schreiber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: