cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [1/2] git commit: Better messaging on URI failure on cassandra.config Patch by Josh McKenzie; review by Lyuben Todorov for CASSANDRA-7398
Date Thu, 07 Aug 2014 17:07:19 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk f92ae20a8 -> 32358d646


Better messaging on URI failure on cassandra.config
Patch by Josh McKenzie; review by Lyuben Todorov for CASSANDRA-7398


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/756c85e8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/756c85e8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/756c85e8

Branch: refs/heads/trunk
Commit: 756c85e86fc9e2de492c23c3e6c10e4b4511293a
Parents: 319eeab
Author: Joshua McKenzie <Josh.McKenzie@datastax.com>
Authored: Thu Aug 7 12:05:40 2014 -0500
Committer: Joshua McKenzie <Josh.McKenzie@datastax.com>
Committed: Thu Aug 7 12:05:40 2014 -0500

----------------------------------------------------------------------
 .../apache/cassandra/config/YamlConfigurationLoader.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/756c85e8/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
index 4a1280c..78621f2 100644
--- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
+++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.config;
 
 import java.beans.IntrospectionException;
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
@@ -66,7 +67,13 @@ public class YamlConfigurationLoader implements ConfigurationLoader
             ClassLoader loader = DatabaseDescriptor.class.getClassLoader();
             url = loader.getResource(configUrl);
             if (url == null)
-                throw new ConfigurationException("Cannot locate " + configUrl);
+            {
+                String required = "file:" + File.separator + File.separator;
+                if (!configUrl.startsWith(required))
+                    throw new ConfigurationException("Expecting URI in variable: [cassandra.config].
 Please prefix the file with " + required + File.separator +
+                            " for local files or " + required + "<server>" + File.separator
+ " for remote files.  Aborting.");
+                throw new ConfigurationException("Cannot locate " + configUrl + ".  If this
is a local file, please confirm you've provided " + required + File.separator + " as a URI
prefix.");
+            }
         }
 
         return url;


Mime
View raw message