Changing serialVersionUID  of  objects serialized in a file.

For myResearch project I have created an application that saves it's data by placing its objects in an ArrayList and then serializing the ArrayList to file.
Up untill now it has been going swimmingly over 18 months. However, I am now for seemingly no reason encountering versioning errors when my app tries to de-serialise the objects. This happens for classes that I have not modified in any way.
I know now that I should manually set the serialVersionUID of my objects to overcome this in the future.
However, my core quesion is:
Can I change the serialVersionUID of the objects in the ArrayList of the serialized file. Otherwise I have to rebuild over 100 program save files.
Kind Regards,
Andrew.

They all have serialVersionUID like
-6011647393756382469
You suggestion will not be a very elegent solution,
as the numbers are meaningless.I do not know what you're talking about. SerialVersionUID numbers are meaningless. They are cryptographic functions of the class signature. They are not intended to be meaningful to anybody but the Serialization subsystem. If you're using them for some other purpose, you're breaking a cardinal rule of computing - a field should not be used for more than one purpose. Don't.
In any case the solution I gave is by a long chalk the most practical.
Is it possible to de-serialise an object, change its
serialVersionUID and then save it again.Why on earth would you go to all this useless bother when you already have a solution?

Similar Messages

  • Read data from Vector object serialized in a file issue!!

    Hi all,
    I have two classes :CBase and CHelper class in a package and serializing some information in a file and then reading it. I am facing some problem while reading the data
    which was stored using vector of objects. Below is the detailed problem:::::
    ////////////CHELPER
    public class CHelper implements Externalizable, Cloneable {
    public string szname;
    //..other functions writeexternal read external
    ////////////CBASE
    public class CBase
    implements Externalizable, Cloneable {
    protected boolean bRead;
    protected boolean bWrite;
    protected Vector vData;
    public void addInstance(CHelper obj) {
    vData.addElement(obj);
    //..other functions writeexternal read external
    I am Serializing all the CBase information in a file and trying to read the contents from this serialized file::::
    CBase base = new CBase();
    CHelper obj = new CHelper();
    obj.setName("HELPER");
    base.addInstance(obj); // ADDING THE OBJECT DATA INTO THE VECTOR
    base.bRead = true;
    base.bWrite = true;
    // Writing to the file
    FileOutputStream fs = new FileOutputStream("d:\\temp\\Base.txt");
    ObjectOutputStream os = new ObjectOutputStream(fs);
    os.writeObject(base);
    os.close();
    //reading from the file
    FileInputStream fi = new FileInputStream("d:\\temp\\Base.txt");
    ObjectInputStream oi = new ObjectInputStream(fi);
    CBase read = (CBase) oi.readObject();
    PRINTING THE OUTPUT
    System.out.println("Vector = " + read.vData.firstElement().toString());
    System.out.println("Write = " + read.bRead);
    System.out.println("Read = " + read.bWrite);
    The output is something like:
    Vector = com.sp.CHelper@14b7453 // WHAT IS THIS ?? GARBAGE ?? NOT ABLE TO ANALYSE :(
    Write = true;
    Read = true;************
    MY PROBLEM:
    i.e How to get the information stored in the Vector ? I am getting something "com.sp.CHelper@14b7453 " whereas the expected output should be Vector = HELPER. I am
    writing and reading the vector as follows:
    // CHELPER
    public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(szName.toString());
    public void readExternal(ObjectInput in) throws IOException,
    ClassNotFoundException {
    setName(in.readUTF());
    Externalize in CBase Classs
    out.writeInt(getInstanceCount()); // getting number of objects in the vector
    for (int index = 0; index < getInstanceCount(); index++) {
    out.writeObject((CHelper)vData.get(index));
    out.writeBoolean(bWrite);
    out.writeBoolean(bRead);
    And reading like this::
    int iNumberofInstances; // number of instances
    iNumberofInstances = in.readInt();
    vData.clear();
    // Get the CHelper object and add it into the CFeatureBase vector
    for (int i = 0; i < iNumberofInstances; i++) {
    CHelper objbase = (CHelper)in.readObject();
    vData.add(objbase);
    this.bWrite = in.readBoolean();
    this.bRead = in.readBoolean();
    I suppose that i am correctly WRITING AND READING the data. B/w what can be the problem. All suggestions are welcome/
    Thanks,
    Rohit

    Vector = com.sp.CHelper@14b7453 // WHAT IS THIS ??
    GARBAGE ?? NOT ABLE TO ANALYSE :(
    Write = true;
    Read = true;************
    MY PROBLEM:
    i.e How to get the information stored in the Vector
    ? I am getting something "com.sp.CHelper@14b7453 "
    whereas the expected output should be Vector =
    HELPER.This is perfectly normal behaviour if your CHelper class doesn't override the toString() method. The default toString() method in Object just prints the name of the class and a hex representation of the object's hash code.
    Add a toString() method to CHelper that returns szname and you should see what you are expecting.

  • Objects in different layers changed position when i opened the project file, why? Can i fix this in a non painful and quick way?

    Im making a frame-by-frame animation and today when i opened my project som objects had changed position while others didn't. This countinues throughout the whole timeline and sometimes they change position.
    Here is before:
    Here is after:
    I think it has something to do with me changing the documents size. But it didnt happen yesterday when i did the change, only today when i opened the file again, and i cant change it back and make things right again.
    If someone knows what happened and if i can fix this it would mean A LOT to me.

    There is really no way around backing up your files regularly.
    Flash is sadly not the most stable program.
    Make it a habit to save a new version every half an hour or so, that will diminish your losses.
    Consider it a "warning shot" and consider yourself lucky that you didn`t get the infamous "flash couldn`t open file" message ;-)

  • Manipulate a object serialized file when the .class file is missing

    I want to know if it is possible to recovery the object when its class file is missing! I guess it needs to manipulate the file and extract the values and ask user to name the values, after that, create a new class file for future use. However, I don't know how to manipulate the object serialized file. I really appreciate any hints you guys can give

    I suppose if you created the class file, with the same name, package, and unique serial ID, fields, etc, it can be done.
    Another option is to not use serialization if you are just trying to recover the data. Again you would need to know what the datatypes of the fields are to know what it is you are trying to read, how to parse serialized data, etc. Some Objects are easy to read, like Strings. The more complicated ones are the simple datatypes.

  • Reading an object from a binary file

    i am writing objects into my binary file using printwriter class. i am able to write objects into the file but i am having problems reading the object from the file. is there any other way of going about it. i tried using the objectoutputstream and object input stream class. but i am getting run time errors coz of something to do with serialization
    i am storing records as a object into a binary file so that it is easy to seek my records

    Of course you have trouble reading objects after you wrote them with a PrintWriter.
    You should rather have fixed the Serialization errors: only objkects that implement Serializable correctly can be serialized.

  • Error while changing the Resource Object Status

    Hi,
    I am trying to change the resource object status from Waiting to Provisioned for a self service task. Before approval I see the Resource Object Status as " Ticket Sent To REMEDY" on the administrator's web console and at the Requestor's web console I get the following error message-
    ???en_US.global.viewProfileForm.Lookup.Ticket-Sent-to-REMEDY???
    But after approval, based on the completion the task, the process on both the consoles is set to provisioned. That is what I want to display but the problem comes when the requestors sees the error status message on its console before approval.
    Can any body tell me the reason of the above error and how to resolve it?
    Thanks in advance

    do you have any custom written event handlers getting triggered off after request submission or during approval?
    It might also be due to either a browser issue or you might have missed any entry in the xladmin properties file for a custom label/error message etc.

  • Smart Object Couldn't Covert File Help!

    I have buil a few site successfully and used smart objects in Golive without any problems. I opened my site today and when I placed a layerd PSD file in a cell Golive said Smart object couldn't convert file.
    Note on this page there are converted PSD files already.
    Note I opened the same PSD file that worked, changed it up and saved it as a different name and still got the error
    I restarted and reinstalled.
    Does someone know a secret trick?
    All my best
    Matt

    update:
    the above error message does not seem to affect what gets published....HOWEVER...none of the comments from my site are being published except for those comments that are new since the upgrade to iLife 08 / iWeb 2.0.2.
    what the.....?

  • Mass change of authorization objects in several roles

    Hello,
    we have to change a authorization object in almost 200 roles. Is there any possibility for mass change of authorization objects in several roles? We don't use the central SAP user administration.
    Best Regards
    Andreas Walter

    > at the moment all entries has the value "*". We want to change this value into "0001".
    Good!
    Here comes:
    1- download all relevant roles in once from PFCG. Make sure you use an appropriate codepage so you don't loose special characters in the role and menu texts.
    2- copy and backup the download file
    3- in the download file (is a text file)  look for all lines starting with AGR_1251 and conatining M_MATE_WGR and the field you want to change
    4- take out the star and two spaces and replace by 001. This file is a set of fixed record length table exports and keeping the original length is very important.
    5- upload the edited file and generate the profiles.
    As you may see this is not SAP standard and completely at your own risk. Best try in a sandbox client first.
    Good luck!
    Jurjen

  • [svn:bz-3.x] 20876: Change default max object nest level to 512.

    Revision: 20876
    Revision: 20876
    Author:   [email protected]
    Date:     2011-03-16 09:02:36 -0700 (Wed, 16 Mar 2011)
    Log Message:
    Change default max object nest level to 512. A max object nest level of 512 should be more than enough for most applications which probably will not be sending deeply nested object graphs over the wire. For applications that are sending deeply nested object graphs over the wire and that bump up against this limit, the limit can be increased but you should also do testing to make sure that serializing/deserializing these deeply nested object graphs doesn't cause stack overflow errors. 
    Add documentation for the max object nest level setting.
    Add documentation for the max collection nest level setting.
    Checkintests: passed
    Modified Paths:
        blazeds/branches/3.x/modules/core/src/java/flex/messaging/endpoints/AbstractEndpoint.java
        blazeds/branches/3.x/resources/config/services-config.xml

    Remember that Arch Arm is a different distribution, but we try to bend the rules and provide limited support for them.  This may or may not be unique to Arch Arm, so you might try asking on their forums as well.

  • [svn:bz-4.0.0_fixes] 20874: Change default max object nest level to 512.

    Revision: 20874
    Revision: 20874
    Author:   [email protected]
    Date:     2011-03-16 06:55:37 -0700 (Wed, 16 Mar 2011)
    Log Message:
    Change default max object nest level to 512. A max object nest level of 512 should be more than enough for most applications which probably will not be sending deeply nested object graphs over the wire. For applications that are sending deeply nested object graphs over the wire and that bump up against this limit, the limit can be increased but you should also do testing to make sure that serializing/deserializing these deeply nested object graphs doesn't cause stack overflow errors. 
    Add documentation for the max object nest level setting.
    Add documentation for the max collection nest level setting.
    Remove max-string-length-bytes setting from the example services-config.xml as this setting doesn't exist.
    Checkintests: passed
    Modified Paths:
        blazeds/branches/4.0.0_fixes/modules/core/src/flex/messaging/endpoints/AbstractEndpoint.j ava
        blazeds/branches/4.0.0_fixes/resources/config/services-config.xml

    Remember that Arch Arm is a different distribution, but we try to bend the rules and provide limited support for them.  This may or may not be unique to Arch Arm, so you might try asking on their forums as well.

  • Find object Names in a file and print all those objects Names

    Hi All,
    I am new to this forum.
    I want to know how to read only objects names in txt file. In the text file i have sql queries, package names, Function Name. I need to read all the objects and display out put. The file contains around 20000 Lines.
    Please suggest me.
    Thanks & Regards
    Suresh.

    Gurram wrote:
    want to read .rex File. The file contains combination of SQL code with table Names, Packages,Functions,There are three basic ways to read an external file.
    You can use UTL_FILE and use standard/basic file I/O calls like fread() and fwrite() - common amongst most (if not all) programming languages.
    You can define an external table for the file, and SQL*Load the contents of the file dynamically via a SQL SELECT statement.
    You can load the file into a CLOB using DBMS_LOB and then process it - quite useful if the text file is XML as the XMLTYPE supports parsing a a CLOB containing XML.
    I want to pick Each object name put in a separate file line by line.That in turn will need to use UTL_FILE to create an external file.
    Keep in mind though that your in a database environment with PL/SQL. The very best place for data is inside the database in SQL tables. Not outside as external files. Thus you need to ask yourself whether dealing this way with external files is the best solution, and a robust and scalable one.
    Granted, many times from the database side we need to deal with external files. The optimal method usually is to load that file's data into a database table as structured data - data that can be accessed via SQL and sorted, filtered, aggregated and analysed.
    To provide a "file" as output - this should ideally be done directly from structured data (SQL tables). And can be done using HTTP (via a web enabled PL/SQL procedure that supplies the file content as a http Mime stream), using FTP (via <i>UTL_TCP</i>) or as a CLOB via a PL/SQL call interface. Using UTL_FILE is not necessarily the only option.

  • How do I stop GoLive from changing the location of my CSScriptLib.js file?

    How do I stop GoLive from changing the location of my CSScriptLib.js file?
    I am making rollovers and want my CSScriptLib.js to be in the same folder as my HTML files.
    Every time I edit the rollovers GoLIve recreates the path of the CSScriptLib.js to file:///Users/xxx/Library/Preferences/Adobe/GoLive/Settings8/JScripts/GlobalScripts/CSScr iptLib.js so it won't work when uploaded. I always need to edit my HTML before uploading. All I want it to say is src="CSScriptLib.js" as the default.

    The site file is a database that keeps track of all your assets (and much more), including the scriptLib file. As soon as the page is saved (when you use the site file and it's open) the link will be change to the correct path that will work on the server.
    If you're not using the site file you might as well use a text editor, since most of GL functionality is gone.

  • How to create custom attributes & object classes through ldif files in OID

    Hi,
    I have to create 4 attributes and one object class(custom) in OID. I want to creae these attributes and object class through LDIF file.
    I tried creating an attribute through this command
    ldapadd -p 389 -h localhost -D cn=orcladmin -w password -f D:/newattr.ldif
    this ldif file contains inf. for creating a new attributes:
    dn: cn=subschemasubentry
    changetype: add
    add: attributetypes
    attributetypes: ( 1.2.3.4.5.6.10 NAME "xsUserType_new" DESC "User Type Definition" EQUALITY caseIgnoreMatch
    SYNTAX "1.3.6.1.4.1.1466.115.121.1.15" )
    I am getting error: Object class violation
    Failed to find add in mandatory or optional attribute list.
    Please help to find where I am going wrong...
    Thanks.

    Hi Ajay,
    Thank you for the help. Now i am able to create both attributes and object classes in OID through Ldif files.
    I was getting constraint violation error because (I think) I was not giving proper naming convection for attributes and object classes. For OID, there are certain Ldap naming conventions. They are as follows:
    # X below is the enterprise number assigned by IANA
    1.3.6.1.4.1.X.1 - assign to SNMP objects
    1.3.6.1.4.1.X.2 - assign to LDAP objects
    1.3.6.1.4.1.X.2.1 - assign to LDAP syntaxes
    1.3.6.1.4.1.X.2.2 - assign to LDAP matchingrules
    1.3.6.1.4.1.X.2.3 - assign to LDAP attributes
    1.3.6.1.4.1.X.2.4 - assign to LDAP objectclasses
    1.3.6.1.4.1.X.2.5 - assign to LDAP supported features
    1.3.6.1.4.1.X.2.9 - assign to LDAP protocol mechanisms
    1.3.6.1.4.1.X.2.10 - assign to LDAP controls
    1.3.6.1.4.1.X.2.11 - assign to LDAP extended operations
    By using these conventions for attributes and object class, I did got any error and they were created in OID.
    Thanks a zillion.
    Kalpana.

  • Is there a way to change the default icon for a sound file in KN2

    i have need to include dozens of sound files on each slide that will trigger as text builds. i can handle all the transitions fine but i cannot figure out how to change the standard icon for the sound file.
    i would prefer to have the text be the icon, if that is not possible to have a smaller icon for the file. as i build the page i am ending up with a huge mess, icons covering text, also there is not a intuitive way to tell which sound file is which with out click/playing each file.
    powerbook g4 Mac OS X (10.4.4)

    Did you try:
    OracleBI/web/app/res/s_.../popbin/
    EX:
    line.pcxml Look for <SeriesDefinition ...
    we modified the line width and a few other things. You'll have to modify all the pcxml files for all the chart types you want to customize.

  • Do you know how to change the Text Object for Billing Document?

    Hi,
    If you execute Transaction VOTX or VOTXn it will take you to Text Determination. The Billing Doc & Sales Document both has the VBBK as Text Object for me and is it like that for all.
    I need to change the Text Object to VBRK for Billing Doc, which is the ideal because I am using the Function Module READ_TEXT to retrieve text. This work perfectly for Sales Document which has VBBK as Text Object, but does not work for Billing Doc where it through as error message saying “Text 0020000021 ID 0002 language EN not found”.
    Thank You
    Kishan

    Hi kishan,
    For updating these text you can use FM 'SAVE_TEXT'.
    As for your problem, to get the parameter you need, go to the billing document, go to the text, and display it in plain page mode.
    Then you do 'GO TO' -> 'HEADER', and a pop-up window open with the parameters you need Obect type, ID, Name, ...
    Regards,
    Erwan.

Maybe you are looking for