• 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
Help with NSXMLOutputStream/NSSMLInputStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with NSXMLOutputStream/NSSMLInputStream


  • Subject: Help with NSXMLOutputStream/NSSMLInputStream
  • From: Robert Walker <email@hidden>
  • Date: Wed, 14 Dec 2005 11:01:34 -0500

I need to serialize some objects for use in web services and am getting the following exception for this example code:

Error occurs on both Xcode 2.0/WO 5.2.4 and Xcode 2.2/WO 5.3.1...  Simply calling this static method from Application class as a test.  Doesn't seem to matter where it's called: also tried calling it from an action method on Main page.

public static void serialize() {
String fileName = "/tmp/example.xml";
BufferedOutputStream os = null;
NSXMLOutputStream xmlos = null;


try {
// File output stream
os = new BufferedOutputStream(new FileOutputStream(fileName));


// XML output stream
xmlos = new NSXMLOutputStream(os);


// Write the data
xmlos.writeObject("Hello World!");
xmlos.writeInt(5);
} catch (Exception e) {
NSLog.err.appendln("Exception encountered: " + e.getMessage());
if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelCritical)) {
NSLog.debug.appendln(e);
}
  } finally {
try {
// close the streams
xmlos.flush();
xmlos.close();
os.close();
} catch (Exception e) {
NSLog.err.appendln("Exception encountered: " + e.getMessage());
if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelCritical)) {
NSLog.debug.appendln(e);
}
}
}
}

------------------------
Exception:

[2005-12-14 10:56:29 EST] <main> java.lang.NullPointerException
at ProcessorService.serialize(ProcessorService.java:70)
at Application.<init>(Application.java:52)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at com.webobjects.appserver.WOApplication.main(WOApplication.java:323)
at Application.main(Application.java:19)
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:324)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:71)

 _______________________________________________
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

  • Prev by Date: RE: Webobjects-dev Digest, Vol 2, Issue 782
  • Next by Date: Re: Help with NSXMLOutputStream/NSSMLInputStream
  • Previous by thread: RE: Webobjects-dev Digest, Vol 2, Issue 782
  • Next by thread: Re: Help with NSXMLOutputStream/NSSMLInputStream
  • Index(es):
    • Date
    • Thread