How to decide if an object was completely encoded using XMLEncoder

Hi, 'completely encoded' means that the object reconstructed from XMLDecoder is equal to the original object. Here is an example class which is not 'completely encoded' (because one of its properties is of type java.awt.geom.Point2D):
public static class SomeBean {
  private Dimension size;
  private Point2D location;
  public Dimension getSize() {
    return size;
  public void setSize(Dimension size) {
    this.size = size;
  public Point2D getLocation() {
    return location;
  public void setLocation(Point2D point) {
    this.location = point;
  public String toString() {
    return getClass().getName() + "[location=" + location +
      ",size=" + size + "]";
here is the corresponding XML representation:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_12" class="java.beans.XMLDecoder">
  <object class="XML_Persistence$SomeBean">
    <void property="location">
      <object class="java.awt.geom.Point2D$Float"/>
    </void>
    <void property="size">
      <object class="java.awt.Dimension">
        <int>42</int>
        <int>42</int>
      </object>
    </void>
  </object>
</java>
By printing out the two objects, you can see that they are not equal:
Serializing: XML_Persistence$SomeBean[location=Point2D.Float[42.0, 42.0],size=java.awt.Dimension[width=42,height=42]]
Deserialzed: XML_Persistence$SomeBean[location=Point2D.Float[0.0, 0.0],size=java.awt.Dimension[width=42,height=42]]
It isn't problematic for my app if an object cannot be 'completely encoded', i'm just looking for a reliable way to know.
Thanks, Hans

ejp wrote:
This is very odd. The XMLEncoder already does a trial decode to make sure it has serialized the object.
Doesn't a line like this one
<object class="java.awt.geom.Point2D$Float"/>
indicate that an object (as part of an object graph) was encoded without any additional information?Exactly. But the XMLEncoder assumes wevertying is a Java bean, with getters and setters. Any object without set methods isn't going to be serialized correctly. You need to add your own PersistenceDelegate for any such classes you find.Thanks, ejp - knowing that an object cannot be reconstructed by encoding/decoding it would be sufficient. Currently my strategy is:
a) Encode the object to memory, using XMLEncoder.
b) If no exceptions were thrown, parse the resulting XML for lines of the form "<object ... />". If any such line is found, the object is no candidate for XML-serialization.
c) If the object (or a super-class) overrides Object.equals, the XML is decoded and the resulting object is compared to the original one.

Similar Messages

  • How to move the anchor object in indesign cs2 using js?

    i can able to move the normal textframe and other objects but cant do this for anchor objects.
    syntex:  anchorobject.move([x value,y value],undefined,true)
    how to move the anchor objects?
    thanks
    subha

    Could it be that the anchord object in question won't move because you have it set to keep within margins which is preventing the move you're requesting? I've certainly run into that.
    I've also run into the situation where the object model thinks the anchored object is in one place when it is actually in another because of that same keep within margins option. In this case, a move will apparently not work because the move is invisible, it being completely outside of the margins -- although that only applies to relative moves, I think.
    Dave

  • How to pass array of Object in A Procedure using OCCI.......

    I m also trying for How to pass Object to a procedureb using OCCI...
    Steps....
    1. I created A type.....
    2. Then I created a VARRAY using that Type.
    3.After that I have written An Procedure with object as a parameter..
    now using OCCI how do u bind the parameter with this . plz note that using OTT
    i have already created the class representation of above object type i.e class
    four Files Created 1> demo.h 2>registermapping.h
    3> demo.cpp 2>registermapping.cpp
    After I want to Pass the Values in A Vector...
    vctor<full_name *> vect;
    stmt=con->createStatement("BEGIN Add_Object(:1); END;");
    full_name *name1 = new full_name; //Giving the Error here Given below....
    name1->
    name1->
    Through name1 Which Function I will call in which I will Pass a String....
    like
    name1->readSQL("Sanjay"); Or I have to add a function......
    vect.push_back(name1);
    setVector(stmt,1,vect,"FULL_NAME");
    error C2259: 'FullName' : cannot instantiate abstract class
    can u plz suggest me Why this Error is Giving......?
    How to pass the data?
    setFirst_name() and setLast_name() this two function I will add in Demo.cpp which one created automativcally by Using OTT command.....or other way plz tell me Boss ....
    Can u lz Suggest me ASAP....

    hi Nishant ,
    What u have done Now I mm trying ....
    can u Plz Suggest me......
    How to pass and Array of Object in Procedure using OCCI... Doing....
    90% finished Two Error's Are Coming...
    1> If I create the Class then Data Not Inserting table......
    2> If I will create the Class through OTT command.......
    then U can't Instantiate Object It is DIsplying ,this is Abstract Class(PObject)...
    Beco'z the below Method is Not adding Automatically by OTT command which is Pure Virtual Function.....
    But I added this Function Still SAme Error Giving..
    getSQLTypeName(oracle::occi::Environment env, void *schName,
    unsigned int &schNameLen, void **typeName,
         unsigned int &typeNameLen) const
    Plz Suggest me....
    regard's
    sanjay

  • How to check if a database was not being used since past 90 days ?

    Team ,
    Thanks for your help in advance  !
    I'm looking out for some pointers to determine if a database was NOT BEING Used since last 90 days so that we can decommission them .
    Rajkumar Yelugu

    My personal method which I apply after mailing to all users and managers and after using methods fellow answeres have given
    Take database offline or in a single user mode and keep it like that for 15-20 days if someone is using it they would surely ping you or mail you. Please mail to all repective persons and app owners before taking it offline. As you said you want to decommission
    it so i assume server will be less utilized itself.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • How to exchange a java object  between two applications using web service?

    Hi,
    I am working with Eclipse 3.2 and the application server is weblogic 10.
    I have two applications, each one works in an instance of the server.
    The first application contains a method called "send " which return a java object.
    The second one contains a method called "receive" which must receive this object.
    The two applications must exchange the object using web service,
    Can you help me please?
    Thanks.

    Have you defined your service class/methods accepting, or returning, the appropriate objects? If so, does the generated WSDL appear to be correct? I have just completed a web service project and found that passing specific objects to be simple, however, I was passing objects which were simply container objects with bean characteristics. Also, might I suggest that you have a play with netbeans. I found that IDE to be great for creating and consuming web services!

  • How do i control my object effects when i use a button?

    I want to use a button so when I click on it a square rises up from the bottom of my slide.  What I'm finding is by the time I click the button to make the square visible its effect has already loaded with the slide so you don't get to see the squares effect working, how do i pause the effect of the square until I have pressed the button?  Should I just make the button jump to a duplicate slide so the effect hasn't loaded if so this will be a pain when I have several buttons on the slide that I want to make objects move when i click them?

    Hello,
    Nothing to do with button becoming inactive, really, but with the way the Effects are scripted. Will try to answer your question about the buttons however.
    I'll try to explain the functionality of a button.  A button typically has a pausing point that is visible on the timeline, right? The portion before the pausing point is the 'active' portion, which will mean that the user can click on the button and this will have results. When you click on a button, the action attached as Success action is triggered, in this example the Text Caption is set to visible. But at the same time the playhead is released and moves beyond the pausing point into the Inactive portion, which means that it cannot be clicked again.
    Two possible solutions:
    use a rollover caption instead of your click/text captions work flow.
    Create a small advanced action BtShow1 and BtShow2 for each of the buttons, again I have screenshots ready but they are not accepted, bummer.... Will try to write the statements:
    Show Text_1      for the first button, shows the correct Caption
    Hide Text_2       hides the other caption that could have been shown by the other button
    Assign rdcmndGotoFrame with rdinfoCurrentFrame            this expression puts back the playhead directly before the pausing point so that button remains active
    You can duplicate this action to create Btn2, and you only have to reverse the ID's of the Text Captions
    When you attach those actions to the buttons, you can click as many times as you want. You tell that you have searched the forums? Bit strange because I have been explaining this so many times, and blogged about this kind of micro-navigation (frame by frame):
    Micro-navigation in Adobe Captivate
    Lilybiri
    PS: when updating, I can insert one image, will try to add the other one, in a second update perhaps

  • How to open a database object for view/edit using a command (v. 3.2.20.09)

    How can I open a database object for view or edit using a command in Oracle SQL Deveveloper?
    I find browsing or search for object in a large database to be slow and too cumbersome.

    Shift-F4 (pop-up descrribe) on a table name in the worksheet will let you view table details, but there is no quick edit.
    You can use filters on the object browser to reduce the number of visible objects.

  • How to convert PL/SQL Objects to XMLTYPE and use external schema

    We are creating PL/SQL Objects using Jpublisher to set values.
    We need to build a SOAP request based on that to call Web Service using utl_DBWS/UTL_HTTP.
    l_RequestHeader := OBJ_RequestHeader(l_UserObj,l_SourceDet,
    l_ReqHeaderId);
    XMLTYPE or CreateXML – both take schema(namespace) argument.
    For example
    reqhead := XMLType(l_RequestHeader,
    'Schema URL');
    We need converted XML in following format:-
    <proc:RequestHeader>
    <id>Id</id>
    <source>sr1</source>
    <user>
    <credentials>pass</credentials>
    <userID>user</userID>
    </user>
    </proc:RequestHeader>
    But after running XMLType, we are getting like this.
    <OBJ_REQUESTHEADER><USER_><USERID_>user</USERID_>
    <CREDENTIALS_>pass</CREDENTIALS_></USER_>
    <SOURCE_>sr1</SOURCE_>
    <ID_>Id</ID_></OBJ_REQUESTHEADER>
    XML tags are as per Oracle PL/SQL Wrapper and they are not matching with the request.
    Please let us know what is the problem here and any syntax/method to rectify this problem.

    "I have created few non cache tables in TT, to compile PL/SQL objects .
    if i make any DML's through PL/SQL(passthrough 1) , it is updationg with TT tables but not Oracle table ."
    [T2C]: This is correct and it is what you want to do, right?
    what is the way to handle non cahe tables updates through PL/SQL, how can we achive non cahe tables updates in TT ,refresh with oracle ( i.e non cahe table updates need to go to the oracle ).
    [T2C]: Sorry, but I am not sure I understand. Were you not able to update the non-cached tables, like you mentioned in the first paragraph? Do you mean that you want the non-cached tables to propagate to Oracle? Would that not be a cache table then?

  • How to wait for a Process to complete without using wait,notify methods

    I have created a new Process using run.exec() method using a cmdline String array in the format "java, class name, 4 command line arguments" to be passed to the main method of that class. But I have a maximum limit of the no. of processes to be created e.g. 5. So whenever I create a process, I use a static semaphore class to decrease the count, and increase it again when the process ends; so when the 6th process wants to start it will be suspended until another process is complete. My problem is how do I communicate to the calling class that the process has ended. I don't want to create any threads as that will defeat the purpose of creating separate processes. I have tried Process.waitFor() method but it doesn't work.

    you could add a iamfinished method to the class where you store the counter and thread calls it if it is finished.

  • VERY basic - how to decide what type of architectu​re to use?

    Forgive me if I'm breaking any forum rules with this post - I'm very new to this.
    I'm trying to write a Labview program to perform a functional test on an electronic product.  The test is fairly sequential - plug in the unit, apply a certain voltage, step up the voltage until the unit turns on, then turn on an electronic load, measure the load voltage, then step up the input voltage again, etc.  The power supply and electronic load that I'm using both have Labview drivers. 
    I'm brand new to Labview, and I have no resources in my company to help me out.  I have taken the Core 1 and 2 training class.  The problem is, I'm not really sure how to start.  Would this be a producer/consumer architecture?  A QSM?  I've been scouring these forums the past couple of days, but most of the discussions are advanced.  I don't understand all the acronyms.  A lot of the replies here assume you have some knowledge of Labview, and I don't.  Part of the problem is that I don't even know enough to ask a specific question, and that's why this post is so vague.
    I'm a competent PLC/HMI programmer but don't have any experience in other languages.
    I also want to be able to use variables for my limits so that I can easily change the pass/fail limits.  (For instance, I want the voltage and current pass/fail limits to be configurable from a "maintenance" screen on the Labview interface, but I don't know how to create multiple screens or password protect them).

    I have stated my opinion reagarding the QSM* design pattern previously and will not repeat it again here aside from "I avoid them like the plague".
    Architecture questions are good question but hardly "very basic" although some architectures can be very basic.
    I would recomend a State Machine that uses Action Engines to control your widgets.
    in this thread AND this thread I wrote extensively and included design documents for apps I developed. I invite you to look those over and start developing your own design that meets your needs.
    Ben
    * It is imposible to fully document all of the possible transitions of a QSM and since my application all are fully documented, the QSM is not an option. A Queued Message Handler on the other hand is different.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How do I confirm my iPhone was wiped?

    I lost my iPhone overseas and requested a wipe via iCloud.  I then received an e mail confirmation that the wipe was started.  How do I know if it was completed?  My iCloud page just shows when it was requested.

    I lost my iPhone overseas too in August 2012. Tried Find my iPhone within half an hour but the phone status was OFFLINE . Having a lot of confidential and personal banking information, I decided to do a wipe via iCloud immediately.
    Now, on 5 Nov 2012, my iCloud still shows PENDING: ERASE IPHONE and below it displays ACTIONS WILL TAKE EFFECT WHEN THIS IPHONE CONNECTS TO THE INTERNET.
    1) Does this mean Find my iPhone does NOT work when the iPhone is SWITCHED OFF or when there's NO INTERNET?
    2) If this is so, why is it possible to switch off devices when they are PASSCODE LOCKED?
    3) Does this mean Find My iPhone is totally useless when the devices are switched off so easily?
    4) Even when Find My iPhone locates a device, would I be able to locate my device in a high-rise building full of people (such as in a multi-storey mall or residential condominium)?
    5) Lastly, like everyone else in this discussion, how do I know if the iphone is wiped?
    Would greatly appreciate if anyone can help with my queries.

  • How to enhance Dynamic Query Object TerrSearch (Territory Management)?

    Hello Friends,
    In the TerrSearch dynamic query object, There are 2 fields Territory_ID and Level_ID. Now i have a requirement to Enhance the Search object using the new field called TERRITORY PATH ID. using which we can search all the entities not only for the terrritory level which we have selected (for example we have assigned the value '01' to LEVEL_ID) but also all the below territory levels of selected territory level.
    If we enhance the search object structure CRMST_TMIL_SEARCH (structure of TerrSearch object) using AET to add the Z field called TERRITORY_PATH_ID then which is the suitable BADI where we can add the necessary code to select all the entities based on all the territory levels below the selected territory level.
    Please guide me friends how to enhance the TerrSearch object.

    Hi friend,
    Try using MACRO and dynamic WHERE condition.
    Group simialr Select statements under a Macro.
    Build a dynamic where by checking conditions
    Call macro passing dynamic where condition.
    TABLES afpo.
    DATA: str TYPE string.
    *Macro definition
    DEFINE operation.
      select single *
           from afpo into afpo
           where (&1).    " Dynamic condition
    END-OF-DEFINITION.
    *Build dynamic WHERE by checking some conditions
    *If conditon 
    CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0001''' INTO str SEPARATED BY space.
    *Else
    CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0002''' INTO str SEPARATED BY space.
    *Endif.
    *Call Macro passing dynamic WHERE condition
    operation str.

  • How to divide big serialized object in parts to be able to save as Blob typ

    Hi,
    Actually i have serialize a big XML document object and want to save in a field of type Blob. As Blob size is 64k. So if the serialized object is greater than 64k. It gives me error of size.Can anybody tell how to break large serialized objects.
    I am using this code
    File f = new File("out.ser");
    FileInputStream fin = new FileInputStream(f);
    p = farCon.prepareStatement("insert into TeeColor values('3',?)");
    p.setBinaryStream(1, fin, f.length());
    p.executeUpdate();
    This code works fine if the size of out.ser file is less than 64k. But does not work for bigger sizes
    Please help me out
    Thanks

    Read your data from the file into a byte array, then extract 64K at a time into a smaller byte array, and use a ByteArrayInputStream for updating the database.

  • How to fire an AbstractAction object

    I have a method that creates a JButton(new ActionClass extends AbstractAction ...). how do I 'action' the object, without having to use the JButton.
    I want ActionClass to run its actionPerformed method without me having to call or run the JButton.
    How do I do that?

    Ceci - I don't want to have to do that. I'm actually writing aJunit test for the ClassAction class, so wwould have liked to just invoke that method.
    Monger, there isn't a no-argument constructor for ActionEvent. this is what's there on Javadoc and I'm not even sure what to pass in:
    public ActionEvent(Object source,
    int id,
    String command)Constructs an ActionEvent object.
    Note that passing in an invalid id results in unspecified behavior.
    Parameters:
    source - the object that originated the event
    id - an integer that identifies the event
    command - a string that may specify a command (possibly one of several) associated with the event

  • Access object on the stage using an as3 widget

    I am trying to use a FlashPro as3 widget and Captivate 6, to toggle an image on the Captivate stage (hide/show) and can't find enough information on how to access the stage objects.
    I can use 
    var numKids:int = parent.parent.parent.numChildren() 
    to see the number of children (of the stage object?) , but can't seem to figure out how to hide or show the child objects (image, button or anything).
    My image names in my Captivate Project are Img_Einstein1 and Img_Einstein2.  They reside on a blank slide along with two buttons and another widget.
    I have looked at Tristen's web site and found a lot of useful information, but I guess I am just not putting it all together.  Because I am a contractor I can't use the Widget Factory or purchase outside widgets.
    Any help will be greatly appreciated!

    On 6 you don't have shared actions yet. I don't understand the explanation with 20 and 10. There are several examples of toggle buttons on my blog. For showing/hiding here a simple one:
    http://blog.lilybiri.com/blog-after-posterous-clickclick

Maybe you are looking for

  • How to connect external database(Ex:SQL Server/Tivoli)  from ABAP Webdynpro

    Hi, Any one have idea how to connect external database like SQL Server/Tivoli to access tables from WebDynPro ABAP. Please point to me some links if you have Thanks Praveen

  • HT201407 how to unlock my iphone

    dear sir:            after updating my iphone it's locked on my vodafone network , what can i do now ??

  • Bridge Tables

    Hi, I am having a little trouble using bridge tables. For testing I created an n-n relation. When I just make joins it shows the link table like fact table but queries work okay. When I check the bridge table check box, it identifies the correct fact

  • Axis Web Service SOAP Response without namespace

    Hi folks, I use the Axis Framework and eclipse to create a Webservice. I wrote a Method which returns a List of customers(complex Element). When I execute the method I get the following result: <soapenv:Body> <getAllCustomersResponse> <ns1:getAllCust

  • Server Admin sharing yellow bar!!!!

    Hi, I have several iMacs in a classroom, all my users have accounts in my xserve, I have set up sharing folders and they all mount fine when logged as a local user and then connect to server via Go>Connect to server. how can I make the iMacs to boot