• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query on StreamResult object for storing transformed xml doc

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,


I was puzzled recently as to why the code I had was throwing an IO FileNotFound error when I had



but worked when I simply used




There is a constructor for Streamresult that takes a File object which I though was correct in the first example. can someone explain what is happeneing here. I would have expected the file to be created with the transformed data in my C drive using example one ...Also , would it be right to say that the second example which works is using the constructor for StrreamResult that takes a string (Construct a StreamResult from a URL.)...becasue such a constructor exists?


Thanks

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That second example is surely the constructor which expects a URL in String form. What you posted there isn't a URL, so I'm surprised that it worked. I'm also surprised that the first example didn't. My conclusion from all of that is that you have got your tests backwards; the first example should work (assuming that file exists) and the second should not.
 
Colm Dickson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying.

Yes it's strange and I checked again and the new File argument does indeed fail and the String URL one works and creates a file with that name in my project directory yet specifying new File("C:\\filename") causes an IO error and this location is fully writable.


Trying this method below however does work




Colm
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're still using jdk 1.3.1 or about, you should consider update jdk. There was a bug on 1.3.1 for constructor StreamResult(File).
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5052510
It should have been fixed in 1.5 or higher.
 
reply
    Bookmark Topic Watch Topic
  • New Topic