Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-233

addClass with DefaultPackage opens addPackage to null arguments

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-beta-4
    • Component/s: None
    • Labels:
      None

      Description

      When adding a Class in addClass, we do a addPackage with a Filter to match inner classes of that class.

      When adding a Class in Default package, the Package we padd to addPackage is null. Meaning addPackage can't verify non null values.

      The downside is, if someone happens to add, e.g.
      addPakcage(true, Package.get("some-missing-package")), addPackage will be called with null, and null means /, which means all found packages are added.

      We need to split addPackage(boolean, Filter, Package...) into two methods, one external which does the null checks from the user and one internal that does not check for null(to support Class in default package).

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            iapazmino Iván Pazmiño added a comment -

            Hello, I've been checking this issue and believe the problem starts in Package.getPackage(String packageName) not making any difference between the default package and a non existent package. So it's necessary to make this difference in the base class-container implementation.

            So, I set non existent package to null and default package to empty string. The external method you mention I labeled it as addDefaultPackage, so a null package outside this method is taken as a non existent package.

            I've commited the changes to this branch https://github.com/iapazmino/shrinkwrap/tree/SHRINKWRAP-233 so you may take a look. Any changes you need just let me know.

            Show
            iapazmino Iván Pazmiño added a comment - Hello, I've been checking this issue and believe the problem starts in Package.getPackage(String packageName) not making any difference between the default package and a non existent package. So it's necessary to make this difference in the base class-container implementation. So, I set non existent package to null and default package to empty string. The external method you mention I labeled it as addDefaultPackage, so a null package outside this method is taken as a non existent package. I've commited the changes to this branch https://github.com/iapazmino/shrinkwrap/tree/SHRINKWRAP-233 so you may take a look. Any changes you need just let me know.
            Show
            alrubinger Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/shrinkwrap/commit/bae88c50e5d27cfde088de84fa8517c0658a07de

              People

              • Assignee:
                iapazmino Iván Pazmiño
                Reporter:
                aslak Aslak Knutsen
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development