Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-7226

Consistent Return Statements from Certain NodeUtil Methods

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None

      The catch block for getNodeIdentifierIfPossible(Node content) and getNodePathIfPossible(Node node) both return “<not available>” . To keep things consistent, it is preferred to have these two catch blocks be similar to that of the getPathIfPossible(Node node) method, where it returns the empty string or null instead of “<not available>".

      See below for the code:

         public static String getNodeIdentifierIfPossible(Node content) {
              try {
                  return content.getIdentifier();
              } catch (RepositoryException e) {
                  return "<not available>";
              }
          }
      
          public static String getNodePathIfPossible(Node node) {
              try {
                  return node.getPath();
              } catch (RepositoryException e) {
                  return "<not available>";
              }
          }
      
          public static String getPathIfPossible(Node node) {
              try {
                  return node.getPath();
              } catch (RepositoryException e) {
                  log.error("Failed to get handle: {}", e.getMessage(), e);
                  return "";
              }
          }
      

        Acceptance criteria

              Unassigned Unassigned
              jnodarse Julian Nodarse
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:

                  Task DoD