Mingliang Liu created HADOOP-14194:
--------------------------------------
Summary: Alyun OSS should not use empty endpoint as default
Key: HADOOP-14194
URL: https://issues.apache.org/jira/browse/HADOOP-14194
Project: Hadoop Common
Issue Type: Bug
Components: fs/oss
Reporter: Mingliang Liu
Assignee: Xiaobing Zhou
In {{AliyunOSSFileSystemStore::initialize()}}, it retrieves the endPoint and
using empty string as a default value.
{code}
String endPoint = conf.getTrimmed(ENDPOINT_KEY, "");
{code}
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:
{code}
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)
{code}
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.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]