Index: org/w3c/css/css/StyleSheetGenerator.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator.java,v retrieving revision 1.19 diff -u -r1.19 StyleSheetGenerator.java --- org/w3c/css/css/StyleSheetGenerator.java 10 Dec 2008 15:10:15 -0000 1.19 +++ org/w3c/css/css/StyleSheetGenerator.java 19 Jan 2009 22:27:22 -0000 @@ -58,8 +58,7 @@ URL url; availableFormat = new Utf8Properties(); try { - url = Messages.adjustURL(StyleSheetGenerator.class.getResource("format.properties")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = StyleSheetGenerator.class.getResourceAsStream("format.properties"); availableFormat.load(f); f.close(); } catch (Exception e) { @@ -69,8 +68,7 @@ availablePropertiesURL = new Utf8Properties(); try { - url = Messages.adjustURL(StyleSheetGenerator.class.getResource("urls.properties")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = StyleSheetGenerator.class.getResourceAsStream("urls.properties"); availablePropertiesURL.load(f); f.close(); } catch (Exception e) { Index: org/w3c/css/util/Messages.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/Messages.java,v retrieving revision 1.22 diff -u -r1.22 Messages.java --- org/w3c/css/util/Messages.java 10 Dec 2008 15:25:52 -0000 1.22 +++ org/w3c/css/util/Messages.java 19 Jan 2009 22:27:23 -0000 @@ -163,8 +163,7 @@ static { Utf8Properties tmp; try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.de")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.de"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -184,8 +183,7 @@ // ------------------------------------------------ try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.en")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.en"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -202,8 +200,7 @@ // ------------------------------------------------ try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.es")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.es"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -221,8 +218,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.fr")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.fr"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -240,8 +236,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.ko")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ko"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -258,8 +253,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.it")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.it"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -276,8 +270,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.nl")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.nl"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -294,8 +287,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.ja")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ja"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -312,8 +304,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.pl-PL")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pl-PL"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -332,8 +323,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.pt-BR")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pt-BR"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -351,8 +341,7 @@ } // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.ru")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ru"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -368,8 +357,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.sv")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.sv"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -386,8 +374,7 @@ // ----------------------- try { - URL url = adjustURL(Messages.class.getResource("Messages.properties.zh-cn")); - java.io.InputStream f = url.openStream(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.zh-cn"); try { tmp = new Utf8Properties(); tmp.load(f); @@ -404,21 +391,4 @@ } } - - /** - * This method is called to clean the URL - * /path/to/file will , file://localhost/path/to/file, file://C:\path\to\file, ... - * will become file:///path/to/file - * @param resource, the URL to "clean" - * @return the clean URL - * @throws MalformedURLException - */ - public static URL adjustURL(URL resource) throws MalformedURLException { - String urlStr = resource.getFile(); - if (urlStr.startsWith("file://")) - urlStr.replaceFirst("file://localhost", "file://"); - else - urlStr = "file:///" + urlStr; - return new URL(urlStr); - } }