Deserialization order problem

Hi,
For a game i am making i am storing the map as a Serialized Object.
The problem is when i try to paint an image (which should be loaded in the constructor) it is null and thus causing a nullpointer. This only happens after serializing and deserializing the Map. It appears to me that somehow the constructors are not called anymore.
I am using the following (simplified) objects:
public class Map implements java.io.Serializable
     //also included are some protected final static primitives
     protected MapModel model;
     //and some other protected primitives and objects     
     public Map()
          this(null);
     public Map(MapModel model)
          this.model=model;
public class MapModel implements java.io.Serializable
     protected Terrain[][] data;
     private Size size;//simple serializable class
     public MapModel()
          this(new Size());
     public MapModel(Size s)
          data=new Terrain[s.width][s.height];
          size=s;
public abstract class Terrain implements java.io.Serializable
     protected transient Image view;     
     //some more protected primitives     
     public Terrain()
          this(Allignment.SOUTHWEST);
     public Terrain(int allignment)
          System.out.println("Terrain constructor: "+getClass().getName());
          view=loadImage();
     protected abstract Image loadImage();
     //some more abstract methods
public abstract class Tile extends Terrain
     //some public final static ints     
     //some protected ints
     public Tile()
          this(Allignment.SOUTHWEST);
     public Tile(int allignment)
          super(allignment);
          System.out.println("Tile constructor");
     //loadImage() is still not implemented
public class GreyTile extends Tile
     public GreyTile()
          this(Allignment.SOUTHWEST);
     public GreyTile(int allignment)
          super(allignment);
          System.out.println("GreyTile constructor");
     protected java.awt.Image loadImage()
          System.out.println("GreyTile loadImage()");
          //load and return an image
}The above object tree is created and serialized and produces the expected output:
Terrain constructor: heroquest.terrain.tiles.GreyTile
GreyTile loadImage()
Tile constructor
GreyTile constructor
Deserialization however does not produce any output, so loadImage is never called and Terrain.view is null. Which explains the Nullpointer i am getting when trying to paint the GreyTile.
However i do not understand why my constructors are never called.
any thoughts?
Thanks,
Mr Mean

This image is loaded in the constructor. And the
problem is that after deserialization the constructor
is never exectued.
My Question is why.First of all, I apologize for not reading through your code thoroughly. Yes your Image object is transient.
A Ctor is called only when a new instance is created. When deserializing, we are not creating a new instance , we are only restoring a persisted object.
The deserialization process does not use the Ctor because it is not needed. The only time it needs a Ctor is when deserializing the state of the first non-serializable superclass of a serializable one (deserialization needs to reconstruct the entire object state, which includes the state of any superclasses. If the superclass is not itself serializable, then deserialization needs to instantiate that superclass from scratch ).That superclass won't be restored from the stream, but by invoking that class' no-argument constructor.
If the default behavior of this process does not suit your purposes, the solution would be to provide your own writeObject/readObject methods to do what you need to do.

Similar Messages

  • ITunes 7.2 Problem: Song Order Problem

    Equipment Specs:
    IPOD -- First Generation, 1 G size, Firmware ver # 1.1.5
    ITunes -- Ver # 7.2.0.34
    Problem
    I recently updated to the above version of ITunes. I also recently reset/erased all my songs (no podcasts or nothing else)from my IPOD.
    I then reloaded just songs to my pod using the drag and drop method from the music file. I then re-arranged the songs in my desired order.
    I then disonnected the pod and exited ITunes.
    When I later restarted ITunes with the pod connected, my song order had changed. With the pod still open in ITunes, I am no longer able to change the play order position. As say, move song #45 to position #2 and etc.
    Has something changed as I was always able to do this prior to updating ITunes and the pod ?
    Was this caused by updating ITunes to the newest version?
    Is there a solution to be able to manage the order of your songs as before ?
    Can I use a 6.0 version of Itunes inorder to regain this song order problem. I was always able to use this function in a previous version.
    Wished I never would have updated to 7.2 from whatever I had. I really should have know better.
    Thx
    Arc

    Solved my problem by reloading ITunes Version 7.1.1.5. Now I can accomplish what I want to do.
    Here's an associated thread:
    http://discussions.apple.com/thread.jspa?threadID=981696&tstart=0

  • Artist sort order problem

    Hi.
    I have music sync'd via iTunes Match from my laptop to my iPad and to my iPhone. The names and order appear correct on both the laptop and on the iPad but on the iPhone several artists are either shown in all lower case or the last name will be used by the sort, rather than the first.
    I've reset the artist, album artist and sort artist tags to different names (and they show up correctly then on the iPhone) and then set them back, but the problem remains.
    I'm thinking that the iPhone has a corrupt file somewhere - but how can I reset that without losing everything on the phone?
    A factory reset and restore from iCloud results in the same problem.
    Any ideas?
    Thanks guys.
    --Cynan.

    I also have an Artist sort order problem. While the circumstances are quite different from yours, I wonder if it's due to a similar corruption problem. I don't use iTunes Match. I found Kenny G listed under letter T.

  • Iphoto Book ordering problems

    After 3 weeks of constant attempts I feel I need to see if anyone out there has a thought on why I receive a return email from my book order "Problems with your order - you have not been charged etc etc"
    I have done everything possible from deleting photos, trying EVERY theme, deleting maps, background photos. I have corresponded by email with the Apple help, and I have spent about an hour at the Genius Bar at Apple to see if anyone can solve my problem. Everyone has comeback with "we don't know"
    I work with a MacBook Pro Mac OS X 10.6.4, have plenty of memory, all software is up to date.
    I am just about to reinitialise my hard disk, install iLife 11 and make the book again, as I can see no other way to try to get this book ordered. Hopefully, oh every so hopefully this will solve my problem.
    Any guru help?

    Since yesterday there have been many reports from all over the world of people unable to buy a book or any print products from Apple.
    Apple has to fix this on the servers.
    See for example this link:  Re: Trying to buy book I created. When I hit "checkout" nothing happens. It's not like Apple to not want to make more m…

  • Field order problem I think

    I just burned through 10 dvds and they all look terrible. There are all these wavy lines. Is this a field order problem? If so, how do I correct it. I have missed my deadline and I am in big trouble. Please help.
    Thanks

    I just burned through 10 dvds and they all look
    terrible. There are all these wavy lines. Is this a
    field order problem? If so, how do I correct it. I
    have missed my deadline and I am in big trouble.
    DV formats ALWAYS use field 1 dominance -- LOWER FIELD FIRST!
    Since your content was created in a graphics program and not a DV camcorder, be sure to read through: http://www.greatdv.com/video/fields.htm
    BTW, It's ALWAYS the best idea to create a disk image out of iDVD (an option under FILE). Verify the image plays correctly with Apple's Disk Utility and then make the actual burns to writable media with Apple's Disk Utility or Roxio's Toast. Use quality DVD-R media (Verbatim or Maxell) and burn at 4x speed or lower.
    F Shippey

  • IPod First Generation Song Order Problem

    Equipment Specs:
    IPOD -- First Generation, 1 G size, Firmware ver # 1.1.5
    ITunes -- Ver # 7.2.0.34
    Problem
    I recently updated to the above version of ITunes. I also recently reset/erased all my songs (no podcasts or nothing else)from my IPOD.
    I then reloaded just songs to my pod using the drag and drop method from the music file. I then re-arranged the songs in my desired order.
    I then disonnected the pod and exited ITunes.
    When I later restarted ITunes with the pod connected, my song order had changed. With the pod still open in ITunes, I am no longer able to change the play order position. As say, move song #45 to position #2 and etc.
    Has something changed as I was always able to do this prior to updating ITunes and the pod ?
    Was this caused by updating ITunes to the newest version?
    Is there a solution to be able to manage the order of your songs as before ?
    Thx
    Arc
    IPOD First Gen 1Gig Firmware 1.1.5   Windows XP   ITunes 7.2.0.34

    OK, When I am trying to do this, I see the following
    columns
    1. name
    2. time artist and so on
    In the name column the songs are numbered.
    I've been referring to the UNlabeled column to the LEFT
    of the "Name" column all this time... you seem to not be able to recognize that there actually IS such column according to your description.
    I'm referring to the numbers on the LEFT side as in this image:
    http://a248.e.akamai.net/7/248/51/3053501176226988/www.info.apple.com/images/kba se/305350/305350_1.gif
    When I try and move 9 to 5 or whatever there is no
    horizontal line as I have seen in previous versions.
    I know how I accomplished this task before and it is
    not working in this version.
    Would it work to revert back to an earlier version of
    Itunes ?
    Dunno... from what I've read in the iTunes discussions
    this problem has not appeared there.
    BUT you CAN delete iTunes 7.2 and then go to http://filehippo.com/download_itunes and download 7.1.1 (under Old Versions in box on right side of page)
    Install it and see if it solves the problem...
    What version are you using ?
    7.1.1(5)

  • Sale Order Problem

    I am facing problem in Sale order , The problem is :-
    Currently the sales orders that have been created before 15th June are running into an issue where it asks for entering the Ship to party for already created orders. The database entry shows the Customer number at the database level, but cannot pull it on to the SAP Screen.
    On the VA02 when i enter the sale order no. it is throwing one information message stating 'PLEASE ENTER SOLD-TO-PARTY'  and they are already maintained in the database.
    What is the reason behind this.

    Hii
    Wheather check error u r getting for some specific material........
    GO to t-code MM02....give here material number...
    then check the Division whather it have been changed or not.
    Here is one workarround available......
    Go to T-code AUT10
    Give the start date 15th June
    and T-code MM01/MM02......dont give any user ID or give the user ID of the person whom u think can might change the data
    Then execute.
    Now system will show wheather Divison (SPART) have been changed or not
    Same you can do with T-code XD01/XD02 for customer.
    Regards
    Shambhu Sarkar

  • Album song order problem

    I am sure that this problem has been posted but for some reason I cannot find the search box to search through the posts. I only have a search box that searches the entire support page.
    I want to be able to see my songs alphabetically when I am viewing my ipod by artist. It seems as though it is set up according to the album order. When I look at a particular artist I have a long list of songs and it is hard to find a song because who remembers the songs in the order of how they are arranged on the album. Is there a way to change this besides going into the info and manually changing it? that would be very time consuming....
    Thanks,
    Kevin
    Also...How do I search posts now??? I used to be able to do this.

    Don't believe you can accomplish what you want with the iPod unless you manually change the sort keys in Get Info, and I'm not sure about that. You could try it for one artist and see.
    The ability to search discussions is temporarily suspended right now while they sort out all the iPhone gremlins.

  • Smart Playlist Song Order Problem on iPod Nano 6th G

    recently i got an iPod Nano 6th G after years of using my iPod Classic 5.5G, and so far it has been a bliss actually if it wasnt for one small thing
    i have a somewhat large collection of music that i have - with a few exceptions - put in one big smart playlist with the rules provided in the pic to fit my needs
    on my old iPod Classic when i sync it i find it in the ipod in the same ordered that shows on my iTunes, but with my iPod Nano that is no longer the case.... even the the same playlist in my iPod have the songs in the exact order as it is in my library on iTunes, once i unblug it the play list on iPod becomes arranged alphabetically by artist and obviousely that is my problem
    so if anyone could guid me to correct it or even the cause of it i'ld be very thankful

    Can someone point me to a forum somewhere where I can get help with this? I'm obviously posting to the wrong place. Thanks!

  • Song order problem

    Some of the songs on certain albums are showing up out of order on my Ipod, even though they are in the correct order on itunes. All the track numbers are correct and all of the info for each track on the album is the same, so why is it different between iTunes and my iPod?
    Anyone have a solution?

    ok, first of all, cool it, just give us a few hours at least, to get back to you,
    ok, to solve your problem, just restore your ipod, first you might as well make sure you have the latest softwere on your ipod (1.2.1) and if so just restore it from your itunes library

  • Att: Apple Customer Service representatives - iPhoto order problem

    Hi,
    I've had the following problem using the iPhoto book ordering system:
    Last week, I decided to make a photo book in iPhoto and buy several copies of it to use as christmas gifts. I bought the most recent version of iPhoto from the App Store even though I had an earlier version installed, just to ensure reliability and the most up-to-date features. After this, I made my book and on wednesday evening, tried to order it several times, with iPhoto telling me my order couldn't be completed.
    On thursday morning, I tried once again ordering the book, and this time, iPhoto tried to upload my book. In the end, iPhoto gave me a message worded something like "Your order could not be completed. Try again at another time". So I waited a bit and tried again, and I got the same error message.
    Later in the morning, however, I was sent 2 order confirmations from the Apple Store, both for 5 books. I only need 5 in total, so I tried cancelling the last order, but the order website said that I could not cancel the order as it was being processed - this was only some 15 minutes after me receiving the order confirmation. I tried phoning Apple in Denmark, and their phone pointed me to the iPhoto website, which had no relevant information whatsoever. I tried finding information on the web and responding to the order email. No help here either, the email was bounced, and I could not find anybody else who had experienced this problem. I decided I would cancel the payment for the last order with my bank and return the 5 extra books.
    In the days since thursday, the payment didn't show up in my bank statement, and thus, I was beginning to think that maybe my order confirmation email was an error on Apples part, and my order wasn't completed after all. However, the delivery man came to our house today, and my girlfriend signed for both packages (she didn't know why there was two packages). I will be keeping five of them, and you can have the last five books back - I will be cancelling the payment for those when it shows up in my bank statement. After all, I would have never ordered them if your system had worked and given me the correct message after the first order had gone through.
    Please contact me by email in order to arrange the pickup of the surplus books.
    Kind regards,
    Christian

    You could try contacting Apple through Express Lane. Click on Mac & Software > iLife > iPhoto. Good luck

  • Sales order -  automatic creation of purchase order - problem on Credit Che

    Hello,
    We have a problem in sales order.
    For one item, we have an automatic creation of Purchase requisation, but we have to give manually the price in the purchase requisition.
    The problem is when we have give the price, the automatic credit check is executed, and the purchase requisition is not created if we block on this credit check.
    When the credit controller, released the Sales order (VKM1), the purchase is not created automatically because the field for the price in purchase requisition is empty and required.
    And when we come back to the sales order, we need to fill the value and the credit check is running a new time. .....
    and we have a loop.
    I have check in OSS Notes, and I not find a solution.
    How can we solve this problem
    Regards
    Jean-Claude Onderbeke

    Hello Buddi,
    It's impossible to change the price in PO, because the PO is not created.
    The problem is on the creation on the PR in the Sales Order.
    I'm not able to create the Purchase Requisition due to Credit Check, and I'm not able to make an automatic credit check because the value price in the PR is not filled automaticaly, and it's required.
    It's a loop known by SAP, but not solve.
    I hope that someone has found a solution to this strange behaviour.
    Regards
    Jean-Claude

  • Stock transport order  problem

    hai guys
    <b>Requirement:</b> Supplying plant good issued valuation type should be automatically updated in the receiving plant while posting goods receipt.
    1.Stock transport order created in receiving plant with valuation type V1.
    2.supplying plant posting goods issue With respect to the Stock transport order with valuation type V2.
    3.But in the receiving plant it is showing valuation type V1 only.i want this should be automatically updated to Valuation type V2 from the supplying plant while posting goods receipt.
    <b>NOTE:</b>both valuation type V1,V2 configured both in the Supplying and receiving plant.
    How to resolve the above problem.

    Use TCode MBSU to recive the material in receing plant against the suppling plant document
    If u do goods recipt against STO it will pick up the data from sto only ie V1 and not V2
    Reward if useful

  • Any fix for random art and song order problems after adding new music?

    If I sync my touch with itunes as a restore, all cover art, albums and playlists are correct. Once I add anything new or make a change and re-sync, random cover art is missing and random songs are in the wrong order. The only way to fix the problems is through a complete restore. Has anyone else had this problem or figured out a fix? I am using the latest itunes on a PC with XP.

    A few issues, but sorry let me try to understand.
    Adding new music, 'XXXX's iPod cannot be written or read'' can you let me know the number. most likely music format is not iPod Compatible like HE-AAC.
    started skipping songs  - these are normally due to corrupted ID3 tags, try converting them -File-> Advance -> IPOD version or use MP3 validator to fix all songs in the library. (My Apologies, only work for MP3 music that skipped)
    As for item 2, you can try Hard Reset if you like to download MP3 validator.
    After charging till full charge, at least 2 hours (preferably 4 hours)
    Toggle the Hold switch, make sure you dont see the red mark when you do the  next step
    Reset the iPod -> Press Menu and Center button simultaneously for about 10 secs till the Apple Logo comes ON
    Then release the buttons
    Select your preferred language.
    Here is the Apple support Article on the 5Rs
    http://www.apple.com/support/ipod/five_rs/classic/
    Good Luck!

  • Process order problem in COR2 - Urgent Please

    hi i have a problem in COR2.
    After creating the process order i TECO Technically complete the same,
    and when i save the process order the system just hangs.
    When i debugged the code i found that issue is inside the functional module CO_ZV_ORDER_POST - Create/change end routine order.
    It does not do the commit work properly. this is in PRD so please help me to resolve this
    I checked for other system and the process order gets saved.
    What should i do
    please help

    just  compare the  function  module  in  both  PRD & DEV  so that  see the difference in the code level  or else  in the debug  mode  upto the  hanging  code level  ....
    i think it is because of the performance  issue  ....  so  need to  be   created the index  of the  table which  it gets  updated  .....
    becuase  as your FM is  for create/chande  .... so it  will be an  big  table  .... so see it  and   do the performace trace  and  create the  index ..
    ST05 ,SCI  , SM30    .... These are  some of the  tracscation code for   Code Insecptor , performance trace & SQL trace , Runtime Analysis..
    seee if the code is  same  in both  the system   ... then it is confirmed  as   performance  issue  ....
    if the code is  different   then it is  patch level  issue ...  tell to  basis  to check the  patch level  of that  both system  and apply it.
    reward  points  if it is usefull ...
    Girish

Maybe you are looking for

  • EEWB Fields in PCUI Screen

    Hi All I am facing a weird problem for a long time and have not got any documentation to refer. I have created a new field through EEWB and want to see it in both Form & List View of Accounts transaction(CRMM_ACCOUNT) in PCUI. I realised that extende

  • Can't play quicktime trailers, keep getting a question mark?

    My mac started acting very strange 2 days ago. I can't play any trailers, the box opens and instead of the trailer playing, I get a question mark. this never happened. Please help

  • Java Script Error in downloading CS3 Master Collection

    I just bought a new MacBook Pro and I went to download my CS3 Master Collection. In the middle of downloading Disc 1 I got a kernel telling my to push the power button until the computer shuts off and turn it on again. Then when I tried to redownload

  • Adobe Photoshop CS6 png image transpercy problem

    Hello, On our site we used a lot of transparent png images. The images show up fine however they are not transparent as in Photoshop. Now the transparent areas are white where they are transparent in Photoshop. Can anybody explains me what I'm doing

  • Re-Installation Issues

    I had iTunes installed and updated when I ran into an issue trying to update my iPhone. iTunes would check for updates, tell me about the updates, update itself, but when I would run the phone updates it would say I didn't have internet connectivity