Page 1 of 1

I get this error sometime...

Posted: Sun Jan 31, 2010 11:21 am
by adamss
If you want to receive support we need this info to help you properly.
ยป Find Revision
L2J Revision 3886:
L2JDP Revision 6988:

java.lang.NullPointerException
at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.doAutoLoot(L2PcInstance.java:4747)
at com.l2jserver.gameserver.model.actor.L2Attackable.doItemDrop(L2Attackable.java:1481)
at com.l2jserver.gameserver.model.actor.L2Attackable.doItemDrop(L2Attackable.java:1392)
at com.l2jserver.gameserver.model.actor.L2Attackable.calculateRewards(L2Attackable.java:538)
at com.l2jserver.gameserver.model.actor.L2Character.doDie(L2Character.java:2086)
at com.l2jserver.gameserver.model.actor.L2Npc.doDie(L2Npc.java:2667)
at com.l2jserver.gameserver.model.actor.L2Attackable.doDie(L2Attackable.java:466)
at com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance.doDie(L2MonsterInstance.java:204)
at com.l2jserver.gameserver.model.actor.status.CharStatus.reduceHp(CharStatus.java:196)
at com.l2jserver.gameserver.model.actor.status.NpcStatus.reduceHp(NpcStatus.java:51)
at com.l2jserver.gameserver.model.actor.status.AttackableStatus.reduceHp(AttackableStatus.java:49)
at com.l2jserver.gameserver.model.actor.L2Character.reduceCurrentHp(L2Character.java:6792)
at com.l2jserver.gameserver.model.actor.L2Attackable.reduceCurrentHp(L2Attackable.java:437)
at com.l2jserver.gameserver.model.actor.L2Attackable.reduceCurrentHp(L2Attackable.java:373)
at handlers.skillhandlers.Mdam.useSkill(Mdam.java:175)
at com.l2jserver.gameserver.model.actor.L2Character.callSkill(L2Character.java:6433)
at com.l2jserver.gameserver.model.actor.L2Character.onMagicHitTimer(L2Character.java:6138)
at com.l2jserver.gameserver.model.actor.L2Character$MagicUseTask.run(L2Character.java:2534)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Can you give me some idea to why?

Re: I get this error sometime...

Posted: Sun Jan 31, 2010 11:40 am
by Stake
"java.lang.NullPointerException
at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.doAutoLoot(L2PcInstance.java:4747)"

You should take a look at this doAutoLoot function. It may have got an attackable instance as value that is null.

Re: I get this error sometime...

Posted: Sun Jan 31, 2010 9:23 pm
by adamss
If it is possible cause this error some server lag? Maybe the server doesn't reach the database for a sec?

Another.... is it possible to catch the error? i need some debug information.... and some advice how i can?

Re: I get this error sometime...

Posted: Sun Jan 31, 2010 9:37 pm
by Stake
adamss wrote:If it is possible cause this error some server lag? Maybe the server doesn't reach the database for a sec?

Another.... is it possible to catch the error? i need some debug information.... and some advice how i can?
Server loads everything into the memory on start. It uses database only for writing. Put a try-catch in doAutoLoot and under catch execute some variable value to be written in the console.

Re: I get this error sometime...

Posted: Mon Feb 01, 2010 12:46 am
by adamss

Code: Select all

public void doAutoLoot(L2Attackable target, L2Attackable.RewardItem item)	{		try        {			if (isInParty()&&ItemTable.getInstance().getTemplate(item.getItemId()).getItemType() != L2EtcItemType.HERB)  				getParty().distributeItem(this, item, false, target);			else if (item.getItemId() == 57) addAdena("Loot", item.getCount(), target, true);			else addItem("Loot", item.getItemId(), item.getCount(), target, true);        }        catch (Exception e)        {        	_log.warning("Target: "+target);        	_log.warning("Reward item: "+item);        	_log.warning("isInParty: "+isInParty());        	_log.warning("ItemCheck: "+ItemTable.getInstance().getTemplate(item.getItemId()).getItemType());        }        finally        {            try { con.close(); } catch (Exception e) {}        }	}

You mean something like this?

Re: I get this error sometime...

Posted: Mon Feb 01, 2010 1:11 am
by _DS_
And where is the line 4747 ?

Re: I get this error sometime...

Posted: Mon Feb 01, 2010 2:43 am
by Stake
_DS_ wrote:And where is the line 4747 ?
That's what he hasn't told us yet. :D
it shows under doAutoLoot to me, so adamss may have some patches in L2PcInstance.

Re: I get this error sometime...

Posted: Mon Feb 01, 2010 12:29 pm
by adamss
yeah, i have some modification.. :)

line 4747: "if (isInParty()&&ItemTable.getInstance().getTemplate(item.getItemId()).getItemType() != L2EtcItemType.HERB)
"

Re: I get this error sometime...

Posted: Mon Feb 01, 2010 2:12 pm
by Stake
adamss wrote:yeah, i have some modification.. :)

line 4747: "if (isInParty()&&ItemTable.getInstance().getTemplate(item.getItemId()).getItemType() != L2EtcItemType.HERB)
"
Java is very sensitive for exceptions, so I think it may be ItemTable.getInstance().getTemplate(item.getItemId()) that returns null at this line, but you don't need to worry. Just put an empty or a one line warning for the catch and there will be no more multi-line errors for you. :P

So it'd better solution than making checks for each function. If Java finds an exception it will stop at that line and not query lines under that exception is found at.