Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-beta1, 2.9.1
    • fs/oss
    • None

    Description

      In AliyunOSSFileSystemStore::initialize(), it retrieves the endPoint and using empty string as a default value.

          String endPoint = conf.getTrimmed(ENDPOINT_KEY, "");
      

      The plain value without validation is passed to OSSClient. If the endPoint is not provided (empty string) or the endPoint is not valid, users will get exception from Aliyun OSS sdk with raw exception message like:

      java.lang.IllegalArgumentException: java.net.URISyntaxException: Expected authority at index 8: https://
      
      	at com.aliyun.oss.OSSClient.toURI(OSSClient.java:359)
      	at com.aliyun.oss.OSSClient.setEndpoint(OSSClient.java:313)
      	at com.aliyun.oss.OSSClient.<init>(OSSClient.java:297)
      	at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystemStore.initialize(AliyunOSSFileSystemStore.java:134)
      	at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem.initialize(AliyunOSSFileSystem.java:272)
      	at org.apache.hadoop.fs.aliyun.oss.AliyunOSSTestUtils.createTestFileSystem(AliyunOSSTestUtils.java:63)
      	at org.apache.hadoop.fs.aliyun.oss.TestAliyunOSSFileSystemContract.setUp(TestAliyunOSSFileSystemContract.java:47)
      	at junit.framework.TestCase.runBare(TestCase.java:139)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at junit.framework.TestSuite.runTest(TestSuite.java:255)
      	at junit.framework.TestSuite.run(TestSuite.java:250)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      Caused by: java.net.URISyntaxException: Expected authority at index 8: https://
      	at java.net.URI$Parser.fail(URI.java:2848)
      	at java.net.URI$Parser.failExpecting(URI.java:2854)
      	at java.net.URI$Parser.parseHierarchical(URI.java:3102)
      	at java.net.URI$Parser.parse(URI.java:3053)
      	at java.net.URI.<init>(URI.java:588)
      	at com.aliyun.oss.OSSClient.toURI(OSSClient.java:357)
      

      Let's check endPoint is not null or empty, catch the IllegalArgumentException and log it, wrapping the exception with clearer message stating the misconfiguration in endpoint or credentials.

      Attachments

        1. HADOOP-14194.000.patch
          1 kB
          Genmao Yu
        2. HADOOP-14194.001.patch
          1.0 kB
          Genmao Yu

        Activity

          People

            uncleGen Genmao Yu
            liuml07 Mingliang Liu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: