diff --git a/src/java/org/lwjgl/Display.java b/src/java/org/lwjgl/Display.java index 91d5e05f..cee29dd6 100644 --- a/src/java/org/lwjgl/Display.java +++ b/src/java/org/lwjgl/Display.java @@ -131,9 +131,9 @@ public final class Display { * still need to query the display's characteristics using getDisplayMode(). * * @param mode The new display mode to set - * @throws Exception if the display mode could not be set + * @throws LWJGLErrorException if the display mode could not be set */ - public static native void setDisplayMode(DisplayMode mode) throws Exception; + public static native void setDisplayMode(DisplayMode mode) throws LWJGLErrorException; /** * Reset the display mode to whatever it was when LWJGL was initialized. @@ -195,14 +195,14 @@ public final class Display { * @param brightness The brightness value between -1.0 and 1.0, inclusive * @param contrast The contrast, larger than 0.0. */ - public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws Exception { + public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLErrorException { if (brightness < -1.0f || brightness > 1.0f) throw new IllegalArgumentException("Invalid brightness value"); if (contrast < 0.0f) throw new IllegalArgumentException("Invalid contrast value"); int rampSize = getGammaRampLength(); if (rampSize == 0) { - throw new Exception("Display configuration not supported"); + throw new LWJGLErrorException("Display configuration not supported"); } FloatBuffer gammaRamp = ByteBuffer.allocateDirect(rampSize*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); for (int i = 0; i < rampSize; i++) { @@ -235,7 +235,7 @@ public final class Display { /** * Native method to set the gamma ramp. */ - private static native void setGammaRamp(FloatBuffer gammaRamp) throws Exception ; + private static native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLErrorException; /** * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", diff --git a/src/java/org/lwjgl/LWJGLErrorException.java b/src/java/org/lwjgl/LWJGLErrorException.java new file mode 100644 index 00000000..61de28a8 --- /dev/null +++ b/src/java/org/lwjgl/LWJGLErrorException.java @@ -0,0 +1,7 @@ +package org.lwjgl; + +public class LWJGLErrorException extends Exception { + public LWJGLErrorException(String msg) { + super(msg); + } +} diff --git a/src/java/org/lwjgl/SwingAdapter.java b/src/java/org/lwjgl/SwingAdapter.java index b44a95a9..7998a53e 100644 --- a/src/java/org/lwjgl/SwingAdapter.java +++ b/src/java/org/lwjgl/SwingAdapter.java @@ -52,7 +52,7 @@ final class SwingAdapter implements PlatformAdapter { */ SwingAdapter() { } - + /** * Spawn a "modal" dialog in the centre of the screen with a message in it * and an OK button. This method blocks until the dialog is dismissed. @@ -60,10 +60,10 @@ final class SwingAdapter implements PlatformAdapter { * @param message Message to show in alert */ public void alert(String title, String message) { - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch(Exception e) { - } - JOptionPane.showMessageDialog(null, message, title, JOptionPane.WARNING_MESSAGE); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch(Exception e) { + } + JOptionPane.showMessageDialog(null, message, title, JOptionPane.WARNING_MESSAGE); } } diff --git a/src/java/org/lwjgl/input/Controller.java b/src/java/org/lwjgl/input/Controller.java index 709c36c3..9743d9ee 100644 --- a/src/java/org/lwjgl/input/Controller.java +++ b/src/java/org/lwjgl/input/Controller.java @@ -37,6 +37,7 @@ import java.util.Map; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -163,9 +164,9 @@ public class Controller { /** * "Create" the controller. The display must first have been created. - * @throws Exception if the controller could not be created for any reason + * @throws LWJGLErrorException if the controller could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created before you can create Controller"); initialize(); @@ -267,7 +268,7 @@ public class Controller { /** * Native method to create the controller */ - private static native void nCreate() throws Exception; + private static native void nCreate() throws LWJGLErrorException; /** * Native method the destroy the controller @@ -278,122 +279,122 @@ public class Controller { * Register fields with the native library */ private static native void initIDs(); - /** - * @return Returns the buttonCount. - */ - public static int getButtonCount() { - return buttonCount; - } + /** + * @return Returns the buttonCount. + */ + public static int getButtonCount() { + return buttonCount; + } - /** - * @return Returns whether POV is supported - */ - public static boolean hasPOV() { - return hasPOV; - } + /** + * @return Returns whether POV is supported + */ + public static boolean hasPOV() { + return hasPOV; + } - /** - * @return Returns whether a rotational x axis is supported - */ - public static boolean hasRXAxis() { - return hasRXAxis; - } + /** + * @return Returns whether a rotational x axis is supported + */ + public static boolean hasRXAxis() { + return hasRXAxis; + } - /** - * @return Returns whether a rotational y axis is supported - */ - public static boolean hasRYAxis() { - return hasRYAxis; - } + /** + * @return Returns whether a rotational y axis is supported + */ + public static boolean hasRYAxis() { + return hasRYAxis; + } - /** - * @return Returns whether a rotational z axis is supported - */ - public static boolean hasRZAxis() { - return hasRZAxis; - } + /** + * @return Returns whether a rotational z axis is supported + */ + public static boolean hasRZAxis() { + return hasRZAxis; + } - /** - * @return Returns whether a slider is supported - */ - public static boolean hasSlider() { - return hasSlider; - } + /** + * @return Returns whether a slider is supported + */ + public static boolean hasSlider() { + return hasSlider; + } - /** - * @return Returns whether a x axis is supported - */ - public static boolean hasXAxis() { - return hasXAxis; - } + /** + * @return Returns whether a x axis is supported + */ + public static boolean hasXAxis() { + return hasXAxis; + } - /** - * @return Returns whether a y axis is supported - */ - public static boolean hasYAxis() { - return hasYAxis; - } + /** + * @return Returns whether a y axis is supported + */ + public static boolean hasYAxis() { + return hasYAxis; + } - /** - * @return Returns whether a z axis is supported - */ - public static boolean hasZAxis() { - return hasZAxis; - } + /** + * @return Returns whether a z axis is supported + */ + public static boolean hasZAxis() { + return hasZAxis; + } - /** - * @return Returns the POV value - */ - public static int getPov() { - return pov; - } + /** + * @return Returns the POV value + */ + public static int getPov() { + return pov; + } - /** - * @return Returns the rotational value of the x axis - */ - public static int getRx() { - return rx; - } + /** + * @return Returns the rotational value of the x axis + */ + public static int getRx() { + return rx; + } - /** - * @return Returns the rotational value of the y axis - */ - public static int getRy() { - return ry; - } + /** + * @return Returns the rotational value of the y axis + */ + public static int getRy() { + return ry; + } - /** - * @return Returns the rotational value of the z axis - */ - public static int getRz() { - return rz; - } + /** + * @return Returns the rotational value of the z axis + */ + public static int getRz() { + return rz; + } - /** - * @return Returns the slider value - */ - public static int getSlider() { - return slider; - } + /** + * @return Returns the slider value + */ + public static int getSlider() { + return slider; + } - /** - * @return Returns the x axis value - */ - public static int getX() { - return x; - } + /** + * @return Returns the x axis value + */ + public static int getX() { + return x; + } - /** - * @return Returns the y axis value - */ - public static int getY() { - return y; - } + /** + * @return Returns the y axis value + */ + public static int getY() { + return y; + } - /** - * @return Returns the z axis value - */ - public static int getZ() { - return z; - } + /** + * @return Returns the z axis value + */ + public static int getZ() { + return z; + } } diff --git a/src/java/org/lwjgl/input/Cursor.java b/src/java/org/lwjgl/input/Cursor.java index 5a4a5901..04176c5c 100644 --- a/src/java/org/lwjgl/input/Cursor.java +++ b/src/java/org/lwjgl/input/Cursor.java @@ -37,6 +37,7 @@ import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -68,9 +69,9 @@ public class Cursor { * @param numImages number of cursor images specified. Must be 1 if animations are not supported. * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL. * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null - * @throws Exception if the cursor could not be created for any reason + * @throws LWJGLErrorException if the cursor could not be created for any reason */ - public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception { + public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException { if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created before creating cursor objects"); if (width*height*numImages > images.remaining()) @@ -94,7 +95,7 @@ public class Cursor { /** * Creates the actual cursor, using a platform specific class */ - private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception { + private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException { // create copy and flip images to match ogl IntBuffer images_copy = ByteBuffer.allocateDirect(images.remaining()*4).order(ByteOrder.nativeOrder()).asIntBuffer(); flipImages(width, height, numImages, images, images_copy); diff --git a/src/java/org/lwjgl/input/Keyboard.java b/src/java/org/lwjgl/input/Keyboard.java index f789af8d..d39cfbe8 100644 --- a/src/java/org/lwjgl/input/Keyboard.java +++ b/src/java/org/lwjgl/input/Keyboard.java @@ -41,6 +41,7 @@ import java.util.Map; import org.lwjgl.BufferUtils; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -284,9 +285,9 @@ public class Keyboard { * "Create" the keyboard. The display must first have been created. The * reason for this is so the keyboard has a window to "focus" in. * - * @throws Exception if the keyboard could not be created for any reason + * @throws LWJGLErrorException if the keyboard could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created before you can create Keyboard"); if (!initialized) @@ -300,7 +301,7 @@ public class Keyboard { /** * Native method to create the keyboard */ - private static native void nCreate() throws Exception; + private static native void nCreate() throws LWJGLErrorException; /** * @return true if the keyboard has been created @@ -388,7 +389,7 @@ public class Keyboard { * Enable keyboard translation. Must be called after the keyboard is created, * and keyboard buffering must be enabled. */ - public static void enableTranslation() throws Exception { + public static void enableTranslation() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Keyboard must be created before you can read events"); if (readBuffer == null) @@ -400,12 +401,12 @@ public class Keyboard { /** * Native method to enable the translation buffer */ - private static native void nEnableTranslation() throws Exception; + private static native void nEnableTranslation() throws LWJGLErrorException; /** * Enable keyboard buffering. Must be called after the keyboard is created. */ - public static void enableBuffer() throws Exception { + public static void enableBuffer() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Keyboard must be created before you can enable buffering"); readBuffer = BufferUtils.createByteBuffer(4*BUFFER_SIZE); @@ -418,7 +419,7 @@ public class Keyboard { * @return the event buffer, * or null if no buffer can be allocated */ - private static native void nEnableBuffer() throws Exception; + private static native void nEnableBuffer() throws LWJGLErrorException; /** * Checks to see if a key is down. diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 480b7ae6..eaef97f5 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -39,6 +39,7 @@ import java.util.Map; import org.lwjgl.BufferUtils; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -164,9 +165,9 @@ public class Mouse { * * @param cursor the native cursor object to bind. May be null. * @return The previous Cursor object set, or null. - * @throws Exception if the cursor could not be set for any reason + * @throws LWJGLErrorException if the cursor could not be set for any reason */ - public static Cursor setNativeCursor(Cursor cursor) throws Exception { + public static Cursor setNativeCursor(Cursor cursor) throws LWJGLErrorException { if (!created) throw new IllegalStateException("Create the Mouse before setting the native cursor"); if ((getNativeCursorCaps() & CURSOR_ONE_BIT_TRANSPARENCY) == 0) @@ -183,7 +184,7 @@ public class Mouse { } /** Native method to set the native cursor */ - private static native void nSetNativeCursor(long handle) throws Exception; + private static native void nSetNativeCursor(long handle) throws LWJGLErrorException; /** * Gets the minimum size of a native cursor. Can only be called if @@ -238,9 +239,9 @@ public class Mouse { /** * "Create" the mouse. The display must first have been created. * - * @throws Exception if the mouse could not be created for any reason + * @throws LWJGLErrorException if the mouse could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created prior to creating mouse"); @@ -293,7 +294,7 @@ public class Mouse { if (currentCursor != null) { try { setNativeCursor(null); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) e.printStackTrace(); } @@ -401,7 +402,7 @@ public class Mouse { /** * Enable mouse button buffering. Must be called after the mouse is created. */ - public static void enableBuffer() throws Exception { + public static void enableBuffer() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering"); readBuffer = BufferUtils.createByteBuffer(2*BUFFER_SIZE); @@ -414,7 +415,7 @@ public class Mouse { * @return the event buffer, * or null if no buffer can be allocated */ - private static native void nEnableBuffer() throws Exception; + private static native void nEnableBuffer() throws LWJGLErrorException; /** * Reads all button events since last read. @@ -545,7 +546,7 @@ public class Mouse { currentCursor.nextCursor(); try { setNativeCursor(currentCursor); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) e.printStackTrace(); } diff --git a/src/java/org/lwjgl/openal/AL.java b/src/java/org/lwjgl/openal/AL.java index bd35b2d7..23127be8 100644 --- a/src/java/org/lwjgl/openal/AL.java +++ b/src/java/org/lwjgl/openal/AL.java @@ -37,6 +37,7 @@ import java.util.StringTokenizer; import org.lwjgl.Display; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -86,7 +87,7 @@ public abstract class AL { * @param oalPaths Array of strings containing paths to search for OpenAL library * @return true if the AL creation process succeeded */ - protected static native void nCreate(String[] oalPaths) throws OpenALException; + protected static native void nCreate(String[] oalPaths) throws LWJGLErrorException; /** * Native method the destroy the AL @@ -101,17 +102,17 @@ public abstract class AL { } /** - * Creates an OpenAL instance. Using this constructor will cause OpenAL to - * open the device using supplied device argument, and create a context using the context values - * supplied. - * - * @param deviceArguments Arguments supplied to native device - * @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100). - * @param contextRefresh Refresh intervalls, in units of Hz. - * @param contextSynchronized Flag, indicating a synchronous context.* + * Creates an OpenAL instance. Using this constructor will cause OpenAL to + * open the device using supplied device argument, and create a context using the context values + * supplied. + * + * @param deviceArguments Arguments supplied to native device + * @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100). + * @param contextRefresh Refresh intervalls, in units of Hz. + * @param contextSynchronized Flag, indicating a synchronous context.* */ public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) - throws OpenALException { + throws LWJGLErrorException { if (created) { return; @@ -130,7 +131,7 @@ public abstract class AL { * Creates an OpenAL instance. The empty create will cause OpenAL to * open the default device, and create a context using default values. */ - public static void create() throws OpenALException { + public static void create() throws LWJGLErrorException { if(created) { return; } @@ -151,7 +152,7 @@ public abstract class AL { jwsLibname = "openal"; break; default: - throw new OpenALException("Unknown platform"); + throw new LWJGLErrorException("Unknown platform"); } String jwsPath = getPathFromJWS(jwsLibname); diff --git a/src/java/org/lwjgl/openal/ALC.java b/src/java/org/lwjgl/openal/ALC.java index 4ef44d3a..1a62bcc3 100644 --- a/src/java/org/lwjgl/openal/ALC.java +++ b/src/java/org/lwjgl/openal/ALC.java @@ -35,6 +35,7 @@ import java.nio.Buffer; import java.nio.IntBuffer; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -158,9 +159,9 @@ public class ALC { /** * Creates the ALC instance * - * @throws Exception if a failiure occured in the ALC creation process + * @throws LWJGLErrorException if a failiure occured in the ALC creation process */ - protected static void create() throws OpenALException { + protected static void create() throws LWJGLErrorException { if (created) { return; } diff --git a/src/java/org/lwjgl/openal/eax/EAX.java b/src/java/org/lwjgl/openal/eax/EAX.java index fe17837a..4d4124c8 100644 --- a/src/java/org/lwjgl/openal/eax/EAX.java +++ b/src/java/org/lwjgl/openal/eax/EAX.java @@ -33,6 +33,7 @@ package org.lwjgl.openal.eax; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -53,15 +54,15 @@ public class EAX { /** * Loads the EAX functions * - * @throws Exception if the EAX extensions couldn't be loaded + * @throws LWJGLErrorException if the EAX extensions couldn't be loaded */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (created) { return; } if (!nCreate()) { - throw new Exception("EAX instance could not be created."); + throw new LWJGLErrorException("EAX instance could not be created."); } EAX20.init(); created = true; diff --git a/src/java/org/lwjgl/opengl/Pbuffer.java b/src/java/org/lwjgl/opengl/Pbuffer.java index 16896397..cbcb823a 100644 --- a/src/java/org/lwjgl/opengl/Pbuffer.java +++ b/src/java/org/lwjgl/opengl/Pbuffer.java @@ -33,6 +33,7 @@ package org.lwjgl.opengl; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; import java.nio.IntBuffer; @@ -159,7 +160,7 @@ public final class Pbuffer { } /** - * Construct an instance of a Pbuffer. If this fails then an Exception will be thrown. The buffer is single-buffered. + * Construct an instance of a Pbuffer. If this fails then an LWJGLErrorException will be thrown. The buffer is single-buffered. *

* NOTE: An OpenGL window must be created before a Pbuffer can be created. The Pbuffer will have its own context that shares * display lists and textures with the OpenGL window context, but it will have its own OpenGL state. Therefore, state changes @@ -182,7 +183,7 @@ public final class Pbuffer { * 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported. * @param renderTexture */ - public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil, int samples, RenderTexture renderTexture) throws Exception { + public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil, int samples, RenderTexture renderTexture) throws LWJGLErrorException { this.width = width; this.height = height; @@ -240,7 +241,7 @@ public final class Pbuffer { int bpp, int alpha, int depth, int stencil, int samples, IntBuffer pixelFormatCaps, int pixelFormatCapsSize, - IntBuffer pBufferAttribs, int pBufferAttribsSize) throws Exception; + IntBuffer pBufferAttribs, int pBufferAttribsSize) throws LWJGLErrorException; /** * Destroys the Pbuffer. After this call, there will be no valid GL rendering context - regardless of whether this Pbuffer was diff --git a/src/java/org/lwjgl/opengl/Window.java b/src/java/org/lwjgl/opengl/Window.java index eb20fa8b..06319421 100644 --- a/src/java/org/lwjgl/opengl/Window.java +++ b/src/java/org/lwjgl/opengl/Window.java @@ -52,6 +52,7 @@ import org.lwjgl.Sys; import org.lwjgl.input.Controller; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import org.lwjgl.LWJGLErrorException; public final class Window { @@ -286,33 +287,33 @@ public final class Window { * buffer, probably no alpha buffer, and probably no multisampling. *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * @param title - * @throws Exception + * @throws LWJGLErrorException */ - public static void create(String title) throws Exception { + public static void create(String title) throws LWJGLErrorException { create(title, Display.getDepth(), 0, 16, 8, 0); } /** * Create a fullscreen window. If the underlying OS does not * support fullscreen mode, then a window will be created instead. If this - * fails too then an Exception will be thrown. + * fails too then an LWJGLErrorException will be thrown. *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * @param title The title of the window * @param bpp Minimum bits per pixel * @param alpha Minimum bits per pixel in alpha buffer * @param depth Minimum bits per pixel in depth buffer * @param stencil Minimum bits per pixel in stencil buffer - * @throws Exception if the window could not be created for any reason; typically because + * @throws LWJGLErrorException if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ - public static void create(String title, int bpp, int alpha, int depth, int stencil) throws Exception { + public static void create(String title, int bpp, int alpha, int depth, int stencil) throws LWJGLErrorException { create(title, bpp, alpha, depth, stencil, 0); } /** * Create a fullscreen window. If the underlying OS does not * support fullscreen mode, then a window will be created instead. If this - * fails too then an Exception will be thrown. + * fails too then an LWJGLErrorException will be thrown. *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * @param title The title of the window * @param bpp Minimum bits per pixel @@ -321,10 +322,10 @@ public final class Window { * @param stencil Minimum bits per pixel in stencil buffer * @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec). Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported. - * @throws Exception if the window could not be created for any reason; typically because + * @throws LWJGLErrorException if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ - public static void create(String title, int bpp, int alpha, int depth, int stencil, int samples) throws Exception { + public static void create(String title, int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLErrorException { if (isCreated()) throw new IllegalStateException("Only one LWJGL window may be instantiated at any one time."); Window.fullscreen = true; @@ -338,7 +339,7 @@ public final class Window { /** * Create a window. If the underlying OS does not have "floating" windows, then a fullscreen - * display will be created instead. If this fails too then an Exception will be thrown. + * display will be created instead. If this fails too then an LWJGLErrorException will be thrown. * If the window is created fullscreen, then its size may not match the specified size * here. *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. @@ -352,16 +353,16 @@ public final class Window { * @param depth Minimum bits per pixel in depth buffer * @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec). Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported. - * @throws Exception if the window could not be created for any reason; typically because + * @throws LWJGLErrorException if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ - public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { + public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws LWJGLErrorException { create(title, x, y, width, height, bpp, alpha, depth, stencil, 0); } /** * Create a window. If the underlying OS does not have "floating" windows, then a fullscreen - * display will be created instead. If this fails too then an Exception will be thrown. + * display will be created instead. If this fails too then an LWJGLErrorException will be thrown. * If the window is created fullscreen, then its size may not match the specified size * here. *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. @@ -376,11 +377,11 @@ public final class Window { * @param stencil Minimum bits per pixel in stencil buffer * @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec). Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported. - * @throws Exception if the window could not be created for any reason; typically because + * @throws LWJGLErrorException if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil, int samples) - throws Exception { + throws LWJGLErrorException { if (isCreated()) throw new IllegalStateException("Only one LWJGL window may be instantiated at any one time."); Window.fullscreen = false; @@ -394,7 +395,7 @@ public final class Window { /** * Create the native window peer. - * @throws Exception + * @throws LWJGLErrorException */ private static native void nCreate( String title, @@ -408,9 +409,9 @@ public final class Window { int depth, int stencil, int samples) - throws Exception; + throws LWJGLErrorException; - private static void createWindow(int bpp, int alpha, int depth, int stencil, int samples) throws Exception { + private static void createWindow(int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLErrorException { nCreate(title, x, y, width, height, fullscreen, bpp, alpha, depth, stencil, samples); context = new Window(); makeCurrent(); @@ -430,7 +431,7 @@ public final class Window { Mouse.create(); createdMouse = true; Mouse.enableBuffer(); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) { e.printStackTrace(System.err); } else { @@ -444,7 +445,7 @@ public final class Window { createdKeyboard = true; Keyboard.enableBuffer(); Keyboard.enableTranslation(); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) { e.printStackTrace(System.err); } else { @@ -456,7 +457,7 @@ public final class Window { try { Controller.create(); createdController = true; - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) { e.printStackTrace(System.err); } else { diff --git a/src/native/common/common_tools.cpp b/src/native/common/common_tools.cpp index 8b77f6a6..b5ae974c 100644 --- a/src/native/common/common_tools.cpp +++ b/src/native/common/common_tools.cpp @@ -120,7 +120,7 @@ void throwOpenALException(JNIEnv * env, const char * err) { } void throwException(JNIEnv * env, const char * err) { - throwGeneralException(env, "java/lang/Exception", err); + throwGeneralException(env, "org/lwjgl/LWJGLErrorException", err); } void doExtension(JNIEnv *env, jobject ext_set, const char *method_name, const char *ext) { diff --git a/src/native/common/extal.cpp b/src/native/common/extal.cpp index 08a5ae7c..9246526c 100644 --- a/src/native/common/extal.cpp +++ b/src/native/common/extal.cpp @@ -197,7 +197,7 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { } env->ReleaseStringUTFChars(path, path_str); } - throwOpenALException(env, "Could not load openal library."); + throwException(env, "Could not load openal library."); return false; } @@ -235,27 +235,27 @@ void InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths) { alGetProcAddress = (alGetProcAddressPROC)extal_GetProcAddress("alGetProcAddress"); if (alGetProcAddress == NULL) { DeInitializeOpenAL(); - throwOpenALException(env, "Could not load alGetProcAddress function pointer."); + throwException(env, "Could not load alGetProcAddress function pointer."); return; } //load basic OpenAL functions if(!LoadAL(env)) { DeInitializeOpenAL(); - throwOpenALException(env, "Could not load OpenAL function pointers."); + throwException(env, "Could not load OpenAL function pointers."); return; } //load OpenAL context functions if(!LoadALC(env)) { DeInitializeOpenAL(); - throwOpenALException(env, "Could not load ALC function pointers."); + throwException(env, "Could not load ALC function pointers."); return; } //load OpenAL extensions if(!LoadALExtensions()) { DeInitializeOpenAL(); - throwOpenALException(env, "Could not load AL extension function pointers."); + throwException(env, "Could not load AL extension function pointers."); return; } }