From 9bae0e9671dae95407902461da9f9f41e0e135eb Mon Sep 17 00:00:00 2001 From: Yuliya Feldman Date: Fri, 27 Jan 2017 14:49:58 -0800 Subject: [PATCH] TWILL-210 Ability to handle FileSystems that do not have authority --- .../main/java/org/apache/twill/internal/ServiceMain.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java b/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java index 91256c84..727435c9 100644 --- a/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java +++ b/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java @@ -147,7 +147,14 @@ protected static Location createAppLocation(final Configuration conf, String fsU @Override public Location run() throws Exception { Configuration hConf = new Configuration(conf); - URI defaultURI = new URI(appDir.getScheme(), appDir.getAuthority(), null, null, null); + final URI defaultURI; + if (appDir.getAuthority() == null || appDir.getAuthority().isEmpty()) { + // some FileSystems do not have authority. E.g. maprfs or s3 (similar to file:///) + // need to handle URI differently for those + defaultURI = new URI(appDir.getScheme(), "", "/", null, null); + } else { + defaultURI = new URI(appDir.getScheme(), appDir.getAuthority(), null, null, null); + } hConf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultURI.toString()); return new FileContextLocationFactory(hConf).create(appDir); }