cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: more sane error message instead of 'Error loading DataChannel: 'null''
Date Mon, 21 Mar 2016 18:49:25 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master b0631deb2 -> 5c5aa6a40


more sane error message instead of 'Error loading DataChannel: 'null''


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/5c5aa6a4
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/5c5aa6a4
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/5c5aa6a4

Branch: refs/heads/master
Commit: 5c5aa6a402d45f88d849348363d48f0fa388a57d
Parents: b0631de
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Mon Mar 21 21:49:06 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Mon Mar 21 21:49:06 2016 +0300

----------------------------------------------------------------------
 .../server/DataDomainLoadException.java         | 56 ++++++++++----------
 .../server/DataDomainProvider.java              |  4 +-
 2 files changed, 31 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/5c5aa6a4/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainLoadException.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainLoadException.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainLoadException.java
index 34434f0..37b5fc2 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainLoadException.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainLoadException.java
@@ -27,33 +27,33 @@ import org.apache.cayenne.configuration.DataChannelDescriptor;
  */
 public class DataDomainLoadException extends ConfigurationException {
 
-    private ConfigurationTree<DataChannelDescriptor> configurationTree;
-
-    public DataDomainLoadException() {
-    }
-
-    public DataDomainLoadException(String messageFormat, Object... messageArgs) {
-        super(messageFormat, messageArgs);
-    }
-
-    public DataDomainLoadException(
-            ConfigurationTree<DataChannelDescriptor> configurationTree,
-            String messageFormat, Object... messageArgs) {
-        super(messageFormat, messageArgs);
-        this.configurationTree = configurationTree;
-    }
-
-    public DataDomainLoadException(Throwable cause) {
-        super(cause);
-    }
-
-    public DataDomainLoadException(String messageFormat, Throwable cause,
-            Object... messageArgs) {
-        super(messageFormat, cause, messageArgs);
-    }
-
-    public ConfigurationTree<DataChannelDescriptor> getConfigurationTree() {
-        return configurationTree;
-    }
+	private static final long serialVersionUID = 7969847819485380271L;
+	
+	private ConfigurationTree<DataChannelDescriptor> configurationTree;
+
+	public DataDomainLoadException() {
+	}
+
+	public DataDomainLoadException(String messageFormat, Object... messageArgs) {
+		super(messageFormat, messageArgs);
+	}
+
+	public DataDomainLoadException(ConfigurationTree<DataChannelDescriptor> configurationTree,
String messageFormat,
+			Object... messageArgs) {
+		super(messageFormat, messageArgs);
+		this.configurationTree = configurationTree;
+	}
+
+	public DataDomainLoadException(Throwable cause) {
+		super(cause);
+	}
+
+	public DataDomainLoadException(String messageFormat, Throwable cause, Object... messageArgs)
{
+		super(messageFormat, cause, messageArgs);
+	}
+
+	public ConfigurationTree<DataChannelDescriptor> getConfigurationTree() {
+		return configurationTree;
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5c5aa6a4/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
index 4815fe4..0b8ee5d 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
@@ -92,7 +92,9 @@ public class DataDomainProvider implements Provider<DataDomain> {
 		} catch (ConfigurationException e) {
 			throw e;
 		} catch (Exception e) {
-			throw new DataDomainLoadException("Error loading DataChannel: '%s'", e, e.getMessage());
+			String causeMessage = e.getMessage();
+			String message = causeMessage != null && causeMessage.length() > 0 ? causeMessage
: e.getClass().getName();
+			throw new DataDomainLoadException("DataDomain startup failed: %s", e, message);
 		}
 	}
 


Mime
View raw message