You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2019/08/13 09:18:06 UTC
[cayenne] branch master updated: CAY-2605 Modeler: Unable to save -
java.nio.file.InvalidPathException
This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new fd1510e CAY-2605 Modeler: Unable to save - java.nio.file.InvalidPathException
fd1510e is described below
commit fd1510e5088118da5723d7b82eb3e8306f2c9422
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Aug 13 12:17:56 2019 +0300
CAY-2605 Modeler: Unable to save - java.nio.file.InvalidPathException
---
RELEASE-NOTES.txt | 1 +
.../main/java/org/apache/cayenne/gen/xml/CgenConfigHandler.java | 9 ++++++++-
.../main/java/org/apache/cayenne/gen/xml/CgenSaverDelegate.java | 9 ++++++++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 022aa80..47cf85c 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -77,6 +77,7 @@ CAY-2595 ObjAttributes are not sorted in alphabetical ordering on save
CAY-2596 DbImport xml config changes after dbImport plugin task execution
CAY-2601 Modeler DbImport: result dialog issues
CAY-2603 NPE reloading project in the model
+CAY-2605 Modeler: Unable to save - java.nio.file.InvalidPathException
----------------------------------
Release: 4.1.B1
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenConfigHandler.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenConfigHandler.java
index d84dfb2..6a80f91 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenConfigHandler.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenConfigHandler.java
@@ -18,11 +18,13 @@
****************************************************************/
package org.apache.cayenne.gen.xml;
+import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.configuration.xml.DataChannelMetaData;
import org.apache.cayenne.configuration.xml.NamespaceAwareNestedTagHandler;
import org.apache.cayenne.gen.CgenConfiguration;
@@ -259,7 +261,12 @@ public class CgenConfigHandler extends NamespaceAwareNestedTagHandler{
private Path buildRootPath(DataMap dataMap) {
URL url = dataMap.getConfigurationSource().getURL();
- Path resourcePath = Paths.get(url.getPath());
+ Path resourcePath;
+ try {
+ resourcePath = Paths.get(url.toURI());
+ } catch (URISyntaxException e) {
+ throw new CayenneRuntimeException("Unable to read cgen path", e);
+ }
if(Files.isRegularFile(resourcePath)) {
resourcePath = resourcePath.getParent();
}
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenSaverDelegate.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenSaverDelegate.java
index 75d63ce..fc75f06 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenSaverDelegate.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/xml/CgenSaverDelegate.java
@@ -18,11 +18,13 @@
****************************************************************/
package org.apache.cayenne.gen.xml;
+import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.configuration.xml.DataChannelMetaData;
import org.apache.cayenne.gen.CgenConfiguration;
import org.apache.cayenne.map.DataMap;
import org.apache.cayenne.project.extension.BaseSaverDelegate;
+import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -56,7 +58,12 @@ public class CgenSaverDelegate extends BaseSaverDelegate{
Path prevPath = cgenConfiguration.buildPath();
URL url = getBaseDirectory().getURL();
if(url != null) {
- Path resourcePath = Paths.get(url.getPath());
+ Path resourcePath;
+ try {
+ resourcePath = Paths.get(url.toURI());
+ } catch (URISyntaxException e) {
+ throw new CayenneRuntimeException("Unable to resolve output path", e);
+ }
if(Files.isRegularFile(resourcePath)) {
resourcePath = resourcePath.getParent();
}