Int 2 Serializable

I have a file with a construction:
Serializable[] serializable = new int[n];
It was generated with jad.exe decompiler from .class file.
When I use javac compiler (java version v1.2.2)
it reports an error that the types java.io.Serializable and int is incompatible
any ideas?
PS
Sorry for my english

I do not know why you change int to Serializable?
The Serializable is a interface that has no methods or fields and serves only to identify the semantics of being serializable. It means Serializable only a signal to tell compiler one class can be serializable. so I think use Serializable array may be a mistake.
The int is a basic type in Java, NOT a class. So it can not change to any class.
By away, one int array can be image to one object, actually the JVM treated the array ( include basic type and object ) as a object.

Similar Messages

  • Goddam Curly Brackets!!!

    HELP!
    I'm having problems finding a missing or extra bracket within my code? Or at least I thik that is the problem.
    The error I get is:
    <----
    270. try
    542. }
    --------^
    *** Syntax Error: "Finally" inserted to complete TryStatement
    I've tried using comparison software but it doesn't help!
    I have attached the section of code that is causing the problem, but I think it may be deeped that just the following section.
    All the brackes "seem" to match, but 271 goes to 501 in theory, but when I rightclick in my software (JCreator) and choose match bracket, it takes me to 531?
    Anyhelp please!! Be most grateful!
    See Attached Code:
    try
         //System.out.println("Here 1");
    * Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
    * I think this could be where LABEL should be a user configured variable (map)
    * Either here or above on line 109. (map) (then again maybe not!!!)
    if (label_tmp == null)
    abortMissingInput("Activity Option 'LABELREF'");
    System.out.println("Here 2");
    else
    //     System.out.println("Here 3");
    * Check to see if the nicelabel file already exists. If it does
    * then we need to write the data into a temporary file.
    // cam removed
    // while(out.exists())
    // cam removed
    // System.out.println("Here 4");
    * Build data for updating the next_number table. Before that happens we need to
    * verify that the SFCs do not already exist in wip, if they do then we need to generate
    * a new batch
    /* map - Fix Rev 1.2 */
    System.out.println("Label TMP "+label_tmp);
    System.out.println("SFC Number "+SFCNumber);
    if (label_tmp.equals("SB"))
    /* map - Fix 1 Rev 1.2 */
         System.out.println("Here 5");
         requestConnection();
         try
         ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
         nbBO = new NextNumberBOHandle(site,"S",itembo);
         StringBuffer next_number_query = new StringBuffer();
         next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
         next_number_query.append("where HANDLE=");
         next_number_query.append(wrap(nbBO));
         Data number_query = executeQuery(next_number_query.toString());
         current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
         prefix = (String)number_query.get("PREFIX");
         suffix = (String)number_query.get("SUFFIX");
         long sfc_seq = current_seq.longValue();
         first_sfc = current_seq.longValue();
                                  int array_length = big.intValue();
         * Build an array to create the next SFC numbers. This information will
         * be used to select from the sfc table. If any of the SFCs in the array
         * are found, a new block should be generated.
         * I think this is where it implements the current sfc by 1. (map)
         new_sfc = new String[array_length];
         * map fix Rev 1.2 - loop until SFC_NBR test has been passed
         System.out.println("Here 8a1");
         if (Serialize == -1);
         /* map added do statement */
              do
         //while (Serialize == -1);
         System.out.println("Here 9");
         * map fix Rev 1.2
              for (int i=0;i<array_length;i++)
              if (suffix == null)
              new_sfc[i] = prefix+sfc_seq;
              else
              new_sfc[i] = prefix+sfc_seq+suffix;
              sfc_seq++;
              System.out.println(new_sfc);
              * Using the data we have generated above we need to check the SFC table.
              int new_sfc_array;
              new_sfc_array = new_sfc.length;
              for (int j=0;j<new_sfc_array;j++)
                   System.out.println("Here 10");
              StringBuffer find_sfc = new StringBuffer();
              find_sfc.append("SELECT count(*) from sfc where ");
              find_sfc.append("sfc=");
              find_sfc.append(wrap(new_sfc[j]));
              System.out.println(find_sfc.toString());
              AreYouThere = executeQuery(find_sfc.toString());
              System.out.println("AreYouThere: "+AreYouThere);
              there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
              //int array_length = big.intValue();
              System.out.println("Valueof There_count: "+there_count);
              int test = there_count.intValue();
              if (test > 0)
              System.out.println("The sfc is already in use : "+new_sfc);
              // We need a new block of sfc's one is already in use. Once we do that
              BigDecimal doubled = new BigDecimal(2);
              old_big = big;
              big=big.multiply(doubled);
              verify = true;
              break;
              if (Serialize == -1);
                   break;
              // System.out.println("Data Returned from SFC select: "+AreYouThere);
              Serialize = 0;
         * map fix Rev 1.2
         //this it my bracket below while searching for the missing one!!!!!!!!!!!
              /* map added line below */
              while (Serialize == -1);
         * map fix Rev 1.2
         current_seq = current_seq.add(big);
         //System.out.println(now);
         System.out.println("Update sequence number: "+current_seq);
         // map commented this out as it is not set properly and will not compile.
         //java.util.Date now = new java.util.Date();
         //java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
         //String time =formatter.format;
         /* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
         * to figure them out.
         StringBuffer update_next_number = new StringBuffer();
         update_next_number.append("UPDATE next_number set ");
         update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
         //update_next_number.append("modified_date_time="+wrap(time)+" ");
         update_next_number.append("where HANDLE="+wrap(nbBO));
         System.out.println("Update Next Number SQL: "+update_next_number);
         System.out.println("Executing update");
         executeUpdate(update_next_number.toString());
              finally
         cleanup();
    /* map - Fix 1 */
         System.out.println("After Allocate SFC");
         /* map - Fix 1 */
    /* This is where it actually writes the label and its contents.
    * I also think its where it should be queuing the next label and not trying
    * to overwrite it, like it does currently. (map)
         //File out = new file(file_time)
              /* map change Rev 1.3*/
              //sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
              /* This is the option to use the date as a time stamp.
         SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
         Date currentTime_1 = new Date();
         fileDate = formatter.format(currentTime_1);
              System.out.println("Current Time : "+fileDate);
         file_path = ("C:\\TEMP\\"+fileDate+".Job");      
         out = new File(file_path);
         System.out.println("Output File Name : "+out);
         /* map change Rev 1.3*/
         //map new code...
         PrintWriter out = null;
         try
                   out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
                   out.print("LABEL \"");
                   out.print(item);
                   out.print("_");
                   out.print(item_rev);
                   out.print("_");
                   out.print(label_tmp);
                   out.print(".lbl\"");
                   out.println();
                   // All other stuff...
         finally
              try
                   out.close();
              catch(Exception e)
                   System.err.println("Unable to close output stream");
                   e.printStackTrace();
         return inData;

    Cheers, your a star!
    The thing is, I have just been looking throughit after what you said and there seems to be only one catch and 3 trys and before I (fooked) around with it, it worked???
    Here is the code. I think JCreator is not very helpful!!
    Cheers
    package com.genrad.app.core.prod.server;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    import javax.naming.*;
    import javax.sql.DataSource;
    import java.sql.*;
    import java.math.*;
    import java.io.*;
    import java.lang.Thread.*;
    import java.util.*;
    import java.util.Date;
    import java.text.*;
    import javax.transaction.*;
    import com.genrad.frame.*;
    import com.genrad.app.common.server.*;
    import com.genrad.app.nc.server.*;
    import com.genrad.app.core.pd.server.*;
    import com.genrad.app.core.sys.server.*;
    import com.genrad.app.core.track.server.*;
    import com.genrad.app.core.demand.server.*;
    import com.genrad.app.core.env.server.*;
    public class LexisBean extends BasicProductionBean implements SessionBean,LexisInterface
    private final String ACTIVITY_ID = "CT520";
    private final String TRUE = "true";
    private String sfc_info = null;
    private String get_prop_sfc = null;
    private Data Context_List;
    private Data test;
    private Data itemBOrs;
    private String item = null;
    private String item_rev = null;
    private String shoporder = null;
    private Data LotSizeRS;
    private Data results;
    private Data hookData;
    private Data AreYouThere;
    private String printer = null;
    private String label_tmp = null;
    private BigDecimal big;
    private BigDecimal current_seq;
    private String site;
    private String file_path;
    private String file_time;
    private String prefix;
    private String suffix;
    private boolean verify = false;
    private NextNumberBOHandle nbBO;
    private String[] new_sfc;
    private int count=0;
    private BigDecimal there_count;
    private BigDecimal old_big;
    private long first_sfc;
    private int Serialize = -1;
    private String fileDate;
    //private PrintWriter out;
    //private output_file;
    // private StringBuffer buffer;
    * Constructor
    public LexisBean()
    public Data execute(Data inData)throws RemoteException, BasicBOBeanException
    * Need to get all the user options defined in the Activity. The only one that
    * is not required in the printer name. There is no validation done on
    * any of these options.
    * Here I think it should be using the LABELREF User Argument in the Hook Activity
    * within Resource Maintenance. (map)
    String setting = null;
    Utils.traceMsg("LexisBean . execute() : inData \n" + inData.toXMLString(), 10);
    hookData = (Data)inData.get("HOOK_DATA",0);
    Utils.traceMsg("LexisBean . execute() : hookData \n" + hookData.toXMLString(), 10);
    results = (Data)hookData.get("ACTIVITY_OPTION", 0);
    if (results != null)
    String value = null;
    String hookData = null;
    Data countData = null;
    * This should check the setting is not SB, don't pre-allocate SFC, just carry on
    * and pass the current sfcnumber. This is my theory anyway!! (map)
    for (int row = 0; row < results.size(); row++)
    countData=results.extractRow(row);
    setting = (String)countData.get("SETTING", 0);
    value = (String)countData.get("EXEC_UNIT_OPTION", 0);
    if (value != null && value.equals("PRINTER"))
    printer = setting;
    System.out.println("Printer: "+printer);
    if (value != null && value.equals("LABELREF"))
    System.out.println("Value: "+value);
    label_tmp = setting;
    System.out.println("Label TMP: "+label_tmp);
    // Get the SFCBO, as that is the key to getting all the data we need.
    Context_List = (Data)inData.get("CONTEXT_LIST",0);
    item = (Context_List.get("CONTEXT_GBO",0)).toString();
    sfc_info = (inData.get("SFC_BO")).toString();
    //SFCBOInterface sfcBean = (SFCBOInterface)getEJB("SFCBO");
    SFCBOHandle sfcbohand = (SFCBOHandle)inData.get("SFC_BO",0);
    site = sfcbohand.getSite();
    String SFCNumber = sfcbohand.getSFC();
    // Need to grab the filename and full path from a system rule.
    System.out.println("Fixing to try and get the Resource_BO");
    ResourceBOHandle resource = (ResourceBOHandle)inData.get("RESOURCE_BO",0);
    file_path = (String)getSystemRule("INLINE_PRINTING",site,resource);
    File out = new File(file_path);
    System.out.println("FilePath from resource "+file_path);
    // Request connection to the database
    requestConnection();
    try
    * Create a string buffer to build the SQL. Need to do this to
    * get the itemBO from the SFC table. There currently is no method
    * to get this information other than this. At lease not that I
    * know of.
    StringBuffer itemBOquery = new StringBuffer();
    itemBOquery.append("SELECT ITEM_BO FROM SFC ");
    itemBOquery.append("WHERE HANDLE=");
    itemBOquery.append(wrap(sfcbohand));
    itemBOrs = executeQuery(itemBOquery.toString());
    System.out.println("ITEM BO FROM SELECT: "+itemBOrs);
    ItemBOHandle itemBOHandle = new ItemBOHandle((String) itemBOrs.get("ITEM_BO"));
    item = itemBOHandle.getItem();
    item_rev = itemBOHandle.getRevision();
    * Create a string buffer to build the SQL. Need to do this to get
    * ShopOrderBO. This information is actually coming from the
    * shop_order_sfc table. Once we have that it will be used to create
    * the printjobname line in the label file.
    StringBuffer soBOquery = new StringBuffer();
    soBOquery.append("SELECT SHOP_ORDER_BO FROM shop_order_sfc ");
    soBOquery.append("where SFC_BO=");
    soBOquery.append(wrap(sfcbohand));
    Data soBOrs = executeQuery(soBOquery.toString());
    ShopOrderBOHandle shopBOHandle = new ShopOrderBOHandle((String) soBOrs.get("SHOP_ORDER_BO"));
    shoporder = shopBOHandle.getShopOrder();
    * Create a string buffer to build the SQL. Need to do this to get
    * lotsize of an item. I will be getting this information from the
    * item table. Once we have that information it will be used to
    * create the PRINT line in the nicelabel.
    * I think this is where it gets the item lot size and needs to get the sfc lot size,
    * another one of Stuarts bugs...
    StringBuffer LotSize = new StringBuffer();
    LotSize.append("SELECT LOT_SIZE FROM ITEM ");
    LotSize.append("where HANDLE=");
    LotSize.append(wrap(itemBOHandle));
    LotSizeRS = executeQuery(LotSize.toString());
    big = (BigDecimal)LotSizeRS.get("LOT_SIZE");
    System.out.println(LotSize.toString());
    System.out.println("LOTSIZE: "+LotSizeRS);
    finally
    cleanup();
    String sfc = sfcbohand.getSFC();
    * The following try block is an attempt to write the information to
    * the nice label file. It uses several of the string variables defined
    * above.
    try
         //System.out.println("Here 1");
    * Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
    * I think this could be where LABEL should be a user configured variable (map)
    * Either here or above on line 109. (map) (then again maybe not!!!)
    if (label_tmp == null)
    abortMissingInput("Activity Option 'LABELREF'");
    System.out.println("Here 2");
    else
    //     System.out.println("Here 3");
    * Check to see if the nicelabel file already exists. If it does
    * then we need to write the data into a temporary file.
    // cam removed
    // while(out.exists())
    // cam removed
    // System.out.println("Here 4");
    * Build data for updating the next_number table. Before that happens we need to
    * verify that the SFCs do not already exist in wip, if they do then we need to generate
    * a new batch
    /* map - Fix Rev 1.2 */
    System.out.println("Label TMP "+label_tmp);
    System.out.println("SFC Number "+SFCNumber);
    if (label_tmp.equals("SB"))
    /* map - Fix 1 Rev 1.2 */
         System.out.println("Here 5");
         requestConnection();
         try
         ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
         nbBO = new NextNumberBOHandle(site,"S",itembo);
         StringBuffer next_number_query = new StringBuffer();
         next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
         next_number_query.append("where HANDLE=");
         next_number_query.append(wrap(nbBO));
         Data number_query = executeQuery(next_number_query.toString());
         current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
         prefix = (String)number_query.get("PREFIX");
         suffix = (String)number_query.get("SUFFIX");
         long sfc_seq = current_seq.longValue();
         first_sfc = current_seq.longValue();
                                  int array_length = big.intValue();
         * Build an array to create the next SFC numbers. This information will
         * be used to select from the sfc table. If any of the SFCs in the array
         * are found, a new block should be generated.
         * I think this is where it implements the current sfc by 1. (map)
         new_sfc = new String[array_length];
         * map fix Rev 1.2 - loop until SFC_NBR test has been passed
         System.out.println("Here 8a1");
         if (Serialize == -1);
         /* map added do statement */
              do
         //while (Serialize == -1);
         System.out.println("Here 9");
         * map fix Rev 1.2
              for (int i=0;i<array_length;i++)
              if (suffix == null)
              new_sfc[i] = prefix+sfc_seq;
              else
              new_sfc[i] = prefix+sfc_seq+suffix;
              sfc_seq++;
              System.out.println(new_sfc);
              * Using the data we have generated above we need to check the SFC table.
              int new_sfc_array;
              new_sfc_array = new_sfc.length;
              for (int j=0;j<new_sfc_array;j++)
                   System.out.println("Here 10");
              StringBuffer find_sfc = new StringBuffer();
              find_sfc.append("SELECT count(*) from sfc where ");
              find_sfc.append("sfc=");
              find_sfc.append(wrap(new_sfc[j]));
              System.out.println(find_sfc.toString());
              AreYouThere = executeQuery(find_sfc.toString());
              System.out.println("AreYouThere: "+AreYouThere);
              there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
              //int array_length = big.intValue();
              System.out.println("Valueof There_count: "+there_count);
              int test = there_count.intValue();
              if (test > 0)
              System.out.println("The sfc is already in use : "+new_sfc);
              // We need a new block of sfc's one is already in use. Once we do that
              BigDecimal doubled = new BigDecimal(2);
              old_big = big;
              big=big.multiply(doubled);
              verify = true;
              break;
              if (Serialize == -1);
                   break;
              // System.out.println("Data Returned from SFC select: "+AreYouThere);
              Serialize = 0;
         * map fix Rev 1.2
         //this it my bracket below while searching for the missing one!!!!!!!!!!!
              /* map added line below */
              while (Serialize == -1);
         * map fix Rev 1.2
         current_seq = current_seq.add(big);
         //System.out.println(now);
         System.out.println("Update sequence number: "+current_seq);
         // map commented this out as it is not set properly and will not compile.
         //java.util.Date now = new java.util.Date();
         //java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
         //String time =formatter.format;
         /* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
         * to figure them out.
         StringBuffer update_next_number = new StringBuffer();
         update_next_number.append("UPDATE next_number set ");
         update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
         //update_next_number.append("modified_date_time="+wrap(time)+" ");
         update_next_number.append("where HANDLE="+wrap(nbBO));
         System.out.println("Update Next Number SQL: "+update_next_number);
         System.out.println("Executing update");
         executeUpdate(update_next_number.toString());
              finally
         cleanup();
    /* map - Fix 1 */
         System.out.println("After Allocate SFC");
         /* map - Fix 1 */
    /* This is where it actually writes the label and its contents.
    * I also think its where it should be queuing the next label and not trying
    * to overwrite it, like it does currently. (map)
         //File out = new file(file_time)
              /* map change Rev 1.3*/
              //sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
              /* This is the option to use the date as a time stamp.
         SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
         Date currentTime_1 = new Date();
         fileDate = formatter.format(currentTime_1);
              System.out.println("Current Time : "+fileDate);
         file_path = ("C:\\TEMP\\"+fileDate+".Job");      
         out = new File(file_path);
         System.out.println("Output File Name : "+out);
         /* map change Rev 1.3*/
         //map new code...
         PrintWriter out = null;
         try
                   out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
                   out.print("LABEL \"");
                   out.print(item);
                   out.print("_");
                   out.print(item_rev);
                   out.print("_");
                   out.print(label_tmp);
                   out.print(".lbl\"");
                   out.println();
                   // All other stuff...
         finally
              try
                   out.close();
              catch(Exception e)
                   System.err.println("Unable to close output stream");
                   e.printStackTrace();
         return inData;

  • 'int' not serializable!?

    Hello all,
    When deploying my application to WLS 8.1, I keep getting warnings along the lines of
    <Warning> <EJB> <BEA-012034> <The Remote interface method: '//snip// Foo.bar(java.lang.String,int) throws java.rmi.RemoteException //snip// contains a parameter of type: 'int' which is not Serializable. Though the EJB 'Foo' has call-by-reference set to false, this parameter is not Serializable and hence will be passed by reference. A parameter can be passed using call-by-value only if the parameter type is Serializable.>
    This message completely confuses me. Since 'int' is a primitive, it cannot implement the Serializable interface. On the other hand this is not necessary since the JVM knows how to serialize primitives anyway. Furthermore, primitives are by Java specification always passed by value.
    My assumption is that this message is essentially bogus, a weblogic bug if you want, and the int parameter will indeed be passed by value no matter what the warning says. I just cant se how WLS could pass it by reference given that it is running on a VM that implements the java standard.
    Am I missing something here? Please give me your thoughts on this one. We have a customer who is very concerned about these warnings showing up in the log...
    Thank you
    Message was edited by:
    [email protected]

    Hello, and thanks for taking a stab at this.
    While it is great that the fix you ar putting into SP5 allows the administrator to supress BEA-012034 warnings all together, would it not be better to simply correct the code not to issue BEA-012034 warnings for ints, floats and other primitives? Enabeling your fix would indeed make these incorrect messages go away, but it will also supress correct BEA-012034 warnings should our ejb interface [heaven forbid :] contain non-serializable objects.
    thanks

  • Int to serializable

    I have a file with a construction:
    Serializable[] serializable = new int[n];
    It was generated with jad.exe decompiler from .class file.
    When I use javac compiler (java version v1.2.2)
    it reports an error that the types java.io.Serializable and int is incompatible
    any ideas?
    PS
    Sorry for my english

    you need to use the object Integer and not the int primitive type:
    Serializable[] serializable = new Integer[n];Talal

  • Object Replacement with the existing one int the Serialization Stream..

    when u readObject() from serialization its fine,but if u change any of its fields or value of variable and than store it back,it append new object to the Serialization Stream.
    I want to store that object back to its original position in the stream.
    please help me in this regard..

    you need to use (override) the readResolve() and writeReplace() methods in the classes that you'll be switching their instances/values/etc. with something else.
    Look at the javadocs for the java.io.Serializable interface.
    Another option is to subclass the ObjectInputStream and override the resolveObject method. (see java.io.ObjectInputStream). You'll probably also have to subclass ObjectOutputStream and override the writeObjectOverride method.
    You really only need to use one of these mechanisms, not both.
    - Andrew

  • Will 2D objects in java.awt.geom.* be Serializable in next version of Java?

    I am pretty frustrated about having to write my own Serializable classes. I'm not sure if this is the right place to ask, but will the next version of Java supports Serializable 2D objects?
    Further, I was trying to write my own class to extend java.awt.geom.GeneralPath to become Serializable, but it's declared "final". What should I do? (I had no problems with Rectangle2D.Double, Line2D.Double, etc.)
    Any help is greatly appreciated.
    Selwyn

    Your code for serializing the state of the General path forgets two things:
    1. the winding rule
    2. the segments types!
    You could use a vector, but I just directly wrote to the file:
    private void writeObject(ObjectOutputStream oos) throws IOException
    {     out.defaultWriteObject();
         //write state of transient GeneralPath _gp;
         out.writeInt(_gp.getWindingRule());
         float[] coord = new float[6];
         PathIterator i = _gp.getPathIterator(null);
         while(!i.isDone())
         {     int seg = i.currentSegment(coords);
              writeInt(seg);
              //switch on seg, writing correct # of floats from coords
              i.next();
         out.writeInt(-1);     //sentinel for end-of-data: SEG_LINETO etc are [0,4]
    private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
    {     in.defaultReadObject();
         int rule = in.readInt();
         _gp = new GeneralPath(rule);
         //etc...
    }3. I'm just winging this code -- haven't tested it
    --Nax                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem with writing and reading using serialization

    I am having a problem with writing and reading an object that has another object in it. The purpose of the class is to write a order that has multiple items in it. And there will be several orders. This is for an IB project, where one of the requirements is to utilize a hierarchical composite data structure. That is, it is "one that contains more than one element and at least one of the elements is a composite data structure. Examples are, an array or linked list of records, a record that has one field that is another record, or an array". The code is shown below:
    The error produced is
    java.lang.NullPointerException
         at SamsonRubberIndustries.CustomerOrderDetails.createCustOrdDetailsScreen(CustomerOrderDetails.java:150)
         at SamsonRubberIndustries.CustomerOrderDetails$1.run(CustomerOrderDetails.java:78)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    public class CustOrdObject implements Serializable {
         public int CustID;
         public int CustOrderID;
         public Object OrderDate;
         public InnerCustOrdObject[] innerCustOrdObj;
         public float GrandTotal;
         public int MaxItems;
         public CustOrdObject() {}
         public CustOrdObject(InnerCustOrdObject[] innerCustOrdObj,
    int CustID, int CustOrderID, Object OrderDate,
    float GrandTotal, int innerarrlength, int innerarrpos, int MaxItems) {
              this.CustID = CustID;
              this.CustOrderID = CustOrderID;
              this.OrderDate = OrderDate;
              this.GrandTotal = GrandTotal;          
              this.MaxItems = MaxItems;
              this.innerCustOrdObj = new InnerCustOrdObject[MaxItems];
         public InnerCustOrdObject[] getInnerCustOrdObj() {
              return innerCustOrdObj;
         public void setInnerCustOrdObj(InnerCustOrdObject[] innerCustOrdObj) {
              this.innerCustOrdObj = innerCustOrdObj;
         public int getCustID() {
              return CustID;
         public void setCustID(int custID) {
              CustID = custID;
         public int getCustOrderID() {
              return CustOrderID;
         public void setCustOrderID(int custOrderID) {
              CustOrderID = custOrderID;
         public Object getOrderDate() {
              return OrderDate;
         public void setOrderDate(Object orderDate) {
              OrderDate = orderDate;
         public void setGrandTotal(float grandTotal) {
              GrandTotal = grandTotal;
         public float getGrandTotal() {
              return GrandTotal;
         public int getMaxItems() {
              return MaxItems;
         public void setMaxItems(int maxItems) {
              MaxItems = maxItems;
    public class InnerCustOrdObject implements Serializable{
         public int ItemNumber;
         public float UnitPrice;
         public int QuantityRequired;
         public float TotalPrice;
         public InnerCustOrdObject() {}
         public InnerCustOrdObject(int ItemNumber, float
    UnitPrice, int QuantityRequired, float TotalPrice){
              this.ItemNumber = ItemNumber;
              this.UnitPrice = UnitPrice;
              this.QuantityRequired = QuantityRequired;
              this.TotalPrice = TotalPrice;
         public int getItemNumber() {
              return ItemNumber;
         public void setItemNumber(int itemNumber) {
              ItemNumber = itemNumber;
         public int getQuantityRequired() {
              return QuantityRequired;
         public void setQuantityRequired(int quantityRequired) {
              QuantityRequired = quantityRequired;
         public float getTotalPrice() {
              return TotalPrice;
         public void setTotalPrice(float totalPrice) {
              TotalPrice = totalPrice;
         public float getUnitPrice() {
              return UnitPrice;
         public void setUnitPrice(float unitPrice) {
              UnitPrice = unitPrice;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import javax.swing.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.DefaultTableModel;
    public class CustomerOrderDetails extends CommonFeatures{
         //TODO
         private static int MAX_ORDERS = 200;
         private static int MAX_ORDERITEMS = 100;
         private static int MaxRecord;
         private static int CurrentRecord = 1;
         private static int currentItem;
         private static int MaxItems;
         private static boolean FileExists, recFileExists;
         private static CustOrdObject[] orderDetails = new CustOrdObject[MAX_ORDERS];
         private static InnerCustOrdObject[] innerCustOrdObj = new InnerCustOrdObject[MAX_ORDERITEMS];     
         private static File OrderDetailsFile = new File("CustOrdDetails.dat");
         private static File OrdRecordNumStore = new File("OrdRecordNumStore.txt");
         private static PrintWriter writeFile;
         private static BufferedReader readFile;
         private static ObjectOutputStream objOut;
         private static ObjectInputStream objIn;
         //Set format for date
         SimpleDateFormat simpleDF = new SimpleDateFormat("dd MM yyyy");
         //--<BEGINNING>--Declaring Interface Variables------------------------------------------//
         private JPanel innertoppanel, innercenterpanel, innerbottompanel, innerrightpanel, innerleftpanel;
         private JLabel CustIDLbl, CustOrderIDLbl, OrderedDateLbl, GrandTotLbl, ItemNumberLbl,UnitPriceLbl, QuantityReqLbl, TotPriceLbl;
         private JTextField CustIDTxt, CustOrderIDTxt, OrderedDateTxt, GrandTotTxt, ItemNumberTxt, UnitPriceTxt, QuantityReqTxt, TotPriceTxt;
         private JButton addrecordbtn, savebtn, externalprevbtn, externalnextbtn, internalprevbtn, internalnextbtn, gotorecordbtn, additemreqbtn;
         //--<END>--Declaring Interface Variables------------------------------------------------//
         public static void main(String[] args) {
              final CustomerOrderDetails COD = new CustomerOrderDetails();
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                             COD.createCustOrdDetailsScreen();
                        } catch (Exception eb) {
                             eb.printStackTrace();
         //--<BEGINNING>--Creating CustomerOrderDetails Screen---------------------------------------//
         public JFrame createCustOrdDetailsScreen() {
              createDefaultFrame();
              mainframe.setSize(800,500);
              createContainerPanel();
              containerpanel.add(createCustOrdDetailsTitle(), BorderLayout.NORTH);
              containerpanel.add(createCustOrdDetailsMainPanel(), BorderLayout.CENTER);
              //containerpanel.add(createCustOrdDetailsLeftNavButtons(), BorderLayout.WEST);
              //containerpanel.add(createCustOrdDetailsRightNavButtons(), BorderLayout.EAST);
              containerpanel.add(createCustOrdDetailsButtons(), BorderLayout.SOUTH);
              mainframe.setContentPane(containerpanel);
              mainframe.setLocationRelativeTo(null);
              mainframe.setVisible(true);
              //--<BEGINNING>--Checks to see whether CRecordNumberStore file exists-------------------------------//
              if (OrdRecordNumStore.exists() == true) {
                   recFileExists = true;
              }else {
                   recFileExists = false;
              if (recFileExists == true) {
                   MaxRecord = readRecordNumber();
                   CurrentRecord = MaxRecord;
                   //readOrder();
                   //readInnerOrderRecord(CurrentRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              }else{
                   MaxRecord = 1;
                   writeRecordNumber(MaxRecord);
                   CustOrderIDTxt.setText(""+MaxRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              //--<END>--Checks to see whether CRecordNumberStore file exists--------------------------------------//
              if(readOrder() != null){
                   orderDetails = (CustOrdObject[]) readOrder();
                 innerCustOrdObj = orderDetails[CurrentRecord].getInnerCustOrdObj();
                   MaxItems = orderDetails[CurrentRecord].getMaxItems();
                   if(CurrentRecord > 1 && CurrentRecord < MaxRecord){
                        externalnextbtn.setEnabled(true);
                        externalprevbtn.setEnabled(true);
                   if(CurrentRecord >= MaxRecord){
                        externalnextbtn.setEnabled(false);
                   getFieldText(CurrentRecord-1);
              }else{
                   orderDetails[CurrentRecord] = new CustOrdObject();
                   currentItem = 1;
              return mainframe;
         //--<END>--Creating CustomerOrderDetails Screen---------------------------------------------//
         public JPanel createCustOrdDetailsTitle(){
              createTitlePanel();
              titlepanel.setBackground(TxtfontColor);
              label.setText("- Customer Order Details -");
              labelpanel.setBackground(TxtfontColor);
              label.setForeground(Color.white);
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor) ;
              buttonpanel.add(createReturnToMainMenuButton());
              titlepanel.add(labelpanel, BorderLayout.WEST);
              titlepanel.add(buttonpanel, BorderLayout.EAST);
              return titlepanel;
         public JPanel createCustOrdDetailsMainPanel(){
              createmainpanel();
              mainpanel.setBackground(TxtfontColor);
              mainpanel.setLayout(new BorderLayout());          
              mainpanel.setBorder(BorderFactory.createTitledBorder(""));
              mainpanel.add(createInnerTopPanel(), BorderLayout.NORTH);
              mainpanel.add(createInnerCenterPanel(), BorderLayout.CENTER);
              mainpanel.add(createInnerBottomPanel(), BorderLayout.SOUTH);
              mainpanel.add(createInnerRightPanel(), BorderLayout.EAST);
              mainpanel.add(createInnerLeftPanel(), BorderLayout.WEST);
              return mainpanel;
         public JPanel createInnerTopPanel(){
              innertoppanel = new JPanel(new GridBagLayout());
              innertoppanel.setBackground(TxtfontColor);
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              CustIDLbl = new JLabel("Customer ID");
              CustIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustIDLbl.setFont(font);
              CustIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innertoppanel.add(CustIDLbl, GBC);     
              CustIDTxt = new JTextField(20);
              CustIDTxt.setEditable(true);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innertoppanel.add(CustIDTxt, GBC);
              GBC.gridx = 3;
              GBC.gridy = 1;
              innertoppanel.add(Box.createHorizontalStrut(220), GBC);
              OrderedDateLbl = new JLabel("Order Date");
              OrderedDateLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              OrderedDateLbl.setFont(font);
              OrderedDateLbl.setForeground(LblfontColor);
              GBC.gridx = 4;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateLbl, GBC);     
              //Get today's date
              Date todaydate = new Date();
              OrderedDateTxt = new JTextField(simpleDF.format(todaydate), 20);
              OrderedDateTxt.setHorizontalAlignment(JTextField.CENTER);
              OrderedDateTxt.setEditable(false);
              GBC.gridx = 5;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateTxt, GBC);
              CustOrderIDLbl = new JLabel("Customer Order ID");
              CustOrderIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustOrderIDLbl.setFont(font);
              CustOrderIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDLbl, GBC);
              CustOrderIDTxt = new JTextField(20);
              CustOrderIDTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDTxt, GBC);
              return innertoppanel;
         public JPanel createInnerCenterPanel(){
              innercenterpanel = new JPanel(new GridBagLayout());
              innercenterpanel.setBackground(TxtfontColor);
              innercenterpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              ItemNumberLbl = new JLabel("Item Number");
              ItemNumberLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              ItemNumberLbl.setFont(font);
              ItemNumberLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberLbl, GBC);     
              ItemNumberTxt = new JTextField(20);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberTxt, GBC);
              UnitPriceLbl = new JLabel("Unit Price");
              UnitPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              UnitPriceLbl.setFont(font);
              UnitPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceLbl, GBC);     
              UnitPriceTxt = new JTextField(20);
              //UnitPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceTxt, GBC);
              QuantityReqLbl = new JLabel("Quantity Required");
              QuantityReqLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              QuantityReqLbl.setFont(font);
              QuantityReqLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqLbl, GBC);     
              QuantityReqTxt = new JTextField(20);
              //QuantityReqTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqTxt, GBC);
              TotPriceLbl = new JLabel("Total Price");
              TotPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              TotPriceLbl.setFont(font);
              TotPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceLbl, GBC);     
              TotPriceTxt = new JTextField(20);
              //TotPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceTxt, GBC);
              return innercenterpanel;
         public JPanel createInnerBottomPanel(){
              innerbottompanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              innerbottompanel.setBackground(TxtfontColor);
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              GrandTotLbl = new JLabel("Grand Total");
              GrandTotLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              GrandTotLbl.setFont(font);
              GrandTotLbl.setForeground(LblfontColor);
              innerbottompanel.add(GrandTotLbl);
              innerbottompanel.add(Box.createHorizontalStrut(30));
              GrandTotTxt = new JTextField(20);
              innerbottompanel.add(GrandTotTxt);
              return innerbottompanel;
         public JPanel createInnerRightPanel(){
              innerrightpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerrightpanel.setBackground(TxtfontColor);
              innerrightpanel.setLayout(new BoxLayout(navrightpanel, BoxLayout.Y_AXIS));
              innerrightpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerrightpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalnextbtn = new JButton(createNextButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        //getInnerFieldText(currentItem);
                        internalprevbtn.setEnabled(true);
                        if(currentItem < MaxItems){
                             ++CurrentRecord;
                             //readOrder();
                             //readInnerOrderRecord(CurrentRecord);
                             setInnerFieldText(currentItem);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(currentItem == MaxItems){
                             internalnextbtn.setEnabled(false);
              innerrightpanel.add(internalnextbtn, GBC);
              return innerrightpanel;
         public JPanel createInnerLeftPanel(){
              innerleftpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerleftpanel.setBackground(TxtfontColor);
              innerleftpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerleftpanel.setForeground(Color.BLACK);
              innerleftpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalprevbtn = new JButton(createPreviousButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        //getInnerFieldText(currentItem);
                        internalnextbtn.setEnabled(true);
                        if(currentItem == 1){
                             internalprevbtn.setEnabled(false);
                        if(currentItem > 0){
                             --currentItem;
                             //readOrder();
                             setInnerFieldText(currentItem);
              innerleftpanel.add(internalprevbtn, GBC);
              return innerleftpanel;
         public JPanel createCustOrdDetailsButtons(){
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor);
              externalprevbtn = new JButton(createPreviousButtonIcon());
              externalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalnextbtn.setEnabled(true);
                        if(CurrentRecord == 1){
                             externalprevbtn.setEnabled(false);
                        if(CurrentRecord > 0){
                             --CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
              buttonpanel.add(externalprevbtn);
              addrecordbtn = new JButton("Add Record", createAddButtonIcon());
              addrecordbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             MaxRecord = readRecordNumber();
                             MaxRecord++;
                             writeRecordNumber(MaxRecord);
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             CustIDTxt.setText("");
                             CustOrderIDTxt.setText(""+MaxRecord);
                             //Get today's date
                             Date todaydate = new Date();
                             OrderedDateTxt.setText(""+simpleDF.format(todaydate));
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             GrandTotTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             externalnextbtn.setEnabled(false);
                             externalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(addrecordbtn);
              savebtn = new JButton("Save Data", createSaveButtonIcon());
              savebtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        setFieldText(CurrentRecord);
                        writeOrder();
                        writeRecordNumber(MaxRecord);
                        System.out.println(CurrentRecord);
                        System.out.println(MaxRecord);
              buttonpanel.add(savebtn);
              java.net.URL imageURL_AddRowIcon = CommonFeatures.class.getResource("Icons/edit_add.png");
              ImageIcon AddRowIcon = new ImageIcon(imageURL_AddRowIcon);
              additemreqbtn = new JButton("Add Item", AddRowIcon);
              additemreqbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             //CurrentRecord = MaxRecord;
                             currentItem++;
                             setInnerFieldText(currentItem);
                             internalnextbtn.setEnabled(false);
                             internalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(additemreqbtn);
              externalnextbtn = new JButton(createNextButtonIcon());
              externalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalprevbtn.setEnabled(true);
                        if(CurrentRecord < MaxRecord){
                             ++CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(CurrentRecord == MaxRecord){
                             externalnextbtn.setEnabled(false);
              buttonpanel.add(externalnextbtn);
              return buttonpanel;
         //TODO
         public void setFieldText(int orderID){//TODO
              orderDetails[orderID].setCustID(Integer.parseInt(CustIDTxt.getText()));
              orderDetails[orderID].setCustOrderID(Integer.parseInt(CustOrderIDTxt.getText()));
              orderDetails[orderID].setOrderDate(OrderedDateTxt.getText());
              orderDetails[orderID].setInnerCustOrdObj(innerCustOrdObj);
              orderDetails[orderID].setMaxItems(MaxItems);
              setInnerFieldText(currentItem);
              orderDetails[orderID].setGrandTotal(Float.parseFloat(GrandTotTxt.getText()));
         public void setInnerFieldText(int currentItem){//TODO
              innerCustOrdObj[currentItem] = new InnerCustOrdObject();
              innerCustOrdObj[currentItem].setItemNumber(Integer.parseInt(ItemNumberTxt.getText()));
              innerCustOrdObj[currentItem].setUnitPrice(Float.parseFloat(UnitPriceTxt.getText()));
              innerCustOrdObj[currentItem].setQuantityRequired(Integer.parseInt(QuantityReqTxt.getText()));
              innerCustOrdObj[currentItem].setTotalPrice(Float.parseFloat(TotPriceTxt.getText()));
         public void getFieldText(int orderID){
              CustIDTxt.setText(Integer.toString(orderDetails[orderID].getCustID()));
              CustOrderIDTxt.setText(Integer.toString(orderDetails[orderID].getCustOrderID()));
              OrderedDateTxt.setText(""+orderDetails[orderID].getOrderDate());          
              currentItem = orderDetails[orderID].getMaxItems();
              System.err.println("currentItem" + currentItem);
              getInnerFieldText(currentItem);
              GrandTotTxt.setText(Float.toString(orderDetails[orderID].getGrandTotal()));
         public void getInnerFieldText(int currentItem){
              ItemNumberTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getItemNumber()));
              UnitPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getUnitPrice()));
              QuantityReqTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getQuantityRequired()));
              TotPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getTotalPrice()));
         public void writeOrder(){//TODO
              try {
                   objOut = new ObjectOutputStream(new FileOutputStream(OrderDetailsFile));
                   objOut.writeObject(orderDetails);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              } catch (IOException e) {
                   e.printStackTrace();
         public Object readOrder(){
              Object temporaryObj;
              try{
                   objIn = new ObjectInputStream(new FileInputStream(OrderDetailsFile));
                   temporaryObj = objIn.readObject();               
                   CustOrdObject[] blah = (CustOrdObject[]) temporaryObj;
                   System.out.println("Outer: "+blah[1].getCustID());
                   InnerCustOrdObject[] whee = blah[1].getInnerCustOrdObj();
                   System.out.println("Inner: "+whee[1].getItemNumber());
                   objIn.close();
                   System.out.println("Read Worky!");
                   return temporaryObj;
              }catch(Exception e){
                   e.printStackTrace();
                   System.out.println("Read No Worky!");
                   return null;
         public void writeRecordNumber(int MaxRecord){
              try{
                   objOut = new ObjectOutputStream(new FileOutputStream(OrdRecordNumStore));
                   objOut.writeObject(MaxRecord);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              }catch(Exception e){e.printStackTrace();}
         public int readRecordNumber() {
              try {
                   objIn = new ObjectInputStream(new FileInputStream(OrdRecordNumStore));
                   int temporaryObj = Integer.parseInt(objIn.readObject().toString());
                   objIn.close();
                   System.out.println("Read Number Worky!");
                   return temporaryObj;
              } catch (Exception e) {
                   e.printStackTrace();
                   System.out.println("Read Number No Worky!");
                   return -1;
    }Message was edited by:
    Kilik07
    Message was edited by:
    Kilik07

    ok i got reading to work to a certain extent... but the prob is i cnt seem to save my innerCustOrdObj proprly...when ever i look for a record using the gotorecordbtn, the outerobject, which is the orderDetails, seems to change but the innerCustOrdObj remains the same... heres the new code..
    public class CustomerOrderDetails extends CommonFeatures{
         //TODO
         private static int MAX_ORDERS = 200;
         private static int MAX_ORDERITEMS = 100;
         private static int MaxRecord;
         private static int CurrentRecord = 1;
         private static int currentItem;
         private static int MaxItems = 1;
         private static boolean FileExists, recFileExists;
         private static boolean RecordExists;
         private static CustOrdObject[] orderDetails = new CustOrdObject[MAX_ORDERS];
         private static InnerCustOrdObject[] innerCustOrdObj = new InnerCustOrdObject[MAX_ORDERITEMS];     
         private static File OrderDetailsFile = new File("CustOrdDetails.ser");
         private static File OrdRecordNumStore = new File("OrdRecordNumStore.txt");
         private static PrintWriter writeFile;
         private static BufferedReader readFile;
         private static ObjectOutputStream objOut;
         private static ObjectInputStream objIn;
         //Set format for date
         SimpleDateFormat simpleDF = new SimpleDateFormat("dd MM yyyy");
         //--<BEGINNING>--Declaring Interface Variables------------------------------------------//
         private JPanel innertoppanel, innercenterpanel, innerbottompanel, innerrightpanel, innerleftpanel;
         private JLabel CustIDLbl, CustOrderIDLbl, OrderedDateLbl, GrandTotLbl, ItemNumberLbl,UnitPriceLbl, QuantityReqLbl, TotPriceLbl;
         private JTextField CustIDTxt, CustOrderIDTxt, OrderedDateTxt, GrandTotTxt, ItemNumberTxt, UnitPriceTxt, QuantityReqTxt, TotPriceTxt;
         private JButton addrecordbtn, savebtn, externalprevbtn, externalnextbtn, internalprevbtn, internalnextbtn, gotorecordbtn, additemreqbtn;
         //--<END>--Declaring Interface Variables------------------------------------------------//
         public static void main(String[] args) {
              final CustomerOrderDetails COD = new CustomerOrderDetails();
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                             COD.createCustOrdDetailsScreen();
                        } catch (Exception eb) {
                             eb.printStackTrace();
         //--<BEGINNING>--Creating CustomerOrderDetails Screen---------------------------------------//
         public JFrame createCustOrdDetailsScreen() {
              createDefaultFrame();
              mainframe.setSize(800,500);
              createContainerPanel();
              containerpanel.add(createCustOrdDetailsTitle(), BorderLayout.NORTH);
              containerpanel.add(createCustOrdDetailsMainPanel(), BorderLayout.CENTER);
              //containerpanel.add(createCustOrdDetailsLeftNavButtons(), BorderLayout.WEST);
              //containerpanel.add(createCustOrdDetailsRightNavButtons(), BorderLayout.EAST);
              containerpanel.add(createCustOrdDetailsButtons(), BorderLayout.SOUTH);
              mainframe.setContentPane(containerpanel);
              mainframe.setLocationRelativeTo(null);
              mainframe.setVisible(true);
              //--<BEGINNING>--Checks to see whether CRecordNumberStore file exists-------------------------------//
              if (OrdRecordNumStore.exists() == true) {
                   recFileExists = true;
              }else {
                   recFileExists = false;
              if (recFileExists == true) {
                   MaxRecord = readRecordNumber();
                   CurrentRecord = MaxRecord;
                   //readOrder();
                   //readInnerOrderRecord(CurrentRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              }else{
                   MaxRecord = 1;
                   writeRecordNumber(MaxRecord);
                   CustOrderIDTxt.setText(""+MaxRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              //--<END>--Checks to see whether CRecordNumberStore file exists--------------------------------------//
              if(readOrder() != null){
                   orderDetails = (CustOrdObject[]) readOrder();
                   //CurrentRecord--;
                   //System.out.println("Current Rec Here"+CurrentRecord);
                   if(orderDetails[CurrentRecord] == null){
                        System.err.println("CustomerOrderObj 1 is null !!");
                   }else{
                        System.err.println("CustomerOrderObj 1 is  not null !!");
                   if(orderDetails[CurrentRecord].getInnerCustOrdObj() == null){
                        System.err.println("InnerCustomerOrderObj is null !!");
                   }else{
                        System.err.println("InnerCustomerOrderObj is  not null !!");
                   innerCustOrdObj = orderDetails[CurrentRecord].getInnerCustOrdObj();
                   MaxItems = orderDetails[CurrentRecord].getMaxItems();
                   if(CurrentRecord > 1 && CurrentRecord < MaxRecord){
                        externalnextbtn.setEnabled(true);
                        externalprevbtn.setEnabled(true);
                   if(CurrentRecord >= MaxRecord){
                        externalnextbtn.setEnabled(false);
                   getFieldText(CurrentRecord);
                   getInnerFieldText(MaxItems);
              }else{
                   orderDetails[CurrentRecord] = new CustOrdObject();
                   currentItem = 1;
              return mainframe;
         //--<END>--Creating CustomerOrderDetails Screen---------------------------------------------//
         public JPanel createCustOrdDetailsTitle(){
              createTitlePanel();
              titlepanel.setBackground(TxtfontColor);
              label.setText("- Customer Order Details -");
              labelpanel.setBackground(TxtfontColor);
              label.setForeground(Color.white);
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor) ;
              buttonpanel.add(createReturnToMainMenuButton());
              titlepanel.add(labelpanel, BorderLayout.WEST);
              titlepanel.add(buttonpanel, BorderLayout.EAST);
              return titlepanel;
         public JPanel createCustOrdDetailsMainPanel(){
              createmainpanel();
              mainpanel.setBackground(TxtfontColor);
              mainpanel.setLayout(new BorderLayout());          
              mainpanel.setBorder(BorderFactory.createTitledBorder(""));
              mainpanel.add(createInnerTopPanel(), BorderLayout.NORTH);
              mainpanel.add(createInnerCenterPanel(), BorderLayout.CENTER);
              mainpanel.add(createInnerBottomPanel(), BorderLayout.SOUTH);
              mainpanel.add(createInnerRightPanel(), BorderLayout.EAST);
              mainpanel.add(createInnerLeftPanel(), BorderLayout.WEST);
              return mainpanel;
         public JPanel createInnerTopPanel(){
              innertoppanel = new JPanel(new GridBagLayout());
              innertoppanel.setBackground(TxtfontColor);
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              CustIDLbl = new JLabel("Customer ID");
              CustIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustIDLbl.setFont(font);
              CustIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innertoppanel.add(CustIDLbl, GBC);     
              CustIDTxt = new JTextField(20);
              CustIDTxt.setEditable(true);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innertoppanel.add(CustIDTxt, GBC);
              GBC.gridx = 3;
              GBC.gridy = 1;
              innertoppanel.add(Box.createHorizontalStrut(220), GBC);
              OrderedDateLbl = new JLabel("Order Date");
              OrderedDateLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              OrderedDateLbl.setFont(font);
              OrderedDateLbl.setForeground(LblfontColor);
              GBC.gridx = 4;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateLbl, GBC);     
              //Get today's date
              Date todaydate = new Date();
              OrderedDateTxt = new JTextField(simpleDF.format(todaydate), 20);
              OrderedDateTxt.setHorizontalAlignment(JTextField.CENTER);
              OrderedDateTxt.setEditable(false);
              GBC.gridx = 5;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateTxt, GBC);
              CustOrderIDLbl = new JLabel("Customer Order ID");
              CustOrderIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustOrderIDLbl.setFont(font);
              CustOrderIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDLbl, GBC);
              CustOrderIDTxt = new JTextField(20);
              //CustOrderIDTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDTxt, GBC);
              return innertoppanel;
         public JPanel createInnerCenterPanel(){
              innercenterpanel = new JPanel(new GridBagLayout());
              innercenterpanel.setBackground(TxtfontColor);
              innercenterpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              ItemNumberLbl = new JLabel("Item Number");
              ItemNumberLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              ItemNumberLbl.setFont(font);
              ItemNumberLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberLbl, GBC);     
              ItemNumberTxt = new JTextField(20);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberTxt, GBC);
              UnitPriceLbl = new JLabel("Unit Price");
              UnitPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              UnitPriceLbl.setFont(font);
              UnitPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceLbl, GBC);     
              UnitPriceTxt = new JTextField(20);
              //UnitPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceTxt, GBC);
              QuantityReqLbl = new JLabel("Quantity Required");
              QuantityReqLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              QuantityReqLbl.setFont(font);
              QuantityReqLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqLbl, GBC);     
              QuantityReqTxt = new JTextField(20);
              //QuantityReqTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqTxt, GBC);
              TotPriceLbl = new JLabel("Total Price");
              TotPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              TotPriceLbl.setFont(font);
              TotPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceLbl, GBC);     
              TotPriceTxt = new JTextField(20);
              TotPriceTxt.setEditable(false);
              TotPriceTxt.addFocusListener(new FocusAdapter(){
                   public void focusGained(FocusEvent evt){
                        TotPriceTxt.setText(""+Integer.parseInt(UnitPriceTxt.getText())*Integer.parseInt(QuantityReqTxt.getText()));
              GBC.gridx = 2;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceTxt, GBC);
              return innercenterpanel;
         public JPanel createInnerBottomPanel(){
              innerbottompanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              innerbottompanel.setBackground(TxtfontColor);
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              GrandTotLbl = new JLabel("Grand Total");
              GrandTotLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              GrandTotLbl.setFont(font);
              GrandTotLbl.setForeground(LblfontColor);
              innerbottompanel.add(GrandTotLbl);
              innerbottompanel.add(Box.createHorizontalStrut(30));
              GrandTotTxt = new JTextField(20);
              innerbottompanel.add(GrandTotTxt);
              return innerbottompanel;
         public JPanel createInnerRightPanel(){
              innerrightpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerrightpanel.setBackground(TxtfontColor);
              innerrightpanel.setLayout(new BoxLayout(navrightpanel, BoxLayout.Y_AXIS));
              innerrightpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerrightpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalnextbtn = new JButton(createNextButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getInnerFieldText(currentItem);
                        internalprevbtn.setEnabled(true);
                        if(currentItem < MaxItems){
                             ++currentItem;
                             orderDetails[CurrentRecord].getInnerCustOrdObj();
                             setInnerFieldText(currentItem);
                             System.out.println("Current Item" + currentItem);
                        if(currentItem == MaxItems){
                             internalnextbtn.setEnabled(false);
              innerrightpanel.add(internalnextbtn, GBC);
              return innerrightpanel;
         public JPanel createInnerLeftPanel(){
              innerleftpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerleftpanel.setBackground(TxtfontColor);
              innerleftpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerleftpanel.setForeground(Color.BLACK);
              innerleftpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalprevbtn = new JButton(createPreviousButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getInnerFieldText(currentItem);
                        internalnextbtn.setEnabled(true);
                        if(currentItem == 1){
                             internalprevbtn.setEnabled(false);
                        if(currentItem > 0){
                             --currentItem;
                             orderDetails[CurrentRecord].getInnerCustOrdObj();
                             setInnerFieldText(currentItem);
                             System.out.println("Current Item" + currentItem);
              innerleftpanel.add(internalprevbtn, GBC);
              return innerleftpanel;
         public JPanel createCustOrdDetailsButtons(){
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor);
              externalprevbtn = new JButton(createPreviousButtonIcon());
              externalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalnextbtn.setEnabled(true);
                        if(CurrentRecord == 1){
                             externalprevbtn.setEnabled(false);
                        if(CurrentRecord > 0){
                             --CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println("Current Record " + CurrentRecord);//Checking RECORD_NUM
              buttonpanel.add(externalprevbtn);
              addrecordbtn = new JButton("Add Record", createAddButtonIcon());
              addrecordbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             MaxRecord = readRecordNumber();
                             MaxRecord++;
                             CurrentRecord = MaxRecord;
                             orderDetails[CurrentRecord] = new CustOrdObject();
                             writeRecordNumber(MaxRecord);
                             MaxItems = 1;
                             innerCustOrdObj[MaxItems] = new InnerCustOrdObject();
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             CustIDTxt.setText("");
                             CustOrderIDTxt.setText(""+MaxRecord);
                             //Get today's date
                             Date todaydate = new Date();
                             OrderedDateTxt.setText(""+simpleDF.format(todaydate));
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             GrandTotTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             externalnextbtn.setEnabled(false);
                             externalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(addrecordbtn);
              savebtn = new JButton("Save Data", createSaveButtonIcon());
              savebtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        setFieldText(CurrentRecord);
                        setInnerFieldText(MaxItems);
                        writeOrder();
                        writeRecordNumber(MaxRecord);
                        System.out.println(CurrentRecord);
                        System.out.println(MaxRecord);
              buttonpanel.add(savebtn);
              java.net.URL imageURL_AddRowIcon = CommonFeatures.class.getResource("Icons/edit_add.png");
              ImageIcon AddRowIcon = new ImageIcon(imageURL_AddRowIcon);
              additemreqbtn = new JButton("Add Item", AddRowIcon);
              additemreqbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             //CurrentRecord = MaxRecord;
                             MaxItems++;
                             innerCustOrdObj[MaxItems] = new InnerCustOrdObject();
                             System.out.println("Max Items "+MaxItems);
                             currentItem = MaxItems;
                             orderDetails[CurrentRecord].setMaxItems(MaxItems);
                             ///setInnerFieldText(currentItem);
                             internalnextbtn.setEnabled(false);
                             internalprevbtn.setEnabled(true);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(additemreqbtn);
              externalnextbtn = new JButton(createNextButtonIcon());
              externalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalprevbtn.setEnabled(true);
                        if(CurrentRecord < MaxRecord){
                             ++CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(CurrentRecord == MaxRecord){
                             externalnextbtn.setEnabled(false);
              buttonpanel.add(externalnextbtn);
              gotorecordbtn = new JButton("Go To Record", createGotoButtonIcon());
              gotorecordbtn.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt){
                         * The text from the GotorecordTxt textfield will be taken and assigned
                         * to a temporary integer variable called Find. 
                        int Find = Integer.parseInt(CustOrderIDTxt.getText());
                        for(int j=1; j <= MaxRecord; j++){
                              * Using a for loop, each record can be read using the readCustRecord
                              * method.
                             getFieldText(j);
                              * An if condition is utilized to check whether the temporary stored variable, Find,
                              * matches a field in a record. If this record is found, then using the RecordExists
                              * which was declared at the top, either a true or false statement can be assigned
                              * If the record exists, then a true statement will be assigned, if not a false
                              * statement will be assigned.
                             if(orderDetails[j].getCustOrderID() == Find){
                                  RecordExists = true;
                                  break;
                             }else{
                                  RecordExists = false;
                        if(RecordExists == false){
                              * If the RecordExists is assigned a false statement, then a message will be
                              * displayed to show that the record does not exist.
                             JOptionPane.showMessageDialog(null, "Record Does Not Exist!", "Error Message", JOptionPane.ERROR_MESSAGE, createErrorIcon());
                        }else{
                             getFieldText(Find);
              buttonpanel.add(gotorecordbtn);
              return buttonpanel;
         //TODO
         public void setFieldText(int orderID){//TODO
              orderDetails[orderID].setCustID(Integer.parseInt(CustIDTxt.getText()));
              orderDetails[orderID].setCustOrderID(Integer.parseInt(CustOrderIDTxt.getText()));
              orderDetails[orderID].setOrderDate(OrderedDateTxt.getText());
              orderDetails[orderID].setInnerCustOrdObj(innerCustOrdObj);
              orderDetails[orderID].setMaxItems(MaxItems);
              setInnerFieldText(currentItem);
              orderDetails[orderID].setGrandTotal(Float.parseFloat(GrandTotTxt.getText()));
         public void setInnerFieldText(int currentItem){//TODO
              innerCustOrdObj[currentItem] = new InnerCustOrdObject();
              innerCustOrdObj[currentItem].setMaxItems(MaxItems);
              innerCustOrdObj[currentItem].setItemNumber(Integer.parseInt(ItemNumberTxt.getText()));
              innerCustOrdObj[currentItem].setUnitPrice(Float.parseFloat(UnitPriceTxt.getText()));
              innerCustOrdObj[currentItem].setQuantityRequired(Integer.parseInt(QuantityReqTxt.getText()));
              innerCustOrdObj[currentItem].setTotalPrice(Float.parseFloat(TotPriceTxt.getText()));
         public void getFieldText(int orderID){
              CustIDTxt.setText(Integer.toString(orderDetails[orderID].getCustID()));
              CustOrderIDTxt.setText(Integer.toString(orderDetails[orderID].getCustOrderID()));
              OrderedDateTxt.setText(""+orderDetails[orderID].getOrderDate());          
              currentItem = orderDetails[orderID].getMaxItems();
              orderDetails[orderID].getInnerCustOrdObj();
              System.err.println("currentItem" + currentItem);
              //getInnerFieldText(currentItem);
              GrandTotTxt.setText(Float.toString(orderDetails[orderID].getGrandTotal()));
         public void getInnerFieldText(int currentItem){
              ItemNumberTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getItemNumber()));
              UnitPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getUnitPrice()));
              QuantityReqTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getQuantityRequired()));
              TotPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getTotalPrice()));
         public void writeOrder(){//TODO
              try {
                   objOut = new ObjectOutputStream(new FileOutputStream(OrderDetailsFile));
                   objOut.writeObject(orderDetails);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              } catch (IOException e) {
                   e.printStackTrace();
         public Object readOrder(){
              Object temporaryObj;
              try{
                   objIn = new ObjectInputStream(new FileInputStream(OrderDetailsFile));
                   temporaryObj = objIn.readObject();               
                   CustOrdObject[] blah = (CustOrdObject[]) temporaryObj;
                   /*               System.out.println("Outer: "+blah[1].getCustID());
                   InnerCustOrdObject[] whee = blah[1].getInnerCustOrdObj();
                   System.out.println("Inner: "+whee[1].getItemNumber());*/
                   objIn.close();
                   System.out.println("Read Worky!");
                   return temporaryObj;
              }catch(Exception e){
                   e.printStackTrace();
                   System.out.println("Read No Worky!");
                   return null;
         public void writeRecordNumber(int MaxRecord){
              try{
                   objOut = new ObjectOutputStream(new FileOutputStream(OrdRecordNumStore));
                   objOut.writeObject(MaxRecord);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              }catch(Exception e){e.printStackTrace();}
         public int readRecordNumber() {
              try {
                   objIn = new ObjectInputStream(new FileInputStream(OrdRecordNumStore));
                   int temporaryObj = Integer.parseInt(objIn.readObject().toString());
                   objIn.close();
                   System.out.println("Read Number Worky!");
                   return temporaryObj;
              } catch (Exception e) {
                   e.printStackTrace();
                   System.out.println("Read Number No Worky!");
                   return -1;
    }Message was edited by:
    Kilik07

  • Trying to serialize C# object and store as XML Datatype in Sql Server 2005

    using
    if (Obj != null)
                   MemoryStream stream = new MemoryStream();
                   StreamWriter writer = new StreamWriter(stream);
                   XmlSerializer x = new XmlSerializer(Obj.GetType());
                   x.Serialize(writer, Obj);
                   writer.Close();
                   byte[] arr = stream.GetBuffer();
                   return Encoding.UTF8.GetString(arr).Trim();
    The object looks like
        public class CorporateBondSec : BaseSecurity
            public double coupon; // CPN
            public string couponType; // CPN_TYPE
            public int couponFreq; // CPN_FREQ
            public string floater; // FLOATER
            public int resetFreq; //REFIX_FREQ
            public DateTime resetDate; //NXT_REFIX_DT              
            public DateTime firstCpnDate; //FIRST_CPN_DT
    XML looks like
    '<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<CorporateBondSec xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n  <coupon>8</coupon>\r\n  <couponType>FIXED</couponType>\r\n  <couponFreq>2</couponFreq>\r\n  <floater>N</floater>\r\n  <resetFreq>0</resetFreq>\r\n  <resetDate>0001-01-01T00:00:00</resetDate>\r\n  <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>\r\n</CorporateBondSec>'
    Error from SQL
    Msg 9413, Level 16, State 1, Procedure procSecuritiesInsert, Line 0
    XML parsing: line 1, character 15, A string literal was expected
    I have also tried
    XmlSerializer x = new XmlSerializer(Obj.GetType());
    System.Text.StringBuilder builder = new System.Text.StringBuilder();
    x.Serialize(XmlWriter.Create(builder), Obj);
    return builder.ToString();
    That gives me an XML
    '<?xml version=\"1.0\" encoding=\"utf-16\"?>
    <CorporateBondSec xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
    <coupon>8</coupon>
    <couponType>FIXED</couponType>
    <couponFreq>2</couponFreq>
    <floater>N</floater>
    <resetFreq>0</resetFreq>
    <resetDate>0001-01-01T00:00:00</resetDate>
    <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>
    </CorporateBondSec>'
    Error
    Msg 9413, Level 16, State 1, Procedure procSecuritiesInsert, Line 0
    XML parsing: line 1, character 15, A string literal was expected

    Tony,
    this is how your XML should look like.
    Code Snippet
    '<?xml version="1.0" encoding="utf-16"?>
    <CorporateBondSec xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <coupon>8</coupon>
    <couponType>FIXED</couponType>
    <couponFreq>2</couponFreq>
    <floater>N</floater>
    <resetFreq>0</resetFreq>
    <resetDate>0001-01-01T00:00:00</resetDate>
    <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>
    </CorporateBondSec>'
    I see you have a few extra '\' characters before double quotes. you need to remove them.

  • Web Service From Java class, serialization problem

    Hi,
    I want to create Web Service from Java class, I made java project, generated web service from it, create web service archive project and deployed it to WAS 6.40.
    My class have 2 methods,
    public int add(int a, int b);
    public MyResponse doSomthing(MyRequest req);
    I can succesfully call add method from Web Service Navigator, it works fine but when I call doSomthing methods I get the following error:
    <b>
    Deserializing fails. Nested message: XML Deserialization Error. Result class [com.mycomp.sap_tech.ws.MyRequest] does not have property [Amount] of type [java.lang.String]. It is required to load XML..
    </b>
    Any ideas how to resolve it?
    P.S. MyRequest class is exposed throw VI, has default constractor and public getters and setters for all properties. It implements Serializable as well. Any guesses?
    Thanks in advance,
    Victor.

    Hi Bhavik, thanks for response.
    as I already mentioned it implements Serializable, so it is not the problem.
    Thanks Avi but it didn't helps iether
    Victor

  • Java.rmi.ServerException: Internal Server Error (serialization error....)

    Hi to all.
    I have two classes.
    The first is:
    public class FatherBean implements Serializable {
    public String name;
    public int id;
    /** Creates a new instance of ChildBean */
    public FatherBean() {
    this.name= null;
    this.id = 0;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    public int getId() {
    return id;
    public void setId(int id) {
    this.id = id;
    The second is :
    public class ChildBean extends FatherBean implements Serializable {
    public double number;
    /** Creates a new instance of ChildBean */
    public ChildBean() {
    super();
    this.number = 0.0;
    public double getNumber() {
    return number;
    public void setNumber(double number) {
    this.number = number;
    A test client class implements the following method that is exposed as web service:
    public java.util.Collection getBeans() {
    java.util.Collection beans = new ArrayList();
    ChildBean childBean1 = new ChildBean();
    ChildBean childBean2 = new ChildBean();
    childBean1.setId(100);
    childBean1.setName("pippo");
    childBean1.setNumber(3.9);
    childBean2.setId(100000);
    childBean2.setName("pluto");
    childBean2.setNumber(4.7);
    beans.add(childBean1);
    beans.add(childBean2);
    return beans;
    When I invoke the web service to url:
    http://localhost:8080/Prova
    and invoke the correspondent method on jsp client, throws exception:
    java.rmi.ServerException: Internal Server Error (serialization error: no serializer is registered for (class test.ChildBean, null))
         at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
         at ws.ProvaClientGenClient.ProvaRPC_Stub.getBeans(ProvaRPC_Stub.java:59)
         at ws.ProvaClientGenClient.getBeans_handler.doAfterBody(getBeans_handler.java:64)
         at jasper.getBeans_TAGLIB_jsp._jspService(_getBeans_TAGLIB_jsp.java:121)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
         at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
         at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
         at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
         at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    Where is the problem? Will be ChildBean that extends FatherBean? Wich settings on Sun Java Studio Enterprise 6 2004Q1?
    Thank you.

    Hi,
    This forum is for Sun Java Studio Creator related questions. Could you pls post your message in the appropriate forum.
    Thank you
    Cheers :-)

  • Problem with serial.serialize(doc) ;statement

    hi this is my code but iam having problem in the aboe statement iam using net beans and it says cannot find symbol serialize while it is still in the package import {com.sun.org.apache.xml.internal.serialize.XMLSerializer;}
    package newPack;
    import org.jdom.Document;
    import org.jdom.JDOMFactory;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    //import org.w3c.dom.Document;
    import java.sql.DriverManager;
    import javax.xml.parsers.ParserConfigurationException;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    //import org.w3c.dom.Element;
    import java.sql.ResultSetMetaData;
    import com.sun.org.apache.xml.internal.serialize.OutputFormat;
    import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
    import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
    import java.io.StringWriter;
    import java.io.IOException;
    import org.jdom.Element;
    import org.jdom.Document;
    public class Conversion {
    // public DocumentBuilderFactory dbf;
    // public DocumentBuilder dob;
    // public Document doc;
    /** Creates a new instance of Conversion */
    public static Document convert(ResultSet rs) throws ParserConfigurationException,SQLException
    // DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    //DocumentBuilder builder=dbf.newDocumentBuilder();
    // Document doc=builder.newDocument();
    Element root=new Element("Artist");
    //doc.appendChild(root);
    ResultSetMetaData rsmd = rs.getMetaData();
    int colCount = rsmd.getColumnCount();
    while (rs.next())
    Element songo= new Element("song1");
    root.addContent(songo);
    //root.appendChild(songo);
    for (int i = 1; i <= colCount; i++)
    String columnName = rsmd.getColumnName(i);
    Object value = rs.getObject(i);
    Element node = new Element(columnName);
    node.setText(value.toString());
    songo.addContent(node);
    Document doc=new Document(root);
    return doc;
    public static String serialized(Document doc) throws IOException
    StringWriter writer = new StringWriter();
    OutputFormat format = new OutputFormat();
    format.setIndenting(true);
    XMLSerializer serial = new XMLSerializer(writer,format);
    serial.serialize(doc);
    return writer.getBuffer().toString();
    }

    VISA is the generic communication interface.
    Hyperterminal has serial comm drivers as well.  It just so happens that Hyperterminal is using the serial comm drivers that are built into Windows.  That's why you don't notice them.
    If you installed LabVIEW, then you should have installed the drivers that come with it.  It is on a separate DVD.  Obviously you haven't.

  • Trying to serialize a simple object

    Hi,
    I can't seem to create an ObjectInputStream. The error is noted in the code below. I also noticd that the output file where I seemingly wrote the object without problems is empty.
    import java.io.*;
    //Class from which an object is serialized:
    class MyClass implements Serializable
         private int num;
         private String str;
         public MyClass(int num, String str)
              this.num = num;
              this.str = str;
         public MyClass()
              num = 0;
              str = null;
         public void show()
              System.out.println(num);
              System.out.println(str);
    public class DemoSerialization
         public static void main(String[] args)
              MyClass A = new MyClass(50, "hello serialization");
              A.show();
    /*Create output file:*****************/
              File myFile = new File("C:\\TestData\\javaIO.txt");
              try
                   myFile.createNewFile();
              catch(IOException exc)
                   System.out.println("couldn't create output file");
                   System.exit(1);
    /*Create output stream:*************/
              ObjectOutputStream out = null;
              FileDescriptor fd = null;     //FileDescriptor represents a connection to a file.  Then,
                                                           //you don't have to do all the file checking, etc, when
                                                           //you move the data in the other direction(see below)
              try
                   FileOutputStream fos = new FileOutputStream(myFile);
                   fd = fos.getFD();
                   out =      new ObjectOutputStream(
                                  new BufferedOutputStream(fos));
              catch(FileNotFoundException exc)
                   System.out.println("couldn't find the file while during creation of file output stream");
                   System.exit(1);
              catch(IOException exc)
                   System.out.println("io error creating output file stream");
    /**/     System.out.println("test1: " + fd); // "java.io.FileDescriptor@df6ccd"
    /*Serialize the object:***************/
              try
                   out.writeObject(A); 
              catch(InvalidClassException exc)
                   System.out.println("class definition of object being written to a file has a problem");
              catch(NotSerializableException exc)
                   System.out.println("class of the object did not implement Serializable");
              catch(IOException exc)
                   System.out.println("general file output error occurred");
    /*Create input file stream:***********/
              FileInputStream fis = new FileInputStream(fd);
              BufferedInputStream bis = new BufferedInputStream(fis);
    /**/     System.out.println("test2: " + bis);  // "java.io.BufferedInputStream@b89838"
              ObjectInputStream in = null;
              try
                   in = new ObjectInputStream(bis);      /*****ERROR--throws exception*****/
              catch(IOException exc     )
                   System.out.println("ObjectInputStream error");
    /**/     System.out.println("test3: " + in);  // "null"
    /*Read in the object:****************/
              MyClass B = null;
              try
                   B = (MyClass) in.readObject();  /***ERROR--NullPointerExecption(see above)***/
              catch(ClassNotFoundException exc)
                   System.out.println("no class definition exists in this program for the object read in");
              catch(InvalidClassException exc)
                   System.out.println("class def is present but there is something wrong with it");
              catch(StreamCorruptedException exc)
                   System.out.println("control info in stream is corrupt");
              catch(OptionalDataException exc)
                   System.out.println("attempted to read in a basic data type--not an object");
              catch(IOException exc)
                   System.out.println("general stream error occurred during read");
              B.show();
    }

    Your originaly source did not include the call to the
    close method of ObjectOutputStream which is why your
    file was created but empty. I assumed you added it
    after the call to writeObject.
    Well, that isn't the case. I posted that I added flush().
    Read the API docs on the FilterDescriptor class.
    This class basically represents an opened file (or
    r other open streams) in either an inputstream OR
    outputstream. So when you close the outputstream.
    The file is not open anymore and thus the
    e FileDescriptor object is no longer valid because it
    represents and open stream.
    I didn't have to read the API docs because to me that seemed like common sense: if I have an object that represents a connection to a file, and I close the connection, it makes sense to me that the object would no longer be valid. Therefore, I didn't use close() in my program.
    As far as avoiding lots of try blocks, why not wrap
    the whole program in a try block? I assume you're
    using all those System.out.println commands to help
    debug. It'd be more helpful if you called
    printStackTrace on the thrown exception when an error
    occurs.
    Ok, thanks.
    I've done some more tests, and the problem isn't specific to serialization. I'm also unable to use a FileDescriptor when reading a char from a file. I get the same "access denied" error:
    import java.io.*;
    class  DemoFileDescriptor
        public static void main(String[] args)
            //Create a file:
            File myfile = new File("C:\\TestData\\javaIO.txt");
            try
                myfile.createNewFile(); 
            catch(IOException exc)
                System.out.println(exc);
                System.out.println("io exception createNewFile()");
            //Create a FileInputStream:
            FileOutputStream out = null;
            try
                out = new FileOutputStream(myfile);
            catch(FileNotFoundException exc)
                System.out.println(exc);
                System.out.println("error creating FileOutputStream");
            //Get the FileDescriptor:
            FileDescriptor fd = null;
            try
                fd = out.getFD(); //a file connection
            catch(IOException exc)
                System.out.println(exc);
                System.out.println("trouble getting FileDescriptor");
            //Output something to the file:
            char ch = 'a';
            try
                out.write((int) ch);
            catch(IOException exc)
                System.out.println(exc);
                System.out.println("io error writing to file");
            //Create a FileInputStream using the FileDescriptor:
            FileInputStream in = new FileInputStream(fd);
            //Read back from the file:
            char input = ' ';
            try
                input = (char) in.read();  /**ERROR-access denied**/
            catch(IOException exc)
                System.out.println(exc);
                System.out.println("problem reading");
                exc.printStackTrace();
            System.out.println(input);
    } Here is the output and stack trace:
    ---------- java ----------
    java.io.IOException: Access is denied
    problem reading
    java.io.IOException: Access is denied
         at java.io.FileInputStream.read(Native Method)
         at DemoFileDescriptor.main(DemoFileDescriptor.java:69)
    Output completed (2 sec consumed) - Normal Termination

  • HashPrintRequestAttributeSet will not serialize correctly

    It seems that HashPrintRequestAttributeSet (or something else) doesn't serialize correctly.
    This only works for a certain high end printer with (multi-purpose tray selected). Note that loading from file right after saving works fine (loading from scratch doesn't work).
    Output:
    Loading print attributes...
    Could not load print properties: java.io.InvalidObjectException: Integer value = 12 not in valid range 0..5for class class sun.print.Win32MediaTray
         at javax.print.attribute.EnumSyntax.readResolve(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at java.io.ObjectStreamClass.invokeReadResolve(Unknown Source)
         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at javax.print.attribute.HashAttributeSet.readObject(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
         at java.io.ObjectInputStream.readSerialData(Unknown Source)
         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at PrintObject.loadAttributes(PrintObject.java:245)
         at PrintObject.sendPrintJob(PrintObject.java:285)
         at printPngApplet.init(printPngApplet.java:81)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Sending print job...
    Saving print attributes...
    Done.
    Done.
    Loading print attributes...
    Done.I have the following class:
    class PrintObject implements Printable
         private String propertyFile = "printer.properties";
         private HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
         private Properties properties = new Properties();
         public int print (Graphics g, PageFormat f, int pageIndex)
         private void saveAttributes()
              System.out.println("Saving print attributes...");
              try
                   // open property file for writing
                   ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(propertyFile));
                   // save printer selection
                   properties.setProperty("Printer", job.getPrintService().getName());
                   // write properties object
                   out.writeObject(properties);
                   // write attributes object
                   out.writeObject(attributes);
                   // close property file
                   out.close();
                   System.out.println("Done.");
              catch (Exception e)
                   System.out.print("Could not save print properties: ");
                   e.printStackTrace();
         private void loadAttributes()
              System.out.println("Loading print attributes...");
              try
                   // open a property file
                   ObjectInputStream in = new ObjectInputStream(new FileInputStream(propertyFile));
                   // read in the properties object
                   properties = (Properties)in.readObject();
                   // restore printer selection
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   for(int i = 0; i < services.length; i++)
                        if( services.getName().toString().compareTo(properties.getProperty("Printer", "").toString()) == 0)
                             try {
                                  job.setPrintService(services[i]);
                             } catch (PrinterException e)
                                  // Couldn't select a service, sorry
                             break;
                   // restore attributes
                   attributes = (HashPrintRequestAttributeSet)in.readObject();
                   // close property file
                   in.close();
                   System.out.println("Done.");
              catch (Exception e)
                   System.out.print("Could not load print properties: ");
                   e.printStackTrace();
         public void sendPrintJob()
              if(job == null)
                   System.out.println("No printers were detected");
              else
                   // tell the job to use this object to request print pages
                   job.setPrintable(this);
                   job.setJobName("Site Panel Print Job");
                   loadAttributes(); // this fails
                   // display print dialog
                   if (job.printDialog(attributes))
                        // user pressed OK
                        System.out.println("Sending print job...");
                        saveAttributes();
                        // try printing
                        try { job.print(attributes); }
                        catch (Exception e) { System.out.println(e); }
                        System.out.println("Done.");
                        loadAttributes(); // this works fine
    Thanks for any help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Squeek_14 wrote:
    HI,
    I am facing the same problem with the serialization of the HashPrintRequestAttributeSet object. Just wondering if there have been any updates or resolutions to this problem?Hi,
    Please don't resurrect old threads. I'm locking this one.
    Create a new thread with a specific question, and a good description of what you are trying to do.
    Kaj

  • Recieving cannot resolve symbol symbol  : class Serializable

    I'm receiving the error:
    cannot resolve symbol symbol : class Serializable
    The class is as follows:
    //package cscie160.hw5;
    import java.io.Serializable
    * @author Eddie Brodie
    * @version %I%, %G%
    public class AccountInfo implements Serializable
         public int _accountNumber;
         public int _pin;
         public AccountInfo(int accountNumber, int pin)
              _accountNumber = accountNumber;
              _pin = pin;
    I've tried importing java.*
    I've also checked my classpath.
    Any ideas?

    Try taking the import statement out of the comment block; that might help

  • Trying to understand serialization basics

    im getting a error messege in my test class
    file load errorjava.lang.ClassCastException: java.lang.String
    why would i be getting java.lang.string as a error if im trying to return a object
    the load methods not working right but it seemed to save fine
    can anyone tell me what im doing wrong
    heres my full test applet
    import java.util.Vector;
    import java.io.*;
    // ill serialize a vector here
    public class SerilizationUsage extends Frame implements Serializable
    Vector v = new Vector();
    Vector vec;
    A a;
    int currentelement =0;
    public SerilizationUsage(){
           a = new A();a.value = 2;
        v.addElement (a);
        a = (A) v.get (currentelement);
        System.out.println("v "+currentelement+"th elements value "+a.value);
        save();
        load();
    public void save(){
    try{
    FileOutputStream out = new FileOutputStream("thevectordata");
    ObjectOutputStream s = new ObjectOutputStream(out);
    s.writeObject("v");
    s.flush();
    }catch (Exception e) {System.out.println("file save error"+e);}
    public void load(){
    try{
    FileInputStream in = new FileInputStream("thevectordata");
    ObjectInputStream s = new ObjectInputStream(in);
    vec = (Vector)s.readObject();
    }catch (Exception e) {System.out.println("file load error"+e);}
    public static void main(String args[]){
    System.out.println("Starting App");
    SerilizationUsage f = new SerilizationUsage();
         System.exit(0);
    class A{
    int value;
    public A(){value = 1;}
    }

    ah wait i didnt see i put "v" instead of v but now its giveing me a not serializable error
    file save errorjava.io.NotSerializableException: A
    file load errorjava.io.WriteAbortedException: Writing aborted by exception; java.io.NotSerializableException: A

Maybe you are looking for

  • URL Decode function

    I am in need of a URL decode function. Can not find one in owa_utl, htp or htf. Is there one available please?

  • Supermarket simulation, last problem

    I have finished with my supermarket, yes! But i have one last issue, my program somehow doesn't get the max wait time that each customer experiences. It provides the same unrealistic 8 minutes for max wait time everytime. Here's my code: import java.

  • MRP views in MM02

    I need to create a Screen Variant  and apply to a Z transaction which only allows users access to change MRP Information u2013 MRP1, MRP2, MRP3 and MRP4 tabs. in the Material Master. I do not want to give everyone access to MM02 u2013 Change Material

  • Service Condition Price in PR!!!!

    Hi All, If I create a purchase requisition with item category D (services) and I use a service master with a valid price in service condition maintained via ML5L, is the price then automatically retrieved in the PR line by standard SAP?? If this is n

  • Shuffle problem? Help!

    My shuffle seems to no longer work. It was working fine but now it plays the first song over and over and doesn't change. I've checked the settings and it's set to random shuffle. Any ideas what is wrong and how I can fix it? Thanks