I
I
Ivan ANTIKLAN2017-03-25 13:07:42
Java
Ivan ANTIKLAN, 2017-03-25 13:07:42

How to read error messages in Java?

Hello! I decided to raise one of the basic questions of Java programming. Namely how to read error messages. There is deathly silence on the Internet about this. Does everyone immediately understand what messages like the one below as an example mean? Can someone describe in detail using the example below what each line in this output means and how to find a place with an error in the code using these messages?

ERROR clientpackets.GameClientPacket: Client: IN_GAME IP: 127.0.0.1 Account: Admin Player : Player - Failed running: [C] EnterWorld - Server Version: Rev 1
java.lang.NullPointerException
  at l2p.gameserver.utils.ItemFunctions.addItem(ItemFunctions.java:108)
  at services.PvpToExp.onPlayerEnter(PvpToExp.java:99)
  at l2p.gameserver.model.actor.listener.PlayerListenerList.onEnter(PlayerListenerList.java:31)
  at l2p.gameserver.clientpackets.EnterWorld.runImpl(EnterWorld.java:178)
  at l2p.gameserver.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:41)
  at l2p.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:34)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Myvrenik, 2017-03-25
@gim0

Does everyone immediately understand what messages like the one below as an example mean?

I'm leaning towards yes. The format is quite logical. This is called a " stack trace ", it indicates which exception was thrown at run time and displays the call stack so you can understand where and in what context the exception occurred. In the stack trace you provided, the first line is just a comment about an error, it is specified by a programmer for programmers. Next comes the specific exception type ( java.lang.NullPointerException ). After it, it shows exactly where the error occurred in the code (class, method, and line number).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question