Repository: gora Updated Branches: refs/heads/master b167b3aca -> b6d3e614f
GORA-352 - Need to handle MalformedURLException when gora-hbase-mapping.xml file is missing Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/b6d3e614 Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/b6d3e614 Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/b6d3e614 Branch: refs/heads/master Commit: b6d3e614f9634141c17ea7ed0de6dcc0f837891a Parents: b167b3a Author: Alfonso Nishikawa <[email protected]> Authored: Fri Aug 29 22:16:23 2014 -0100 Committer: Alfonso Nishikawa <[email protected]> Committed: Fri Aug 29 22:16:23 2014 -0100 ---------------------------------------------------------------------- .../main/java/org/apache/gora/hbase/store/HBaseStore.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/b6d3e614/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java ---------------------------------------------------------------------- diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java index c5671b9..3400a34 100644 --- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java +++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java @@ -22,6 +22,8 @@ import static org.apache.gora.hbase.util.HBaseByteInterface.toBytes; import java.io.FileNotFoundException; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -788,6 +790,14 @@ implements Configurable { LOG.error("KeyClass in gora-hbase-mapping is not the same as the one in the databean."); } } + } catch (MalformedURLException ex) { + LOG.error("Error while trying to read the mapping file {}. " + + "Expected to be in the classpath " + + "(ClassLoader#getResource(java.lang.String)).", + filename) ; + LOG.error("Actual classpath = {}", Arrays.asList( + ((URLClassLoader) getClass().getClassLoader()).getURLs())); + throw ex ; } catch(IOException ex) { LOG.error(ex.getMessage()); LOG.error(ex.getStackTrace().toString());
