Java error spamming the console

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Java error spamming the console

Postby Xcom » Sun Dec 29, 2013 3:55 pm

I have this stupid bug that just wont go away. When I click and release the Alt key without clicking anything else I get this error:

Code: Select all
C:\Games\Ender>"C:\Program1\Java\jdk1.7.0_45\jre\bin\java.exe" -Xms5
12m -Xmx1024m -jar haven.jar moltke.seatribe.se
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at sun.awt.SunToolkit.getWindowDeactivationTime(SunToolkit.java:1876)
        at com.sun.java.swing.plaf.windows.WindowsRootPaneUI$AltProcessor.altRel
eased(WindowsRootPaneUI.java:139)
        at com.sun.java.swing.plaf.windows.WindowsRootPaneUI$AltProcessor.postPr
ocessKeyEvent(WindowsRootPaneUI.java:178)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboard
FocusManager.java:772)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeybo
ardFocusManager.java:1027)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeybo
ardFocusManager.java:899)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFoc
usManager.java:727)
        at java.awt.Component.dispatchEventImpl(Component.java:4731)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:694)
        at java.awt.EventQueue$3.run(EventQueue.java:692)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:708)
        at java.awt.EventQueue$4.run(EventQueue.java:706)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


I have looked left and right for a solution but I cant find one. I have even tried to look for the bug in the java source except sun.awt.SunToolkit doesn't even exist in the JDK source. I am completely out of options as I have exhausted every possible way to fix this stupid bug.

I have tried updating the JDK, JRE, ant, tried different clients including the default one and I get the same stupid error to show up in the console. I suspect its got something to do with the sun files except I have no idea where they are or how I can update them.

I am also not alone in getting this error as I know 2 other friends who have the same problem and I have seen other people post bug reports on the web with this same exact error. If anyone knows of any fix or solution it would be a great help in getting rid of this stupid spam bug.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Java error spamming the console

Postby borka » Sun Dec 29, 2013 8:01 pm

Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
User avatar
borka
 
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Re: Java error spamming the console

Postby Xcom » Sun Dec 29, 2013 8:47 pm

Thanks for the tip. Will try JDK 1.8 and see if it works out.

But that source is just a load of bull. Its impossible for the source to show a nullpointer check while I'm getting a null pointer. Oddly src file inside the JDK folder doesn't even have the sun files included so I don't get how that is even possible so I can compare.

What I'm refering to is this

Code: Select all
    public synchronized long getWindowDeactivationTime(Window w) {
        AppContext ctx = getAppContext(w);
        WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
        if (map == null) {
            return -1;
        }
        Long time = map.get(w);
        return time == null ? -1 : time;
    }
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Java error spamming the console

Postby Xcom » Sun Dec 29, 2013 9:15 pm

I updated to JDK and JRE 1.8.

At first I was ecstatic as the bug was gone. But now its much worse as the Alt key somehow disables the next key event. I get an error sound and the next key I type causes an error sound instead of preforming that key event. Including that the cursor turns into a default windows key when I press it. I wish there was a way around this retarded bug.

Edit: I get the same exact problem when I hit F10. But oddly the F10 bug have been around long before I updated to 1.8 and now I suspect they both are rooted in the same shitty java bug.
Last edited by Xcom on Mon Dec 30, 2013 5:13 am, edited 1 time in total.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Java error spamming the console

Postby loftar » Mon Dec 30, 2013 5:09 am

Xcom wrote:But now its much worse as the Alt key somehow disables the next key event. I get an error sound and the next key I type causes an error sound instead of preforming that key event. Including that the cursor turns into a default windows key when I press it. I wish there was a way around this retarded bug.

Unless I'm mistaken, that's not so much a bug as a consequence of running on Windows, since Alt activates the window's menu (and in the lack of any explicit such, the window menu that is mouse-opened by clicking the top-left icon).
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8927
Joined: Fri Apr 03, 2009 7:05 am

Re: Java error spamming the console

Postby Xcom » Mon Dec 30, 2013 5:18 am

That is a good tip. It might be that F10 somehow preforms a window action as well. Thank you!

Will try find a solution except others have reported the same bug without giving any helpful indications on how to fix it.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Java error spamming the console

Postby Xcom » Mon Dec 30, 2013 6:19 am

After looking for info regarding default windows key actions I found alot of other applications and programs having the same problem on windows.

I also found this link describing what I think might be related. Its unfortunately way above my head and I am having problems finding any solutions.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646287%28v=vs.85%29.aspx

some people have suggested to use AutoHotKey to fix the problem by disabling the Alt button on KeyUp but it has side affects as its altering the global behavior throughout windows. If I manage to find something I will post. But as of now it seams to be a problem that cant be fixed at all through regular user friendly means.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Java error spamming the console

Postby Xcom » Mon Dec 30, 2013 8:13 am

With help of romovs (thank for the help romovs) and this link:
http://stackoverflow.com/a/3994002/217039
I found a solution to the problem.

Added this code in the HavenPanel.java in the init() function at the end of it on line 195:

Code: Select all
   this.addFocusListener(new FocusListener() {
   private final KeyEventDispatcher altDisabler = new KeyEventDispatcher() {
      @Override
      public boolean dispatchKeyEvent(KeyEvent e) {
         if(e.getKeyCode() == 18){
            return true;
         }else if((e.getID() == KeyEvent.KEY_RELEASED) && e.getKeyCode() == 121){
            return true;
         }
         return false;
      }
   };
   
   @Override
   public void focusGained(FocusEvent e) {
      KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(altDisabler);
   }
   
   @Override
   public void focusLost(FocusEvent e) {
      KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(altDisabler);
   }
   });


Both F10 and Alt release bugs are now gone.

Going to update the Edited haven client with this fix in case others will bump into the same problem after they update to java 1.8 in a few weeks.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm


Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 1 guest