8 Replies Latest reply on Feb 15, 2010 2:04 PM by lightguard

    Illegal path

    germanescobar
      What should happen if a user has, for example, an archive with a single entry "/test.properties" and then he adds another asset to "/test.properties/another/test2.properties". A IllegalArgumentException? Maybe we can create an IllegalPathException?
        • 1. Re: Illegal path
          alrubinger

          Sure.

           

          PathExistsException extends IllegalArgumentException?

           

          S,

          ALR

          • 2. Re: Illegal path
            aslak

            You have previously added content to something you're trying to define as a Directory. IllegalPathException sounds better to me.

             

            PathExistsException sounds more like something you would get from adding content to the same Path twice, which we now ignore and always let you overwrite. (unless we want to make this over writable as well, remove the illegal path and create the new one)

            • 3. Re: Illegal path
              alrubinger

              What's illegal about the path though; that it exists, right?   I could even see something extending PathExistsException to a type that denotes (this is already a directory).  Whatever we can cook up with is most descriptive/obvious should be good; "IllegalPath" to me begs the question "why is this illegal?"

               

              S,

              ALR

              • 4. Re: Illegal path
                aslak

                Well if you look at Path alone, the reason is that it exists. But it's Illegal because the Asset there can not have sub paths connected to it..

                 

                Even tho we split Path and Asset, in this case, and in the ArchiveAsset case, they have a connection..

                • 5. Re: Illegal path
                  alrubinger

                  aslak wrote:

                   

                  Well if you look at Path alone, the reason is that it exists. But it's Illegal because the Asset there can not have sub paths connected to it..

                  Right.  So how does "IllegalPathException" convey that to the user?

                   

                  S,

                  ALR

                  • 6. Re: Illegal path
                    aslak

                    IllegalPathAssetCombinationException

                    IllegalSubPathException

                     

                     

                    ?

                     

                     

                    • 7. Re: Illegal path
                      germanescobar
                      I'd say that IllegalPathException is self-explanatory and we would also add a message saying why it is illegal.
                      • 8. Re: Illegal path
                        lightguard

                        ParentPathNotADirectoryException ? Maybe a little too long though.

                         

                        I think the idea is to have the exception name give as much detail about the error as we can reasonably do so the user has a good idea when looking at a stack trace what the problem is.