From: Ton H. <a.j...@ch...> - 2005-03-14 21:23:53
|
Hi, I discovered a bug in JSLDesktop.getDefaultLocation. Maybe this bug has been reported in the past. I was trying out the Korg X3 single editor in MDI mode, and the following error occurred: ERR> 'Error in PatchEditor.' reported. ERR> [Exception] / by zero java.lang.ArithmeticException: / by zero at core.JSLDesktop.getDefaultLocation(Unknown Source) at core.JSLFrame.moveToDefaultLocation(Unknown Source) at core.Actions$EditAction$Worker.run(Unknown Source) I put some println's in the following code: Dimension screenSize = getSize(); System.out.println(screenSize.getWidth() + " " + frameSize.getWidth() + " " + xofs); int x = xofs + (xsep * frame_count) % (int) (screenSize.getWidth() - frameSize.getWidth() - xofs); if (x < 0) x = 0; System.out.println(screenSize.getHeight() + " " + frameSize.getHeight() + " " + yofs); int y = yofs + (ysep * frame_count) % (int) (screenSize.getHeight() - frameSize.getHeight() - yofs); if (y < 0) y = yofs + ysep; This was the result: setVisible : Korg X3 Single Editor JSynthLib finalizing... 816.0 567.0 0 488.0 488.0 0 The screen height and frame height are the same and yofs=0, so a division by zero occurs. Whenever you code a division you have to check if the denominator is zero. Regards, Ton Holsink |