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

Consistent Return Statements from Certain NodeUtil Methods

    XMLWordPrintable

Details

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

    Description

      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 "";
              }
          }
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:

                  Checklists

                    Task DoD