Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 33368 Details for
Bug 115704
The performance of loading MSL resources with errors could be significantly improved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for org.eclipse.gmf.runtime.emf.core
2006-01-20_org.eclipse.gmf.runtime.emf.core.txt (text/plain), 8.61 KB, created by
Christian Vogt
on 2006-01-20 13:32:24 EST
(
hide
)
Description:
patch for org.eclipse.gmf.runtime.emf.core
Filename:
MIME Type:
Creator:
Christian Vogt
Created:
2006-01-20 13:32:24 EST
Size:
8.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.emf.core >Index: src/org/eclipse/gmf/runtime/emf/core/internal/domain/MSLEditingDomain.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/domain/MSLEditingDomain.java,v >retrieving revision 1.9 >diff -u -r1.9 MSLEditingDomain.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/domain/MSLEditingDomain.java 29 Dec 2005 19:01:08 -0000 1.9 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/domain/MSLEditingDomain.java 20 Jan 2006 18:31:19 -0000 >@@ -1,5 +1,5 @@ > /****************************************************************************** >- * Copyright (c) 2004 IBM Corporation and others. >+ * Copyright (c) 2004-2006 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -84,6 +84,7 @@ > import org.eclipse.gmf.runtime.emf.core.internal.resources.MResource; > import org.eclipse.gmf.runtime.emf.core.internal.resources.MSLExtendedMetaData; > import org.eclipse.gmf.runtime.emf.core.internal.resources.MSLPathmap; >+import org.eclipse.gmf.runtime.emf.core.internal.resources.MSLResource; > import org.eclipse.gmf.runtime.emf.core.internal.util.MSLAdapterFactoryManager; > import org.eclipse.gmf.runtime.emf.core.internal.util.MSLComposedAdapterFactory; > import org.eclipse.gmf.runtime.emf.core.internal.util.MSLConstants; >@@ -647,6 +648,9 @@ > > loadOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, > extendedMetaData); >+ } else { >+ loadOptions.put(MSLResource.OPTION_ABORT_ON_ERROR, >+ Boolean.TRUE); > } > > if (null == inputStream) >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLLoad.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLLoad.java,v >retrieving revision 1.3 >diff -u -r1.3 MSLLoad.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLLoad.java 23 Dec 2005 20:19:04 -0000 1.3 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLLoad.java 20 Jan 2006 18:31:19 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.emf.ecore.xmi.XMLResource; > import org.eclipse.emf.ecore.xmi.impl.SAXWrapper; > import org.eclipse.emf.ecore.xmi.impl.XMILoadImpl; >+import org.eclipse.gmf.runtime.emf.core.internal.exceptions.AbortResourceLoadException; > import org.xml.sax.helpers.DefaultHandler; > > /** >@@ -51,9 +52,10 @@ > super.load(r, s, o); > > } catch (Resource.IOWrappedException e) { >- > if (!(e.getWrappedException() instanceof UnresolvedReferenceException)) > throw e; >+ } catch (AbortResourceLoadException arle) { >+ throw new Resource.IOWrappedException((Exception)arle.getCause()); > } > } > >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLResource.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLResource.java,v >retrieving revision 1.5 >diff -u -r1.5 MSLResource.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLResource.java 29 Dec 2005 19:01:08 -0000 1.5 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLResource.java 20 Jan 2006 18:31:19 -0000 >@@ -1,5 +1,5 @@ > /****************************************************************************** >- * Copyright (c) 2004 IBM Corporation and others. >+ * Copyright (c) 2004-2006 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -37,6 +37,12 @@ > extends XMIResourceImpl > implements org.eclipse.gmf.runtime.emf.core.resources.ILogicalResource { > >+ /** >+ * Use this option to abort loading a resource immediately when an error occurs. >+ * The default is <code>Boolean.FALSE</code> unless set to <code>Boolean.TRUE</code> explicitly. >+ */ >+ public static final String OPTION_ABORT_ON_ERROR = "ABORT_ON_ERROR"; //$NON-NLS-1$ >+ > private boolean useIDAttributes = false; > > /** >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLHandler.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLHandler.java,v >retrieving revision 1.3 >diff -u -r1.3 MSLHandler.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLHandler.java 23 Dec 2005 20:19:04 -0000 1.3 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/MSLHandler.java 20 Jan 2006 18:31:19 -0000 >@@ -23,10 +23,12 @@ > import org.eclipse.emf.ecore.InternalEObject; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.resource.impl.ResourceImpl; >+import org.eclipse.emf.ecore.xmi.XMIException; > import org.eclipse.emf.ecore.xmi.XMLHelper; > import org.eclipse.emf.ecore.xmi.XMLResource; > import org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler; > import org.eclipse.emf.ecore.xml.type.AnyType; >+import org.eclipse.gmf.runtime.emf.core.internal.exceptions.AbortResourceLoadException; > > /** > * The SAX handler for MSL resources. Updates demand-created packages with their >@@ -38,6 +40,8 @@ > extends SAXXMIHandler { > > protected final Map urisToProxies; >+ >+ protected boolean abortOnError; > > /** > * Constructs a new MSL handler for the specified resource with the >@@ -54,6 +58,9 @@ > super(xmiResource, helper, options); > > urisToProxies = new HashMap(); >+ if (Boolean.TRUE.equals(options.get(MSLResource.OPTION_ABORT_ON_ERROR))) { >+ abortOnError = true; >+ } > } > > /** >@@ -130,4 +137,18 @@ > return super.validateCreateObjectFromFactory(factory, typeName, > newObject, feature); > } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#error(org.eclipse.emf.ecore.xmi.XMIException) >+ */ >+ public void error(XMIException e) { >+ super.error(e); >+ if (abortOnError) { >+ if (e.getWrappedException() != null) { >+ throw new AbortResourceLoadException(e.getWrappedException()); >+ } >+ throw new AbortResourceLoadException(e); >+ } >+ } >+ > } >\ No newline at end of file >Index: src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java >diff -N src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/****************************************************************************** >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.internal.exceptions; >+ >+import org.eclipse.gmf.runtime.emf.core.exceptions.MSLRuntimeException; >+ >+/** >+ * This exception is intended to be thrown during Resource load when an >+ * error occurs. This RuntimeException wrapper is required in order to >+ * abort loading at any time. >+ * >+ * @author Christian Vogt (cvogt) >+ */ >+public class AbortResourceLoadException extends MSLRuntimeException { >+ >+ /** >+ * Initializes me without any details. >+ */ >+ public AbortResourceLoadException() { >+ super(); >+ } >+ >+ /** >+ * Initializes me with a useful message. >+ * >+ * @param message >+ * a message >+ */ >+ public AbortResourceLoadException(String message) { >+ super(message); >+ } >+ >+ /** >+ * Initializes me with a cause. >+ * >+ * @param cause >+ * the cause of this exception. >+ */ >+ public AbortResourceLoadException(Throwable cause) { >+ super(null == cause ? null >+ : cause.toString(), cause); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115704
:
33288
| 33368