• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
WOXMLDecoder no protocol error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WOXMLDecoder no protocol error


  • Subject: WOXMLDecoder no protocol error
  • From: Victor Tsang <email@hidden>
  • Date: Fri, 15 May 2009 12:05:49 +0800

Hi,

I am studying the WOXMLCoding interface. I create a pure java application in Eclipse with the testing code below. The decoding is always failed with a strange "no protocol" error. It seems that the WOXMLDecoder can't decode the NSMutableDictionary... but it is very unreasonable to me...

I have no idea on fixing it... Any clue?



Test code fragment:

    NSMutableDictionary d=new NSMutableDictionary();
    d.setObjectForKey("value 1","key1");
    d.setObjectForKey("value 2","key2");
    d.setObjectForKey("value 3","key3");

 

    NSTimestamp start=NSTimestamp.DistantPast, finish=NSTimestamp.DistantPast;
    String xml=null;

    

    start=new NSTimestamp();
    xml=WOXMLCoder.coder().encodeRootObjectForKey(d,"dictionary");
    finish=new NSTimestamp();
    System.out.println("encode ok. time required = "+(finish.getTime()-start.getTime())+"ms.");

    finish=NSTimestamp.DistantPast;
    d=null;
    try
    {
      start=new NSTimestamp();
      d=(NSMutableDictionary)WOXMLDecoder.decoder().decodeRootObject(xml);
      finish=new NSTimestamp();
    }
    catch(Exception ex)
    {
      ex.printStackTrace(System.out);
    }
    System.out.println("decode ok. time required = "+(finish.getTime()-start.getTime())+"ms.");
    System.out.println("decoded dictionary = "+d);


The test is always failed with a strange "no protocol" error.


encode ok. time required = 26ms.
: com.webobjects.appserver.xml.WOXMLException [java.net.MalformedURLException] no protocol: <dictionary type="com.webobjects.foundation.NSMutableDictionary" objectID="1">
<key1 type="java.lang.String" objectID="2">value 1</key1>
<key2 type="java.lang.String" objectID="3">value 2</key2>
<key3 type="java.lang.String" objectID="4">value 3</key3>
</dictionary>
:java.net.MalformedURLException: no protocol: <dictionary type="com.webobjects.foundation.NSMutableDictionary" objectID="1">
<key1 type="java.lang.String" objectID="2">value 1</key1>
<key2 type="java.lang.String" objectID="3">value 2</key2>
<key3 type="java.lang.String" objectID="4">value 3</key3>
</dictionary>

at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObjectWithXMLReader(WOXMLDecoder.java:811)
at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObject(WOXMLDecoder.java:768)
at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObject(WOXMLDecoder.java:732)
at com.hkt.qmanager.calldata.LoadTest02.testTheLoadTest(LoadTest02.java:174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.net.MalformedURLException: no protocol: <dictionary type="com.webobjects.foundation.NSMutableDictionary" objectID="1">
<key1 type="java.lang.String" objectID="2">value 1</key1>
<key2 type="java.lang.String" objectID="3">value 2</key2>
<key3 type="java.lang.String" objectID="4">value 3</key3>
</dictionary>

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 org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObjectWithXMLReader(WOXMLDecoder.java:806)
... 22 more
decode ok. time required = -63368279640178ms.
decoded dictionary = null




Victor Tsang
email@hidden
http://www.villeo.com



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: WOXMLDecoder no protocol error
      • From: Anjo Krank <email@hidden>
  • Prev by Date: Re: Curly Generics Question - Update
  • Next by Date: Re: WOXMLDecoder no protocol error
  • Previous by thread: Re: Curly Generics Question - Update
  • Next by thread: Re: WOXMLDecoder no protocol error
  • Index(es):
    • Date
    • Thread