summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-12-20 20:45:11 +0000
committerBernard Normier <bernard@zeroc.com>2006-12-20 20:45:11 +0000
commit243e1a6c6aaeb256d2fc8c7191f4427f43afb8a8 (patch)
treebb62427edede8bdff99997f68007aa45f0f6c606 /java/src
parentFixed various Ice.OA issues; added iceVersion (diff)
downloadice-243e1a6c6aaeb256d2fc8c7191f4427f43afb8a8.tar.bz2
ice-243e1a6c6aaeb256d2fc8c7191f4427f43afb8a8.tar.xz
ice-243e1a6c6aaeb256d2fc8c7191f4427f43afb8a8.zip
Better handling of bogus files
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/IceGridGUI/Application/Root.java33
-rwxr-xr-xjava/src/IceGridGUI/Application/UpdateFailedException.java2
-rwxr-xr-xjava/src/IceGridGUI/Coordinator.java45
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/ServerEditor.java8
4 files changed, 65 insertions, 23 deletions
diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java
index db14f4da7df..2522e75b4cc 100755
--- a/java/src/IceGridGUI/Application/Root.java
+++ b/java/src/IceGridGUI/Application/Root.java
@@ -32,7 +32,7 @@ public class Root extends ListTreeNode
// Construct a normal, existing Application
//
public Root(Coordinator coordinator, ApplicationDescriptor desc,
- boolean live, File file)
+ boolean live, File file) throws UpdateFailedException
{
super(false, null, desc.name);
_coordinator = coordinator;
@@ -41,18 +41,8 @@ public class Root extends ListTreeNode
_file = file;
_live = live;
- try
- {
- init();
- }
- catch(UpdateFailedException e)
- {
- //
- // Impossible
- //
- System.err.println(e.toString());
- assert false;
- }
+
+ init();
}
//
@@ -720,7 +710,22 @@ public class Root extends ListTreeNode
assert false;
}
- Root newRoot = new Root(_coordinator, desc, _live, _file);
+ Root newRoot;
+
+ try
+ {
+ newRoot = new Root(_coordinator, desc, _live, _file);
+ }
+ catch(UpdateFailedException e)
+ {
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ e.toString(),
+ "Bad Application Descriptor: Unable reload Application",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
ApplicationPane app = _coordinator.getMainPane().findApplication(this);
assert app != null;
app.setRoot(newRoot);
diff --git a/java/src/IceGridGUI/Application/UpdateFailedException.java b/java/src/IceGridGUI/Application/UpdateFailedException.java
index 3f148185fcf..98dd24ecbb9 100755
--- a/java/src/IceGridGUI/Application/UpdateFailedException.java
+++ b/java/src/IceGridGUI/Application/UpdateFailedException.java
@@ -8,7 +8,7 @@
// **********************************************************************
package IceGridGUI.Application;
-class UpdateFailedException extends Exception
+public class UpdateFailedException extends Exception
{
UpdateFailedException(TreeNode parent, String id)
{
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index bc48d8389d7..25a87290c1f 100755
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -654,12 +654,28 @@ public class Coordinator
"The application '" + applicationName + "' was not found in the registry.",
"No such application",
JOptionPane.ERROR_MESSAGE);
+ return null;
}
//
// Essential: deep-copy desc!
//
desc = IceGridGUI.Application.Root.copyDescriptor(desc);
- app = new ApplicationPane(new IceGridGUI.Application.Root(this, desc, true, null));
+ IceGridGUI.Application.Root root;
+ try
+ {
+ root = new IceGridGUI.Application.Root(this, desc, true, null);
+ }
+ catch(IceGridGUI.Application.UpdateFailedException e)
+ {
+ JOptionPane.showMessageDialog(
+ _mainFrame,
+ e.toString(),
+ "Bad Application Descriptor: Unable load from Registry",
+ JOptionPane.ERROR_MESSAGE);
+ return null;
+ }
+
+ app = new ApplicationPane(root);
_mainPane.addApplication(app);
_liveApplications.put(applicationName, app);
}
@@ -1850,8 +1866,21 @@ public class Coordinator
if(desc != null)
{
- IceGridGUI.Application.Root root =
- new IceGridGUI.Application.Root(Coordinator.this, desc, false, file);
+ IceGridGUI.Application.Root root;
+ try
+ {
+ root = new IceGridGUI.Application.Root(Coordinator.this, desc, false, file);
+ }
+ catch(IceGridGUI.Application.UpdateFailedException ex)
+ {
+ JOptionPane.showMessageDialog(
+ _mainFrame,
+ ex.toString(),
+ "Bad Application Descriptor: Unable load from file",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
_mainPane.setSelectedComponent(app);
@@ -1887,10 +1916,14 @@ public class Coordinator
if(appName != null)
{
- IceGridGUI.Application.Root root = openLiveApplication(appName).getRoot();
- if(root.getSelectedNode() == null)
+ ApplicationPane app = openLiveApplication(appName);
+ if(app != null)
{
- root.setSelectedNode(root);
+ IceGridGUI.Application.Root root = app.getRoot();
+ if(root.getSelectedNode() == null)
+ {
+ root.setSelectedNode(root);
+ }
}
}
}
diff --git a/java/src/IceGridGUI/LiveDeployment/ServerEditor.java b/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
index 7dd3cee2c8b..bf87427cd80 100755
--- a/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
@@ -71,8 +71,12 @@ class ServerEditor extends CommunicatorEditor
{
public void actionPerformed(ActionEvent e)
{
- _coordinator.openLiveApplication(_application.getText()).getRoot().
- selectServer(((Node)_target.getParent()).getId(), _target.getId());
+ ApplicationPane app = _coordinator.openLiveApplication(_application.getText());
+ if(app != null)
+ {
+ app.getRoot().
+ selectServer(((Node)_target.getParent()).getId(), _target.getId());
+ }
}
};
gotoApplication.putValue(Action.SHORT_DESCRIPTION,