Jump to content
  • 0

Help with code ..


Question

Posted

Hello all,

 

I've been just trying to implement one very simple voice command  on the server pack . 

 

I get no errors during compilation , but when  i run gameserver i get that error at the end.

 

I tried to trace it down but i cant find it..

 

I went on to net.sf.l2j.gameserver.handler.UserCommandHandle and line 45 but it shows no error . 

 

any help would be greatly appreciated.

 

This is the error

 

Exception in thread "main" java.lang.ExceptionInInitializerError
        at net.sf.l2j.gameserver.handler.UserCommandHandler.getInstance(UserCommandHandler.java:45)
        at net.sf.l2j.gameserver.GameServer.<init>(GameServer.java:277)
        at net.sf.l2j.gameserver.GameServer.main(GameServer.java:383)
Caused by: java.lang.NullPointerException
        at net.sf.l2j.gameserver.handler.UserCommandHandler.registerUserCommandHandler(UserCommandHandler.java:70)
        at net.sf.l2j.gameserver.handler.UserCommandHandler.<init>(UserCommandHandler.java:51)
        at net.sf.l2j.gameserver.handler.UserCommandHandler$SingletonHolder.<clinit>(UserCommandHandler.java:97)
        ... 3 more

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

UserCommandHandler.java line 70 ends with a NPE. If it's your new handler, verify if you initialized it correctly.

 

Short version : UserCommandHandler instance can't load properly, because an error (NPE) has been found on line 70 during the registration of an handler.

Edited by Tryskell
  • 0
Posted
On 4/12/2019 at 4:37 PM, SweeTs said:

 

NullPointerExceptions are exceptions that occur when you try to use a reference that points to no location in memory (null) as though it were referencing an object. Calling a method on a null reference or trying to access a field of a null reference will trigger a NullPointerException

 

For example,

 

String s = null;
int len = s.length();  // NullPointerException because s is null

So you should check if the variable is null before calling any method on it, for example:

int len;
if (s == null) {
    len = 0;
}
else {
    len = s.length();  // safe, s is never null when you get here
}

 

How to avoid NullPointerExceptions?

 

  • Use the final modifier to enforce good initialization.
  • Avoid returning null in methods, for example returning empty collections when applicable.
  • Use annotations @NotNull and @Nullable
  • Fail fast and use asserts to avoid propagation of null objects through the whole application when they shouldn't be null.
  • Use equals with a known object first: if("knownObject".equals(unknownObject)
  • Prefer valueOf() over toString().
  • Use null safe StringUtils methods StringUtils.isEmpty(null).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Posts

    • NEW SEASON START 23.01.2026 Get ready for the ultimate High Five adventure on L2Exoplanet.net!   • The last two previous Seasons are now merged into the Core Server. • The Core Server remains our main long-term world. • All future Seasonal Servers will be merged into Core after they end. • No characters or items will be lost – everything stays safe!     GRAND OPENING:  23.01.2026 at 20:00 GMT+1 BETA TEST:    16.01.2026    Client: High Five Rates: x10   Website: https://l2exoplanet.net Facebook: https://www.facebook.com/L2-Exoplanet-106811564103836 Discord: https://discord.gg/4fzhW7ZSPc         Game Rates    Experience: x10  Skill Points: x10  Adena: x5  Drop: x8  Spoil: x8  Quest: x5  Raid Boss Drop: x5  Fame: x2  Epaulette: x8  Manor: x8      Safe Enchant: +3  Maximum Enchant: +16  Normal Scroll Chance: 60%  Blessed Scroll Chance: 63%  Attribute Stone Chance: 50%  Attribute Crystal Chance: 30%      Game Settings    Multibox - 3 game clients per HWID  Autoloot  Autolearn Skills Auto Farm  NPC Buffer   Buff Slots (24+4/12)  Buff Duration (2h)  Olympiad Period 7days (new heroes appear every monday)  Seven Signs Period  Class Transfer for Adena  Max Sub-Class 3  Sub-Class Max Level 85  Essence Interface  Champions System  Vote Reward System  Dayli Reward System  PC Points Reward (500PC = 1 Donate Coin)      Epic Bosses Respawn Times     Queen Ant:  24 Hours +/- 4 Hours   Beleth: 3 Days +/- 8 Hours   Baium: 3 Days +/- 8 Hours   Antharas: 4 Days +/- 8 Hours   Valakas:  5 Days +/- 8 Hours     Instance Info     Normal Freya = 6 Players   Hard Freya = 12 Players   Frintezza = 6 Players   Zaken 83 Day = 6 Players   Zaken 60 Day = 6 Players   Zaken Nightly = 9 Players   Tiat = 6 Players   Beleth = 12 Players
    • when did i say something about mobius files besides what i've said on this post? or you're "calling me out" for saying this when someone says mobius is a better interlude alternative than acis? lol  
    • Spreading FUD disguised as "experience," mocking the project publicly, then acting shocked when called out. That's the conduct.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock