svn commit: r16451 - trunk/src: argouml-app/src/org/argouml/profile argouml-core-model-mdr/src/org/argouml/model/mdr

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-28 16:02:49-0800
New Revision: 16451

Modified:
   trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java

Log:
RESOLVED - Issue 5574: Make exception handling more robust
http://argouml.tigris.org/issues/show_bug.cgi?id=5574

Modified: trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java?view=diff&pathrev=16451&r1=16450&r2=16451
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java	2008-12-28 16:02:49-0800
@@ -76,9 +76,9 @@
             elements = xmiReader.parse(inputSource, true);
             return elements;
         } catch (UmlException e) {
-            throw new ProfileException("Invalid XMI data!", e);
+            throw new ProfileException("Error loading profile XMI file ", e);
         } catch (IOException e) {
-            throw new ProfileException("Invalid zip file with XMI data!", e);
+            throw new ProfileException("I/O error loading profile XMI ", e);
         }
     }
 

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=16451&r1=16450&r2=16451
==============================================================================
--- 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	2008-12-28 16:02:49-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -236,7 +236,12 @@
                 repository.endTrans();
             } catch (Throwable e) {
                 // Roll back transaction to remove any partial results read
-                modelImpl.getRepository().endTrans(true);
+                try {
+                    modelImpl.getRepository().endTrans(true);
+                } catch (Throwable e2) {
+                    // Ignore any error.  The transaction may already have
+                    // been unwound as part of exception processing by MDR
+                }
                 if (e instanceof MalformedXMIException) {
                     throw (MalformedXMIException) e;
                 } else if (e instanceof IOException) {
@@ -291,7 +296,11 @@
             modelImpl.deleteExtent(extent);
             throw new XmiException(e);
         } catch (IOException e) {
-            modelImpl.deleteExtent(extent);
+            try {
+                modelImpl.deleteExtent(extent);
+            } catch (InvalidObjectException e2) {
+                // Ignore if the extent never got created or has been deleted
+            }
             throw new XmiException(e);
         }

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

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.