Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-5075

MavenProject.getParent throws undocumented ISE

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.2.1
    • Component/s: Embedding
    • Labels:
      None
    • Complexity:
      Intermediate
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      http://bugzilla-attachments-197994.netbeans.org/bugzilla/attachment.cgi?id=107899 shows a stack trace encountered when calling MavenProject.getParent on a project with some errors (probably POMs missing in the local repository).

      This method has no Javadoc comment, so it is hard to know exactly what it is permitted/supposed to do, but hasParent implies that null is a valid return value, and there is no throws IllegalStateException clause. The attached patch brings the behavior in line with that signature. (I think I got the PlexusTestCase infrastructure working with all the required wiring but it may be possible to simplify the test case.)

      Cleaner might be to just declare getParent (and also hasParent?) to throw ProjectBuildingException, though this would be a source-incompatible change. (Only binary-incompatible for clients which are already catching IllegalStateException!)

        Activity

          People

          • Assignee:
            Stephen Connolly
            Reporter:
            Jesse Glick
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: