Skip to content

Commit 9784974

Browse files
committed
fixed script move/rename issue
1 parent c90b821 commit 9784974

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptMoveServlet.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import com.cognifide.apm.core.Property;
2424
import com.cognifide.apm.core.endpoints.response.ResponseEntity;
2525
import com.cognifide.apm.core.endpoints.utils.RequestProcessor;
26-
import com.cognifide.apm.core.scripts.ScriptStorageException;
2726
import com.cognifide.apm.core.scripts.ScriptStorageImpl;
2827
import com.day.cq.commons.jcr.JcrConstants;
2928
import com.day.cq.commons.jcr.JcrUtil;
3029
import java.io.IOException;
3130
import java.util.ArrayList;
3231
import java.util.List;
3332
import java.util.regex.Pattern;
33+
import java.util.stream.Collectors;
3434
import javax.jcr.Session;
3535
import javax.servlet.Servlet;
3636
import org.apache.commons.lang3.StringUtils;
@@ -118,7 +118,9 @@ private void validate(String path, String name) {
118118
containsExtension(name) ? SCRIPT_PATTERN : FOLDER_PATTERN);
119119
ScriptStorageImpl.ensurePropertyMatchesPattern(validationErrors, "destination", path, DESTINATION_PATTERN);
120120
if (!validationErrors.isEmpty()) {
121-
throw new ScriptStorageException("Script errors", validationErrors);
121+
String message = validationErrors.stream()
122+
.collect(Collectors.joining("\n", "Validation errors:\n", ""));
123+
throw new RuntimeException(message);
122124
}
123125
}
124126
}

0 commit comments

Comments
 (0)