Object cast - J2EE to ActionScript strange problem

Hello,
I am working in a project with multiple layers composed by Flash+Flex; BlazeDS; J2EE+Hibernate.
I have some services to get all the data from database and I have a strange problem when I try to cast some objects from J2EE to ActionScript via BlazeDS Services. This is the structure that I have in my project:
Oracle
Table ServicePetitions (a table with all the data about a service petition)
J2EE+Hibernate
ServicePetition object (mapping object generated by hibernate)
ServicePetitionId object (multiple key object generated by hibernate)
ServiceServicePetitions object (the service to use in blazeDS)
Flex 4 (All the objects generated by Flex Builder at the time of map the service)
_Super_ServiceServicePetitions
ServiceServicePetitions
_Super_ServicePetitions
_Super_ServicePetitionId
_Super_ServicePetitionEntityMetadata
_Super_ServicePetitionIdEntityMetadata
ServicePetition
ServicePetitionId
Normally I call the service and later I try to get the data using a CallResponder object to make the assignation lastresult = ServicePetition; except when I use a datagrid that automaticly use the CallResponser.lastresult as dataprovider, without any assignation (important, always work!)
The fact is that when I try to make the assignation all works alright, I get all the data, I can work with those data, all goes perfect, but...when I make the second call, the assignation (callresponder.lastresult = ServicePetition) does not assign anything.
This is the code of the assignation:
    private var respPs:CallResponder;
    private var servPs:ServiceServicePetitions;
    private var objPs:ServicePetition;
    // Call
    public function AprobarPS(ter:String,idps:String,sec:int)
      servPs = new ServicioVPeticionesServicio();
      respPs = new CallResponder();
      respPs.addEventListener(ResultEvent.RESULT,getDatosPs);
      respPs.addEventListener(FaultEvent.FAULT,error);
      respPs.token = servPs.getPeticionServicio(ter,idps,sec);
    // Get the data
    private function getDatosPs(resultEvent:ResultEvent):void
      objPs = respPs.lastResult as VPeticionesServicio;
      switch (obj.petitionType) { // Here I have a null exception
I make the debug with the blazeDS tools and all the responses and call statements is Ok, and the service return the data always, but Flex only works the first time per execution.
If I assign all the data field by field from lastResult to ServicePetition all works properly always, the first call, the second call, etc., but if I want to make the assignment, object to object, only works 1 time.
any ideas?
best regards,
thx!

sorry, copy-paste problem...
switch (objPs.petitionType)
I have been researching and I think that I know where (maybe...) is the problem.
The object to serialize have another object inside. Could be this the problem at the time to des-serialize the object? Also, the object is very big, have around 40 fields, could be also a problem ?
thanks!

Similar Messages

  • Strange Problem with Web Object Manager

    Hi,
    I have a very strange problem with JDev.
    When I register a servlet with the Web Object Manager, it does not work (the web server does not find the servlet). This is not the end... If I exit JDev, re-open it and return to the Web Object Manager, instead of the Web Object Manager tree appears a tree labeled JTree with leaves labeled "colors", "sports" and "food"???
    No way to recover the Web Object Manager!
    I had to re-install JDev.
    Any ideas?
    Thanks
    -David

    Thanks but I don't understand. Here is wtgapp.xml:
    <?xml version = '1.0'?>
    <workspace>
    </workspace>
    Here is webtogo.ora:
    [WEBTOGO]
    USE_SYSTEM_CLASSPATH=YES
    DEBUG=YES
    [FILESYSTEM]
    ROOT_DIR=C:\
    TYPE=OS
    [MIMES]
    html=text/html
    xml=text/xml
    xsl=text/xml
    jsp=text/html;handler=oracle.jsp.JspServlet
    xsql=text/html;handler=oracle.xml.xsql.XSQLServlet
    [APPLICATIONS]
    xmlfile=.\wtgapp.xml
    [SERVLET_PARAMETERS]
    emit_debuginfo=true
    bypass_source=true
    jspcompiler=oracle.jdeveloper.jsp.JspOjcCompiler
    page_repository_root=C:\Program Files\Oracle\JDeveloper 3.1.1.2\myclasses\_pages
    after I added my servlet (which was named Servlet1). Where is the problem exactely.
    Thanks.
    -David
    In any case, is the fixed version available?
    null

  • Strange Problem - All of my preloaded .swf files play at once

    Hey guys,
      I've been getting a strange problem that I haven't been able to debug.  I recently developed an interactive audio and video treatment program that users click through in which a master swf file (DTM-Start.swf) uses ActionScript upon first being loaded to load the rest of the program in the background.  Here's how the code looks: 
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.Event;
    // create movieclip objects to hold the loaded movies
    var intr1:MovieClip;
    var maladaptIntr1:MovieClip;
    var maladaptIntr1Loader:Loader = new Loader();
    var maladaptIntr1Request:URLRequest = new URLRequest("DTM-Maladapt1.swf");
    maladaptIntr1Loader.load(maladaptIntr1Request);
    maladaptIntr1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, maladaptIntr1Loaded);
    var intr1Loader:Loader = new Loader(); 
    var intr1Request:URLRequest = new URLRequest("DTM-Intr1.swf");
    intr1Loader.load(intr1Request);
    intr1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, intr1Loaded);
    function maladaptIntr1Loaded(event:Event):void
        maladaptIntr1 = event.currentTarget.content as MovieClip;
        maladaptIntr1.stop();
        addChild(maladaptIntr1);
        maladaptIntr1.y = -1000
        trace("maladaptIntr1");
    function intr1Loaded(event:Event):void
        intr1 = event.currentTarget.content as MovieClip;
        intr1.stop();
        addChild(intr1);
        intr1.y = -1000
        trace("intr1");
    function playIntr1() {
       intr1.y = 0;
       intr1.play();
    function playMaladapt1() {
        maladaptIntr1.y = 0;
        maladaptIntr1.play();
    So that's the idea.  What's strange is that when I load a .swf file compiled with AIR 2.6 (because the user interacts with the movie and a text file is output) it's fine too, but as soon as I add any actionscript, even if it's just a stop() command, to a .swf file compiled with AIR, the DTM-Start.swf loads and then plays all of the movies simultaneously so they're all going off at once.  Essentially, flash seems to be ignoring the maladaptIntr.stop() command in the Loaded function, for instance.  I just don't understand why adding any Actionscript whatsoever to a .swf compiled with AIR would make my DTM-Start do this.  I am very confident this is the issue too, because loading .swf files compiled with the FlashPlayer with action script are fine...AIR .swf files without Actionscript are fine too, it's only AIR .swf files with ANY actionscript that cause this problem....
    Any ideas?
    Much appreciated!
    Thanks,
    Ricky

    One solution is simply to have a stop() in the constructor of the document Class of each swf you're loading. Another solution is something like:
    package {
         class MainDocument extends MovieClip {
         protected var swfs:Array = ['DTM-Maladapt1.swf', 'DTM-Intr1.swf'];
         protected var positions:Array = [{x:0, y:0}, {x:0, y:0}];
         protected var movies:Array /*of  MovieClips*/ = [];
         protected var loadIndex:int;
         protected var playIndex:int;
         protected var curremtMovie:MovieClip;
              public function MainDocument() {
                   super();
                   loadMovie(loadIndex);
              protected function loadMovie(loadIndex:int):void {
                   var loader:Loader = new Loader;
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
                   loader.load(new URLRequest(swfs[loadIndex]));
              protected function onLoadComplete(e:Event):void {
                   var mc:MovieClip = LoaderInfo(e.currentTarget).content as MovieClip;
                   mc.stop();
                   var position:Object = positions[loadIndex];
                   mc.x = positions.x;
                   mc.y = positions.y;
                   addChild(mc);
                   movies[movies.length] = mc;
                   loadIndex++;
                   if (loadIndex<swfs.length) {
                        loadMovie(loadInxed);
                   } else {
                        playMovie(playIndex);
              protected function playMovie(playIndex):void{
                   if (currentMovie) {
                        currentMovie.stop();
                   currentMovie = movies[playIndex];
                   currentMovie.play();
    Note that with this approach you don't need to create a whole new set of logic each time you want to add a new swf to load.

  • Strange Problem - Cluster of References

    Hello guys
    I had a strange problems using a cluster with references.
    How to reproduce the problem:
    - open a blank VI;
    - create two graphs in the front panel;
    - in the block diagram, create references for both graphs;
    - connect these references to a bundle (not bundle by name);
    - create an indicator for the bundle;
    - run the VI once;
    - right click on the bundle indicator and change it to a control;
    - delete references and bundle;
    - select the control in the front panel, go to EDIT, CUSTOMIZE CONTROL;
    - change to strict type def;
    - save this control as Control1.ctl;
    - connect the control to a unbundle by name;
    - right click on the unbundle by name and select one of the two graphs as an item (doesn't matter which one you select);
    - create a property node and feed its reference terminal with the reference from the unbundle by name;
    - use the property "Label.Text" in the property node;
    - create an indicator for the the property node;
    - run the VI;
    - the indicator will show the correct label for that graph;
    - perfect!!!
    If you save the VI and run it again, everything is fine.
    But............... if you close it, open again and run.... you will get an error 1055 "Object reference is invalid".
    Why it was working before closing?
    Find attached the VI and the Control.
    Thanks
    Dan07
    Solved!
    Go to Solution.
    Attachments:
    Cluster References.vi ‏11 KB
    Control1.ctl ‏7 KB

    Let see if I can answer before I have to start working.
    Do a quick experiment.
    Use a Type cast to cast your ref as a U32 and show that value on the FP.
    Save the VI run it and record the number on the FP.
    Mod the vi save it clsoe it open it and run again. The number should have changed.
    That is the issue you facing, the ref number changes so you need one that is valid when you run.
    How I do it;
    I use an Action Engine (see this Nugget to learn what an Action Engine is) that servse as a GUI controller and lets me get at refs where even I need them. The following is a case study.
    First I collect all of th refs I will need and bundle them in a type def. I sue a state machine to do the bundling if there are a lot.
    THe bundled clsuter get passed to an GUI Controller Action Engine
    Inside the Init I check the refs to make sure they are vlid. THis has saved a lot of wated time chasing invalid refs.
    If they were valid I cache the refs.
    For major mode changes that demand a lot of GUI punching I create sub-VI to do the dirty work.
    When ever other codes needs a ref to the GUI I have a method that returns the refs.
    THe following shows another VI using those GUI refs.
    I hope that helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Strange problem - WebDynpro DC after importing from standalone WD

    Hi All,
    I am having a strange problem. I have a webdynpro
    project which is not on NWDI and was deployed , working
    fine. Now, I created a WebDynpro DC, and I imported the
    working non-dc project to new WebDynpro DC. This
    webdynpro is straight forward.
    Now, When i activate the DC its deployment is failed.
    After a 2 days of investigating to the Traces, I found
    the exceptions.
    Failed to deploy
    application 'burton.com/portal~passwordchange' for
    deployment state listener 'com.sap.tc.webdynpro.serverimpl.wdc.repository.
    RepositoryContainerHook'. [EXCEPTION]
    com.sap.tc.webdynpro.repository.RepositoryRuntimeException: Failed to deploy the file '/usr/sap/EPD/JC35/j2ee/cluster/server0/./temp/webdynpro/public/burton.com/portal~passwordchange/webdynpro/Components/com.burton.webshop.b2b.myprofile.EditPassword/EditPassword.xml' into the database. Reason: Development Object 'local/wdMyProfile' contains already same repository content. Hint: fully qualified name of the repository VMO must be globally unique.
         at com.sap.tc.webdynpro.repository.deploy.RepositoryUpdateManager.checkVMOsExistInOtherDC(RepositoryUpdateManager.java:504)
         at com.sap.tc.webdynpro.repository.deploy.RepositoryUpdateManager.deployRepositoryContent(RepositoryUpdateManager.java:98)
         at com.sap.tc.webdynpro.serverimpl.wdc.repository.RepositoryContainerHook.onDeploy(RepositoryContainerHook.java:232)
         at com.sap.engine.services.webdynpro.WebDynproContainer.deploy(WebDynproContainer.java:1007)
         at com.sap.engine.services.webdynpro.WebDynproContainer.makeUpdate(WebDynproContainer.java:1259)
         at com.sap.engine.services.deploy.server.application.UpdateTransaction.makeComponents(UpdateTransaction.java:400)
         at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:321)
         at com.sap.engine.services.deploy.server.application.UpdateTransaction.begin(UpdateTransaction.java:164)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:292)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:326)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3184)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.update(DeployServiceImpl.java:669)
         at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1278)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:207)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Strange thing is in the Exception trace, It is says conflicting with the local webdynpro from which i imported to this DC.
    com.sap.tc.webdynpro.repository.RepositoryRuntimeException: Failed to deploy the
    file '/usr/sap/EPD/JC35/j2ee/cluster/server0/./temp/webdynpro/public/burton.com/portal~passwordchange/webdynpro/Components/com.burton.webshop.b2b.myprofile.EditPassword/EditPassword.xml' into the database.
    <u>Reason: Development Object 'local/wdMyProfile' contains already same repository content.</u> Hint: fully qualified name of the repository VMO must be globally unique.
    Did anyone came across this problem, Please let me
    know how to sovlve this..
    Thanks,
    Raags
    Message was edited by:
            Raghavendra Pothula

    Interesting and Time consumed bug. Here is the answer/solution i have found for this kind of problem.
    As VMO id is same for the non-nwdi webdynpro and nwdi-webdynpro(which imported non-nwdi webdynpro), We need to go in Visual Administrator and Undeploy the non-nwdi webdynpro ie., local/WDXyz.
    Once you undeployed that webdynpro then you can try for this nwdi-webdynpro.
    This is the solution!!!
    Thanks,
    Raags

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Strange problem with WD component build

    Hi all,
    I have strange problem with building one wd component, which is part of SC. I'm getting few errors which stops me from building component (and transporting to other systems via CMS of course). I'm providing sample of the errors (3 types) and ant error:
    [code]     [wdgen] [Error]   com.gbs.gmob.RequisitionFoCust --> ContextValueAttribute startDate [type]: Type missing (Hint: The type property must be set to a simple type, a built in type or any java native type)
         [wdgen] [Error]   com.gbs.gmob.RequisitionFoCust --> ContextValueAttribute stopDate [type]: Type missing (Hint: The type property must be set to a simple type, a built in type or any java native type)
         [wdgen] [Error]   com.gbs.gmob.SuppMatGroupView --> TextView MATERIAL_GROUP_NAME_editor [text]: Context element and property are not compatible
         [wdgen] [Error]   com.gbs.gmob.SuppMatGroupView --> TextView MATERIAL_GROUP_ID_editor [text]: Context element and property are not compatible
         [wdgen] [Error]   com.gbs.gmob.SupplierCust --> ContextModelNode SuppMatGroup [modelClass]: The context model node has not been bound to a model class (Hint: A Context model node has to be bound to a model class or mapped to a model node of another controller.)
         [wdgen] [Error]   com.gbs.gmob.SupplierCust --> ContextValueAttribute material_group_list [type]: Type missing (Hint: The type property must be set to a simple type, a built in type or any java native type)
         [wdgen] [Warning] com.gbs.gmob.ApprovalRejectView --> TextEdit TextEdit: UIElement does not have a label
         [wdgen] [Info]    Catching throwable null
         [wdgen] [Info]    com.sap.webdynpro.generation.ant.GenerationAntTaskError
         [wdgen]      at com.sap.webdynpro.generation.ant.GenerationAnt.showCheckResult(GenerationAnt.java:153)
         [wdgen]      at com.sap.ide.webdynpro.generation.Generation.check(Generation.java:2050)
         [wdgen]      at com.sap.ide.webdynpro.generation.Generation.generatePersistentComponent(Generation.java:1299)
         [wdgen]      at com.sap.ide.webdynpro.generation.console.GenerationConsole.generate(GenerationConsole.java:175)
         [wdgen]      at com.sap.webdynpro.generation.ant.GenerationAnt.main(GenerationAnt.java:50)
         [wdgen]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         [wdgen]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         [wdgen]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         [wdgen]      at java.lang.reflect.Method.invoke(Method.java:324)
         [wdgen]      at com.sap.webdynpro.generation.ant.WDGenAntTask.execute(WDGenAntTask.java:219)
         [wdgen]      at org.apache.tools.ant.Task.perform(Task.java:341)
         [wdgen]      at org.apache.tools.ant.Target.execute(Target.java:309)
         [wdgen]      at org.apache.tools.ant.Target.performTasks(Target.java:336)
         [wdgen]      at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
         [wdgen]      at com.sap.tc.buildplugin.techdev.ant.util.AntRunner.run(AntRunner.java:115)
         [wdgen]      at com.sap.tc.buildplugin.AbstractAntBuildAction.execute(AbstractAntBuildAction.java:65)
         [wdgen]      at com.sap.tc.buildplugin.AbstractPlugin.handleBuildStepSequence(AbstractPlugin.java:225)
         [wdgen]      at com.sap.tc.buildplugin.AbstractPlugin.performBuild(AbstractPlugin.java:201)
         [wdgen]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         [wdgen]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         [wdgen]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         [wdgen]      at java.lang.reflect.Method.invoke(Method.java:324)
         [wdgen]      at com.sap.tc.buildtool.PluginCommunicator.maybeInvoke(PluginCommunicator.java:114)
         [wdgen]      at com.sap.tc.buildtool.PluginCommunicatorV2.communicate(PluginCommunicatorV2.java:42)
         [wdgen]      at com.sap.tc.buildtool.PluginHandlerImpl.handlePluginCommunication(PluginHandlerImpl.java:354)
         [wdgen]      at com.sap.tc.buildtool.PluginHandlerImpl.execute(PluginHandlerImpl.java:176)
         [wdgen]      at com.sap.tc.devconf.impl.DCProxy.make(DCProxy.java:1726)
         [wdgen]      at com.sap.tc.devconf.impl.DCProxy.make(DCProxy.java:5559)
         [wdgen]      at com.sap.ide.eclipse.component.provider.actions.dcproject.BuildAction.buildDCsForDevConfig(BuildAction.java:307)
         [wdgen]      at com.sap.ide.eclipse.component.provider.actions.dcproject.BuildAction.access$200(BuildAction.java:58)
         [wdgen]      at com.sap.ide.eclipse.component.provider.actions.dcproject.BuildAction$1.run(BuildAction.java:212)
         [wdgen]      at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
         [wdgen] ERROR: Unknown exception during generation null (com.sap.webdynpro.generation.ant.GenerationAntTaskError)
         [wdgen] ERROR: Generation failed due to errors (6 seconds)
    Ant runtime 9.234 seconds
    Ant build finished with ERRORS
    [Error]   Generation failed!
    Error: Build stopped due to an error: [Error]   Generation failed!
    [/code]
    Strange is that if I try to rebuild and deploy locally, no errors occurs and I can normally deploy and run application manually!
    Does anyone have experience with this problem?
    Thanks in advance!
    Regards,
    Ivan

    Hi Ivan
    I have faced this problem earlier BUT ultimately I have to create the DC from scratch.
    But you can check these things:
    1.Have you copy/pasted Dictionary type from other location (check the path of the dictionary types ) --> If yes then deleted that and create again(do not use copy/paste)
    2.This also happens if your "Used DC" has some problems in the JDI --> Remove the used DC and add it again.
    3.Make sure the NWDI infastructure is perfect- this may be a cause.
    4. Check Context mappings --> delete all mappings > save metadata > Create again.
    5. Delete the model and recreate it again.
    6.If you have done reimporting model make sure to restart J2EE instance.
    Hope this solves the problem - if not please post
    Regards
    Ananda

  • Strange Problem with a Vector wraped inside a Hashtable

    Hi all ,
    I'm having a strange problem with a Vector wraped within a Hashtable inherited Class.
    My goal is to keep the order of the elements of the Hashtable so what I did was to extend Hashtable and wrap a Vector Inside of it.
    Here is what it looks like :
    package somepackage.util;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import java.util.Vector;
    public class OrderedHashTable extends Hashtable {
        private Vector index;
        /** Creates a new instance of OrderedHashTable */
        public OrderedHashTable() {      
            this.index = new Vector();
    //adds a key pair value to the HashTable and adds the key at the end of the index Vector
       public synchronized Object put(Object key,Object value){      
           index.addElement(key);
           Object obj = super.put(key,value);
           System.out.println("inside OrderedHashTable Put method index size = " + index.size());
           return obj;    
    public synchronized Object remove(Object key){
           int indx = index.indexOf(key);
           index.removeElementAt(indx);
           Object obj = super.remove(key);
           return obj;
    public synchronized Enumeration getOrderedEnumeration(){
           return index.elements();
    public synchronized Object getByIndex(int indexValue){
           Object obj1 = index.elementAt(indexValue);
           Object obj2 = super.get(obj1);      
           return obj2;
       public synchronized int indexOf(Object key){
        return index.indexOf(key);
        public synchronized int getIndexSize() {
            return index.size();
        }Everything seemed to work fine util I tried to add objects using a "for" loop such as this one :
    private synchronized void testOrderedHashTable(){
            OrderedHashTable test = new OrderedHashTable();
            for (int i = 1 ; i<15; i++){
                 System.out.println("adding Object No " + i);
                 String s = new String("string number = "+i);
                 test.put(new Integer(i),s);
                 System.out.println("-----------------------------------");
            //try to list the objects
            Enumeration e = test.getOrderedEnumeration();
            while (e.hasMoreElements()){
                Integer intObj = (Integer) e.nextElement();
                System.out.println("nextObject Number = "+ intObj);
        }Here is the console output :
    Generic/JSR179: adding Object No 1
    Generic/JSR179: inside OrderedHashTable Put method index size = 1
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 2
    Generic/JSR179: inside OrderedHashTable Put method index size = 2
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 3
    Generic/JSR179: inside OrderedHashTable Put method index size = 3
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 4
    Generic/JSR179: inside OrderedHashTable Put method index size = 4
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 5
    Generic/JSR179: inside OrderedHashTable Put method index size = 5
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 6
    Generic/JSR179: inside OrderedHashTable Put method index size = 6
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 7
    Generic/JSR179: inside OrderedHashTable Put method index size = 7
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 8
    Generic/JSR179: inside OrderedHashTable Put method index size = 8
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 9
    Generic/JSR179: inside OrderedHashTable Put method index size = 10
    Generic/JSR179: inside OrderedHashTable Put method index size = 10
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 10
    Generic/JSR179: inside OrderedHashTable Put method index size = 11
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 11
    Generic/JSR179: inside OrderedHashTable Put method index size = 12
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 12
    Generic/JSR179: inside OrderedHashTable Put method index size = 13
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 13
    Generic/JSR179: inside OrderedHashTable Put method index size = 14
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 14
    Generic/JSR179: inside OrderedHashTable Put method index size = 15
    Generic/JSR179: -----------------------------------
    Generic/JSR179: nextObject Number = 1
    Generic/JSR179: nextObject Number = 2
    Generic/JSR179: nextObject Number = 3
    Generic/JSR179: nextObject Number = 4
    Generic/JSR179: nextObject Number = 5
    Generic/JSR179: nextObject Number = 6
    Generic/JSR179: nextObject Number = 7
    Generic/JSR179: nextObject Number = 8
    Generic/JSR179: nextObject Number = 9
    Generic/JSR179: nextObject Number = 9
    Generic/JSR179: nextObject Number = 10
    Generic/JSR179: nextObject Number = 11
    Generic/JSR179: nextObject Number = 12
    Generic/JSR179: nextObject Number = 13
    Generic/JSR179: nextObject Number = 14
    You can notice that the output seems correct until the insertion of object 9.
    At this point the vector size should be 9 and the output says it is 10 elements long ...
    In the final check you can notice the 9 was inserted twice ...
    I think the problem has something to do with the automatic resizing of the vector but I'm not really sure. Mybe the resizing is done in a separate thread and the new insertion occurs before the vector is resized ... this is my best guess ...
    I also tested this in a pure J2SE evironment and I don't have the same strange behavior
    Can anybody tell me what I am doing wrong or how I could avoid this problem ?
    Thanks a lot !
    Cheers Alex

    Am i doing anything wrong?Uhm, yes. Read the API doc for addElement() and for addAll()

  • Web Service Strange problem

    Hi
    I have the following strange problem while calling a
    web-service that is bind to a data grid on a popup container:
    When I’m calling the web service using the popup
    container automatic event (i.e. show, creation-completed, activate,
    etc) the structure returned from the web service is an [Object
    Proxy] type that needs to be decipher…
    Changing the logic and calling the same web service by a user
    interface action (click etc), returns an ArrayCollection Object.
    The question is actually what is the difference between an
    automatic and a user action?
    Should there be such a difference?

    Hi
      Again you are trying to add an empty line and then delete it. Well what i am saying is you dont have to do the lines
    complex.addRETURN(new ComplexType_BAPIRET2());
    complex.addUSERLIST(new ComplexType_BAPIUSNAME());
    ComplexType_BAPIUSSEXP d1 = new ComplexType_BAPIUSSEXP();
    complex.addSELECTION_EXP(d1);
    ComplexType_BAPIUSSRGE d2 = new ComplexType_BAPIUSSRGE();
    complex.addSELECTION_RANGE(d2);
    complex.removeSELECTION_EXP(d1);
    complex.removeSELECTION_RANGE(d2);
    input.setParameters(complex);
    Just write the following code and you are good to go.
    Bapi_User_Getlist_Input complex = new Bapi_User_Getlist_Input();
    wdContext.nodeBapi_User_Getlist_Input().bind(complex);
    complex.setMax_Rows(10);
    complex.setWith_Username("X");
    try
      wdContext.currentBapi_User_Getlist_InputElement().modelObject().execute();        
    catch(Exception e)
      wdComponentAPI.getMessageManager().reportException ("Exception occured "+e,true);      
    Hope that helps you. You dont have to pass any values to the table structures. This specific bapi does not require data to be passed to the structures and by doing so empty lines are added and that is what i was saying when i explained in my previous post. Hope that clarifies your doubt. Do let me know in case u require further clarifications.
    If you are getting a error saying Return and Selection_EXP are required check the mapping.
    It is enough if you just select the nodes under
       Bapi_User_List_Input
          |_Output
          |    |_Return (Model Node)
          |    |_Selection_Exp (Model Node)
          |    |_Selection_Range (Model Node)
          |    |_Userlist (Model Node)
          |    |_Rows (Model Attribute)
          |_Max_Rows (Model Attribute)
          |_With_Username (Model Attribute)  
    and of course select the Model Attributes MAX_ROWS and With_Username
    Let me know if you require any more information
    regards
    ravi

  • Object Casting

    hi ,i have a question for .Base on this example below , i need to understand some casting basic .I understand how premitives values widening rules works but not on object casting rules.
    Question 1.
    Okay ,base on the example below why 'c=(Test) a' will always give compile error while "a=b" does not .Let takes this example , b already extends A and should have information of A class while A only have it own .I know i was thinking another way round.Can any one help.
    Question 2.
    How to make " c = (Test) a to run without any problem ,as long as a is assign to a is ok.
    Question 3.
    I have a statement from Khalid book page 202 and i don't understand .
    First statement:=Conversion which preserve the inheritance is a relationship are allowed ,other conversion      require an explicit case or are illegal.
    Fecond statement:=There is no notion of promotion for reference values.
    Question 4.
    What is the benefit of using casting and when we need to use it .Can give a short example.??
    class A {int Athing = 1;}
    class B extends A {int Bthing = 2;}
    class Test extends A
    { int Cthing = 3;
    public static void main(String args[])
    A a = new A();
    B b = new B();
    Test c = new Test();
    //c = (Test) a; //runtime error
    a = b;

    Ron, does your mommy know you're here? Shoudn't you be out riding your bike or doing homework or watching X Men or something instead of interrupting the grown-ups?
    Wikey: The answer to your question is that you can always (and implicitly) cast to a subclass because the subclass is always a member of the class, but you can't always even explicitly cast to the parent or higher class. To give a concrete example, all Toyota Camries are cars, but not all cars are Toyota Camries. There are things you can do with a Toyota Camry that you can't do with all cars. In your code, if you had coded A a = new Test();, you woudn't have a runtime error.
    Doug

  • Strange problem with my build JAR

    Hiii everybody... I'm having a strange problem with my build (JAR file)... when I work with the Eclipse and I click in the table that returns the clients stored in my PostGre database it works fine, but when I build my application and it generates my JAR file and I open it and click in the same table to return the objects that I have.. it does not appears anymore.. just show when I work with eclipse... and the database is the same for both.
    I already checked the database path in my properties file... and the application recognize the database because I can login and there isn't any runtime exception...
    In that application I work with Hibernate and Spring... for me it is very strange because the application works fine when I run by eclipse... but does not return the database data when I click on my Jar file to open the application..
    Someone can help me with that?
    I dont know if the problem is in the Spring, Hibernate, Libraries...
    thanks in advance...

    So what's the error then? Are there any error messages? Have you checked the console? Or are you just clicking on the jar and you wouldn't even see the errors if there are any?
    What do the logs say?
    You're not giving a lot to work on here.

  • Strange problem with JComboBox

    I am having a strange problem with JComboBox, I created a method as a JComboBox factory which returns a JComboBox filled with items. the method works fine and I can see the items in the JComboBox. The problem is when I try using the method myCombo.SelectedItem(String item); the object myCombo does not set the selected item, it just leaves the item blank (or unselected).
    //This method build a JComboBox
    public javax.swing.JComboBox makeJComboBox(String[] items) {
    javax.swing.JComboBox myComboBox = new javax.swing.JComboBox();
    for (int index=0;index<items.length;index++){
    myComboBox.addItem(makeObj(items[index]));
    return myComboBox;
    public Object makeObj(final String item) {
    return new Object() {
    public String toString() {
    return item;
    }

    Couple of better ways to populate a combo with items-
    public javax.swing.JComboBox makeJComboBox(String[]items) {
    javax.swing.ComboBoxModel cbModel = new DefaultComboBoxModel(items);
    javax.swing.JComboBox myComboBox = new javax.swing.JComboBox(cbModel);
    return myComboBox;
    }OR
    public javax.swing.JComboBox makeJComboBox(String[]items) {
    return new javax.swing.JComboBox(items);

  • Strange problem with Inheritance

    Hi,
    I have a Strange problem with Inheritance which I think should work, but doesn't.
    I have 3 classes in 3 different packages.
    Class A in package 1 is abstract
    Class B extend class A is also Abstract and is in package 2
    Class C extend Class B and is in package 3
    When i do the following
    C c = new C();
    A a = (A)c;
    I get a class cast exception
    Any ideas?
    Jag

    That should work fine. Can you check the exact classes created (using: System.out.println(c.getClass().toString()). You may have accidentally created an instance of a class with the same name but from a different package.

  • Strange problem with DatagramSocket and DatagramPacket.

    Hi!
    I got a strange problem with UDP sockets:
    Client (hardware device) send binary data messages, consisting of bytes and shorts fields (8 and 16 bits). But when I tried to read byte array, received from socket, I got some type anomaly. For example:
    byte[] buffer = new byte[1024];
    DatagramPacket packet = new DatagramPacket(buffer, 1024);
    socket.receive(packet);
    byte[] data = packet.getData();
    System.out.println("Received data:");
    for (int i = 0; i < packet.getLength(); i++) {
      System.out.printf("%h:", data);
    I got such thing: 34:4:fffffff1:ffffffdb:ffffffdc:20:1:1:0:2:50
    If I try to parse it using ByteArrayInputStream and DataInputStream
    ByteArrayInputStream is = new ByteArrayInputStream(packet.getData());
    DataInputStream dis = new DataInputStream(is);
    int head = dis.readByte();
    int recvinfo = dis.readByte();
    short count = (short)dis.readShort();
    System.err.printf("Decoded:\n head: %h\n recvinfo: %h\n count: %h\n",
         head, recvinfo, count);i got following:
    Decoded:
    head: 34
    recvinfo: 4
    count: fffff1db
    So I get Integer entries in byte?! array. I also got Integer even I try to read and cast it as short in short!!! variable.
    Please help!
    P.S. Sorry for my bad English.

    Rather fortunate that it auto-casts(or rather, that 0xFF is int by default, rather than attempting any type-detection as most languages do), as otherwise the brackets would have been in the wrong place. If it was still a byte after the "& 0xFF", sign extension would still occur.
    For the sake of the less bit-literate reading this thread, it should be explained that the reason for this was large bytes being interpreted as negative numbers, which translate to negative int, which in hexa become very large ints. That's about as verbose as I can be about this without writing the equivalent of a wikipedia entry about 2s complement.

  • Strange problem with Eclipse, JAXB and JBoss

    Hello,
    I've been confronted to a very strange problem for the last week, and I still can't manage to fix it. I'm working on a J2EE application, using JBOSS. One of its functionality require the use of XML parsing. For this task, I've used JAXB since everyone in my company use this library. So I've written a small test class, that read my XML file, unmarshal it to java beans, and then write it back to another file (just for testing purpose only, I'm not trying to make the worst "copy" implementation ever done :) .)
    jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    //Unmarshal from XML to Bean
    XMLResult result = (XMLResult)unmarshaller.unmarshal(new File("path/to/file/myTestFile.xml"));
    //[Test] marshal back to XML
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.marshal(result, new File("path/to/file/output.xml"));When I run this file, I first get an error about namespaces...
    unexpected element (uri:"http://myNamespace.com", local:"XMLResult"). Expected elements are <{http://myNamespace.com/}Patient>,<{}Episode>, ..... <{}XMLResult>, etc...
    (Result is the root, patient and episode are sub elements)
    I have absolutely no idea why my root (XMLResult) should have no namespace, but some other elements should, and some shouldn't... but that's not the real problem. I've tried to fix this for days, changing namespaces, removing them.. but it didn't work. And then, I once chose to clean my project in Eclipse, and re-run my test. and it worked... !
    After some changes to the XSD, I re-run XJC, then recompile my project, and re-deploy it to JBOSS. I ran my test once more and... same error as before. Then, again, I clean the project.. and the test worked.
    So when I use the basic compiler for eclipse, everything works, but if I choose to use ant to build and deploy, it won't... even if they are supposed to be the same (run configuration / jre / use same as workspace). Here is an example of XML file I'm trying to read, and the related XSD :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://myNamespace.com"
    xmlns:ar="http://myNamespace.com">
    <xs:element name="XMLResult">
         <xs:complexType>
              <xs:sequence>               
                   <xs:element ref="ar:Patient"/>
                   <xs:element ref="ar:Episode"/>
              </xs:sequence>          
         </xs:complexType>
    </xs:element>
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <XMLResult xmlns="http://myNamespace.com">
      <Patient >
      </Patient>
      <Episode >
      </Episode>
    </XMLResult>Any idea of what I'm doing wrong? I think I've tried everything.... and looked everywhere, but had no success :/ I still don't know why it work with the basic compilation, or why my namespaces are wrong... (if they are).

    I don?t know if its a bug of the lomboz, if it is,
    please tell me what to do.It is a bug in Lomboz. It has a forum here: http://forge.objectweb.org/forum/forum.php?forum_id=360.

Maybe you are looking for

  • ITunes/Computer will not recognize my iPod??

    I recently attempted to update my iPod Touch 3G to the newest update, and afterwards, my iPod only shows the screen that wants me to connect my iPod to iTunes b ut when I connect it to my computer, iTunes will not recognize it, and my computer says t

  • Log and transfer question

    OK I was wondering if when I import AVCHD from my hard drive if the original files would be damaged at or removed at all. I just had a slight issue, and was wondering if that would be a problem. Any advice is appreciated. Thanks!

  • Live bookmarks feed failed to load

    After upgrading to Firefox5 got this "Live bookmarks feed failed to load"

  • Can't get iPad2 to sync with my MacBook Pro.

    Have always been able to in the past. In my utilities on my iPad2, it says it was last synced with my MacBook on 3/16. I am on wi fi and plugged in but the Sync Now button on my iPad is grey and it says it will sync when my MacBook is available.

  • Error in CFUPDATE tag

    after calling  cfupdate tag it raise following erro The ISUSERDATAUPDATED fieldname cannot be found in the Users table while 'ISUSERDATAUPDATED ' is a control name in form. I am using following code <CFIF ID GT 0> <CFUPDATE DATASOURCE="#Application.D