< prev index next >
src/java.xml.bind/share/classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 45,57 ****
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
! import java.io.File;
! import java.io.Reader;
! import java.net.MalformedURLException;
import java.net.URL;
/**
* Partial default {@code Unmarshaller} implementation.
*
--- 45,55 ----
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
! import java.io.*;
import java.net.URL;
/**
* Partial default {@code Unmarshaller} implementation.
*
*** 176,195 ****
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "file" ) );
}
try {
! // copied from JAXP
! String path = f.getAbsolutePath();
! if (File.separatorChar != '/')
! path = path.replace(File.separatorChar, '/');
! if (!path.startsWith("/"))
! path = "/" + path;
! if (!path.endsWith("/") && f.isDirectory())
! path = path + "/";
! return unmarshal(new URL("file", "", path));
! } catch( MalformedURLException e ) {
throw new IllegalArgumentException(e.getMessage());
}
}
public final Object unmarshal( java.io.InputStream is )
--- 174,185 ----
throw new IllegalArgumentException(
Messages.format( Messages.MUST_NOT_BE_NULL, "file" ) );
}
try {
! return unmarshal(new BufferedInputStream(new FileInputStream(f)));
! } catch( FileNotFoundException e ) {
throw new IllegalArgumentException(e.getMessage());
}
}
public final Object unmarshal( java.io.InputStream is )
< prev index next >