Author: thn
Date: 2008-08-05 22:35:54-0700
New Revision: 15515
Modified:
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 5278: failed to load project when a deactivated profile is not available
(fixed by better error message)
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&rev=15515&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java&r1=15514&r2=15515
==============================================================================
--- 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-08-05 22:35:54-0700
@@ -259,6 +259,11 @@
}
} catch (MalformedXMIException e) {
+ // If we failed reading an external referenced document (href)
+ if (resolver.getLastFailedExternalReference() != null) {
+ throw new XmiException("Error reading external document "
+ + resolver.getLastFailedExternalReference());
+ }
// If we can find a nested SAX exception, it will have information
// on the line number, etc.
ErrorManager.Annotation[] annotations =
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&rev=15515&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&r1=15514&r2=15515
==============================================================================
--- 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 2008-08-05 22:35:54-0700
@@ -50,7 +50,7 @@
* Custom resolver to use with XMI reader.
* <p>
*
- * This provides two functions:
+ * This provides three functions:
* <nl>
* <li>Records the mapping of <code>xmi.id</code>'s to MDR objects as they
* are resolved so that the map can be used to lookup objects by xmi.id later
@@ -64,12 +64,15 @@
* AndroMDA 3.1 implementation
* (org.andromda.repositories.mdr.MDRXmiReferenceResolverContext) by Ludo
* (rastaman).
+ * <li>Tracks latest failure in reading an external referenced document (href)
+ * so that later a javax.jmi.xmi.MalformedXMIException can be specifically
+ * handled in that case.
* </nl>
* <p>
* NOTE: This is not a standalone implementation of the reference resolver since
* it depends on extending the specific MDR implementation.
*
- * @author Tom Morris
+ * @author Tom Morris, Thomas Neustupny
*
*/
class XmiReferenceResolverImpl extends XmiContext {
@@ -125,10 +128,10 @@
private String modelPublicId;
/**
- * The URL of the last document that we attempted to read. Used for
- * error reporting if the read fails inside MDR.
+ * The URL of the last document that we failed to read. Used for error
+ * reporting if the read fails inside MDR.
*/
- private String lastExternalReference;
+ private String lastFailedExternalReference = null;
/**
* Constructor.
@@ -257,8 +260,17 @@
idToObjects.clear();
objectsToId.clear();
}
-
-
+
+ /**
+ * Gets the URL of the last document that we attempted to read. Used for
+ * error reporting if the read fails inside MDR.
+ *
+ * @return URL of the last document that we attempted to read
+ */
+ public String getLastFailedExternalReference() {
+ return lastFailedExternalReference;
+ }
+
/////////////////////////////////////////////////////
////////// Begin AndroMDA Code //////////////////////
/////////////////////////////////////////////////////
@@ -532,13 +544,13 @@
@Override
public void readExternalDocument(String arg0) {
- lastExternalReference = arg0;
+ lastFailedExternalReference = null;
try {
super.readExternalDocument(arg0);
} catch (DebugException e) {
+ lastFailedExternalReference = arg0;
LOG.error("Error reading external document " + arg0);
throw e;
}
}
-
}
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.