svn commit: r17534 - trunk/src: argouml-app/src/org/argouml/ui argouml-core-model-mdr/src/org/argouml/model/mdr argouml-core-model/src/org/argouml/model

Luis Sergio Oliveira <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: euluis
Date: 2009-11-23 16:55:36-0800
New Revision: 17534

Added:
   trunk/src/argouml-core-model/src/org/argouml/model/XmiReferenceRuntimeException.java   (contents, props changed)
      - copied, changed from r17510, /trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java
Removed:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java
Modified:
   trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java

Log:
Issue 5862: Adding a runtime XMI reference exception to be thrown from model subsystem internals.

Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java?view=diff&pathrev=17534&r1=17533&r2=17534
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java	2009-11-23 16:55:36-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -81,6 +81,7 @@
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.model.XmiReferenceException;
+import org.argouml.model.XmiReferenceRuntimeException;
 import org.argouml.persistence.AbstractFilePersister;
 import org.argouml.persistence.OpenException;
 import org.argouml.persistence.PersistenceManager;
@@ -1667,6 +1668,13 @@
                                 "dialog.error.open.error",
                                 new Object[] {file.getName()}),
                         showUI, ex);
+            } catch (XmiReferenceRuntimeException ex) {
+                // an error that can be corrected by the user, so no stack
+                // trace, but instead an explanation and a hint how to fix
+                reportError(pmw,
+                    Translator.localize("dialog.error.xmi.reference.error",
+                        new Object[] {ex.getReference(), ex.getMessage()}),
+                    ex.toString(), showUI);
             } catch (RuntimeException ex) {
                 LOG.error("Exception while loading project", ex);
                 reportError(

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java?view=diff&pathrev=17534&r1=17533&r2=17534
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	2009-11-23 16:55:36-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -283,9 +283,9 @@
                 } else if (throwable instanceof SAXException) {
                     SAXException se = (SAXException) throwable;
                     Exception e1 = se.getException();
-                    if (e1 instanceof org.argouml.model.mdr.XmiReferenceException) {
+                    if (e1 instanceof org.argouml.model.XmiReferenceRuntimeException) {
                         String href = 
-                            ((org.argouml.model.mdr.XmiReferenceException) e1)
+                            ((org.argouml.model.XmiReferenceRuntimeException) e1)
                                 .getReference();
                         throw new org.argouml.model.XmiReferenceException(href,
                                 e);

Removed: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java?view=markup&pathrev=17533

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java?view=diff&pathrev=17534&r1=17533&r2=17534
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	2009-11-23 16:55:36-0800
@@ -41,6 +41,7 @@
 import javax.jmi.reflect.RefPackage;
 
 import org.apache.log4j.Logger;
+import org.argouml.model.XmiReferenceRuntimeException;
 import org.netbeans.api.xmi.XMIInputConfig;
 import org.netbeans.lib.jmi.util.DebugException;
 import org.netbeans.lib.jmi.xmi.XmiContext;
@@ -541,7 +542,7 @@
             // exception rather than nesting the exception itself, so
             // we don't have all the information we'd like
             LOG.error("Error reading external document " + arg0);
-            throw new XmiReferenceException(arg0, e);
+            throw new XmiReferenceRuntimeException(arg0, e);
         }
     }
 }

Copied: trunk/src/argouml-core-model/src/org/argouml/model/XmiReferenceRuntimeException.java (from r17510, /trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/XmiReferenceRuntimeException.java?view=diff&pathrev=17534&r1=17510&r2=17534
==============================================================================
--- /trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceException.java	(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/XmiReferenceRuntimeException.java	2009-11-23 16:55:36-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2006 The Regents of the University of California. All
+// Copyright (c) 2006-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -22,36 +22,36 @@
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
-package org.argouml.model.mdr;
+package org.argouml.model;
 
 
 /**
- * Exception for external reference problems with XMI files.  This is an
- * internal MDR exception which extends RuntimeException so that it can be
- * thrown from MDR internals.
+ * Exception for external reference problems with XMI files.  This is a
+ * {@link RuntimeException}, so that it can be thrown from specific model
+ * implementation internals.
  * 
  * @author Tom Morris
  */
-public class XmiReferenceException extends RuntimeException {
+public class XmiReferenceRuntimeException extends RuntimeException {
     
     private String reference;
     
     /**
-     * Construct an XmiReferenceException with the given message.
+     * Construct an XmiReferenceRuntimeException with the given message.
      * 
      * @param message the message
      */
-    public XmiReferenceException(String message) {
+    public XmiReferenceRuntimeException(String message) {
         super(message);
     }
 
     /**
-     * Construct an XmiReferenceException for the given reference
+     * Construct an XmiReferenceRuntimeException for the given reference
      * 
      * @param href the reference that caused the error
      * @param cause the nested exception if available
      */
-    public XmiReferenceException(String href, Throwable cause) {
+    public XmiReferenceRuntimeException(String href, Throwable cause) {
         super(href, cause);
         reference = href;
     }
@@ -68,9 +68,8 @@
      *
      * @param c the cause of the exception
      */
-    public XmiReferenceException(Throwable c) {
+    public XmiReferenceRuntimeException(Throwable c) {
         super(c);
     }
 
-
 }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2423639

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.