public void validateNotSubdirectoryOf(String otherSCMMaterialFolder) {
   String myDirPath = this.getFolder();
   if (myDirPath == null || otherSCMMaterialFolder == null) {
     return;
   }
   File myDir = new File(myDirPath);
   File otherDir = new File(otherSCMMaterialFolder);
   try {
     if (FileUtil.isSubdirectoryOf(myDir, otherDir)) {
       addError(
           FOLDER,
           "Invalid Destination Directory. Every material needs a different destination directory and the directories should not be nested.");
     }
   } catch (IOException e) {
     throw bomb("Dest folder specification is not valid. " + e.getMessage());
   }
 }
Ejemplo n.º 2
0
 public File findArtifact(LocatableEntity locatableEntity, String path)
     throws IllegalArtifactLocationException {
   try {
     File root = chooseExistingRoot(locatableEntity);
     if (root == null) {
       root = preferredRoot(locatableEntity);
     }
     File file = new File(root, path);
     if (!FileUtil.isSubdirectoryOf(root, file)) {
       throw new IllegalArtifactLocationException(
           "Artifact path ["
               + path
               + "] is illegal."
               + " Path must be inside the artifact directory.");
     }
     return file;
   } catch (IOException e) {
     throw new IllegalArtifactLocationException(
         "Artifact path [" + path + "] is illegal." + e.getMessage(), e);
   }
 }