From common-issues-return-153330-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Jun 6 06:18:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 377E6180674 for ; Wed, 6 Jun 2018 06:18:06 +0200 (CEST) Received: (qmail 28424 invoked by uid 500); 6 Jun 2018 04:18:05 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 28413 invoked by uid 99); 6 Jun 2018 04:18:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2018 04:18:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A28171A1A8D for ; Wed, 6 Jun 2018 04:18:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id SKgNPkFf-p4r for ; Wed, 6 Jun 2018 04:18:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 000255F1EE for ; Wed, 6 Jun 2018 04:18:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D789BE0E87 for ; Wed, 6 Jun 2018 04:18:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 34E6621099 for ; Wed, 6 Jun 2018 04:18:00 +0000 (UTC) Date: Wed, 6 Jun 2018 04:18:00 +0000 (UTC) From: "Xiao Chen (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HADOOP-15217) FsUrlConnection does not handle paths with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-15217?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiao Chen updated HADOOP-15217: ------------------------------- Summary: FsUrlConnection does not handle paths with spaces (was: org.a= pache.hadoop.fs.FsUrlConnection does not handle paths with spaces) > FsUrlConnection does not handle paths with spaces > ------------------------------------------------- > > Key: HADOOP-15217 > URL: https://issues.apache.org/jira/browse/HADOOP-15217 > Project: Hadoop Common > Issue Type: Bug > Components: fs > Affects Versions: 3.0.0 > Reporter: Joseph Fourny > Assignee: Zsolt Venczel > Priority: Major > Attachments: HADOOP-15217.01.patch, HADOOP-15217.02.patch, HADOOP= -15217.03.patch, HADOOP-15217.04.patch, HADOOP-15217.05.patch, HADOOP-15217= .06.patch, TestCase.java > > > When=C2=A0_FsUrlStreamHandlerFactory_ is registered with _java.net.URL_ (= ex: when Spark is initialized), it breaks URLs with spaces (even though the= y are properly URI-encoded). I traced the problem down to _FSUrlConnection.= connect()_ method.=C2=A0It naively gets the path from the URL, which contai= ns encoded spaces, and pases it to _org.apache.hadoop.fs.Path(String)_ cons= tructor. This is not correct, because the docs clearly say that the string = must NOT be encoded. Doing so causes double encoding within the Path class = (ie: %20 becomes=C2=A0%2520).=C2=A0 > See attached JUnit test.=C2=A0 > This test case mimics an issue I ran into when trying to use Commons Conf= iguration 1.9 AFTER initializing Spark. Commons Configuration uses URL clas= s to load configuration files, but Spark installs=C2=A0_FsUrlStreamHandlerF= actory_, which hits this issue. For now, we are using an AspectJ aspect to = "patch" the bytecode at load time to work-around the issue.=C2=A0 > The real fix is quite simple. All you need to do is replace this line in= =C2=A0_org.apache.hadoop.fs.FsUrlConnection.connect()_: > =C2=A0 =C2=A0 =C2=A0 =C2=A0is =3D fs.open(new Path(url.getPath())); > with this line: > =C2=A0 =C2=A0 =C2=A0is =3D fs.open(new Path(url.*toUri()*.getPath())); > URI.getPath() will correctly decode the path, which is what is expected b= y=C2=A0_org.apache.hadoop.fs.Path(String)_=C2=A0constructor. > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org