> On 6 Mar 2017, at 09:10, Simon Scott <simon.sc...@viavisolutions.com> wrote:
> 
> Yes it is. But the registration of the FsUrlStreamHandlerFactory has surely 
> influenced the JDK in some manner?
> 

Not at that point, I don't think. Why not comment out the hadoop code and rerun
'
> -----Original Message-----
> From: Steve Loughran [mailto:ste...@hortonworks.com] 
> Sent: 03 March 2017 21:49
> Cc: common-dev@hadoop.apache.org
> Subject: Re: FsUrlStreamHandlerFactory and Windows file URLs
> 
> That stack trace is coming from the java code before it his Hadoop
> 
>> On 3 Mar 2017, at 13:30, Simon Scott <simon.sc...@viavisolutions.com> wrote:
>> 
>> Apologies if this an old topic, however the following test program:
>> 
>> package com.viavi;
>> 
>> import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
>> 
>> import java.io.File;
>> import java.net.MalformedURLException; import java.net.URI; import 
>> java.net.URISyntaxException; import java.net.URL;
>> 
>> public class Main {
>> 
>>   public static void main(String[] args) {
>>       System.out.println("URI is " + makeURI());
>>       URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
>>       System.out.println("URI is " + makeURI());
>>   }
>> 
>>   private static URI makeURI() {
>>       try {
>>           File file = new File("C:/Users");
>>           final URL url = new URL("file:///" + file.getAbsolutePath());
>>           return url.toURI();   ** HERE**
> 
> 
> Ty creating the URI via File.toURI(); 
> 
> 
> 
> 
>>       } catch (MalformedURLException x) {
>>           x.printStackTrace();
>>           return null;
>>       } catch (URISyntaxException x) {
>>           x.printStackTrace();
>>           return null;
>>       }
>>   }
>> }
>> 
>> gives the following output:
>> 
>> URI is file:/C:/Users
>> URI is null
>> java.net.URISyntaxException: Illegal character in path at index 8: 
>> file:/C:\Users
>>               at java.net.URI$Parser.fail(URI.java:2848)
>>               at java.net.URI$Parser.checkChars(URI.java:3021)
>>               at java.net.URI$Parser.parseHierarchical(URI.java:3105)
>>               at java.net.URI$Parser.parse(URI.java:3053)
>>               at java.net.URI.<init>(URI.java:588)
>>               at java.net.URL.toURI(URL.java:946)
>>               at com.viavi.Main.makeURI(Main.java:23)
>>               at com.viavi.Main.main(Main.java:16)
>>               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:498)
>>               at 
>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
>> 
>> That is, it seems that registering the FsUrlStreamHandlerFactory disrupts 
>> the subsequent creation of Windows "file" URLs.
>> I encountered this on 2.6.5, and have reproduced in 3.0.0 - alpha2.
>> 
>> I believe I have a fair understanding of the root of the issue. Is this of 
>> interest to anybody?
>> 
>> Thanks
>> Simon
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
> For additional commands, e-mail: common-dev-h...@hadoop.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to