From 745e025e0e2843aa2cbae8eb6d1f10e1965bed37 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Mon, 12 Dec 2005 18:54:25 +0000 Subject: Fixed Issue 207 : Viewer.java throws exception with leading \n git-svn-id: https://svn.java.net/svn/j3d-core-utils~svn/trunk@91 9497e636-51bd-65ba-982d-a4982e1767a5 --- .../sun/j3d/utils/universe/ConfigContainer.java | 8 +++--- .../com/sun/j3d/utils/universe/ConfigObject.java | 4 +-- .../sun/j3d/utils/universe/ConfigSexpression.java | 2 +- .../sun/j3d/utils/universe/ConfiguredUniverse.java | 8 +++--- .../share/com/sun/j3d/utils/universe/ViewInfo.java | 4 +-- .../share/com/sun/j3d/utils/universe/Viewer.java | 33 +++++++++++----------- 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/classes/share/com/sun/j3d/utils/universe/ConfigContainer.java b/src/classes/share/com/sun/j3d/utils/universe/ConfigContainer.java index 44adc59..96006af 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ConfigContainer.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ConfigContainer.java @@ -264,8 +264,8 @@ public class ConfigContainer { streamTokenizer = new StreamTokenizer(r) ; } catch (IOException e) { - throw new IllegalArgumentException - ("\n" + e + "\nUnable to open " + currentFileName) ; + throw new IllegalArgumentException( + e + "\nUnable to open " + currentFileName) ; } // @@ -302,8 +302,8 @@ public class ConfigContainer { inputStream.close() ; } catch (IOException e) { - throw new IllegalArgumentException - ("\n" + e + "\nUnable to close " + currentFileName) ; + throw new IllegalArgumentException( + e + "\nUnable to close " + currentFileName) ; } // Restore current file name. diff --git a/src/classes/share/com/sun/j3d/utils/universe/ConfigObject.java b/src/classes/share/com/sun/j3d/utils/universe/ConfigObject.java index 8e26300..cc009cf 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ConfigObject.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ConfigObject.java @@ -369,8 +369,8 @@ class ConfigObject { */ static String errorMessage(ConfigCommand cmd, String s) { return - "\n" + s + "\nat line " + cmd.lineNumber + - " in " + cmd.fileName + "\n" + cmd + "\n" ; + s + "\nat line " + cmd.lineNumber + + " in " + cmd.fileName + "\n" + cmd; } /** diff --git a/src/classes/share/com/sun/j3d/utils/universe/ConfigSexpression.java b/src/classes/share/com/sun/j3d/utils/universe/ConfigSexpression.java index bf63ef2..fdaa53c 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ConfigSexpression.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ConfigSexpression.java @@ -67,7 +67,7 @@ class ConfigSexpression { tok = st.nextToken() ; } catch (IOException e) { - throw new RuntimeException("\n" + e + "\nwhile reading " + file) ; + throw new RuntimeException(e + "\nwhile reading " + file) ; } return tok ; } diff --git a/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java b/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java index 15b1ac9..9b27175 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ConfiguredUniverse.java @@ -470,8 +470,8 @@ public class ConfiguredUniverse extends SimpleUniverse { Collection c = configContainer.getViewers(); if (c == null || c.size() == 0) - throw new IllegalArgumentException - ("\nno views defined in configuration file\n"); + throw new IllegalArgumentException( + "no views defined in configuration file"); viewer = (Viewer[])c.toArray(new Viewer[1]); @@ -536,8 +536,8 @@ public class ConfiguredUniverse extends SimpleUniverse { Collection c = configContainer.getViewers(); if (c == null || c.size() == 0) - throw new IllegalArgumentException - ("\nno views defined in configuration file\n"); + throw new IllegalArgumentException( + "no views defined in configuration file"); viewer = (Viewer[])c.toArray(new Viewer[1]); diff --git a/src/classes/share/com/sun/j3d/utils/universe/ViewInfo.java b/src/classes/share/com/sun/j3d/utils/universe/ViewInfo.java index bd5113c..7b0f48e 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/ViewInfo.java +++ b/src/classes/share/com/sun/j3d/utils/universe/ViewInfo.java @@ -2171,8 +2171,8 @@ public class ViewInfo { // Now get the CanvasInfo to update. CanvasInfo ci = (CanvasInfo)canvasMap.get(c3d) ; if (ci == null) - throw new IllegalArgumentException - ("\nSpecified Canvas3D is not a component of the View") ; + throw new IllegalArgumentException( + "Specified Canvas3D is not a component of the View") ; // Check rest of autoUpdateFlags. if (autoUpdate) getAutoUpdate(ci) ; diff --git a/src/classes/share/com/sun/j3d/utils/universe/Viewer.java b/src/classes/share/com/sun/j3d/utils/universe/Viewer.java index bd6101e..7bb2dac 100644 --- a/src/classes/share/com/sun/j3d/utils/universe/Viewer.java +++ b/src/classes/share/com/sun/j3d/utils/universe/Viewer.java @@ -499,8 +499,8 @@ public class Viewer { devices = graphicsEnv.getScreenDevices(); if (devices == null) - throw new RuntimeException - ("\nNo screen devices available in local environment"); + throw new RuntimeException( + "No screen devices available in local environment"); if (debug) { System.out.println @@ -534,22 +534,21 @@ public class Viewer { // the configured attributes for the Canvas3D and Screen3D associated // with each screen. for (int i = 0; i < cs.length; i++) { - if (cs[i].frameBufferNumber >= devices.length) - throw new ArrayIndexOutOfBoundsException - (cs[i].errorMessage - (cs[i].creatingCommand, - "Screen " + cs[i].frameBufferNumber + " is invalid; " + - (devices.length-1) + " is the maximum local index.")); + if (cs[i].frameBufferNumber >= devices.length) + throw new ArrayIndexOutOfBoundsException( + cs[i].errorMessage(cs[i].creatingCommand, + "Screen " + cs[i].frameBufferNumber + " is invalid; " + + (devices.length-1) + " is the maximum local index.")); Rectangle bounds; Container contentPane; GraphicsConfiguration cfg = devices[cs[i].frameBufferNumber].getBestConfiguration(tpl3D); - + if (cfg == null) - throw new RuntimeException - ("\nNo GraphicsConfiguration on screen " + - cs[i].frameBufferNumber + " conforms to template"); + throw new RuntimeException( + "No GraphicsConfiguration on screen " + + cs[i].frameBufferNumber + " conforms to template"); bounds = cfg.getBounds(); cs[i].j3dJFrame = j3dJFrames[i] = @@ -849,8 +848,8 @@ public class Viewer { * Viewer class. */ public Frame getFrame() { - throw new UnsupportedOperationException - ("\nAWT Frame components are not created by the Viewer class"); + throw new UnsupportedOperationException( + "AWT Frame components are not created by the Viewer class"); } /** @@ -911,8 +910,8 @@ public class Viewer { * Viewer class. */ public Panel getPanel() { - throw new UnsupportedOperationException - ("\nAWT Panel components are not created by the Viewer class"); + throw new UnsupportedOperationException( + "AWT Panel components are not created by the Viewer class"); } /** @@ -1040,7 +1039,7 @@ public class Viewer { win.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent winEvent) { Window w = winEvent.getWindow(); - w.hide(); + w.setVisible(false); try { w.dispose(); } catch (IllegalStateException e) {} -- cgit v1.2.3