• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

ArrayList to XML

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I currently have the below code, In it I want my ArrayList<Device> contents put into an XML file but I'm getting a Errorjava.io.NotSerializableException on my Dvd and CD classes. I cant seem to find the problem if anyone can help that would be great.










 
Saloon Keeper
Posts: 13372
295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thomas, welcome to CodeRanch.

The error says *exactly* what's wrong. Why don't you look up NotSerializableException?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Device must implement java.io.Serializable

It is an empty interface,so you don't need to worry about it.
 
Marshal
Posts: 74351
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch Luk Lukach

Please don't give straight answers too quickly; people learn better if they have to look things up for themselves.
 
Stephan van Hulst
Saloon Keeper
Posts: 13372
295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Luk!

Luk Lukach wrote:It is an empty interface,so you don't need to worry about it.



This is a big mistake. You should think long and hard about implementing Serializable. It imposes lots of limits on your class, and exposes a lot of its internals to the outside world. To date, I haven't written a single class that implemented this interface and that left a good taste in my mouth.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic