From 015fe4c937f8b8c89235c963e628c5827e6f7fde Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 22 Dec 2011 14:22:33 +0000 Subject: [PATCH] [367264] [dstore] Trace should be written when load miner is failed. --- .../dstore/core/java/RemoteClassLoader.java | 21 +++++++++++++------ .../internal/core/server/MinerLoader.java | 15 +++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java index c1cb9f04c1d..d741a467432 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 2011 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 @@ -14,6 +14,7 @@ * Contributors: * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed + * David McKnight (IBM) - [367264] [dstore] Trace should be written when load miner is failed. *******************************************************************************/ package org.eclipse.dstore.core.java; @@ -131,7 +132,11 @@ public class RemoteClassLoader extends ClassLoader public boolean useCaching() { boolean useCaching = false; - String pref = _dataStore.getPreference(CACHING_PREFERENCE); + + // hard coding this to false for now since remote loading can cause problems + // and isn't intentionally used by anyone + String pref = "false"; //$NON-NLS-1$ + //String pref = _dataStore.getPreference(CACHING_PREFERENCE); if (pref != null && pref.equals("true")) //$NON-NLS-1$ { useCaching = true; @@ -185,9 +190,8 @@ public class RemoteClassLoader extends ClassLoader theClass = ((ClassLoader)localLoaders.get(i)).loadClass(className); if (theClass != null) return theClass; } - catch (Exception e) - { - //e.printStackTrace(); + catch (Exception e){ + _dataStore.trace(e); } } } @@ -203,9 +207,14 @@ public class RemoteClassLoader extends ClassLoader } catch (Exception e) { - e.printStackTrace(); + if (!_useCaching){ + // no remote loading in this case + throw new ClassNotFoundException(className); + } } + + // DKM // only do lookup if the classname looks valid // don't want to be requesting rsecomm from client diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/MinerLoader.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/MinerLoader.java index 94ca939a3e7..eb5c3663dca 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/MinerLoader.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/MinerLoader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2011 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 @@ -13,6 +13,7 @@ * * Contributors: * David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed + * David McKnight (IBM) - [367264] [dstore] Trace should be written when load miner is failed. *******************************************************************************/ package org.eclipse.dstore.internal.core.server; @@ -213,25 +214,25 @@ public class MinerLoader implements ISchemaRegistry } catch (NoClassDefFoundError e) { - e.printStackTrace(); + _dataStore.trace(e); handleNoClassFound(e.getMessage().replace('/','.')); } catch (ClassNotFoundException e) { - e.printStackTrace(); + _dataStore.trace(e); handleNoClassFound(name); } catch (InstantiationException e) { - e.printStackTrace(); + _dataStore.trace(e); } catch (IllegalAccessException e) { - e.printStackTrace(); + _dataStore.trace(e); } catch (Exception e) { - e.printStackTrace(); + _dataStore.trace(e); } } else @@ -350,7 +351,6 @@ public class MinerLoader implements ISchemaRegistry //if (remoteLoader.canLoad(source)) if(true) { - //System.out.println("using RemoteClassLoader"); return remoteLoader; } @@ -359,7 +359,6 @@ public class MinerLoader implements ISchemaRegistry ExternalLoader loader = (ExternalLoader) _loaders.get(i); if (loader.canLoad(source)) { - // System.out.println("using local loader"); return loader; } else