All pastes #17818 Raw Edit

Stuff

public java v1 · immutable
#17818 ·published 2005-07-16 03:58 UTC
rendered paste body
// this null pointer error appears to happens sometimes when u attempt to equip 1 hand right handed weaponerror handling client message [C] 14 UseItemjava.util.ConcurrentModificationException        at java.util.AbstractList$Itr.checkForComodification(Unknown Source)        at java.util.AbstractList$Itr.next(Unknown Source)        at net.sf.l2j.gameserver.model.Inventory.setPaperdollItem(Inventory.java:299)        at net.sf.l2j.gameserver.model.Inventory.equipItem(Inventory.java:455)        at net.sf.l2j.gameserver.model.Inventory.equipItemAndRecord(Inventory.java:392)        at net.sf.l2j.gameserver.clientpackets.UseItem.runImpl(UseItem.java:77)        at net.sf.l2j.gameserver.clientpackets.ClientBasePacket.run(ClientBasePacket.java:56)        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)// from inventory.java, here is the code surrounding lines 299, 455 and 392// comments beginning with "//--+" have been added as my notes and are not in the code originally// 299:L2ItemInstance setPaperdollItem(int slot, L2ItemInstance item)	{		L2ItemInstance old = _paperdoll[slot]; 		if (old != item)		{			if (old != null)			{				_paperdoll[slot] = null;				old.setLocation(getBaseLocation());				old.setLastChange(L2ItemInstance.MODIFIED);				int mask = 0;				for (int i=0; i < PAPERDOLL_LRHAND; i++)				{					L2ItemInstance pi = _paperdoll[i]; 					if (pi != null)						mask |= pi.getItem().getItemMask(); 				}				_wearedMask = mask;//--+ next line is 299. "PaperdollListener listener" is shown as having the following problem in eclipse://--+ Syntax error on token(s), misplaced contruct(s)				for (PaperdollListener listener : _paperdollListeners) 					listener.notifyUnequiped(slot, old);				old.updateDatabase();			}			if (item != null)			{				_paperdoll[slot] = item;				item.setLocation(getEquipLocation(), slot);				item.setLastChange(L2ItemInstance.MODIFIED);				_wearedMask |= item.getItem().getItemMask();//--+ same error here on the paperdolllistener as above				for (PaperdollListener listener : _paperdollListeners)					listener.notifyEquiped(slot, item);				item.updateDatabase();			}		}		return old;	}//455://--+ no errors appear in the following code in eclipse			case L2Item.SLOT_R_HAND:			{				if (_paperdoll[PAPERDOLL_LRHAND] != null)				{					setPaperdollItem(PAPERDOLL_LRHAND, null);					setPaperdollItem(PAPERDOLL_LHAND, null);					setPaperdollItem(PAPERDOLL_RHAND, null);				}				else				{//--+ 455 below					setPaperdollItem(PAPERDOLL_RHAND, null);				}								setPaperdollItem(PAPERDOLL_RHAND, item);				break;			}//392:    public L2ItemInstance[] equipItemAndRecord(L2ItemInstance item)    {		Inventory.ChangeRecorder recorder = newRecorder(); 		try		{//--+ 392 below	       equipItem(item, true); 		} finally {			removePaperdollListener(recorder);		}		return recorder.getChangedItems();    }