Author: tfmorris
Date: 2008-05-22 13:54:34-0700
New Revision: 14786
Modified:
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java
Log:
Issue 4724 - Improve error reporting for XMI reader. Include file position in exception. Make XMI header available to consumers.
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=14786&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=14785&r2=14786
==============================================================================
--- 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-05-22 13:54:34-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2005-2007 The Regents of the University of California. All
+// Copyright (c) 2005-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
@@ -42,6 +42,7 @@
import org.apache.log4j.Logger;
import org.netbeans.api.xmi.XMIInputConfig;
+import org.netbeans.lib.jmi.util.DebugException;
import org.netbeans.lib.jmi.xmi.XmiContext;
import org.omg.uml.foundation.core.ModelElement;
@@ -124,6 +125,12 @@
private String modelPublicId;
/**
+ * The URL of the last document that we attempted to read. Used for
+ * error reporting if the read fails inside MDR.
+ */
+ private String lastExternalReference;
+
+ /**
* Constructor.
* @param systemId
* @see org.netbeans.lib.jmi.xmi.XmiContext#XmiContext(javax.jmi.reflect.RefPackage[], org.netbeans.api.xmi.XMIInputConfig)
@@ -522,4 +529,16 @@
}
return url;
}
+
+ @Override
+ public void readExternalDocument(String arg0) {
+ lastExternalReference = arg0;
+ try {
+ super.readExternalDocument(arg0);
+ } catch (DebugException e) {
+ 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.