Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavid_williams2006-02-21 17:16:32 +0000
committerdavid_williams2006-02-21 17:16:32 +0000
commit3d3200f1f25d1aede2faad444b62b40c8fa2fed8 (patch)
tree7765e6eede032ce41c577a5ed31f234ed6138655 /plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java
parent189539c4c0cd24883637a6a60269a6754a976b03 (diff)
downloadwebtools.common-I20060224.tar.gz
webtools.common-I20060224.tar.xz
webtools.common-I20060224.zip
This commit was manufactured by cvs2svn to create tag 'I20060224'.I20060224
Diffstat (limited to 'plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java')
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java152
1 files changed, 0 insertions, 152 deletions
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java
deleted file mode 100644
index 9844b9b8f..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/ClientAccessRegistryException.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 2, 2003
- *
- */
-package org.eclipse.wst.common.internal.emfworkbench.edit;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.WeakHashMap;
-
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchEditResourceHandler;
-
-
-/**
- * The ClientAccessRegistryException accepts a WeakHashSet registry and a Set of all Snapshots that
- * should be contained in the registry. It will perform the necessary set difference in order to
- * determine which Snapshots exist in the baseSet but not in the registry.
- *
- * @author mdelder
- */
-public class ClientAccessRegistryException extends RuntimeException {
-
- public static final int UNKNOWN = 0;
- public static final int DANGLING_REFERENCE = 1;
- public static final int INVALID_ACCESS_KEY = 2;
- private WeakHashMap registry = null;
- private Set baseSet = null;
- private boolean processed = false;
- private int type = UNKNOWN;
-
- public ClientAccessRegistryException(WeakHashMap registry, Set baseSet) {
- this.registry = registry;
- this.baseSet = new HashSet();
- this.baseSet.addAll(baseSet);
- this.type = DANGLING_REFERENCE;
- }
-
- public ClientAccessRegistryException(String msg, Object key) {
- super(msg + " : " + key); //$NON-NLS-1$
- this.type = INVALID_ACCESS_KEY;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
- */
- public void printStackTrace(PrintStream s) {
-
- s.println(toString());
- super.printStackTrace(s);
-
- if (this.registry != null) {
- Snapshot snapshot = null;
- if (!processed) {
- Object key = null;
- Iterator keyIterator = this.registry.keySet().iterator();
- while (keyIterator.hasNext()) {
- key = keyIterator.next();
- snapshot = (Snapshot) this.registry.get(key);
- this.baseSet.remove(snapshot);
- }
- processed = true;
- }
- s.println(EMFWorkbenchEditResourceHandler.getString(EMFWorkbenchEditResourceHandler.ClientAccessRegistryException_UI_0, new Object[]{new Integer(baseSet.size()).toString()})); //$NON-NLS-1$
-
- for (Iterator possibleCulpritsItr = baseSet.iterator(); possibleCulpritsItr.hasNext();) {
- snapshot = (Snapshot) possibleCulpritsItr.next();
- snapshot.printStackTrace(s);
- }
-
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
- */
- public void printStackTrace(PrintWriter s) {
-
- s.println(toString());
- super.printStackTrace(s);
- if (this.registry != null) {
- Snapshot snapshot = null;
- if (!processed) {
- Object key = null;
- Iterator keyIterator = this.registry.keySet().iterator();
- while (keyIterator.hasNext()) {
- key = keyIterator.next();
- snapshot = (Snapshot) this.registry.get(key);
- this.baseSet.remove(snapshot);
- }
- processed = true;
- }
- s.println(EMFWorkbenchEditResourceHandler.getString("", new Object[]{new Integer(baseSet.size()).toString()})); //$NON-NLS-1$
-
- for (Iterator possibleCulpritsItr = baseSet.iterator(); possibleCulpritsItr.hasNext();) {
- snapshot = (Snapshot) possibleCulpritsItr.next();
- snapshot.printStackTrace(s);
- }
-
- }
- }
-
- public String getType() {
- switch (type) {
- case DANGLING_REFERENCE :
- return "DANGLING_REFERENCE"; //$NON-NLS-1$
- case INVALID_ACCESS_KEY :
- return "INVALID_ACCESS_KEY"; //$NON-NLS-1$
- default :
- return "UNKNOWN"; //$NON-NLS-1$
- }
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer(super.toString()).append("\r\n"); //$NON-NLS-1$
- result.append(EMFWorkbenchEditResourceHandler.getString(EMFWorkbenchEditResourceHandler.ClientAccessRegistryException_UI_1, new Object[]{getType()})); //$NON-NLS-1$
- // if (this.badReferenceLocation != null) {
- // result.append("The invalid access occurred somewhere in the following stack
- // trace.").append("\n");
- // result.append(this.badReferenceLocation.getStackTraceString());
- // }
- return result.toString();
- }
-
- public static void main(String[] args) {
- System.out.println(new ClientAccessRegistryException("test message", "-somekeyobj-").toString()); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("LINEBREAK"); //$NON-NLS-1$
- System.out.println(new ClientAccessRegistryException(new WeakHashMap(), new HashSet()).toString());
- System.out.println("LINEBREAK"); //$NON-NLS-1$
- new ClientAccessRegistryException("test message", "-somekeyobj-").printStackTrace(); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("LINEBREAK"); //$NON-NLS-1$
- new ClientAccessRegistryException(new WeakHashMap(), new HashSet()).printStackTrace();
-
- }
-
-}

Back to the top