commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jzwang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DIGESTER-128) When using Digester parsed a file with a directory that contained chinese charset it will throw java.net.MalformedURLException.
Date Mon, 25 Aug 2008 08:35:45 GMT

    [ https://issues.apache.org/jira/browse/DIGESTER-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625275#action_12625275
] 

jzwang commented on DIGESTER-128:
---------------------------------

I changed my test case as this.
digester.parse("jar:file:/C:/EAS/中文/temp/JZWANG-DESKTOP/1/default145610.jar!/com/sun/faces/standard-html-renderkit.xml");
Now I got the same exception as my real case.  But when I try to use directory name in English
it worked.
So do you think it is a digester issue or other one?
--------------
java.net.MalformedURLException: no protocol: standard-html-renderkit-impl.xml
	at java.net.URL.<init>(URL.java:567)
	at java.net.URL.<init>(URL.java:464)
	at java.net.URL.<init>(URL.java:413)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:968)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:905)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:843)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.startPE(XMLDTDScannerImpl.java:686)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDScannerImpl.java:2065)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:2027)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDInternalSubset(XMLDTDScannerImpl.java:367)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:977)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at org.apache.commons.digester.Digester.parse(Digester.java:1704)
	at SampleDigester.run(SampleDigester.java:43)
	at SampleDigester.main(SampleDigester.java:18)


> When using Digester parsed a file with a directory that contained chinese charset it
will throw java.net.MalformedURLException.
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIGESTER-128
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-128
>             Project: Commons Digester
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Windows XP
> Eclipse 3.2
>            Reporter: jzwang
>            Priority: Critical
>
> When I try to use Digester to parser a file I found if the file is in a directory with
Chinese(such as c:/tmp/中文/datasource.xml) char set it will throw java.net.malformedURLException.
> My code is here.
> -------------------- SampleDigester.java -------------------
> import java.io.IOException;
> import java.util.Hashtable;
> import org.apache.commons.digester.Digester;
> import org.xml.sax.SAXException;
> public class SampleDigester
> {
>   private Hashtable dataSources = new Hashtable();
>   public static void main(String[] args)
>   {
>     SampleDigester sample = new SampleDigester();
>     try
>     {
>       sample.run();
>     }
>     catch(Exception e)
>     {
>       e.printStackTrace();
>     }
>   }
>   public void run() throws IOException, SAXException
>   {
>     Digester digester = new Digester();
>     digester.push(this);
>     digester.addCallMethod("datasources/datasource", "addDataSource", 5 );
>     digester.addCallParam("datasources/datasource/name", 0);
>     digester.addCallParam("datasources/datasource/driver", 1);
>     digester.addCallParam("datasources/datasource/url", 2);
>     digester.addCallParam("datasources/datasource/username", 3);
>     digester.addCallParam("datasources/datasource/password", 4);
> //    digester.parse("datasource.xml"); // ok
>     digester.parse("c:/tmp/中文/datasource.xml"); // failed
> //    digester.parse("c:/tmp/a b/datasource.xml"); // ok
>   }
>   public void addDataSource(String name,
>                             String driver,
>                             String url,
>                             String userName,
>                             String password)
>   {
>     DataSource dataSource = new DataSource(name, driver,url, userName, password);
>     dataSources.put(name, dataSource);
>     System.out.println("DataSource added: " + name);
>   }
> }
> --------------------------- DataSource.java ---------------------
> public class DataSource
> {
>   private String name;
>   private String driver;
>   private String url;
>   private String password;
>   private String userName;
>   public DataSource(String name, String driver, String url, String userName, String password)
>   {
>     this.name = name;
>     this.driver = driver;
>     this.url = url;
>     this.userName = userName;
>     this.password = password;
>   }
>   public String getName()
>   {
>     return name;
>   }
>   public String getDriver()
>   {
>     return driver;
>   }
>   public String getURL()
>   {
>     return url;
>   }
>   public String getPassword()
>   {
>     return password;
>   }
>   public String getUserName()
>   {
>     return userName;
>   }
> }
> --------------------------- DataSource.xml -------------
> <?xml version="1.0"?>
> <datasources>
>   <datasource>
>     <name>HsqlDataSource</name>
>     <driver>org.hsqldb.jdbcDriver</driver>
>     <url>jdbc:hsqldb:hsql://localhost</url>
>     <username>sa</username>
>     <password></password>
>   </datasource>
>   <datasource>
>       <name>OracleDataSource</name>
>       <driver>oracle.jdbc.driver.OracleDriver</driver>
>       <url>jdbc:oracle:thin:@localhost:1521:orcl</url>
>       <username>scott</username>
>       <password>tiger</password>
>   </datasource>
> </datasources>
> ----------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message