Author Topic: NullPointerException while change'ing Agents parent folder  (Read 6451 times)

Offline pawelmichalak

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
NullPointerException while change'ing Agents parent folder
« on: March 01, 2010, 03:53:10 PM »
I am writing application based on Java Configuration SDK (7.6) which has to synchronize structure of Persons folder with external database.
There are two tasks of synchronization:
- update data of agent (firstname, lastname etc.)
- move agent to proper folder in Persons

The problem occurs when I try to change agent's parent folder - I get NullPointerException while perforing folder.save() operation:
[code]java.lang.NullPointerException
        at java.util.Hashtable$HashIterator.<init>(Unknown Source)
        at java.util.Hashtable$4.iterator(Unknown Source)
        at java.util.Collections$SynchronizedCollection.iterator(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.runtime.XmlObjectUpdateHelper.areEqual(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.runtime.XmlObjectUpdateHelper.createDiffStructList(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.runtime.XmlObjectUpdateHelper.createDeltaObject(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.CfgObject.save(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.CfgObject.save(Unknown Source)
        at com.genesyslab.platform.applicationblocks.com.objects.CfgFolder.save(Unknown Source)
        at org.importer.genesys.AgentManager.moveTo(AgentManager.java:319)[/code]

This is code I use:
[code]
Integer agentsParentFolder = agent.getFolderId();

CfgObjectID id = new CfgObjectID(service, null);
id.setDBID(agent.getDBID());
id.setType(CfgObjectType.CFGPerson);

List<CfgObjectID> tmp = folder.getObjectIDs();
tmp.add(id);

folder.setObjectIDs(tmp);

folder.save();
[/code]

I can't also do it via agent.setFolder() function because when I try to use it I get 'object already saved error'

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: NullPointerException while change'ing Agents parent folder
« Reply #1 on: March 01, 2010, 04:17:21 PM »
Hi Pawel,

I think that your issue is caused by passing "null" as second parameter when creating instance of CfgObjectID class. Please change this line as shown below and try again.

[code]CfgObjectID id = new CfgObjectID(service, agent);
id.setDBID(agent.getDBID());
id.setType(agent.getObjectType());[/code]

R.

Offline pawelmichalak

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: NullPointerException while change'ing Agents parent folder
« Reply #2 on: March 02, 2010, 07:59:55 AM »
I changed it as you have written but unfortunately it didn't help.

The strangest thing in this problem is that it seems to be not deterministic. During latest tests I didn't stop process when this error is thrown and I find out that it occurs in about 10% of all move cases.

Maybe there is sth wrong with our agents or folder configuration?

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: NullPointerException while change'ing Agents parent folder
« Reply #3 on: March 03, 2010, 08:41:54 AM »
Hi Pawel,

It sounds really strange. Genesys Application Blocks come with source codes so you can try to debug the process and try to find out what is wrong. Does the error occur on the same agent object every time or it is random?

BTW What version of Platform SKD do you have?

R.

Offline pawelmichalak

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: NullPointerException while change'ing Agents parent folder
« Reply #4 on: March 04, 2010, 02:56:38 PM »
It seems to happen quite random. But more often when I change some person property (like firstname) before (after changing this property I of course save agent and then, before moving object in Persons refresh him).

I am using Platform SDK 7.6

I asked this question because I thought I am doing sth wrong but if this problem seem to be not related to my code I will just send it to support.

Offline pawelmichalak

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: NullPointerException while change'ing Agents parent folder
« Reply #5 on: April 22, 2010, 07:52:45 AM »
I recently found reason of the problem - in my code I was moving few agents to same folder object.
The Genesys Configuration API is using synchronized collections to store configuration objects, and probably there was an hazard between changes my code was doing to this folder object and changes done by Genesys API during save() operations.

The workaround is to [u]reload folder object manualy everytime[/u] you want to change it. (not by referesh() function but through service querry)

Offline yan9085

  • Newbie
  • *
  • Posts: 2
  • Karma: -2
Re: NullPointerException while change'ing Agents parent folder
« Reply #6 on: August 11, 2010, 02:51:54 AM »

Time is running out for my friend. While we are sitting at lunch she casually mentions she and her husband are thinking of starting a family. "We're taking a survey,"she says, half-joking. "Do you think I should have a baby?"
[url=http://www.wotlk-power-leveling.com]wow powr leveling[/url],
"It will change your life,"wow power leveling  I say, carefully keeping my tone neutral. "I know,"she says, "no more sleeping in on weekends, no more spontaneous holidays..."
But that's not what I mean at all. I look at my friend, trying to decide what to tell her. I want her to know what she will never learn in childbirth classes. I want to tell her that the physical wounds of child bearing will heal, but becoming a mother will leave her with an emotional wound so raw that she will be vulnerable forever.
[url=http://www.ugamewow.com/aion-gold.html]cheap aion kinah[/url],
I consider warning her that she will never again read a newspaper without thinking:cheap aion kinah "What if that had been MY child?" That every plane crash, every house fire will haunt her. That when she sees pictures of starving children, she will wonder if anything could be worse than watching your child die. I look at her carefully manicured nails and stylish suit and think that no matter how sophisticated she is, becoming a mother will reduce her to the primitive level of a bear protecting her cub.
[url=http://www.flyff-penya-store.com]flyff penya[/url],
I feel I should warn her that no matter how many years she has invested in her career, flyff penya she will be professionally derailed by motherhood. She might arrange for child care, but one day she will be going into an important business meeting, and she will think her baby's sweet smell. She will have to use every ounce of discipline to keep from running home, just to make sure her child is all right.
[url=http://www.ugamewow.com/Maple-Story-USA-20.html]maple story mesos[/url],
I want my friend to know that every decision will no longer be routine. maple story mesos  That a five-year-old boy's desire to go to the men's room rather than the women's at a restaurant will become a major dilemma. The issues of independence and gender identity will be weighed against the prospect that a child molester may be lurking in the lavatory. However decisive she may be at the office, she will second-guess herself constantly as a mother.
[url=http://www.cheap-penya.com]flyff penya[/url],
Looking at my attractive friend, flyff penya I want to assure her that eventually she will shed the added weight of pregnancy, but she will never feel the same about herself. That her own life, now so important, will be of less value to her once she has a child. She would give it up in a moment to save her offspring, but will also begin to hope for more years—not to accomplish her own dreams—but to watch her children accomplish theirs.
[url=http://www.flyff-penya.com]flyff penya[/url],
I want to describe to my friend the exhilaration of seeing your child learn to hit a ball.flyff penya  I want to capture for her the belly laugh of a baby who is touching the soft fur of a dog for the first time. I want her to taste the joy that is so real it hurts.
My friend's look makes me realize that tears have formed in my eyes. "You'll never regret it," I say finally. Then, squeezing my friend's hand, I offer a prayer for her and me and all of the mere mortal women who stumble their way into this holiest of callings.