Merge pull request #1234 from ilikenwf/master

Proper error output for invalid cell id's in static service and error handling messages for invalid objects in objectservice
This commit is contained in:
tacef
2014-10-05 19:09:58 +02:00
4 changed files with 34 additions and 21 deletions
+6 -7
View File
@@ -58,15 +58,14 @@ public class Equipment extends Delta {
}
public byte[] getBytes() {
if (!(getObject() instanceof TangibleObject)) {
if (getObject() == null) {
System.err.println("Serious error: Equipment object is null in objectList.");
} else {
System.err.println("Serious error: Equipment object isn't a TangibleObject");
}
SWGObject sobject = getObject();
if (sobject == null) {
System.err.println("Serious error: Equipment object is null in objectList.");
return null;
}
TangibleObject object = (TangibleObject) getObject();
TangibleObject object = (TangibleObject) sobject;
synchronized(objectMutex) {
int size = 19 + object.getCustomization ().length;
+4 -2
View File
@@ -127,9 +127,11 @@ public class StaticService implements INetworkDispatch {
long buildingId = 0;
int cellNumber = 0;
SWGObject cell = core.objectService.getObject(cellId);
SWGObject cell = null;
if (cellId != 0 && cell == null) {
if (cellId != 0L && cellId != 0) {
cell = core.objectService.getObject(cellId);
} else {
System.err.println("CellId invalid for template " + template);
return null;
}
+6 -1
View File
@@ -997,6 +997,11 @@ public class CommandService implements INetworkDispatch {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
if (data == null){
System.out.println("NULL data passed to insertOpcodes, ignoring.");
return;
}
data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
@@ -1017,7 +1022,7 @@ public class CommandService implements INetworkDispatch {
BaseSWGCommand command = getCommandByCRC(commandCRC);
if (command == null) {
//System.out.println("Unknown Command CRC: " + commandEnqueue.getCommandCRC());
System.out.println("Unknown Command CRC: " + commandEnqueue.getCommandCRC());
return;
}
+18 -11
View File
@@ -575,7 +575,8 @@ public class ObjectService implements INetworkDispatch {
if (objectList.containsKey(objectID)) {
System.err.println("getObject(): object is null but objectList contains objectID key");
} else {
// System.err.println("getObject(): object is null");
System.err.println("getObject(): object is null");
Thread.currentThread().dumpStack();
}
}
@@ -1147,8 +1148,10 @@ public class ObjectService implements INetworkDispatch {
System.err.println("NULL Client");
return;
}
CreatureObject creature = null;
if(getObject(objectId) == null) {
if(objectId != 0L && getObject(objectId) == null) {
creature = getCreatureFromDB(objectId);
if(creature == null) {
System.err.println("Cant get creature from db");
@@ -1165,7 +1168,7 @@ public class ObjectService implements INetworkDispatch {
} else {
if (!(getObject(objectId) instanceof CreatureObject)) {
System.out.println("Character is not an instance of CreatureObject!");
System.out.println("Character is not an instance of CreatureObject or is null!");
return;
}
@@ -1222,14 +1225,18 @@ public class ObjectService implements INetworkDispatch {
});
creature.viewChildren(creature, true, true, (object) -> {
if(object.getMutex() == null)
object.initializeBaselines();
object.initAfterDBLoad();
if(object.getParentId() != 0 && object.getContainer() == null)
object.setParent(getObject(object.getParentId()));
object.getContainerInfo(object.getTemplate());
if(getObject(object.getObjectID()) == null)
objectList.put(object.getObjectID(), object);
if (object != null) {
if(object.getMutex() == null)
object.initializeBaselines();
object.initAfterDBLoad();
if(object.getParentId() != 0 && object.getContainer() == null)
object.setParent(getObject(object.getParentId()));
object.getContainerInfo(object.getTemplate());
if(getObject(object.getObjectID()) != null)
objectList.put(object.getObjectID(), object);
} else {
Thread.currentThread().dumpStack();
}
});
if(creature.getParentId() != 0) {