Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-352

Need to handle MalformedURLException when gora-hbase-mapping.xml file is missing

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 0.4
    • 0.5
    • gora-hbase
    • A custom Gora 0.4 irrelevant for the improvement (but maybe for the stacktrace)

    Description

      This line of HBaseStore throws the following exception:

      Stacktrace
      org.apache.gora.util.GoraException: java.lang.RuntimeException: java.net.MalformedURLException
      at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:174)
      at org.apache.gora.store.DataStoreFactory.getDataStore(DataStoreFactory.java:285)
      at org.apache.gora.pig.GoraStorageTest.setUpBeforeClass(GoraStorageTest.java:59)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
      Caused by: java.lang.RuntimeException: java.net.MalformedURLException
      at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:133)
      at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:109)
      at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:168)
      ... 24 more
      Caused by: java.net.MalformedURLException
              at java.net.URL.<init>(URL.java:619)
              at java.net.URL.<init>(URL.java:482)
              at java.net.URL.<init>(URL.java:431)
              at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
              at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
              at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
              at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518)
              at org.jdom.input.SAXBuilder.build(SAXBuilder.java:865)
              at org.apache.gora.hbase.store.HBaseStore.readMapping(HBaseStore.java:656)
              at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:116)
              ... 26 more
      Caused by: java.lang.NullPointerException
              at java.net.URL.<init>(URL.java:524)
              ... 39 more
      

      The objetive is to catch MalformedURLException and log a better message showing what expected file was not found.

      Attachments

        1. GORA-352v2.patch
          1 kB
          alfonso.nishikawa
        2. GORA-352v1.patch
          1 kB
          alfonso.nishikawa

        Activity

          Hi alfonso.nishikawa, which version do you want to fix this for? We have 4 issues for 0.5 remaining. If you want to add this then by all means please do. Can you assign it a version to clean up Jira please?

          lewismc Lewis John McGibbney added a comment - Hi alfonso.nishikawa , which version do you want to fix this for? We have 4 issues for 0.5 remaining. If you want to add this then by all means please do. Can you assign it a version to clean up Jira please?

          Hi, lewismc, I will try to release a fix soon Thanks por the bump! I set it for 0.5

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited Hi, lewismc , I will try to release a fix soon Thanks por the bump! I set it for 0.5

          Trivial patch
          Can find applied on https://github.com/alfonsonishikawa/gora/tree/GORA-352

          If ok, I will submit a pull request to master.

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited Trivial patch Can find applied on https://github.com/alfonsonishikawa/gora/tree/GORA-352 If ok, I will submit a pull request to master.

          First proposal patch. Trivial.

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited First proposal patch. Trivial.
          hsaputra Henry Saputra added a comment -

          +1 ship it

          hsaputra Henry Saputra added a comment - +1 ship it

          I am OK with logging the entire classpath as it is a major issue when the mapping cannot be read and logging the entire classpath will highlight that this is major.
          Thanks Alfosno.
          ship it

          lewismc Lewis John McGibbney added a comment - I am OK with logging the entire classpath as it is a major issue when the mapping cannot be read and logging the entire classpath will highlight that this is major. Thanks Alfosno. ship it

          Thanks for the feedback Tomorrow I will add that of showing the classpath.

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited Thanks for the feedback Tomorrow I will add that of showing the classpath.

          Sorry for the delay
          I attached a patch that will show the classpath when the exception is thrown. I have clear doubts when I use ((URLClassLoader) getClass().getClassLoader()).getURLs(). Is there other better ways to do this? Will getClassLoader() always return an URLClassLoader instance?

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited Sorry for the delay I attached a patch that will show the classpath when the exception is thrown. I have clear doubts when I use ((URLClassLoader) getClass().getClassLoader()).getURLs() . Is there other better ways to do this? Will getClassLoader() always return an URLClassLoader instance?

          Commit when you can please alfonso.nishikawa, I would like to try and push 0.5 soon whilst I have energy and appetite

          lewismc Lewis John McGibbney added a comment - Commit when you can please alfonso.nishikawa , I would like to try and push 0.5 soon whilst I have energy and appetite

          Commited b167b3a..b6d3e61 master -> master

          alfonsonishikawa Alfonso Nishikawa Muñumer added a comment - - edited Commited b167b3a..b6d3e61 master -> master
          hudson Hudson added a comment -

          FAILURE: Integrated in gora-trunk #1198 (See https://builds.apache.org/job/gora-trunk/1198/)
          GORA-352 - Need to handle MalformedURLException when gora-hbase-mapping.xml file is missing (alfonso.nishikawa: rev b6d3e614f9634141c17ea7ed0de6dcc0f837891a)

          • gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
          hudson Hudson added a comment - FAILURE: Integrated in gora-trunk #1198 (See https://builds.apache.org/job/gora-trunk/1198/ ) GORA-352 - Need to handle MalformedURLException when gora-hbase-mapping.xml file is missing (alfonso.nishikawa: rev b6d3e614f9634141c17ea7ed0de6dcc0f837891a) gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java

          People

            alfonsonishikawa Alfonso Nishikawa Muñumer
            alfonsonishikawa Alfonso Nishikawa Muñumer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 5h
                5h