Oh my Java diagnostics really do suck major ass, 'null' is just a fancy term of saying nothin, you referencing nothin, your trying to load nothing and it's having a hissy fit
|
So yesterday i was trying to pack a new data, but i didint use the main files, made a copy of a cache and a client, eventually failed to pack the data so i deleted the files i tried them on. But today I was trying to run my server with the original client ive been using and original source, and it throws this error to source.
[SPOIL]Could not load blacklisted hosts.
[2017-08-27 16:29:14] java.lang.NullPointerException
[2017-08-27 16:29:14] at com.dark.core.cache.ByteStreamExt.readUnsignedWord (ByteStreamExt.java:24)
[2017-08-27 16:29:14] at com.dark.core.cache.map.ObjectDef.loadConfig(Objec tDef.java:330)
[2017-08-27 16:29:14] at com.dark.GameDataLoader$1.run(GameDataLoader.java: 93)
[2017-08-27 16:29:14] java.io.FileNotFoundException: .\data\def\interface (The system cannot find the path specified)
[2017-08-27 16:29:14] at java.io.FileInputStream.open0(Native Method)
[2017-08-27 16:29:14] at java.io.FileInputStream.open(Unknown Source)
[2017-08-27 16:29:14] at java.io.FileInputStream.<init>(Unknown Source)
[2017-08-27 16:29:14] at com.dark.core.cache.map.RSInterface.unpack(RSInter face.java:6344)
[2017-08-27 16:29:14] at com.dark.GameDataLoader.load(GameDataLoader.java:1 15)
[2017-08-27 16:29:14] at com.dark.core.GameThread.startup(GameThread.java:6 9)
[2017-08-27 16:29:14] at com.dark.core.GameThread.init(GameThread.java:34)
[2017-08-27 16:29:14] at com.dark.Server.main(Server.java:105)
[2017-08-27 16:29:14] java.lang.NullPointerException
[2017-08-27 16:29:14] at com.dark.core.cache.map.RSInterface.unpack(RSInter face.java:6352)
[2017-08-27 16:29:14] at com.dark.GameDataLoader.load(GameDataLoader.java:1 15)
[2017-08-27 16:29:14] at com.dark.core.GameThread.startup(GameThread.java:6 9)
[2017-08-27 16:29:14] at com.dark.core.GameThread.init(GameThread.java:34)
[2017-08-27 16:29:14] at com.dark.Server.main(Server.java:105)[/SPOIL]
I mean first of all I didint have any errors yesterday, neither it shows any left side of the eclipse (only shows error on running the server.) Second how come packing a data in a different folders can harm the source and third i eventually deleted the thing i did and moved into the source i used and it didint work anymore. I might sound stupid so i really looking forward to help, thanks.
Problems it causes:
*NPCs wont spawn (execpt minigame one ex. fight caves)
*Wont compile anything
*Eclipse wont run the server, only can do it with run.bat
Spoiler for Objectdef.java lines 327-341:
if any other lines is needed to post for help please make sure to tell me
Oh my Java diagnostics really do suck major ass, 'null' is just a fancy term of saying nothin, you referencing nothin, your trying to load nothing and it's having a hissy fit
My first assumption would be that the resource you're providing to ByteStreamExt is non-existant. i.e; getBuffer("loc.XXX"). Make sure that file exists at its relative location.
show method getBuffer
obectdef.java
[SPOIL] public static void loadConfig() {
stream = new ByteStreamExt(getBuffer("loc.dat"));
ByteStreamExt stream = new ByteStreamExt(getBuffer("loc.idx"));
objects = stream.readUnsignedWord();
streamIndices = new int[objects];
int i = 2;
for (int j = 0; j < objects; j++) {
streamIndices[j] = i;
i += stream.readUnsignedWord();
}
cache = new ObjectDef[20];
for (int k = 0; k < 20; k++) {
cache[k] = new ObjectDef();
}
logger.info(Utility.format(objects) + " Objects have been loaded successfully.");
} [/SPOIL]
streambuffer.java
[SPOIL]
public static final class InBuffer extends StreamBuffer {
/**
* The internal buffer.
*/
private ChannelBuffer buffer;
/**
* Creates a new InBuffer.
*
* @param buffer
* the buffer
*/
private InBuffer(ChannelBuffer buffer) {
this.buffer = buffer;
}
/**
* Gets the internal buffer.
*
* @return the buffer
*/
public ChannelBuffer getBuffer() {
return buffer;
}
/**
* Reads a standard signed byte.
*
* @return the value
*/
public int readByte() {
return readByte(true, ValueType.STANDARD);
}
/**
* Reads a standard byte.
*
* @param signed
* the signedness
* @return the value
*/
public int readByte(boolean signed) {
return readByte(signed, ValueType.STANDARD);
}
/**
* Reads a value as a byte.
*
* @param signed
* the signedness
* @param type
* the value type
* @return the value
*/
public int readByte(boolean signed, ValueType type) {
int value = buffer.readByte();
switch (type) {
case A:
value = value - 128;
break;
case C:
value = -value;
break;
case S:
value = 128 - value;
break;
default:
break;
}
return signed ? value : value & 0xff;
}
/**
* Reads a signed byte.
*
* @param type
* the value type
* @return the value
*/
public int readByte(ValueType type) {
return readByte(true, type);
}
/**
* Reads the amuont of bytes into the array, starting at the current
* location.
*
* @param amount
* the amount to read
* @return a buffer filled with the data
*/
public byte[] readBytes(int amount) {
return readBytes(amount, ValueType.STANDARD);
}
/**
* Reads the amount of bytes into a byte array, starting at the current
* location.
*
* @param amount
* the amount of bytes
* @param type
* the value type of each byte
* @return a buffer filled with the data
*/
public byte[] readBytes(int amount, ValueType type) {
byte[] data = new byte[amount];
for (int i = 0; i < amount; i++) {
data[i] = (byte) readByte(type);
}
return data;
}
/**
* Reads the amount of bytes from the buffer in reverse, starting at
* current location + amount and reading in reverse until the current
* location.
*
* @param amount
* the amount of bytes
* @param type
* the value type of each byte
* @return a buffer filled with the data
*/
public byte[] readBytesReverse(int amount, ValueType type) {
byte[] data = new byte[amount];
int dataLocation = 0;
for (int i = buffer.readerIndex() + amount - 1; i >= buffer.readerIndex(); i--) {
int value = buffer.getByte(i);
switch (type) {
case A:
value -= 128;
break;
case C:
value = -value;
break;
case S:
value = 128 - value;
break;
default:
break;
}
data[dataLocation++] = (byte) value;
}
return data;
}
/**
* Reads a signed standard big-endian integer.
*
* @return the value
*/
public int readInt() {
return (int) readInt(true, ValueType.STANDARD, ByteOrder.BIG);
}
/**
* Reads a standard big-endian integer.
*
* @param signed
* the signedness
* @return the value
*/
public long readInt(boolean signed) {
return readInt(signed, ValueType.STANDARD, ByteOrder.BIG);
}
/**
* Reads a standard integer.
*
* @param signed
* the signedness
* @param order
* the byte order
* @return the value
*/
public long readInt(boolean signed, ByteOrder order) {
return readInt(signed, ValueType.STANDARD, order);
}
/**
* Reads a big-endian integer.
*
* @param signed
* the signedness
* @param type
* the value type
* @return the value
*/
public long readInt(boolean signed, ValueType type) {
return readInt(signed, type, ByteOrder.BIG);
}
/**
* Reads an integer.
*
* @param signed
* the signedness
* @param type
* the value type
* @param order
* the byte order
* @return the value
*/
public long readInt(boolean signed, ValueType type, ByteOrder order) {
long value = 0;
switch (order) {
case BIG:
value |= readByte(false) << 24;
value |= readByte(false) << 16;
value |= readByte(false) << 8;
value |= readByte(false, type);
break;
case MIDDLE:
value |= readByte(false) << 8;
value |= readByte(false, type);
value |= readByte(false) << 24;
value |= readByte(false) << 16;
break;
case INVERSE_MIDDLE:
value |= readByte(false) << 16;
value |= readByte(false) << 24;
value |= readByte(false, type);
value |= readByte(false) << 8;
break;
case LITTLE:
value |= readByte(false, type);
value |= readByte(false) << 8;
value |= readByte(false) << 16;
value |= readByte(false) << 24;
break;
}
return signed ? value : value & 0xffffffffL;
}
/**
* Reads a signed standard integer.
*
* @param order
* the byte order
* @return the value
*/
public int readInt(ByteOrder order) {
return (int) readInt(true, ValueType.STANDARD, order);
}
/**
* Reads a signed big-endian integer.
*
* @param type
* the value type
* @return the value
*/
public int readInt(ValueType type) {
return (int) readInt(true, type, ByteOrder.BIG);
}
/**
* Reads a signed integer.
*
* @param type
* the value type
* @param order
* the byte order
* @return the value
*/
public int readInt(ValueType type, ByteOrder order) {
return (int) readInt(true, type, order);
}
/**
* Reads a signed standard big-endian long.
*
* @return the value
*/
public long readLong() {
return readLong(ValueType.STANDARD, ByteOrder.BIG);
}
/**
* Reads a signed standard long.
*
* @param order
* the byte order
* @return the value
*/
public long readLong(ByteOrder order) {
return readLong(ValueType.STANDARD, order);
}
/**
* Reads a signed big-endian long
*
* @param type
* the value type
* @return the value
*/
public long readLong(ValueType type) {
return readLong(type, ByteOrder.BIG);
}
/**
* Reads a signed long value.
*
* @param type
* the value type
* @param order
* the byte order
* @return the value
*/
public long readLong(ValueType type, ByteOrder order) {
long value = 0;
switch (order) {
case BIG:
value |= (long) readByte(false) << 56L;
value |= (long) readByte(false) << 48L;
value |= (long) readByte(false) << 40L;
value |= (long) readByte(false) << 32L;
value |= (long) readByte(false) << 24L;
value |= (long) readByte(false) << 16L;
value |= (long) readByte(false) << 8L;
value |= readByte(false, type);
break;
case MIDDLE:
throw new UnsupportedOperationException("middle-endian long is not implemented!");
case INVERSE_MIDDLE:
throw new UnsupportedOperationException("inverse-middle-endian long is not implemented!");
case LITTLE:
value |= readByte(false, type);
value |= (long) readByte(false) << 8L;
value |= (long) readByte(false) << 16L;
value |= (long) readByte(false) << 24L;
value |= (long) readByte(false) << 32L;
value |= (long) readByte(false) << 40L;
value |= (long) readByte(false) << 48L;
value |= (long) readByte(false) << 56L;
break;
}
return value;
}
/**
* Reads a standard signed big-endian short.
*
* @return the value
*/
public int readShort() {
return readShort(true, ValueType.STANDARD, ByteOrder.BIG);
}
/**
* Reads a standard big-endian short.
*
* @param signed
* the signedness
* @return the value
*/
public int readShort(boolean signed) {
return readShort(signed, ValueType.STANDARD, ByteOrder.BIG);
}
/**
* Reads a standard short.
*
* @param signed
* the signedness
* @param order
* the byte order
* @return the value
*/
public int readShort(boolean signed, ByteOrder order) {
return readShort(signed, ValueType.STANDARD, order);
}
/**
* Reads a big-endian short.
*
* @param signed
* the signedness
* @param type
* the value type
* @return the value
*/
public int readShort(boolean signed, ValueType type) {
return readShort(signed, type, ByteOrder.BIG);
}
/**
* Reads a short value.
*
* @param signed
* the signedness
* @param type
* the value type
* @param order
* the byte order
* @return the value
*/
public int readShort(boolean signed, ValueType type, ByteOrder order) {
int value = 0;
switch (order) {
case BIG:
value |= readByte(false) << 8;
value |= readByte(false, type);
break;
case MIDDLE:
throw new UnsupportedOperationException("Middle-endian short is impossible!");
case INVERSE_MIDDLE:
throw new UnsupportedOperationException("Inverse-middle-endian short is impossible!");
case LITTLE:
value |= readByte(false, type);
value |= readByte(false) << 8;
break;
}
return signed ? value : value & 0xffff;
}
/**
* Reads a signed standard short.
*
* @param order
* the byte order
* @return the value
*/
public int readShort(ByteOrder order) {
return readShort(true, ValueType.STANDARD, order);
}
/**
* Reads a signed big-endian short.
*
* @param type
* the value type
* @return the value
*/
public int readShort(ValueType type) {
return readShort(true, type, ByteOrder.BIG);
}
/**
* Reads a signed short.
*
* @param type
* the value type
* @param order
* the byte order
* @return the value
*/
public int readShort(ValueType type, ByteOrder order) {
return readShort(true, type, order);
}
/**
* Reads a RuneScape string value.
*
* @return the string
*/
public String readString() {
byte temp;
StringBuilder b = new StringBuilder();
while ((temp = (byte) readByte()) != 10) {
b.append((char) temp);
}
return b.toString();
}
public void reset() {
buffer.readerIndex(0);
}
@Override
void switchAccessType(AccessType type) {
if (type == AccessType.BIT_ACCESS) {
throw new UnsupportedOperationException("Reading bits is not implemented!");
}
}
}
/**
* A StreamBuffer used to write outgoing data.
*
* @author blakeman8192
*/
public static final class OutBuffer extends StreamBuffer {
/**
* The internal buffer.
*/
private ChannelBuffer buffer;
/**
* The location of the packet length in the packet header.
*/
private int lengthLocation = 0;
/**
* Creates a new OutBuffer.
*
* @param size
* the size
*/
private OutBuffer(int size) {
buffer = ChannelBuffers.buffer(size);
}
/**
* Finishes a variable packet header by writing the actual packet length
* at the length byte's location. Call this when the construction of the
* actual variable length packet is complete.
*/
public void finishVariablePacketHeader() {
buffer.setByte(lengthLocation, (byte) (buffer.writerIndex() - lengthLocation - 1));
}
/**
* Finishes a variable packet header by writing the actual packet length
* at the length short's location. Call this when the construction of
* the variable length packet is complete.
*/
public void finishVariableShortPacketHeader() {
buffer.setShort(lengthLocation, (short) (buffer.writerIndex() - lengthLocation - 2));
}
/**
* Gets the internal buffer.
*
* @return the buffer
*/
public ChannelBuffer getBuffer() {
return buffer;
}
} [/SPOIL]
ByteStreamExt stream = new ByteStreamExt(getBuffer("loc.idx"));
getBuffer() returns a null most likely which causes the ByteStreamExt to become null as well; it's probably due to the loc.idx file not being in the correct directory.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |