1.1 --- a/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Fri Sep 06 12:21:51 2002 +0000
1.2 +++ b/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Fri Sep 06 17:01:01 2002 +0000
1.3 @@ -30,6 +30,7 @@
1.4 import org.netbeans.mdr.handlers.*;
1.5 import org.netbeans.mdr.handlers.gen.TagSupport;
1.6 import org.netbeans.mdr.util.*;
1.7 +import org.netbeans.mdr.util.Logger;
1.8
1.9 /** This is an implementation of MOF based repository.
1.10 *
1.11 @@ -94,7 +95,7 @@
1.12 * </table>
1.13 */
1.14 public NBMDRepositoryImpl() {
1.15 - System.out.println("using default values...");
1.16 + Logger.getDefault().log("using default values...");
1.17
1.18 String storageClass = System.getProperty("org.netbeans.mdr.storagemodel.StorageFactoryClassName", "org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeFactory");
1.19 String storageFile = System.getProperty("org.netbeans.mdr.persistence.Dir");
1.20 @@ -115,7 +116,7 @@
1.21 * </ol></p>
1.22 */
1.23 public NBMDRepositoryImpl(Map parameters) {
1.24 - Log.out.println("Creating MDRepository implementation ...");
1.25 + Logger.getDefault().log("Creating MDRepository implementation ...");
1.26 this.parameters = parameters;
1.27 // instances.add(this);
1.28 }
1.29 @@ -253,8 +254,7 @@
1.30 result = (String[]) mdrStorage.getContexts().toArray(result);
1.31 return result;
1.32 } catch (StorageException e) {
1.33 - e.printStackTrace();
1.34 - throw new DebugException();
1.35 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.36 } finally {
1.37 endTrans();
1.38 }
1.39 @@ -270,8 +270,7 @@
1.40 StorableBaseObject storable = mdrStorage.getObject(mdrStorage.resolveMOFID(mofId));
1.41 return BaseObjectHandler.getHandler(storable);
1.42 } catch (StorageException e) {
1.43 - e.printStackTrace();
1.44 - throw new DebugException();
1.45 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.46 } finally {
1.47 endTrans();
1.48 }
1.49 @@ -286,8 +285,7 @@
1.50 mdrStorage.shutDown();
1.51 mdrStorage = null;
1.52 } catch (StorageException e) {
1.53 - e.printStackTrace();
1.54 - throw new DebugException();
1.55 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.56 }
1.57 }
1.58 }
1.59 @@ -349,8 +347,7 @@
1.60 try {
1.61 instantiatePackage(substName, null, (MofPackage) metaPackage, instancesToCluster, storageId, false);
1.62 } catch (RuntimeException e) {
1.63 - e.printStackTrace();
1.64 - throw new CreationFailedException("Cannot instantiate package because of unexpected exception: " + e);
1.65 + throw (CreationFailedException) Logger.getDefault().annotate(new CreationFailedException("Cannot instantiate package because of unexpected exception: " + e), e);
1.66 }
1.67
1.68 classProxies = null;
1.69 @@ -471,17 +468,16 @@
1.70
1.71 mdrStorage = new MdrStorage(this, storageClass, this.parameters);
1.72 try {
1.73 - System.out.println("initializing...");
1.74 + Logger.getDefault().log("initializing...");
1.75 // initialize storage
1.76 if (!mdrStorage.init()) {
1.77 - System.out.println("booting...");
1.78 + Logger.getDefault().log("booting...");
1.79 // bootstrapping the repository
1.80 boot();
1.81 }
1.82 return;
1.83 } catch (StorageException e) {
1.84 - e.printStackTrace();
1.85 - throw new DebugException("Fatal error: Repository boot/initialization failed with message: " + e.getMessage());
1.86 + throw (DebugException) Logger.getDefault().annotate(new DebugException("Fatal error: Repository boot/initialization failed with message: " + e.getMessage()), e);
1.87 }
1.88 }
1.89 }
1.90 @@ -524,9 +520,7 @@
1.91 private RefPackage instantiatePackage(String substName, StorablePackage immediatePackage, MofPackage metaPackage, Map clusteredInstances, String storageId, boolean clustered) {
1.92 // Create package proxy
1.93 StorablePackage newPackage = createPackageHandler(metaPackage, immediatePackage, substName, storageId, clustered);
1.94 - System.out.println("new package: " + newPackage.getMofId() + ", metapackage: " + metaPackage.refMofId());
1.95 -
1.96 - Log.out.indent();
1.97 + Logger.getDefault().log("new package: " + newPackage.getMofId() + ", metapackage: " + metaPackage.refMofId());
1.98
1.99 Set localAssocProxies = new HashSet();
1.100 Map localClassProxies = new HashMap();
1.101 @@ -538,8 +532,7 @@
1.102 try {
1.103 mdrStorage.buildSAIndexes(localAssocProxies, classProxiesMofIds);
1.104 } catch (StorageException e) {
1.105 - e.printStackTrace();
1.106 - throw new DebugException();
1.107 + throw Logger.getDefault().annotate(new DebugException(), e);
1.108 }
1.109 */
1.110 return (RefPackage) BaseObjectHandler.getHandler(newPackage);
1.111 @@ -611,7 +604,7 @@
1.112 me = (ModelElement) contents.next();
1.113 if (me instanceof Reference) {
1.114 end = ((Reference) me).getExposedEnd();
1.115 - //System.out.println("registering reference: " + me.getName() + " for end: " + end.getName());
1.116 + //Logger.getDefault().log("registering reference: " + me.getName() + " for end: " + end.getName());
1.117 sc.addReferenceDescriptor(((BaseObjectHandler)me)._getDelegate().getMofId(), me.getName(), (MOFID) associationProxies.get(((BaseObjectHandler)end.getContainer())._getDelegate().getMofId()), end.getName());
1.118 }
1.119 } // for
1.120 @@ -693,8 +686,7 @@
1.121 typeA = BaseObjectHandler.resolveInterface(TagSupport.getDataTypeName((StorableObject)((InstanceHandler)ends[0].getType())._getDelegate()));
1.122 typeB = BaseObjectHandler.resolveInterface(TagSupport.getDataTypeName((StorableObject)((InstanceHandler)ends[1].getType())._getDelegate()));
1.123 } catch (java.lang.Exception e) {
1.124 - e.printStackTrace();
1.125 - throw new DebugException();
1.126 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.127 }
1.128 orderA = (ends[0].getMultiplicity().isOrdered());
1.129 orderB = (ends[1].getMultiplicity().isOrdered());
1.130 @@ -715,8 +707,8 @@
1.131 }
1.132
1.133 } else if (element instanceof MofPackage) {
1.134 - // System.out.println("found inner package");
1.135 - // System.out.println("creating: META: " + element.refMofId() + ", IMMEDIATE: " + newPackage.refMofId() + ", CONTEXT: " + context);
1.136 + // Logger.getDefault().log("found inner package");
1.137 + // Logger.getDefault().log("creating: META: " + element.refMofId() + ", IMMEDIATE: " + newPackage.refMofId() + ", CONTEXT: " + context);
1.138 String storageId = MdrStorage.getStorageIdFromMofId(newPackage.getMofId());
1.139 StorablePackage pkg = createPackageHandler((MofPackage) element, newPackage, null, storageId, false);
1.140 instantiatePackageContent((MofPackage) element, pkg, clusteredInstances, localClassProxies, localAssocProxies);
1.141 @@ -738,8 +730,7 @@
1.142 try {
1.143 newPackage.clusterPackage(imp.getName(), ((BaseObjectHandler)pkg)._getDelegate().getMofId());
1.144 } catch (StorageException e) {
1.145 - e.printStackTrace();
1.146 - throw new DebugException("Storage exception: " + e);
1.147 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.148 }
1.149 } // if
1.150 } // if
1.151 @@ -806,8 +797,7 @@
1.152 try {
1.153 memberTypes.add(BaseObjectHandler.resolveInterface(TagSupport.getDataTypeName((StorableObject) ((BaseObjectHandler) ((StructureField) me).getType())._getDelegate())));
1.154 } catch (ClassNotFoundException e) {
1.155 - e.printStackTrace();
1.156 - throw new DebugException();
1.157 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.158 }
1.159 }
1.160 }
1.161 @@ -856,8 +846,7 @@
1.162 try {
1.163 type = BaseObjectHandler.resolveInterface(TagSupport.getDataTypeName((StorableObject)((InstanceHandler)attr.getType())._getDelegate()));
1.164 } catch (java.lang.Exception e) {
1.165 - e.printStackTrace();
1.166 - throw new DebugException();
1.167 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.168 }
1.169 StorableClass.AttributeDescriptor desc = new StorableClass.AttributeDescriptor(mdrStorage, ((BaseObjectHandler)attr)._getDelegate().getMofId(), attr.getName(), type, attr.getMultiplicity().getLower(), attr.getMultiplicity().getUpper(), attr.getMultiplicity().isUnique(), attr.getMultiplicity().isOrdered(), attr.isChangeable(), MdrStorage.getStorageIdFromMofId(immediatePackage.getMofId()));
1.170 if (ScopeKindEnum.INSTANCE_LEVEL.equals(attr.getScope())) {
1.171 @@ -885,8 +874,7 @@
1.172 try {
1.173 memberTypes.add(BaseObjectHandler.resolveInterface(TagSupport.getDataTypeName((StorableObject) ((BaseObjectHandler) ((StructureField) me).getType())._getDelegate())));
1.174 } catch (ClassNotFoundException e) {
1.175 - e.printStackTrace();
1.176 - throw new DebugException();
1.177 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.178 }
1.179 }
1.180 }
1.181 @@ -922,8 +910,7 @@
1.182 localClassProxies.put(metaObject, storable);
1.183 return storable;
1.184 } catch ( StorageException e ) {
1.185 - e.printStackTrace();
1.186 - throw new DebugException("Storage exception: " + e.getMessage());
1.187 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
1.188 }
1.189 }
1.190
1.191 @@ -1011,8 +998,7 @@
1.192 */
1.193 private void boot() {
1.194 boolean fail = true;
1.195 - Log.out.println( "Booting repository ..." );
1.196 - Log.out.indent();
1.197 + Logger.getDefault().log( "Booting repository ..." );
1.198 mdrStorage.setBooting(true);
1.199 try {
1.200 beginTrans(true);
1.201 @@ -1020,18 +1006,17 @@
1.202 installPureMof();
1.203 fail = false;
1.204 } catch (Throwable e) {
1.205 - e.printStackTrace();
1.206 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
1.207 } finally {
1.208 mdrStorage.setBooting(false);
1.209 endTrans(fail);
1.210 }
1.211 - Log.out.unindent();
1.212 }
1.213
1.214 /** Installs the fake MOF
1.215 */
1.216 private void installFakeMof() {
1.217 - Log.out.println("Creating boot MOF metamodel ...");
1.218 + Logger.getDefault().log("Creating boot MOF metamodel ...");
1.219
1.220 createBootMOF();
1.221 if (getExtent(BOOT_MOF) == null) {
1.222 @@ -1042,20 +1027,16 @@
1.223 /** Programatically installs the pure MOF model.
1.224 */
1.225 private void installPureMof() {
1.226 - Log.out.println("Installing pure MOF Metamodel ... ");
1.227 - Log.out.indent();
1.228 + Logger.getDefault().log("Installing pure MOF Metamodel ... ");
1.229
1.230 try {
1.231 - Log.out.println("Parsing MOF model to DOM represtentation ....");
1.232 + Logger.getDefault().log("Parsing MOF model to DOM represtentation ....");
1.233 ModelPackage modelPackage = (ModelPackage) createExtent(PURE_MOF, getBMModelPackage());
1.234 XMIReader xmiReader = XMIReader.getDefault();
1.235 xmiReader.read(MOF_XML_URL.toString(), new RefPackage[] {modelPackage});
1.236 mdrStorage.rebuildMofContext();
1.237 } catch (Exception e) {
1.238 - e.printStackTrace();
1.239 - throw new DebugException("Boot failed: " + e.getMessage());
1.240 - } finally {
1.241 - Log.out.unindent();
1.242 + throw (DebugException) Logger.getDefault().annotate(new DebugException("Boot failed."), e);
1.243 }
1.244 }
1.245
1.246 @@ -1084,8 +1065,7 @@
1.247 BootReader br = new BootReader(mdrStorage, BOOTMOF_XML_URL);
1.248 br.read();
1.249 } catch (Exception e) {
1.250 - e.printStackTrace();
1.251 - throw new DebugException("Unable to read MOF XMI: " + e.getMessage());
1.252 + throw (DebugException) Logger.getDefault().annotate(new DebugException("Unable to read MOF XMI: " + e.getMessage()), e);
1.253 }
1.254 }
1.255 }
2.1 --- a/mdr/src/org/netbeans/mdr/handlers/AssociationHandler.java Fri Sep 06 12:21:51 2002 +0000
2.2 +++ b/mdr/src/org/netbeans/mdr/handlers/AssociationHandler.java Fri Sep 06 17:01:01 2002 +0000
2.3 @@ -64,8 +64,7 @@
2.4 try {
2.5 return new IndexSetWrapper(_getMdrStorage(), getAssociationDelegate().getAllLinks());
2.6 } catch (StorageException e) {
2.7 - e.printStackTrace();
2.8 - throw new DebugException();
2.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.10 }
2.11 }
2.12
2.13 @@ -87,8 +86,7 @@
2.14 try {
2.15 return new Boolean(getAssociationDelegate().linkExists(((BaseObjectHandler)associationEnd1)._getDelegate().getMofId(), ((BaseObjectHandler)associationEnd2)._getDelegate().getMofId()));
2.16 } catch (StorageException e) {
2.17 - e.printStackTrace();
2.18 - throw new DebugException();
2.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.20 }
2.21 }
2.22
2.23 @@ -107,8 +105,7 @@
2.24 try {
2.25 result = getAssociationDelegate().queryObjects(endName, query == null ? null : ((BaseObjectHandler)query)._getDelegate().getMofId());
2.26 } catch (StorageException e) {
2.27 - e.printStackTrace();
2.28 - throw new DebugException();
2.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.30 }
2.31
2.32 if (result instanceof AssocEndIndexUList) {
2.33 @@ -147,8 +144,7 @@
2.34 }
2.35 return result;
2.36 } catch (StorageException e) {
2.37 - e.printStackTrace();
2.38 - throw new DebugException();
2.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.40 }
2.41 }
2.42
2.43 @@ -183,8 +179,7 @@
2.44 }
2.45 return result;
2.46 } catch (StorageException e) {
2.47 - e.printStackTrace();
2.48 - throw new DebugException();
2.49 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.50 }
2.51 }
2.52
2.53 @@ -417,8 +412,7 @@
2.54 getAssociationDelegate().verify(violations);
2.55 return violations;
2.56 } catch (StorageException e) {
2.57 - e.printStackTrace();
2.58 - throw new DebugException();
2.59 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
2.60 } finally {
2.61 _unlock();
2.62 }
3.1 --- a/mdr/src/org/netbeans/mdr/handlers/AssociationLinkWrapper.java Fri Sep 06 12:21:51 2002 +0000
3.2 +++ b/mdr/src/org/netbeans/mdr/handlers/AssociationLinkWrapper.java Fri Sep 06 17:01:01 2002 +0000
3.3 @@ -97,7 +97,7 @@
3.4 LinkReference reference;
3.5
3.6 while ((reference = (LinkReference) queue.poll()) != null) {
3.7 -// System.out.println("Removing: " + reference.getProxyMofId());
3.8 +// Logger.getDefault().log("Removing: " + reference.getProxyMofId());
3.9 this.remove(reference.getProxyMofId());
3.10 }
3.11 }
4.1 --- a/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java Fri Sep 06 12:21:51 2002 +0000
4.2 +++ b/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java Fri Sep 06 17:01:01 2002 +0000
4.3 @@ -66,7 +66,7 @@
4.4 if (defaultLoader == null) {
4.5 defaultLoader = new MDRClassLoader(provider);
4.6 }
4.7 -// System.out.println(defaultLoader.toString() + " : " + defaultLoader.getClass().getName());
4.8 +// Logger.getDefault().log(defaultLoader.toString() + " : " + defaultLoader.getClass().getName());
4.9 return defaultLoader;
4.10 }
4.11
4.12 @@ -103,7 +103,7 @@
4.13 // file.write(handlerClassFile);
4.14 // file.close();
4.15 // } catch (Exception e) {
4.16 -// e.printStackTrace();
4.17 +// Logger.getDefault().notify(Logger.INFORMATIONAL, e);
4.18 // }
4.19
4.20 result = loader.defineClass(className, handlerClassFile);
4.21 @@ -153,8 +153,7 @@
4.22
4.23 return result;
4.24 } catch (StorageException e) {
4.25 - e.printStackTrace();
4.26 - throw new DebugException();
4.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.28 }
4.29 }
4.30
4.31 @@ -244,18 +243,13 @@
4.32 return (BaseObjectHandler) oldRecord;
4.33 }
4.34 } catch (NoSuchMethodException e) {
4.35 - Log.out.println(s.getClass().getName());
4.36 - e.printStackTrace(Log.out);
4.37 - throw new DebugException(e.toString());
4.38 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.39 } catch (IllegalAccessException e) {
4.40 - e.printStackTrace();
4.41 - throw new DebugException(e.toString());
4.42 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.43 } catch (InstantiationException e) {
4.44 - e.printStackTrace();
4.45 - throw new DebugException(e.toString());
4.46 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.47 } catch (InvocationTargetException e) {
4.48 - e.printStackTrace();
4.49 - throw new DebugException(e.toString());
4.50 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.51 }
4.52 }
4.53
4.54 @@ -271,12 +265,12 @@
4.55 try {
4.56 return Class.forName(ifcName, true, getDefaultClassLoader());
4.57 } catch (RuntimeException e) {
4.58 - System.out.println("ClassLoader: " + getDefaultClassLoader());
4.59 - System.out.println("ClassName: " + ifcName);
4.60 + Logger.getDefault().annotate(e, "ClassLoader: " + getDefaultClassLoader());
4.61 + Logger.getDefault().annotate(e, "ClassName: " + ifcName);
4.62 throw e;
4.63 } catch (Error e) {
4.64 - System.out.println("ClassLoader: " + getDefaultClassLoader());
4.65 - System.out.println("ClassName: " + ifcName);
4.66 + Logger.getDefault().annotate(e, "ClassLoader: " + getDefaultClassLoader());
4.67 + Logger.getDefault().annotate(e, "ClassName: " + ifcName);
4.68 throw e;
4.69 }
4.70 }
4.71 @@ -291,15 +285,15 @@
4.72 try {
4.73 return Class.forName(implName, true, getDefaultClassLoader());
4.74 } catch (ClassNotFoundException e) {
4.75 - // System.out.println("Implementation of derived element not found. ClassName: " + implName);
4.76 + // Logger.getDefault().annotate(e, "Implementation of derived element not found. ClassName: " + implName);
4.77 throw e;
4.78 } catch (Error e) {
4.79 - System.out.println("ClassLoader: " + getDefaultClassLoader());
4.80 - System.out.println("ClassName: " + implName);
4.81 + Logger.getDefault().annotate(e, "ClassLoader: " + getDefaultClassLoader());
4.82 + Logger.getDefault().annotate(e, "ClassName: " + implName);
4.83 throw e;
4.84 } catch (RuntimeException e) {
4.85 - System.out.println("ClassLoader: " + getDefaultClassLoader());
4.86 - System.out.println("ClassName: " + implName);
4.87 + Logger.getDefault().annotate(e, "ClassLoader: " + getDefaultClassLoader());
4.88 + Logger.getDefault().annotate(e, "ClassName: " + implName);
4.89 throw e;
4.90 }
4.91 }
4.92 @@ -424,8 +418,7 @@
4.93 try {
4.94 return (RefObject) getHandler(_getDelegate().getMetaObject());
4.95 } catch (StorageException e) {
4.96 - e.printStackTrace();
4.97 - throw new DebugException();
4.98 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.99 }
4.100 }
4.101
4.102 @@ -433,8 +426,7 @@
4.103 try {
4.104 return (RefPackage) getHandler(_getDelegate().getImmediatePackage());
4.105 } catch (StorageException e) {
4.106 - e.printStackTrace();
4.107 - throw new DebugException();
4.108 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.109 }
4.110 }
4.111
4.112 @@ -447,8 +439,7 @@
4.113 return (RefPackage) getHandler(pkg);
4.114 }
4.115 } catch (StorageException e) {
4.116 - e.printStackTrace();
4.117 - throw new DebugException();
4.118 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
4.119 }
4.120 }
4.121
4.122 @@ -537,7 +528,7 @@
4.123 HandlerReference reference;
4.124
4.125 while ((reference = (HandlerReference) queue.poll()) != null) {
4.126 -// System.out.println("Removing: " + reference.getProxyMofId());
4.127 +// Logger.getDefault().log("Removing: " + reference.getProxyMofId());
4.128 this.remove(reference.getProxyMofId());
4.129 }
4.130 }
5.1 --- a/mdr/src/org/netbeans/mdr/handlers/ClassProxyHandler.java Fri Sep 06 12:21:51 2002 +0000
5.2 +++ b/mdr/src/org/netbeans/mdr/handlers/ClassProxyHandler.java Fri Sep 06 17:01:01 2002 +0000
5.3 @@ -79,8 +79,7 @@
5.4 }
5.5 return (RefObject) getHandler (storableObject);
5.6 } catch (StorageException e) {
5.7 - e.printStackTrace();
5.8 - throw new DebugException();
5.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
5.10 }
5.11 }
5.12
5.13 @@ -132,8 +131,7 @@
5.14 }
5.15 return result;
5.16 } catch (StorageException e) {
5.17 - e.printStackTrace();
5.18 - throw new DebugException();
5.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
5.20 }
5.21 }
5.22
5.23 @@ -141,8 +139,7 @@
5.24 try {
5.25 getClassDelegate().setAttribute(attrName, newValue);
5.26 } catch (StorageException e) {
5.27 - e.printStackTrace();
5.28 - throw new DebugException();
5.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
5.30 }
5.31 }
5.32
5.33 @@ -155,8 +152,7 @@
5.34 _lock(false);
5.35 return new IndexSetWrapper(_getMdrStorage(), getClassDelegate().allObjects(true));
5.36 } catch (StorageException e) {
5.37 - e.printStackTrace();
5.38 - throw new DebugException();
5.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
5.40 } finally {
5.41 _unlock();
5.42 }
5.43 @@ -167,8 +163,7 @@
5.44 _lock(false);
5.45 return new IndexSetWrapper(_getMdrStorage(), getClassDelegate().allObjects(false));
5.46 } catch (StorageException e) {
5.47 - e.printStackTrace();
5.48 - throw new DebugException();
5.49 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
5.50 } finally {
5.51 _unlock();
5.52 }
6.1 --- a/mdr/src/org/netbeans/mdr/handlers/EnumResolver.java Fri Sep 06 12:21:51 2002 +0000
6.2 +++ b/mdr/src/org/netbeans/mdr/handlers/EnumResolver.java Fri Sep 06 17:01:01 2002 +0000
6.3 @@ -62,8 +62,7 @@
6.4 } catch (NoSuchFieldException e) {
6.5 throw new InvalidNameException(label, "Invalid literal name '" + label + "' for enumeration " + ifcName);
6.6 } catch (Exception e) {
6.7 - e.printStackTrace();
6.8 - throw new DebugException(e.toString());
6.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
6.10 }
6.11 }
6.12
7.1 --- a/mdr/src/org/netbeans/mdr/handlers/FeaturedHandler.java Fri Sep 06 12:21:51 2002 +0000
7.2 +++ b/mdr/src/org/netbeans/mdr/handlers/FeaturedHandler.java Fri Sep 06 17:01:01 2002 +0000
7.3 @@ -122,8 +122,7 @@
7.4 } catch (ClassCastException e) {
7.5 throw new InvalidCallException(null, feature);
7.6 /* } catch (StorageException e) {
7.7 - e.printStackTrace();
7.8 - throw new DebugException();
7.9 + throw Logger.getDefault().annotate(new DebugException(), e);
7.10 */ } finally {
7.11 _unlock();
7.12 }
7.13 @@ -157,8 +156,7 @@
7.14 throw new InvalidCallException(null, feature);
7.15 /*
7.16 } catch (StorageException e) {
7.17 - e.printStackTrace();
7.18 - throw new DebugException();
7.19 + throw Logger.getDefault().annotate(new DebugException(), e);
7.20 */
7.21 } finally {
7.22 _unlock();
8.1 --- a/mdr/src/org/netbeans/mdr/handlers/InstanceHandler.java Fri Sep 06 12:21:51 2002 +0000
8.2 +++ b/mdr/src/org/netbeans/mdr/handlers/InstanceHandler.java Fri Sep 06 17:01:01 2002 +0000
8.3 @@ -22,6 +22,7 @@
8.4 import org.netbeans.mdr.storagemodel.*;
8.5 import org.netbeans.mdr.util.DebugException;
8.6 import org.netbeans.mdr.persistence.StorageException;
8.7 +import org.netbeans.mdr.util.Logger;
8.8
8.9 /** Invocation handler for Instances
8.10 *
8.11 @@ -83,8 +84,7 @@
8.12 try {
8.13 return getInstanceDelegate().getClassProxy().getReferenceDescriptor(name) != null;
8.14 } catch (StorageException e) {
8.15 - e.printStackTrace();
8.16 - throw new DebugException();
8.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.18 }
8.19 }
8.20
8.21 @@ -102,7 +102,7 @@
8.22 try {
8.23 reference = getInstanceDelegate().getClassProxy().getReferenceDescriptor(featureName);
8.24 AssociationHandler assoc = (AssociationHandler) getHandler(reference.getAssociation());
8.25 - //System.out.println("getting reference " + featureName + " for end: " + reference.getEndName());
8.26 + //Logger.getDefault().log("getting reference " + featureName + " for end: " + reference.getEndName());
8.27 return assoc._query(reference.getEndName(), (RefObject) this);
8.28 } catch (ClassCastException e) {
8.29 // this will throw TypeMismatchException or DebugException if the mismatch is not found
8.30 @@ -113,8 +113,7 @@
8.31 }
8.32 return null;
8.33 } catch (StorageException e) {
8.34 - e.printStackTrace();
8.35 - throw new DebugException();
8.36 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.37 }
8.38 }
8.39
8.40 @@ -178,8 +177,7 @@
8.41 // the operation will be atomic and replace event can be thrown instead
8.42 // of add and remove events
8.43 } catch (StorageException e) {
8.44 - e.printStackTrace();
8.45 - throw new DebugException();
8.46 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.47 }
8.48 }
8.49
8.50 @@ -204,8 +202,7 @@
8.51 }
8.52 return result;
8.53 } catch (StorageException e) {
8.54 - e.printStackTrace();
8.55 - throw new DebugException();
8.56 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.57 }
8.58 }
8.59
8.60 @@ -213,8 +210,7 @@
8.61 try {
8.62 getInstanceDelegate().setAttribute(attrIndex, newValue);
8.63 } catch (StorageException e) {
8.64 - e.printStackTrace();
8.65 - throw new DebugException();
8.66 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.67 }
8.68 }
8.69
8.70 @@ -274,8 +270,7 @@
8.71 _lock(false);
8.72 return (RefClass) getHandler(getInstanceDelegate().getClassProxy());
8.73 } catch (StorageException e) {
8.74 - e.printStackTrace();
8.75 - throw new DebugException();
8.76 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.77 } finally {
8.78 _unlock();
8.79 }
8.80 @@ -298,8 +293,7 @@
8.81 try {
8.82 getInstanceDelegate().delete();
8.83 } catch (StorageException e) {
8.84 - e.printStackTrace();
8.85 - throw new DebugException();
8.86 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.87 }
8.88 fail = false;
8.89 } finally {
8.90 @@ -339,8 +333,7 @@
8.91 } catch (ClassCastException e) {
8.92 throw new InvalidCallException(null, feature);
8.93 } catch (StorageException e) {
8.94 - e.printStackTrace();
8.95 - throw new DebugException();
8.96 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.97 } finally {
8.98 _unlock();
8.99 }
8.100 @@ -379,8 +372,7 @@
8.101 } catch (ClassCastException e) {
8.102 throw new InvalidCallException(null, feature);
8.103 } catch (StorageException e) {
8.104 - e.printStackTrace();
8.105 - throw new DebugException();
8.106 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.107 } finally {
8.108 _unlock();
8.109 }
8.110 @@ -444,8 +436,7 @@
8.111 getInstanceDelegate().verify(violations);
8.112 return violations;
8.113 } catch (StorageException e) {
8.114 - e.printStackTrace();
8.115 - throw new DebugException();
8.116 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
8.117 } finally {
8.118 _unlock();
8.119 }
9.1 --- a/mdr/src/org/netbeans/mdr/handlers/MDRClassLoader.java Fri Sep 06 12:21:51 2002 +0000
9.2 +++ b/mdr/src/org/netbeans/mdr/handlers/MDRClassLoader.java Fri Sep 06 17:01:01 2002 +0000
9.3 @@ -33,6 +33,7 @@
9.4 import org.netbeans.lib.jmi.mapping.ClassFileMapper;
9.5 import org.netbeans.api.mdr.JMIMapper;
9.6 import org.netbeans.mdr.persistence.StorageException;
9.7 +import org.netbeans.mdr.util.Logger;
9.8
9.9 /**
9.10 *
9.11 @@ -117,8 +118,7 @@
9.12 }
9.13 classes.put(key, result);
9.14 } catch (Exception e) {
9.15 - e.printStackTrace();
9.16 - throw new DebugException();
9.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
9.18 }
9.19 }
9.20 return result;
10.1 --- a/mdr/src/org/netbeans/mdr/handlers/PackageProxyHandler.java Fri Sep 06 12:21:51 2002 +0000
10.2 +++ b/mdr/src/org/netbeans/mdr/handlers/PackageProxyHandler.java Fri Sep 06 17:01:01 2002 +0000
10.3 @@ -84,8 +84,7 @@
10.4 try {
10.5 return (RefPackage) getHandler(getPackageDelegate().getPackage(proxyName));
10.6 } catch (StorageException e) {
10.7 - e.printStackTrace();
10.8 - throw new DebugException();
10.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.10 }
10.11 }
10.12
10.13 @@ -102,8 +101,7 @@
10.14 try {
10.15 return (RefClass) getHandler(getPackageDelegate().getClassProxy(proxyName));
10.16 } catch (StorageException e) {
10.17 - e.printStackTrace();
10.18 - throw new DebugException();
10.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.20 }
10.21 }
10.22
10.23 @@ -120,8 +118,7 @@
10.24 try {
10.25 return (RefAssociation) getHandler(getPackageDelegate().getAssociation(proxyName));
10.26 } catch (StorageException e) {
10.27 - e.printStackTrace();
10.28 - throw new DebugException();
10.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.30 }
10.31 }
10.32
10.33 @@ -164,8 +161,7 @@
10.34 _lock(false);
10.35 return new IndexSetWrapper(_getMdrStorage(), getPackageDelegate().getAllAssociations());
10.36 } catch (StorageException e) {
10.37 - e.printStackTrace();
10.38 - throw new DebugException();
10.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.40 } finally {
10.41 _unlock();
10.42 }
10.43 @@ -176,8 +172,7 @@
10.44 _lock(false);
10.45 return new IndexSetWrapper(_getMdrStorage(), getPackageDelegate().getAllClasses());
10.46 } catch (StorageException e) {
10.47 - e.printStackTrace();
10.48 - throw new DebugException();
10.49 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.50 } finally {
10.51 _unlock();
10.52 }
10.53 @@ -188,8 +183,7 @@
10.54 _lock(false);
10.55 return new IndexSetWrapper(_getMdrStorage(), getPackageDelegate().getAllPackages());
10.56 } catch (StorageException e) {
10.57 - e.printStackTrace();
10.58 - throw new DebugException();
10.59 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.60 } finally {
10.61 _unlock();
10.62 }
10.63 @@ -324,8 +318,7 @@
10.64 try {
10.65 getPackageDelegate().delete();
10.66 } catch (StorageException e) {
10.67 - e.printStackTrace();
10.68 - throw new DebugException();
10.69 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
10.70 }
10.71 fail = false;
10.72 } finally {
11.1 --- a/mdr/src/org/netbeans/mdr/handlers/StructImpl.java Fri Sep 06 12:21:51 2002 +0000
11.2 +++ b/mdr/src/org/netbeans/mdr/handlers/StructImpl.java Fri Sep 06 17:01:01 2002 +0000
11.3 @@ -65,8 +65,7 @@
11.4 }
11.5 return newInstance(BaseObjectHandler.resolveInterface(dataType.getIfcName()), dataType.getMembers(), values, dataType.getTypeName());
11.6 } catch (ClassNotFoundException e) {
11.7 - e.printStackTrace();
11.8 - throw new DebugException(e.toString());
11.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
11.10 }
11.11 }
11.12
11.13 @@ -80,17 +79,13 @@
11.14
11.15 return struct;
11.16 } catch (NoSuchMethodException e) {
11.17 - e.printStackTrace();
11.18 - throw new DebugException(e.toString());
11.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
11.20 } catch (IllegalAccessException e) {
11.21 - e.printStackTrace();
11.22 - throw new DebugException(e.toString());
11.23 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
11.24 } catch (InstantiationException e) {
11.25 - e.printStackTrace();
11.26 - throw new DebugException(e.toString());
11.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
11.28 } catch (InvocationTargetException e) {
11.29 - e.printStackTrace();
11.30 - throw new DebugException(e.toString());
11.31 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
11.32 }
11.33 }
11.34
12.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/AssociationGenerator.java Fri Sep 06 12:21:51 2002 +0000
12.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/AssociationGenerator.java Fri Sep 06 17:01:01 2002 +0000
12.3 @@ -99,8 +99,7 @@
12.4 methods.add(getDispatchMethod("_all", new String[0], DT_MULTIVALUED, (MethodDescHolder) dispatchMethods.get("_all")));
12.5 return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);
12.6 } catch (Exception e) {
12.7 - e.printStackTrace();
12.8 - throw new DebugException();
12.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
12.10 }
12.11 }
12.12
13.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/ClassGenerator.java Fri Sep 06 12:21:51 2002 +0000
13.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/ClassGenerator.java Fri Sep 06 17:01:01 2002 +0000
13.3 @@ -166,8 +166,7 @@
13.4 methods.add(mtds[i]);
13.5 return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);
13.6 }catch (Exception e) {
13.7 - e.printStackTrace();
13.8 - throw new DebugException();
13.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
13.10 }
13.11 }
13.12
14.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/ContainsIterator.java Fri Sep 06 12:21:51 2002 +0000
14.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/ContainsIterator.java Fri Sep 06 17:01:01 2002 +0000
14.3 @@ -37,8 +37,7 @@
14.4 elements.add(obj);
14.5 }
14.6 } catch(Exception e) {
14.7 - e.printStackTrace();
14.8 - throw new DebugException();
14.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
14.10 }
14.11 }
14.12
15.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/ContentsFinder.java Fri Sep 06 12:21:51 2002 +0000
15.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/ContentsFinder.java Fri Sep 06 17:01:01 2002 +0000
15.3 @@ -58,9 +58,9 @@
15.4 }
15.5 /*
15.6 public void dump() {
15.7 - System.out.println("Contents finder dump:");
15.8 + Logger.getDefault().log("Contents finder dump:");
15.9 for (Iterator it = snameToObject.keySet().iterator(); it.hasNext();) {
15.10 - System.out.println(" sname: " + it.next());
15.11 + Logger.getDefault().log(" sname: " + it.next());
15.12 }
15.13 }
15.14 */
15.15 @@ -94,8 +94,7 @@
15.16 }
15.17 this.derived = derived;
15.18 } catch (Exception e) {
15.19 - e.printStackTrace();
15.20 - throw new DebugException();
15.21 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
15.22 }
15.23 }
15.24
15.25 @@ -184,8 +183,7 @@
15.26 this.derived = derived;
15.27 this.index = index;
15.28 } catch (Exception e) {
15.29 - e.printStackTrace();
15.30 - throw new DebugException();
15.31 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
15.32 }
15.33 }
15.34
16.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/FeaturedGenerator.java Fri Sep 06 12:21:51 2002 +0000
16.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/FeaturedGenerator.java Fri Sep 06 17:01:01 2002 +0000
16.3 @@ -56,9 +56,8 @@
16.4 methods.add(getDispatcherMethod("_setAttribute", new String[] {"java.lang.String", "java.lang.Object"}, "void", (HashMap) dispatchMethods.get("_setAttribute")));
16.5 methods.add(getDispatcherMethod("_getAttribute", new String[] {"java.lang.String"}, "java.lang.Object", (HashMap) dispatchMethods.get("_getAttribute")));
16.6 return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);
16.7 - }catch (Exception e) {
16.8 - e.printStackTrace();
16.9 - throw new DebugException();
16.10 + } catch (Exception e) {
16.11 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
16.12 }
16.13 }
16.14
17.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/HandlerGenerator.java Fri Sep 06 12:21:51 2002 +0000
17.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/HandlerGenerator.java Fri Sep 06 17:01:01 2002 +0000
17.3 @@ -73,8 +73,7 @@
17.4 throw new InternalError("Unknow dispatcher type.");
17.5 }
17.6 } catch (Exception e) {
17.7 - e.printStackTrace();
17.8 - throw new DebugException();
17.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
17.10 }
17.11
17.12 ByteArrayOutputStream bout = new ByteArrayOutputStream();
17.13 @@ -558,8 +557,7 @@
17.14 curType = getAttrType(curType);
17.15 return curType;
17.16 } catch (Exception e) {
17.17 - e.printStackTrace();
17.18 - throw new DebugException();
17.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
17.20 }
17.21 }
17.22
17.23 @@ -576,8 +574,7 @@
17.24 return getTypeName2(attr);
17.25 }
17.26 } catch (Exception e) {
17.27 - e.printStackTrace();
17.28 - throw new DebugException();
17.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
17.30 }
17.31 }
17.32
18.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/InstanceGenerator.java Fri Sep 06 12:21:51 2002 +0000
18.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/InstanceGenerator.java Fri Sep 06 17:01:01 2002 +0000
18.3 @@ -148,8 +148,7 @@
18.4 methods.add(mtds[i]);
18.5 return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);
18.6 }catch (Exception e) {
18.7 - e.printStackTrace();
18.8 - throw new DebugException();
18.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
18.10 }
18.11 }
18.12 }
19.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/PackageGenerator.java Fri Sep 06 12:21:51 2002 +0000
19.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/PackageGenerator.java Fri Sep 06 17:01:01 2002 +0000
19.3 @@ -130,9 +130,8 @@
19.4 methods.add(getDispatcherMethod("_getPackage", new String[] {"java.lang.String"}, "javax.jmi.reflect.RefPackage", (HashMap) dispatchMethods.get("_getPackage")));
19.5 methods.add(getDispatcherMethod("_createStruct", new String[] {"java.lang.String", "java.lang.Object[]"}, "javax.jmi.reflect.RefStruct", (HashMap) dispatchMethods.get("_createStruct")));
19.6 return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);
19.7 - }catch (Exception e) {
19.8 - e.printStackTrace();
19.9 - throw new DebugException();
19.10 + } catch (Exception e) {
19.11 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
19.12 }
19.13 }
19.14
20.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/TagSupport.java Fri Sep 06 12:21:51 2002 +0000
20.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/TagSupport.java Fri Sep 06 17:01:01 2002 +0000
20.3 @@ -91,8 +91,7 @@
20.4 }
20.5 }
20.6 } catch (Exception e) {
20.7 - e.printStackTrace();
20.8 - throw new DebugException();
20.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.10 }
20.11
20.12 return tag;
20.13 @@ -108,8 +107,7 @@
20.14 return (Collection) tag.getAttribute(MOFConstants.SH_MODEL_TAG_VALUES);
20.15 }
20.16 } catch (Exception e) {
20.17 - e.printStackTrace();
20.18 - throw new DebugException();
20.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.20 }
20.21 }
20.22
20.23 @@ -128,8 +126,7 @@
20.24 valueCache.put(tagKey, value);
20.25 }
20.26 } catch (Exception e) {
20.27 - e.printStackTrace();
20.28 - throw new DebugException();
20.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.30 }
20.31 }
20.32
20.33 @@ -161,8 +158,7 @@
20.34 } else
20.35 return getTypeFullName(type);
20.36 } catch (Exception e) {
20.37 - e.printStackTrace();
20.38 - throw new DebugException();
20.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.40 }
20.41
20.42 }
20.43 @@ -185,8 +181,7 @@
20.44 else
20.45 meta = metaName;
20.46 } catch (Exception e) {
20.47 - e.printStackTrace();
20.48 - throw new DebugException();
20.49 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.50 }
20.51 String temp = result;
20.52 if (MOFConstants.SH_MODEL_CONSTANT.equals(meta))
20.53 @@ -278,8 +273,7 @@
20.54
20.55 return result.toLowerCase();
20.56 } catch (Exception e) {
20.57 - e.printStackTrace();
20.58 - throw new DebugException();
20.59 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
20.60 }
20.61 }
20.62 }
21.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreeindex/MOFIDInfo.java Fri Sep 06 12:21:51 2002 +0000
21.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreeindex/MOFIDInfo.java Fri Sep 06 17:01:01 2002 +0000
21.3 @@ -15,6 +15,8 @@
21.4 import org.netbeans.mdr.persistence.SinglevaluedIndex;
21.5 import org.netbeans.mdr.persistence.Storage;
21.6 import org.netbeans.mdr.persistence.MOFID;
21.7 +import org.netbeans.mdr.util.Logger;
21.8 +
21.9 /**
21.10 * EntryTypeInfo implementation for type MOFID
21.11 *
21.12 @@ -93,7 +95,7 @@
21.13 return mofBytes;
21.14 }
21.15 } catch (Exception e) {
21.16 - e.printStackTrace ();
21.17 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
21.18 }
21.19 return null;
21.20 }
21.21 @@ -117,7 +119,7 @@
21.22 long serialNumber = Converter.readLong (buffer, 0);
21.23 return new MOFID (serialNumber, storageId);
21.24 } catch (Exception e) {
21.25 - e.printStackTrace ();
21.26 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
21.27 return null;
21.28 }
21.29 }
21.30 @@ -130,7 +132,7 @@
21.31 try {
21.32 return storage.resolveObject (mofidFromBuffer(buffer));
21.33 } catch (Exception e) {
21.34 - e.printStackTrace();
21.35 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
21.36 }
21.37 return null;
21.38 }
22.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreeindex/VarRecordPage.java Fri Sep 06 12:21:51 2002 +0000
22.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreeindex/VarRecordPage.java Fri Sep 06 17:01:01 2002 +0000
22.3 @@ -493,9 +493,9 @@
22.4
22.5 /*
22.6 public void dumpPage () {
22.7 - System.out.println("******************************");
22.8 + Logger.getDefault().log("******************************");
22.9 for (int i = 0; i < nextOffset; i++) {
22.10 - System.out.println("key: " + new String(getKey(i)) + " data: " + new String(getData(i)));
22.11 + Logger.getDefault().log("key: " + new String(getKey(i)) + " data: " + new String(getData(i)));
22.12 }
22.13 }
22.14 */
23.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/ActiveBtreeExtent.java Fri Sep 06 12:21:51 2002 +0000
23.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/ActiveBtreeExtent.java Fri Sep 06 17:01:01 2002 +0000
23.3 @@ -17,6 +17,7 @@
23.4 import java.util.zip.*;
23.5
23.6 import org.netbeans.mdr.persistence.*;
23.7 +import org.netbeans.mdr.util.Logger;
23.8
23.9 /**
23.10 * This is the superclass for extents which are parts of records
23.11 @@ -78,12 +79,12 @@
23.12 (dataStart + toCopy - 1) / BtreeDataFile.BTREE_CHUNK_SIZE + 1;
23.13
23.14 if (numChunks > chunks) {
23.15 - System.out.println("Bad number of chunks: ----------------------");
23.16 - System.out.println("start chunk number: " + myChunkNum);
23.17 - System.out.println("#chunks: " + chunks + " computed #chunks: " + numChunks);
23.18 - System.out.println("dataLength: " + dataLength + " dataSart: " + dataStart);
23.19 - Thread.dumpStack();
23.20 - throw new StoragePersistentDataException ("Number of chunks does not match.");
23.21 + StorageException se = new StoragePersistentDataException ("Number of chunks does not match.");
23.22 + Logger.getDefault().annotate(se, "Bad number of chunks: ----------------------");
23.23 + Logger.getDefault().annotate(se, "start chunk number: " + myChunkNum);
23.24 + Logger.getDefault().annotate(se, "#chunks: " + chunks + " computed #chunks: " + numChunks);
23.25 + Logger.getDefault().annotate(se, "dataLength: " + dataLength + " dataSart: " + dataStart);
23.26 + throw se;
23.27 }
23.28
23.29 CachedPage pages[] = owner.getChunks(myChunkNum, numChunks, offst);
23.30 @@ -125,12 +126,12 @@
23.31 CachedPage[] pages = owner.getChunks(myChunkNum, numChunks, offst);
23.32
23.33 if (numChunks > chunks) {
23.34 - System.out.println("Bad number of chunks: ----------------------");
23.35 - System.out.println("start chunk number: " + myChunkNum);
23.36 - System.out.println("#chunks: " + chunks + " computed #chunks: " + numChunks);
23.37 - System.out.println("dataLength: " + dataLength + " dataSart: " + dataStart);
23.38 - Thread.dumpStack();
23.39 - throw new StoragePersistentDataException ("Number of chunks does not match.");
23.40 + StorageException se = new StoragePersistentDataException ("Number of chunks does not match.");
23.41 + Logger.getDefault().annotate(se, "Bad number of chunks: ----------------------");
23.42 + Logger.getDefault().annotate(se, "start chunk number: " + myChunkNum);
23.43 + Logger.getDefault().annotate(se, "#chunks: " + chunks + " computed #chunks: " + numChunks);
23.44 + Logger.getDefault().annotate(se, "dataLength: " + dataLength + " dataSart: " + dataStart);
23.45 + throw se;
23.46 }
23.47
23.48 int pageNum = 0;
24.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeStorage.java Fri Sep 06 12:21:51 2002 +0000
24.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeStorage.java Fri Sep 06 17:01:01 2002 +0000
24.3 @@ -18,6 +18,7 @@
24.4
24.5 import org.netbeans.mdr.persistence.btreeimpl.btreeindex.*;
24.6 import org.netbeans.mdr.persistence.*;
24.7 +import org.netbeans.mdr.util.Logger;
24.8
24.9 /**
24.10 * This class implements Storage using Btree files. Almost all implementation
24.11 @@ -75,7 +76,7 @@
24.12 * for the btree files
24.13 */
24.14 public BtreeStorage(String name) {
24.15 - System.out.println("DATABSE: "+name);
24.16 + Logger.getDefault().log("DATABSE: "+name);
24.17 btreeDBName = name;
24.18 shortName = new File (name).getName ();
24.19 }
25.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/ContinuationBtreeExtent.java Fri Sep 06 12:21:51 2002 +0000
25.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/ContinuationBtreeExtent.java Fri Sep 06 17:01:01 2002 +0000
25.3 @@ -14,6 +14,7 @@
25.4
25.5 import java.io.*;
25.6 import java.util.*;
25.7 +import org.netbeans.mdr.util.Logger;
25.8
25.9 /**
25.10 * A ContinuationBtreeExtent in an extent which is the second or subsequent
25.11 @@ -83,10 +84,10 @@
25.12 void readHeaderFromPage(byte buffer[], IntHolder offset) {
25.13 dataLength = Converter.readInt(buffer, offset);
25.14 if (dataLength > getAvailableDataLength()) {
25.15 - System.out.println("Bad data length read: ----------------------");
25.16 - System.out.println("chunk number: " + myChunkNum);
25.17 - System.out.println("dataLength: " + dataLength);
25.18 - System.out.println("available: " + getAvailableDataLength());
25.19 + Logger.getDefault().log("Bad data length read: ----------------------");
25.20 + Logger.getDefault().log("chunk number: " + myChunkNum);
25.21 + Logger.getDefault().log("dataLength: " + dataLength);
25.22 + Logger.getDefault().log("available: " + getAvailableDataLength());
25.23 }
25.24 }
25.25
26.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java Fri Sep 06 12:21:51 2002 +0000
26.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java Fri Sep 06 17:01:01 2002 +0000
26.3 @@ -89,7 +89,7 @@
26.4 System.exit(1);
26.5 }
26.6
26.7 - //System.out.println(property + ": : count is " + count);
26.8 + //Logger.getDefault().log(property + ": : count is " + count);
26.9 return count;
26.10 }
26.11
26.12 @@ -100,7 +100,7 @@
26.13 pages.add(page);
26.14 freePages.addLast(page);
26.15 }
26.16 - // System.out.println("Cache is now " + pages.size() + " pages");
26.17 + // Logger.getDefault().log("Cache is now " + pages.size() + " pages");
26.18 }
26.19
26.20 /** A callback used by the logging system to indicate that a modified
26.21 @@ -124,7 +124,7 @@
26.22 freePages.addFirst(page);
26.23 }
26.24 heldForLog.clear();
26.25 - // System.out.println("Log file flushed");
26.26 + // Logger.getDefault().log("Log file flushed");
26.27 }
26.28
26.29 /** Create the cache and open the files. The files are assumed
27.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/MDRCache.java Fri Sep 06 12:21:51 2002 +0000
27.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/MDRCache.java Fri Sep 06 17:01:01 2002 +0000
27.3 @@ -258,9 +258,9 @@
27.4 }
27.5 /*
27.6 if (i > 0) {
27.7 - System.out.println("Removed " + i +
27.8 + Logger.getDefault().log("Removed " + i +
27.9 " references; hash size now " + hashOnId.size() + " was " + (hashOnId.size() + i));
27.10 - System.out.println( " HardRefs " + hardIndex );
27.11 + Logger.getDefault().log( " HardRefs " + hardIndex );
27.12 }
27.13 */
27.14 }
27.15 @@ -269,7 +269,7 @@
27.16 */
27.17 private void checkThreshhold() throws StorageException {
27.18 int allChanged = newOnes.size() + dirty.size();
27.19 - // System.out.println("checkThreshhold called at level " + allChanged);
27.20 + // Logger.getDefault().log("checkThreshhold called at level " + allChanged);
27.21 if (allChanged >= threshhold)
27.22 handler.cacheThreshholdReached(this, allChanged);
27.23 }
28.1 --- a/mdr/src/org/netbeans/mdr/persistence/memoryimpl/MultivaluedIndexImpl.java Fri Sep 06 12:21:51 2002 +0000
28.2 +++ b/mdr/src/org/netbeans/mdr/persistence/memoryimpl/MultivaluedIndexImpl.java Fri Sep 06 17:01:01 2002 +0000
28.3 @@ -174,7 +174,7 @@
28.4 str = "</entries>";
28.5 outputStream.write(str.getBytes());
28.6 } catch (java.io.IOException e) {
28.7 - e.printStackTrace();
28.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
28.9 }
28.10 }
28.11 /** Restore state of the Storable object from the stream.
28.12 @@ -184,7 +184,7 @@
28.13 public void read(java.io.InputStream inputStream) throws StorageException {
28.14 try {
28.15 name = XmlUtils.readTextTag(inputStream); // "<name>"
28.16 - Log.out.println("name:"+name);
28.17 + Logger.getDefault().log("name:"+name);
28.18 String keyTypeName = XmlUtils.readTextTag(inputStream);// "<keyType>"
28.19 String valueTypeName = XmlUtils.readTextTag(inputStream);// "<valueType>"
28.20 keyType = Storage.EntryType.decodeEntryType(keyTypeName);
28.21 @@ -214,11 +214,11 @@
28.22 val = cls.newInstance();
28.23 ((Streamable) val).read(inputStream);
28.24 } catch (ClassNotFoundException e) {
28.25 - e.printStackTrace();
28.26 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
28.27 } catch (InstantiationException e) {
28.28 - e.printStackTrace();
28.29 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
28.30 } catch (IllegalAccessException e) {
28.31 - e.printStackTrace();
28.32 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
28.33 }
28.34 } else {
28.35 val = XmlUtils.readValue(inputStream);
28.36 @@ -235,8 +235,7 @@
28.37 }
28.38 XmlUtils.skipTagEnd(inputStream); // </entries>
28.39 } catch (java.io.IOException e) {
28.40 - e.printStackTrace(Log.out);
28.41 - throw new StoragePersistentDataException(e.getMessage());
28.42 + throw (StoragePersistentDataException) Logger.getDefault().annotate(new StoragePersistentDataException(e.getMessage()), e);
28.43 }
28.44 }
28.45
29.1 --- a/mdr/src/org/netbeans/mdr/persistence/memoryimpl/MultivaluedOrderedIndexImpl.java Fri Sep 06 12:21:51 2002 +0000
29.2 +++ b/mdr/src/org/netbeans/mdr/persistence/memoryimpl/MultivaluedOrderedIndexImpl.java Fri Sep 06 17:01:01 2002 +0000
29.3 @@ -84,7 +84,7 @@
29.4 str = "</entries>";
29.5 outputStream.write(str.getBytes());
29.6 } catch (java.io.IOException e) {
29.7 - e.printStackTrace();
29.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
29.9 }
29.10 }
29.11 /** Restore state of the Storable object from the stream.
29.12 @@ -94,7 +94,7 @@
29.13 public void read(java.io.InputStream inputStream) throws StorageException {
29.14 try {
29.15 name = XmlUtils.readTextTag(inputStream); // "<name>"
29.16 - Log.out.println("name:"+name);
29.17 + Logger.getDefault().log("name:"+name);
29.18 String keyTypeName = XmlUtils.readTextTag(inputStream);// "<keyType>"
29.19 String valueTypeName = XmlUtils.readTextTag(inputStream);// "<valueType>"
29.20 keyType = Storage.EntryType.decodeEntryType(keyTypeName);
29.21 @@ -126,11 +126,11 @@
29.22 val = cls.newInstance();
29.23 ((Streamable) val).read(inputStream);
29.24 } catch (ClassNotFoundException e) {
29.25 - e.printStackTrace();
29.26 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
29.27 } catch (InstantiationException e) {
29.28 - e.printStackTrace();
29.29 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
29.30 } catch (IllegalAccessException e) {
29.31 - e.printStackTrace();
29.32 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
29.33 }
29.34 } else {
29.35 val = XmlUtils.readValue(inputStream);
29.36 @@ -149,8 +149,7 @@
29.37 }
29.38 XmlUtils.skipTagEnd(inputStream); // </entries>
29.39 } catch (java.io.IOException e) {
29.40 - e.printStackTrace(Log.out);
29.41 - throw new StoragePersistentDataException(e.getMessage());
29.42 + throw (StoragePersistentDataException) Logger.getDefault().annotate(new StoragePersistentDataException(), e);
29.43 }
29.44 }
29.45
30.1 --- a/mdr/src/org/netbeans/mdr/persistence/memoryimpl/SinglevaluedIndexImpl.java Fri Sep 06 12:21:51 2002 +0000
30.2 +++ b/mdr/src/org/netbeans/mdr/persistence/memoryimpl/SinglevaluedIndexImpl.java Fri Sep 06 17:01:01 2002 +0000
30.3 @@ -236,7 +236,7 @@
30.4 str = "</entries>";
30.5 outputStream.write(str.getBytes());
30.6 } catch (java.io.IOException e) {
30.7 - e.printStackTrace();
30.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
30.9 }
30.10 }
30.11 /** Restore state of the Storable object from the stream.
30.12 @@ -246,7 +246,7 @@
30.13 public void read(java.io.InputStream inputStream) throws StorageException {
30.14 try {
30.15 name = XmlUtils.readTextTag(inputStream); // "<name>"
30.16 - Log.out.println("name:"+name);
30.17 + Logger.getDefault().log("name:"+name);
30.18 String keyTypeName = XmlUtils.readTextTag(inputStream);// "<keyType>"
30.19 String valueTypeName = XmlUtils.readTextTag(inputStream);// "<valueType>"
30.20 keyType = Storage.EntryType.decodeEntryType(keyTypeName);
30.21 @@ -274,11 +274,11 @@
30.22 val = cls.newInstance();
30.23 ((Streamable) val).read(inputStream);
30.24 } catch (ClassNotFoundException e) {
30.25 - e.printStackTrace();
30.26 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
30.27 } catch (InstantiationException e) {
30.28 - e.printStackTrace();
30.29 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
30.30 } catch (IllegalAccessException e) {
30.31 - e.printStackTrace();
30.32 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
30.33 }
30.34 } else {
30.35 val = XmlUtils.readValue(inputStream);
30.36 @@ -296,8 +296,7 @@
30.37 }
30.38 XmlUtils.skipTagEnd(inputStream); // </entries>
30.39 } catch (java.io.IOException e) {
30.40 - e.printStackTrace(Log.out);
30.41 - throw new StoragePersistentDataException(e.getMessage());
30.42 + throw (StoragePersistentDataException) Logger.getDefault().annotate(new StoragePersistentDataException(), e);
30.43 }
30.44 }
30.45
31.1 --- a/mdr/src/org/netbeans/mdr/persistence/memoryimpl/StorageImpl.java Fri Sep 06 12:21:51 2002 +0000
31.2 +++ b/mdr/src/org/netbeans/mdr/persistence/memoryimpl/StorageImpl.java Fri Sep 06 17:01:01 2002 +0000
31.3 @@ -127,8 +127,7 @@
31.4 }
31.5
31.6 public void open(boolean createOnNoExist, ObjectResolver resolver) throws StorageException {
31.7 - Log.out.println("Reading storage from XML document ...");
31.8 - Log.out.indent();
31.9 + Logger.getDefault().log("Reading storage from XML document ...");
31.10 String className = null;
31.11 if (this.persistent) {
31.12 try {
31.13 @@ -140,8 +139,7 @@
31.14 String str = XmlUtils.readTagStart(is); // <Index>
31.15 if (str.equals("/MDRStorage")) break;
31.16 className = XmlUtils.readTextTag(is); // <class>
31.17 - Log.out.println("Index:"+className);
31.18 - Log.out.indent();
31.19 + Logger.getDefault().log("Index:"+className);
31.20
31.21 Streamable object = null;
31.22 try {
31.23 @@ -153,25 +151,19 @@
31.24 primaryIndex = (SinglevaluedIndexImpl) object;
31.25 }
31.26 } catch (ClassNotFoundException e) {
31.27 - e.printStackTrace(Log.out);
31.28 - throw new StoragePersistentDataException(e.getMessage());
31.29 + throw (StoragePersistentDataException) Logger.getDefault().annotate(new StoragePersistentDataException(e.getMessage()), e);
31.30 } catch (InstantiationException e) {
31.31 - e.printStackTrace(Log.out);
31.32 - throw new StoragePersistentDataException(e.getMessage());
31.33 + throw (StorageException) Logger.getDefault().annotate(new StoragePersistentDataException(e.getMessage()), e);
31.34 } catch (IllegalAccessException e) {
31.35 - e.printStackTrace(Log.out);
31.36 - throw new StoragePersistentDataException(e.getMessage());
31.37 + throw (StorageException) Logger.getDefault().annotate(new StoragePersistentDataException(e.getMessage()), e);
31.38 }
31.39 XmlUtils.skipTagEnd(is); // </Index>
31.40 - Log.out.unindent();
31.41 }
31.42 } catch ( java.io.IOException e ) {
31.43 - e.printStackTrace(Log.out);
31.44 - throw new StoragePersistentDataException(e.getMessage());
31.45 + throw (StoragePersistentDataException) Logger.getDefault().annotate(new StoragePersistentDataException(e.getMessage()), e);
31.46 }
31.47 }
31.48 - Log.out.unindent();
31.49 - Log.out.println("Finished reading document.");
31.50 + Logger.getDefault().log("Finished reading document.");
31.51 }
31.52
31.53 public void objectStateChanged(Object key) throws StorageException {
31.54 @@ -230,7 +222,7 @@
31.55 String className = index.getClass().getName();
31.56 str = "<Index><class>"+className+"</class>";
31.57 outputStream.write(str.getBytes());
31.58 - Log.out.println("Save index:" + ((Index)index).getName() );
31.59 + Logger.getDefault().log("Save index:" + ((Index)index).getName() );
31.60 ((Streamable) index).write(outputStream);
31.61 //Log.out.println("...saved");
31.62 str = "</Index>";
31.63 @@ -240,7 +232,7 @@
31.64 outputStream.write(str.getBytes());
31.65 outputStream.close();
31.66 } catch (java.io.IOException e) {
31.67 - e.printStackTrace();
31.68 + Logger.getDefault().notify(e);
31.69 }
31.70 }
31.71 }
32.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexSet.java Fri Sep 06 12:21:51 2002 +0000
32.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexSet.java Fri Sep 06 17:01:01 2002 +0000
32.3 @@ -12,6 +12,8 @@
32.4 */
32.5 package org.netbeans.mdr.storagemodel;
32.6
32.7 +import org.netbeans.mdr.util.Logger;
32.8 +
32.9 import java.util.*;
32.10
32.11 import javax.jmi.reflect.*;
32.12 @@ -57,8 +59,7 @@
32.13 try {
32.14 keyObject = (StorableObject) storage.getObject((MOFID) indexKey);
32.15 } catch (StorageException e) {
32.16 - e.printStackTrace();
32.17 - throw new DebugException();
32.18 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
32.19 }
32.20 } else {
32.21 keyObject = null;
32.22 @@ -135,8 +136,7 @@
32.23
32.24 return result;
32.25 } catch (StorageException e) {
32.26 - e.printStackTrace();
32.27 - throw new DebugException();
32.28 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
32.29 }
32.30 }
32.31
32.32 @@ -172,8 +172,7 @@
32.33 // duplicate element -> return false
32.34 return false;
32.35 } catch (StorageException e) {
32.36 - e.printStackTrace();
32.37 - throw new DebugException();
32.38 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
32.39 }
32.40 }
32.41
33.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexUList.java Fri Sep 06 12:21:51 2002 +0000
33.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexUList.java Fri Sep 06 17:01:01 2002 +0000
33.3 @@ -19,6 +19,7 @@
33.4 import org.netbeans.mdr.handlers.BaseObjectHandler;
33.5 import org.netbeans.mdr.persistence.*;
33.6 import org.netbeans.mdr.util.DebugException;
33.7 +import org.netbeans.mdr.util.Logger;
33.8
33.9 /**
33.10 *
33.11 @@ -36,8 +37,7 @@
33.12 try {
33.13 return orderedIndex.getItemsOrdered(indexKey);
33.14 } catch (StorageException e) {
33.15 - e.printStackTrace();
33.16 - throw new DebugException();
33.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
33.18 }
33.19 }
33.20
33.21 @@ -46,8 +46,7 @@
33.22 return (List) storage.getObjectsFromIndex(index, indexKey);
33.23
33.24 } catch (StorageException e) {
33.25 - e.printStackTrace();
33.26 - throw new DebugException();
33.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
33.28 }
33.29 }
33.30
33.31 @@ -284,8 +283,7 @@
33.32 }
33.33
33.34 } catch (StorageException e) {
33.35 - e.printStackTrace ();
33.36 - throw new DebugException();
33.37 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
33.38 }
33.39 }
33.40 }
34.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AssociationLink.java Fri Sep 06 12:21:51 2002 +0000
34.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AssociationLink.java Fri Sep 06 17:01:01 2002 +0000
34.3 @@ -15,6 +15,7 @@
34.4 import org.netbeans.mdr.persistence.StorageException;
34.5 import org.netbeans.mdr.persistence.MOFID;
34.6 import org.netbeans.mdr.util.DebugException;
34.7 +import org.netbeans.mdr.util.Logger;
34.8
34.9 /**
34.10 *
34.11 @@ -37,8 +38,7 @@
34.12 this.end1 = (StorableObject) storage.getObject(end1);
34.13 this.end2 = (StorableObject) storage.getObject(end2);
34.14 } catch (Exception e) {
34.15 - e.printStackTrace();
34.16 - throw new DebugException();
34.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
34.18 }
34.19 }
34.20
35.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Fri Sep 06 12:21:51 2002 +0000
35.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Fri Sep 06 17:01:01 2002 +0000
35.3 @@ -88,8 +88,7 @@
35.4 attrName = IOUtils.readString(stream);
35.5 cacheValues(storable.getClassProxy().getAttrDesc(attrName));
35.6 } catch (StorageException e) {
35.7 - e.printStackTrace();
35.8 - throw new DebugException(e.toString());
35.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
35.10 }
35.11
35.12 for (int i = 0; i < size; i++) {
35.13 @@ -132,8 +131,7 @@
35.14 try {
35.15 setAttribComposite((RefObject) obj);
35.16 } catch (StorageException e) {
35.17 - e.printStackTrace();
35.18 - throw new DebugException();
35.19 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
35.20 }
35.21 }
35.22 mdrObject.objectChanged();
35.23 @@ -192,8 +190,7 @@
35.24 try {
35.25 clearAttribComposite((RefObject) obj);
35.26 } catch (StorageException e) {
35.27 - e.printStackTrace();
35.28 - throw new DebugException();
35.29 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
35.30 }
35.31 }
35.32 mdrObject.objectChanged();
35.33 @@ -269,8 +266,7 @@
35.34 try {
35.35 clearAttribComposite((RefObject) lastRead);
35.36 } catch (StorageException e) {
35.37 - e.printStackTrace();
35.38 - throw new DebugException();
35.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
35.40 }
35.41 }
35.42 if (isIndexed)
36.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrList.java Fri Sep 06 12:21:51 2002 +0000
36.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrList.java Fri Sep 06 17:01:01 2002 +0000
36.3 @@ -18,6 +18,7 @@
36.4 import org.netbeans.mdr.persistence.StorageException;
36.5 import org.netbeans.mdr.persistence.MOFID;
36.6 import org.netbeans.mdr.util.DebugException;
36.7 +import org.netbeans.mdr.util.Logger;
36.8
36.9 /**
36.10 *
36.11 @@ -56,8 +57,7 @@
36.12 try {
36.13 setAttribComposite((RefObject) obj);
36.14 } catch (StorageException e) {
36.15 - e.printStackTrace();
36.16 - throw new DebugException();
36.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
36.18 }
36.19 }
36.20
36.21 @@ -101,8 +101,7 @@
36.22 try {
36.23 clearAttribComposite((RefObject) result);
36.24 } catch (StorageException e) {
36.25 - e.printStackTrace();
36.26 - throw new DebugException();
36.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
36.28 }
36.29 }
36.30
36.31 @@ -125,8 +124,7 @@
36.32 clearAttribComposite((RefObject) result);
36.33 setAttribComposite((RefObject) obj);
36.34 } catch (StorageException e) {
36.35 - e.printStackTrace();
36.36 - throw new DebugException();
36.37 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
36.38 }
36.39 }
36.40
36.41 @@ -161,8 +159,7 @@
36.42 try {
36.43 setAttribComposite((RefObject) obj);
36.44 } catch (StorageException e) {
36.45 - e.printStackTrace();
36.46 - throw new DebugException();
36.47 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
36.48 }
36.49 }
36.50
36.51 @@ -200,8 +197,7 @@
36.52 clearAttribComposite((RefObject) lastRead);
36.53 setAttribComposite((RefObject) obj);
36.54 } catch (StorageException e) {
36.55 - e.printStackTrace();
36.56 - throw new DebugException();
36.57 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
36.58 }
36.59 }
36.60
37.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/BootReader.java Fri Sep 06 12:21:51 2002 +0000
37.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/BootReader.java Fri Sep 06 17:01:01 2002 +0000
37.3 @@ -78,7 +78,7 @@
37.4 }
37.5
37.6 public InputSource resolveEntity(String publicID, String systemID) {
37.7 - System.out.println("resolving reference: " + publicID + ", " + systemID);
37.8 + Logger.getDefault().log("resolving reference: " + publicID + ", " + systemID);
37.9 return new InputSource(new StringReader(""));
37.10 }
37.11 }
37.12 @@ -131,7 +131,7 @@
37.13 rebuildMetas();
37.14 return result;
37.15 } catch (ParserConfigurationException e) {
37.16 - System.out.println("Unable to parse document. "+e.getMessage() );
37.17 + Logger.getDefault().log("Unable to parse document. "+e.getMessage() );
37.18 return null;
37.19 }
37.20 }
37.21 @@ -196,8 +196,7 @@
37.22 mdrStorage.rebuildMetas(NBMDRepositoryImpl.BOOT_MOF, objectsByName);
37.23 mdrStorage.setProperty(MdrStorage.MOF_TOP_PACKAGE, sp.getMofId());
37.24 } catch (Exception e) {
37.25 - e.printStackTrace();
37.26 - throw new DebugException("Error: " + e);
37.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.28 }
37.29 }
37.30
37.31 @@ -275,8 +274,7 @@
37.32 try {
37.33 maxSize = Integer.parseInt(upper);
37.34 } catch (NumberFormatException e) {
37.35 - e.printStackTrace();
37.36 - throw new DebugException();
37.37 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.38 }
37.39 logicalMOFName = name.getStorageID() + "." + attName;
37.40 StorableClass.AttributeDescriptor desc = new StorableClass.AttributeDescriptor(mdrStorage, new MOFID (bootSequenceNumber(logicalMOFName), logicalMOFName), attName, Object.class, 0, maxSize, false, true, true, null);
37.41 @@ -307,7 +305,7 @@
37.42 if ((sc != null) && (storableXmiId != null)) {
37.43 proxyIdByXmiId.put(storableXmiId, sc.getMofId()); //prepare for later use - CLASSES are enough
37.44 } else {
37.45 - Log.out.println( "Unable to set proxy by XmiId: "+nonAbstract.getNodeName() );
37.46 + Logger.getDefault().log( "Unable to set proxy by XmiId: "+nonAbstract.getNodeName() );
37.47 }
37.48
37.49 } else if (nodeName.equals(MdrStorage.MODEL_ASSOCIATION)) {
37.50 @@ -437,7 +435,7 @@
37.51 objectsByName.put(name, instance.getMofId());
37.52 ObjectDescriptor od = new ObjectDescriptor(classNode, instance, name);
37.53 if (odByName.put(name, od) != null) {
37.54 - System.out.println("duplicate for: " + name);
37.55 + Logger.getDefault().log("duplicate for: " + name);
37.56 }
37.57 if (xmiId != null) {
37.58 odByXmiId.put(xmiId, od);
37.59 @@ -501,9 +499,9 @@
37.60 readFeatureValues(od, (ObjectDescriptor) odByName.get(od.getStorable().getMetaObjectId()));
37.61 /*
37.62 try {
37.63 - System.out.println("- name: " + od.getStorable().getAttribute("name"));
37.64 + Logger.getDefault().log("- name: " + od.getStorable().getAttribute("name"));
37.65 if (od.getStorable().getAttribute("name") == null) {
37.66 - System.out.println("null:" + XmiUtils.getXmiAttrValueAsString(od.getNode(), MOFConstants.MODEL_MODEL_ELEMENT_NAME));
37.67 + Logger.getDefault().log("null:" + XmiUtils.getXmiAttrValueAsString(od.getNode(), MOFConstants.MODEL_MODEL_ELEMENT_NAME));
37.68 }
37.69 } catch (Exception e) {
37.70 }
37.71 @@ -542,8 +540,7 @@
37.72 }
37.73 }
37.74 } catch (StorageException e) {
37.75 - e.printStackTrace();
37.76 - throw new DebugException();
37.77 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.78 }
37.79 }
37.80
37.81 @@ -587,8 +584,7 @@
37.82 try {
37.83 value = StructImpl.newInstance(Class.forName(JMI_PACKAGE_PREFIX + getObjectName((MOFID)dataType.getName())), new ArrayList(fields.keySet()), fields, parseDots(dataType.getName()));
37.84 } catch (ClassNotFoundException e) {
37.85 - e.printStackTrace();
37.86 - throw new DebugException();
37.87 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.88 }
37.89 } else {
37.90 if (feature.isMultivalued()) {
37.91 @@ -600,7 +596,7 @@
37.92 value = x;
37.93 } else {
37.94 value = decodeStringValue(XmiUtils.getXmiAttrValueAsString(node, feature.getName().getStorageID()), metaType, dataType);
37.95 -// System.out.println("multivalued: " + feature.getName() + ", " + value);
37.96 +// Logger.getDefault().log("multivalued: " + feature.getName() + ", " + value);
37.97 }
37.98 }
37.99
37.100 @@ -627,10 +623,10 @@
37.101 } else if (typeName.equals(MdrStorage.DATATYPES_LONG)) {
37.102 value = new Long(stringValue);
37.103 } else {
37.104 - System.out.println("unrecognized type: " + typeName);
37.105 + Logger.getDefault().log("unrecognized type: " + typeName);
37.106 }
37.107 } else {
37.108 - System.out.println("unrecognized metatype: " + metaType);
37.109 + Logger.getDefault().log("unrecognized metatype: " + metaType);
37.110 }
37.111
37.112 return value;
37.113 @@ -665,8 +661,7 @@
37.114 }
37.115 return sp;
37.116 } catch ( StorageException e ) {
37.117 - e.printStackTrace();
37.118 - throw new DebugException("Storage exception: " + e);
37.119 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.120 }
37.121 }
37.122
37.123 @@ -694,8 +689,7 @@
37.124 immediatePackage.addClass(metaObjectName, sc.getMofId());
37.125 return sc;
37.126 } catch (StorageException e) {
37.127 - e.printStackTrace();
37.128 - throw new DebugException("Storage exception: " + e);
37.129 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.130 }
37.131 }
37.132
37.133 @@ -751,8 +745,7 @@
37.134 storage.addBootObject(so.getMofId());
37.135 return so;
37.136 } catch (StorageException e) {
37.137 - e.printStackTrace();
37.138 - throw new DebugException("Storage exception: " + e);
37.139 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
37.140 }
37.141 }
37.142
37.143 @@ -789,7 +782,7 @@
37.144 feature = (Feature) features.next();
37.145 if (feature.getType() == feature.REFERENCE) {
37.146 MOFID endName = (MOFID) otherEnds.get(feature.getAssocEndName());
37.147 -// System.out.println("registering reference: " + feature.getName() + " for end: " + endName);
37.148 +// Logger.getDefault().log("registering reference: " + feature.getName() + " for end: " + endName);
37.149 ((StorableClass)sc).addReferenceDescriptor(feature.getName(), getObjectName((MOFID)feature.getName()), (MOFID) proxyIdByName.get(feature.getAssocName()), getObjectName(endName));
37.150 }
37.151 }
38.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/CachedCollection.java Fri Sep 06 12:21:51 2002 +0000
38.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/CachedCollection.java Fri Sep 06 17:01:01 2002 +0000
38.3 @@ -17,6 +17,7 @@
38.4
38.5 import org.netbeans.mdr.util.DebugException;
38.6 import org.netbeans.mdr.persistence.StorageException;
38.7 +import org.netbeans.mdr.util.Logger;
38.8
38.9 /**
38.10 * Read-only collection. Wraps an inner collection all entries of which are
38.11 @@ -79,8 +80,7 @@
38.12 array[i] = storage.getObject((org.netbeans.mdr.persistence.MOFID) array[i]);
38.13 }
38.14 } catch (Exception e) {
38.15 - e.printStackTrace();
38.16 - throw new DebugException();
38.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
38.18 }
38.19
38.20 return array;
38.21 @@ -129,8 +129,7 @@
38.22 try {
38.23 return storage.getObject((org.netbeans.mdr.persistence.MOFID) innerIterator.next());
38.24 } catch (StorageException e) {
38.25 - e.printStackTrace();
38.26 - throw new DebugException();
38.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
38.28 }
38.29 }
38.30
39.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/DatatypeDescriptor.java Fri Sep 06 12:21:51 2002 +0000
39.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/DatatypeDescriptor.java Fri Sep 06 17:01:01 2002 +0000
39.3 @@ -104,8 +104,7 @@
39.4 try {
39.5 memberTypes.add(BaseObjectHandler.resolveInterface((String) storage.storageValues(this.storageId).resolve(memberTypeIDs[i])));
39.6 } catch (ClassNotFoundException e) {
39.7 - e.printStackTrace();
39.8 - throw new DebugException();
39.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
39.10 }
39.11 }
39.12 memberTypes = Collections.unmodifiableList(memberTypes);
40.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/IndexImmutSet.java Fri Sep 06 12:21:51 2002 +0000
40.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/IndexImmutSet.java Fri Sep 06 17:01:01 2002 +0000
40.3 @@ -16,6 +16,7 @@
40.4
40.5 import org.netbeans.mdr.persistence.*;
40.6 import org.netbeans.mdr.util.DebugException;
40.7 +import org.netbeans.mdr.util.Logger;
40.8
40.9 /**
40.10 * Instances of this class are immutable, live collections representing
40.11 @@ -56,8 +57,7 @@
40.12 try {
40.13 return index.getItems(indexKey);
40.14 } catch (StorageException e) {
40.15 - e.printStackTrace();
40.16 - throw new DebugException();
40.17 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
40.18 }
40.19 }
40.20
40.21 @@ -65,8 +65,7 @@
40.22 try {
40.23 return storage.getObjectsFromIndex(index, indexKey);
40.24 } catch (StorageException e) {
40.25 - e.printStackTrace();
40.26 - throw new DebugException();
40.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
40.28 }
40.29 }
40.30
41.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/MdrStorage.java Fri Sep 06 12:21:51 2002 +0000
41.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/MdrStorage.java Fri Sep 06 17:01:01 2002 +0000
41.3 @@ -239,8 +239,8 @@
41.4 } catch (Exception e) {
41.5 // in case the passed StorageFactory class could not be created, create default implementation
41.6 // of StorageFactory interface
41.7 - e.printStackTrace();
41.8 - Log.out.println("using: org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl");
41.9 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
41.10 + Logger.getDefault().log("using: org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl");
41.11 storageFactory = new org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl();
41.12 }
41.13
41.14 @@ -250,8 +250,7 @@
41.15 // cache the NULL MOFID of the boot storage
41.16 this.bootNullMofId = storageFactory.createNullMOFID();
41.17 } catch (StorageException e) {
41.18 - e.printStackTrace();
41.19 - throw new DebugException("Accessing storage factory failed: " + e.toString());
41.20 + throw (DebugException) Logger.getDefault().annotate(new DebugException("Failed accessing storage factory."), e);
41.21 }
41.22
41.23 // create the utilities for storage management
41.24 @@ -389,7 +388,7 @@
41.25 // everything succeeded -> return true
41.26 result = true;
41.27 } catch (Exception e) {
41.28 - e.printStackTrace();
41.29 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
41.30 // storage not found or corrupted -> create new one
41.31 try {
41.32 // in case the storage is already open, try to close it
41.33 @@ -542,8 +541,7 @@
41.34 throw new DebugException("No such storage");
41.35 return (org.netbeans.mdr.persistence.MOFID) propertiesIndex.get(key);
41.36 } catch (StorageException e) {
41.37 - e.printStackTrace();
41.38 - throw new DebugException();
41.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.40 }
41.41 }
41.42
41.43 @@ -570,8 +568,7 @@
41.44 throw new DebugException("No such storage");
41.45 propertiesIndex.put(key, value);
41.46 } catch (StorageException e) {
41.47 - e.printStackTrace();
41.48 - throw new DebugException();
41.49 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.50 }
41.51 }
41.52
41.53 @@ -1012,7 +1009,6 @@
41.54 try {
41.55 StorableClass sc = getIndexClassProxy (context, indexName);
41.56 if (sc == null) {
41.57 - Thread.dumpStack();
41.58 throw new DebugException ("Index " + indexName + " does not exist in the specified context.");
41.59 }
41.60 StorableClass.IndexDescriptor desc = sc.getAdditionalIndex (indexName);
41.61 @@ -1218,8 +1214,7 @@
41.62 rebuildMetas(NBMDRepositoryImpl.PURE_MOF, fromTo);
41.63 dropBoot();
41.64 } catch (Exception e) {
41.65 - e.printStackTrace();
41.66 - throw new DebugException("Error: " + e);
41.67 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.68 }
41.69 }
41.70
41.71 @@ -1375,8 +1370,7 @@
41.72 //
41.73 // return result;
41.74 // } catch (java.lang.Exception e) {
41.75 - // e.printStackTrace();
41.76 - // throw new DebugException("Error: " + e);
41.77 + // throw Logger.getDefault().annotate(new DebugException(), e);
41.78 // }
41.79 // }
41.80 //
41.81 @@ -1654,8 +1648,7 @@
41.82 }
41.83 return ((Integer) index).intValue() + 1;
41.84 } catch (StorageException e) {
41.85 - e.printStackTrace();
41.86 - throw new DebugException();
41.87 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.88 }
41.89 }
41.90
41.91 @@ -1688,7 +1681,6 @@
41.92 if (value == null) return 0;
41.93 Integer result = (Integer) map.get(value);
41.94 if (result == null) {
41.95 - Thread.dumpStack();
41.96 throw new DebugException("Value not found.");
41.97 }
41.98 return result.intValue() + 1;
41.99 @@ -1707,8 +1699,7 @@
41.100 map.put(list.get(i), new Integer(i));
41.101 }
41.102 } catch (IOException e) {
41.103 - e.printStackTrace();
41.104 - throw new DebugException();
41.105 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.106 }
41.107 }
41.108
41.109 @@ -1724,8 +1715,7 @@
41.110 IOUtils.writeMOFID (outputStream, id, this.storage);
41.111 IOUtils.write(outputStream, list);
41.112 } catch (IOException e) {
41.113 - e.printStackTrace();
41.114 - throw new DebugException();
41.115 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
41.116 }
41.117 }
41.118 }
42.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableAssociation.java Fri Sep 06 12:21:51 2002 +0000
42.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableAssociation.java Fri Sep 06 17:01:01 2002 +0000
42.3 @@ -104,7 +104,7 @@
42.4
42.5 super(mdrStorage, immediatePackage, meta);
42.6
42.7 - //System.out.println("association: endA: " + endA + ", endB: " + endB);
42.8 + //Logger.getDefault().log("association: endA: " + endA + ", endB: " + endB);
42.9 this.endA = endA;
42.10 this.endB = endB;
42.11 this.endAId = endAId;
42.12 @@ -272,7 +272,7 @@
42.13 * @return
42.14 */
42.15 public Object queryObjects(String endName, org.netbeans.mdr.persistence.MOFID obj) throws StorageException {
42.16 - //System.out.println("query: end: " + endName + ", endA:" + endA + ", endB:" + endB);
42.17 + //Logger.getDefault().log("query: end: " + endName + ", endA:" + endA + ", endB:" + endB);
42.18 boolean isEndA = endName.equals(endB);
42.19 boolean multi = isEndA ? multiValuedA : multiValuedB;
42.20 boolean order = isEndA ? orderedA : orderedB;
42.21 @@ -323,8 +323,7 @@
42.22 }
42.23 }
42.24 } catch (ClassNotFoundException e) {
42.25 - e.printStackTrace();
42.26 - throw new DebugException();
42.27 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
42.28 }
42.29 }
42.30
42.31 @@ -341,8 +340,7 @@
42.32 }
42.33 }
42.34 } catch (ClassNotFoundException e) {
42.35 - e.printStackTrace();
42.36 - throw new DebugException();
42.37 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
42.38 }
42.39 }
42.40
42.41 @@ -356,7 +354,7 @@
42.42 (RefObject) BaseObjectHandler.getHandler(getMdrStorage().getObject(endBId)));
42.43 }
42.44 } catch (StorageException e) {
42.45 - e.printStackTrace();
42.46 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
42.47 }
42.48 throw new DebugException();
42.49 }
42.50 @@ -532,7 +530,7 @@
42.51 IOUtils.writeBoolean(outputStream, indexedA);
42.52 IOUtils.writeBoolean(outputStream, indexedB);
42.53 } catch (java.io.IOException e) {
42.54 - e.printStackTrace();
42.55 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
42.56 }
42.57 }
42.58
42.59 @@ -569,14 +567,11 @@
42.60 indexedA = IOUtils.readBoolean(inputStream);
42.61 indexedB = IOUtils.readBoolean(inputStream);
42.62 } catch (java.io.IOException e) {
42.63 - e.printStackTrace(Log.out);
42.64 - throw new RuntimeException (e.getMessage());
42.65 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
42.66 } catch (StorageException ex) {
42.67 - ex.printStackTrace(Log.out);
42.68 - throw new RuntimeException(ex.getMessage());
42.69 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), ex);
42.70 } catch (ClassNotFoundException e) {
42.71 - e.printStackTrace();
42.72 - throw new RuntimeException();
42.73 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
42.74 }
42.75 }
42.76
42.77 @@ -712,8 +707,7 @@
42.78 a = (StorableObject) getMdrStorage().getObject(aID);
42.79 } catch (StorageException se) {
42.80 // {XXX]: better exception handling
42.81 - se.printStackTrace();
42.82 - throw new DebugException();
42.83 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), se);
42.84 }
42.85 }
42.86 AssociationLink link = new AssociationLink(a,b);
43.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableBaseObject.java Fri Sep 06 12:21:51 2002 +0000
43.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableBaseObject.java Fri Sep 06 17:01:01 2002 +0000
43.3 @@ -137,8 +137,7 @@
43.4 } while (temp != null);
43.5 outermostPackage = pkg.getMofId();
43.6 } catch (StorageException e) {
43.7 - e.printStackTrace ();
43.8 - throw new DebugException (e.getMessage ());
43.9 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
43.10 }
43.11 } // if
43.12 } // if
43.13 @@ -194,8 +193,7 @@
43.14 IOUtils.writeMOFID (outputStream, id,this.getMdrStorage(), this.id);
43.15 IOUtils.write (outputStream, this.handlerProperties, this);
43.16 } catch (java.io.IOException e) {
43.17 - e.printStackTrace(Log.out);
43.18 - throw new RuntimeException (e.getMessage());
43.19 + throw (DebugException) Logger.getDefault().annotate(new RuntimeException(), e);
43.20 }
43.21 }
43.22
43.23 @@ -208,8 +206,7 @@
43.24 this.handlerProperties = (Map) IOUtils.read (inputStream, this, null);
43.25 outermostPackage = null; // not inited
43.26 } catch (java.io.IOException e) {
43.27 - e.printStackTrace(Log.out);
43.28 - throw new RuntimeException (e.getMessage());
43.29 + throw (DebugException) Logger.getDefault().annotate(new RuntimeException(), e);
43.30 }
43.31 }
43.32
43.33 @@ -297,8 +294,7 @@
43.34 try {
43.35 getMdrStorage().objectStateChanged(id);
43.36 } catch (StorageException e) {
43.37 - e.printStackTrace();
43.38 - throw new DebugException();
43.39 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
43.40 }
43.41 }
43.42
44.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Fri Sep 06 12:21:51 2002 +0000
44.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Fri Sep 06 17:01:01 2002 +0000
44.3 @@ -347,18 +347,18 @@
44.4
44.5 int result = attributes.indexOf(attributeName);
44.6 if (result < 0) {
44.7 - System.out.println("attribute not found: " + attributeName);
44.8 - System.out.println("collected attributes of " + getMofId() + ":");
44.9 + Logger.getDefault().log("attribute not found: " + attributeName);
44.10 + Logger.getDefault().log("collected attributes of " + getMofId() + ":");
44.11 for (Iterator it = attributes.iterator(); it.hasNext();) {
44.12 - System.out.println("\t" + it.next());
44.13 + Logger.getDefault().log("\t" + it.next());
44.14 }
44.15 - System.out.println("registered superclasses:");
44.16 + Logger.getDefault().log("registered superclasses:");
44.17 for (Iterator it = superclasses.iterator(); it.hasNext();) {
44.18 - System.out.println("\t" + it.next());
44.19 + Logger.getDefault().log("\t" + it.next());
44.20 }
44.21 - System.out.println("registered subclasses:");
44.22 + Logger.getDefault().log("registered subclasses:");
44.23 for (Iterator it = subclasses.iterator(); it.hasNext();) {
44.24 - System.out.println("\t" + it.next());
44.25 + Logger.getDefault().log("\t" + it.next());
44.26 }
44.27 throw new DebugException();
44.28 }
44.29 @@ -426,7 +426,7 @@
44.30 if (attributes == null) {
44.31 synchronized (attrMutex) {
44.32 if (attributes == null) {
44.33 - //System.out.println("collecting attributes for: " + getMofId());
44.34 + //Logger.getDefault().log("collecting attributes for: " + getMofId());
44.35 attributes = new ArrayList();
44.36 List attribDescs = new ArrayList();
44.37 indexDescriptors = new ArrayList();
44.38 @@ -671,7 +671,7 @@
44.39 }
44.40
44.41 } catch (java.io.IOException e) {
44.42 - e.printStackTrace();
44.43 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
44.44 }
44.45 }
44.46
44.47 @@ -729,8 +729,7 @@
44.48 }
44.49
44.50 } catch (IOException e) {
44.51 - e.printStackTrace();
44.52 - throw new DebugException("IOException: " + e);
44.53 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
44.54 }
44.55 }
44.56
44.57 @@ -769,8 +768,7 @@
44.58 try {
44.59 proxy = (StorableAssociation) getMdrStorage().getObject(proxyId);
44.60 } catch (StorageException e) {
44.61 - e.printStackTrace();
44.62 - throw new DebugException();
44.63 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
44.64 }
44.65 }
44.66 return proxy;
45.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableFeatured.java Fri Sep 06 12:21:51 2002 +0000
45.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableFeatured.java Fri Sep 06 17:01:01 2002 +0000
45.3 @@ -93,9 +93,8 @@
45.4 try {
45.5 checkInitValue (desc, value);
45.6 } catch (RuntimeException e) {
45.7 - System.out.println("multivalued: " + desc.isMultivalued() + ", name: " + desc.getName());
45.8 - System.out.println("maxSize: " + desc.getMaxSize() + ", minSize: " + desc.getMinSize());
45.9 - e.printStackTrace();
45.10 + Logger.getDefault().annotate(e, "multivalued: " + desc.isMultivalued() + ", name: " + desc.getName());
45.11 + Logger.getDefault().annotate(e, "maxSize: " + desc.getMaxSize() + ", minSize: " + desc.getMinSize());
45.12 throw e;
45.13 }
45.14 result = value;
45.15 @@ -111,7 +110,7 @@
45.16 try {
45.17 return (RefObject) BaseObjectHandler.getHandler(getMdrStorage().getObject(mofId));
45.18 } catch (StorageException e) {
45.19 - e.printStackTrace();
45.20 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
45.21 return null;
45.22 }
45.23 }
46.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableObject.java Fri Sep 06 12:21:51 2002 +0000
46.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableObject.java Fri Sep 06 17:01:01 2002 +0000
46.3 @@ -88,7 +88,7 @@
46.4 }
46.5
46.6 public void setAttribute(String featureName, Object value) throws StorageException {
46.7 - if (value == null) Thread.dumpStack();
46.8 + if (value == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
46.9 setAttribute(getClassProxy().getAttrIndex(featureName), value);
46.10 }
46.11
46.12 @@ -352,7 +352,7 @@
46.13 }
46.14 }
46.15 } catch (java.io.IOException e) {
46.16 - e.printStackTrace();
46.17 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
46.18 }
46.19 }
46.20
46.21 @@ -366,8 +366,7 @@
46.22 attribComposite = (org.netbeans.mdr.persistence.MOFID) IOUtils.read (inputStream, this);
46.23 // init value of "meta" (not serialized in case of StorableObject)
46.24 } catch (java.io.IOException e) {
46.25 - e.printStackTrace(Log.out);
46.26 - throw new RuntimeException(e.getMessage());
46.27 + throw (RuntimeException) Logger.getDefault().annotate(new RuntimeException(e.getMessage()), e);
46.28 }
46.29 // init value of "meta" (not serialized in case of StorableObject)
46.30 try {
46.31 @@ -375,8 +374,7 @@
46.32 meta = classProxy.getMetaObjectId();
46.33 immediatePackage = classProxy.getImmediatePackageId();
46.34 } catch (StorageException e) {
46.35 - e.printStackTrace(Log.out);
46.36 - throw new DebugException(e.getMessage());
46.37 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
46.38 }
46.39
46.40 try {
46.41 @@ -386,12 +384,11 @@
46.42 values = new Object[count];
46.43 for (int i = 0; i < count; i++) {
46.44 values[i] = IOUtils.read(inputStream, this, getClassProxy().getAttrDesc(i).getType().getName());
46.45 - //System.out.println(getClassProxy().getAttrDesc(i).getName() + " = " + values[i]);
46.46 + //Logger.getDefault().log(getClassProxy().getAttrDesc(i).getName() + " = " + values[i]);
46.47 }
46.48 }
46.49 } catch (Exception e) {
46.50 - e.printStackTrace();
46.51 - throw new DebugException("Exception: " + e.getMessage());
46.52 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
46.53 }
46.54 }
46.55
46.56 @@ -461,7 +458,7 @@
46.57 buf.append(suffix);
46.58 }
46.59 attrIndex.remove(buf.toString(), mofId);
46.60 - //System.out.println("remove: " + buf.toString ());
46.61 + //Logger.getDefault().log("remove: " + buf.toString ());
46.62
46.63 buf = new StringBuffer();
46.64 if (prefix.length() > 0) {
46.65 @@ -474,7 +471,7 @@
46.66 buf.append(suffix);
46.67 }
46.68 attrIndex.add(buf.toString(), mofId);
46.69 - //System.out.println("add: " + buf.toString ());
46.70 + //Logger.getDefault().log("add: " + buf.toString ());
46.71
46.72 } finally {
46.73 if (attrIndex != null) getMdrStorage().releaseAdditionalIndex();
46.74 @@ -510,8 +507,7 @@
46.75 StorableClass proxy = getClassProxy();
46.76 modifyIndex (proxy.getIndexes(id), false);
46.77 } catch (StorageException e) {
46.78 - e.printStackTrace ();
46.79 - throw new DebugException ();
46.80 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
46.81 }
46.82 }
46.83
46.84 @@ -520,8 +516,7 @@
46.85 StorableClass proxy = getClassProxy();
46.86 modifyIndex (proxy.getIndexes(id), true);
46.87 } catch (StorageException e) {
46.88 - e.printStackTrace ();
46.89 - throw new DebugException ();
46.90 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
46.91 }
46.92 }
46.93
46.94 @@ -538,10 +533,10 @@
46.95 try {
46.96 attrIndex = getMdrStorage().acquireAdditionalIndex(outermostPackageId, desc.getName());
46.97 if (remove) {
46.98 - //System.out.println("Remove: " + valuesToKey (fields, 0, fields.length - 1));
46.99 + //Logger.getDefault().log("Remove: " + valuesToKey (fields, 0, fields.length - 1));
46.100 attrIndex.remove(valuesToKey(fields, 0, fields.length - 1), mofId);
46.101 } else {
46.102 - //System.out.println("Add: " + valuesToKey (fields, 0, fields.length - 1));
46.103 + //Logger.getDefault().log("Add: " + valuesToKey (fields, 0, fields.length - 1));
46.104 attrIndex.add(valuesToKey(fields, 0, fields.length - 1), mofId);
46.105 }
46.106 } finally {
46.107 @@ -586,7 +581,7 @@
46.108 if (fields[x] instanceof StorableClass.IndexDescriptor.Attrib) {
46.109 String name = ((StorableClass.IndexDescriptor.Attrib) fields[x]).getName();
46.110 res = objectToString(values[getClassProxy().getAttrIndex(name)], fields[x].isOrdered());
46.111 - //System.out.println("valuesToKey, Attrib: " + res);
46.112 + //Logger.getDefault().log("valuesToKey, Attrib: " + res);
46.113 } else {
46.114 StorableClass.IndexDescriptor.AssocEnd endDesc = (StorableClass.IndexDescriptor.AssocEnd)fields[x];
46.115 StorableAssociation sa = (StorableAssociation) getMdrStorage().getObject(endDesc.getAssociation());
46.116 @@ -594,7 +589,7 @@
46.117 if (otherEndName.equals (endDesc.getName()))
46.118 otherEndName = sa.getEnd2Name ();
46.119 res = objectToString(sa.queryObjects(otherEndName, getMofId()), fields[x].isOrdered());
46.120 - //System.out.println("valuesToKey, AssocEnd: " + res);
46.121 + //Logger.getDefault().log("valuesToKey, AssocEnd: " + res);
46.122 }
46.123 buf.append(res);
46.124 if (x < pos_2)
47.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorablePackage.java Fri Sep 06 12:21:51 2002 +0000
47.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorablePackage.java Fri Sep 06 17:01:01 2002 +0000
47.3 @@ -234,7 +234,7 @@
47.4 ((DatatypeDescriptor) datatypes.get(name)).write(outputStream);
47.5 }
47.6 } catch (java.io.IOException e) {
47.7 - e.printStackTrace();
47.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
47.9 }
47.10 }
47.11
47.12 @@ -259,8 +259,7 @@
47.13 datatypes.put(name, DatatypeDescriptor.readResolve(inputStream, this));
47.14 }
47.15 } catch (IOException e) {
47.16 - e.printStackTrace();
47.17 - throw new DebugException("IOException: " + e);
47.18 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
47.19 }
47.20 }
47.21
48.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/TransientStorableObject.java Fri Sep 06 12:21:51 2002 +0000
48.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/TransientStorableObject.java Fri Sep 06 17:01:01 2002 +0000
48.3 @@ -20,6 +20,8 @@
48.4 import org.netbeans.mdr.persistence.StorageException;
48.5 import org.netbeans.mdr.storagemodel.transientimpl.TransientStorage;
48.6 import org.netbeans.mdr.util.DebugException;
48.7 +import org.netbeans.mdr.util.Logger;
48.8 +
48.9 /**
48.10 *
48.11 * @author tz97951
48.12 @@ -105,7 +107,7 @@
48.13 try {
48.14 super.setAttribute (key.intValue (), value);
48.15 } catch (StorageException se) {
48.16 - se.printStackTrace ();
48.17 + Logger.getDefault().notify(Logger.INFORMATIONAL, se);
48.18 }
48.19 }
48.20 }
49.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/transientimpl/TransactionalIndex.java Fri Sep 06 12:21:51 2002 +0000
49.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/transientimpl/TransactionalIndex.java Fri Sep 06 17:01:01 2002 +0000
49.3 @@ -17,6 +17,8 @@
49.4 import java.util.Stack;
49.5 import org.netbeans.mdr.persistence.Index;
49.6 import org.netbeans.mdr.persistence.StorageException;
49.7 +import org.netbeans.mdr.util.Logger;
49.8 +
49.9 /**
49.10 *
49.11 * @author tz97951
49.12 @@ -47,7 +49,7 @@
49.13 CompensatingTransaction ctx = (CompensatingTransaction) txlog.pop();
49.14 ctx.perform(this);
49.15 } catch (StorageException se) {
49.16 - se.printStackTrace();
49.17 + Logger.getDefault().notify(Logger.INFORMATIONAL, se);
49.18 }
49.19 }
49.20 }
50.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/transientimpl/TransientSinglevaluedIndex.java Fri Sep 06 12:21:51 2002 +0000
50.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/transientimpl/TransientSinglevaluedIndex.java Fri Sep 06 17:01:01 2002 +0000
50.3 @@ -24,6 +24,7 @@
50.4 import org.netbeans.mdr.persistence.Storage;
50.5 import org.netbeans.mdr.storagemodel.MdrStorage;
50.6 import org.netbeans.mdr.util.DebugException;
50.7 +import org.netbeans.mdr.util.Logger;
50.8
50.9 /**
50.10 *
50.11 @@ -66,7 +67,7 @@
50.12 try {
50.13 handleRemove(entry.getKey(), entry);
50.14 } catch (StorageException se) {
50.15 - se.printStackTrace();
50.16 + Logger.getDefault().notify(Logger.INFORMATIONAL, se);
50.17 }
50.18 }
50.19 }
50.20 @@ -133,7 +134,7 @@
50.21 handleRemove(entry.getKey(), entry);
50.22 result = true;
50.23 } catch (StorageException se) {
50.24 - se.printStackTrace();
50.25 + Logger.getDefault().notify(Logger.INFORMATIONAL, se);
50.26 }
50.27 }
50.28 }
50.29 @@ -220,7 +221,7 @@
50.30 try {
50.31 handleRemove(last.getKey(), last);
50.32 } catch (StorageException se) {
50.33 - se.printStackTrace();
50.34 + Logger.getDefault().notify(Logger.INFORMATIONAL, se);
50.35 }
50.36 last = null;
50.37 }
51.1 --- a/mdr/src/org/netbeans/mdr/util/EventNotifier.java Fri Sep 06 12:21:51 2002 +0000
51.2 +++ b/mdr/src/org/netbeans/mdr/util/EventNotifier.java Fri Sep 06 17:01:01 2002 +0000
51.3 @@ -171,8 +171,7 @@
51.4 Set collected = (Set) preChangeListeners.remove(event);
51.5 changeListeners.remove(event);
51.6 if (collected == null) {
51.7 - System.err.println("Change cancelled event not corresponding to any planned change event.");
51.8 - Thread.dumpStack();
51.9 + Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException("Change cancelled event not corresponding to any planned change event."));
51.10 return;
51.11 }
51.12 // fire changeCancelled event
51.13 @@ -181,7 +180,7 @@
51.14 ((MDRPreChangeListener) it.next()).changeCancelled(event);
51.15 } catch (RuntimeException e) {
51.16 // log the exception
51.17 - e.printStackTrace();
51.18 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
51.19 }
51.20 }
51.21 }
51.22 @@ -237,22 +236,20 @@
51.23 try {
51.24 globalQueue.wait();
51.25 } catch (InterruptedException e) {
51.26 - e.printStackTrace();
51.27 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
51.28 }
51.29 }
51.30 collected = (Collection) changeListeners.remove(event = (MDRChangeEvent) globalQueue.removeFirst());
51.31 }
51.32 if (collected == null) {
51.33 - System.err.println("Change event not corresponding to any planned change event.");
51.34 - Thread.dumpStack();
51.35 + Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException("Change event not corresponding to any planned change event."));
51.36 return;
51.37 }
51.38 for (Iterator it = collected.iterator(); it.hasNext();) {
51.39 try {
51.40 ((MDRChangeListener) it.next()).change(event);
51.41 } catch (RuntimeException e) {
51.42 - // log the exception
51.43 - e.printStackTrace();
51.44 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
51.45 }
51.46 }
51.47 }
51.48 @@ -278,7 +275,6 @@
51.49 * matching <code>mask</code>.
51.50 */
51.51 public void addListener(MDRChangeListener listener, int mask, Object source) {
51.52 - //System.out.println("-- CALLED: addListener on " + source + " with " + prettyPrintMask(mask));
51.53 if ( (listener == null) || (mask == 0) ) return;
51.54
51.55 synchronized (RegisteredListenerSets) {
51.56 @@ -336,7 +332,6 @@
51.57 * @exception DebugException if the event was already fired
51.58 */
51.59 public void firePlannedChange(Object current, MDRChangeEvent event) {
51.60 - //System.out.println("-- CALLED: firePlannedChange on " + current + " with type " + prettyPrintType(event));
51.61 localQueue.addLast(event);
51.62 HashSet preChange = new HashSet();
51.63 HashSet postChange = new HashSet();
51.64 @@ -346,8 +341,7 @@
51.65 try {
51.66 ((MDRPreChangeListener) it.next()).plannedChange(event);
51.67 } catch (RuntimeException e) {
51.68 - // log the exception
51.69 - e.printStackTrace();
51.70 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
51.71 }
51.72 }
51.73 if (preChangeListeners.put(event, preChange) != null) {
52.1 --- a/mdr/src/org/netbeans/mdr/util/IOUtils.java Fri Sep 06 12:21:51 2002 +0000
52.2 +++ b/mdr/src/org/netbeans/mdr/util/IOUtils.java Fri Sep 06 17:01:01 2002 +0000
52.3 @@ -196,7 +196,7 @@
52.4
52.5 } else if (object instanceof AttrImmutList) {
52.6 MdrStorage storage = storable.getMdrStorage();
52.7 - if (storage == null) Thread.dumpStack();
52.8 + if (storage == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.9 if (object instanceof AttrImmutUList) {
52.10 outputStream.write(T_LIST_U_IMMUTABLE);
52.11 } else {
52.12 @@ -216,7 +216,7 @@
52.13 outputStream.write(T_STRUCT);
52.14 RefStruct struct = (RefStruct) object;
52.15 MdrStorage storage = storable.getMdrStorage();
52.16 - if (storage == null) Thread.dumpStack();
52.17 + if (storage == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.18 writeInt(outputStream, storage.values(storable.getMofId()).indexOf(struct.refTypeName()));
52.19 List fields = struct.refFieldNames();
52.20 writeInt(outputStream, fields.size());
52.21 @@ -228,7 +228,7 @@
52.22
52.23 } else if (object instanceof RefEnum) {
52.24 MdrStorage storage = storable.getMdrStorage();
52.25 - if (storage == null) Thread.dumpStack();
52.26 + if (storage == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.27 outputStream.write(T_ENUM);
52.28 writeInt(outputStream, storage.values(storable.getMofId()).indexOf(object.toString()));
52.29
52.30 @@ -247,7 +247,7 @@
52.31
52.32 } else if (object instanceof Class) {
52.33 MdrStorage storage = storable.getMdrStorage();
52.34 - if (storage == null) Thread.dumpStack();
52.35 + if (storage == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.36 outputStream.write(T_CLASS);
52.37 writeInt(outputStream, storage.values(storable.getMofId()).indexOf(((Class) object).getName()));
52.38 /*
52.39 @@ -399,7 +399,7 @@
52.40 return result;
52.41 } case T_LIST_IMMUTABLE:
52.42 case T_LIST_U_IMMUTABLE: {
52.43 - if (storable == null) Thread.dumpStack();
52.44 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.45 AttrImmutList result;
52.46 if (type == T_LIST_IMMUTABLE) {
52.47 result = new AttrImmutList();
52.48 @@ -432,7 +432,7 @@
52.49 }
52.50 return result;
52.51 } case T_STRUCT: {
52.52 - if (storable == null) Thread.dumpStack();
52.53 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.54 MdrStorage storage = storable.getMdrStorage();
52.55 List qualifiedName = (List) storage.values(storable.getMofId()).resolve(readInt(inputStream));
52.56 int size = readInt(inputStream);
52.57 @@ -449,32 +449,29 @@
52.58 try {
52.59 clazz = BaseObjectHandler.resolveInterface(className);
52.60 } catch (ClassNotFoundException e) {
52.61 - e.printStackTrace();
52.62 - throw new DebugException();
52.63 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
52.64 }
52.65
52.66 return StructImpl.newInstance(clazz, fields, values, qualifiedName);
52.67 } case T_ENUM: {
52.68 - if (storable == null) Thread.dumpStack();
52.69 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.70 return EnumResolver.resolveEnum(className, (String) storable.getMdrStorage().values(storable.getMofId()).resolve(readInt(inputStream)));
52.71 } case T_MOF_REFERENCE: {
52.72 - if (storable == null) Thread.dumpStack();
52.73 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.74 return ((StorableClass) storable).new ReferenceDescriptor(readMOFID(inputStream, storable.getMdrStorage(), storable.getMofId()), readMOFID(inputStream, storable.getMdrStorage(), storable.getMofId()), readString(inputStream));
52.75 } case T_CLASS: {
52.76 - if (storable == null) Thread.dumpStack();
52.77 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.78 try {
52.79 return BaseObjectHandler.resolveInterface((String) storable.getMdrStorage().values(storable.getMofId()).resolve(readInt(inputStream)));
52.80 } catch (ClassNotFoundException e) {
52.81 - e.printStackTrace();
52.82 - throw new DebugException();
52.83 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
52.84 }
52.85 } case T_OBJECT: {
52.86 - if (storable == null) Thread.dumpStack();
52.87 + if (storable == null) Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException());
52.88 try {
52.89 return BaseObjectHandler.getHandler(storable.getMdrStorage().getObject(readMOFID(inputStream, storable.getMdrStorage(), storable.getMofId())));
52.90 } catch (StorageException e) {
52.91 - e.printStackTrace();
52.92 - throw new DebugException();
52.93 + throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);
52.94 }
52.95 } case T_MOFID: {
52.96 return readMOFID (inputStream, storable.getMdrStorage (), storable.getMofId());
52.97 @@ -486,8 +483,7 @@
52.98 try {
52.99 return new NbObjectInputStream(inputStream).readObject();
52.100 } catch (ClassNotFoundException ex) {
52.101 - ex.printStackTrace();
52.102 - throw new DebugException();
52.103 + throw Logger.getDefault().annotate(new DebugException(), e);
52.104 }
52.105 }
52.106 */
53.1 --- a/mdr/src/org/netbeans/mdr/util/ImplClass.java Fri Sep 06 12:21:51 2002 +0000
53.2 +++ b/mdr/src/org/netbeans/mdr/util/ImplClass.java Fri Sep 06 17:01:01 2002 +0000
53.3 @@ -156,8 +156,7 @@
53.4 // } catch (ClassFormatError e) {
53.5 // throw new IllegalArgumentException();
53.6 // } catch (Exception e) {
53.7 -// e.printStackTrace();
53.8 -// throw new DebugException();
53.9 +// throw Logger.getDefault().annotate(new DebugException(), e);
53.10 // }
53.11 // }
53.12 }
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/mdr/src/org/netbeans/mdr/util/Logger.java Fri Sep 06 17:01:01 2002 +0000
54.3 @@ -0,0 +1,31 @@
54.4 +/*
54.5 + * Sun Public License Notice
54.6 + *
54.7 + * The contents of this file are subject to the Sun Public License
54.8 + * Version 1.0 (the "License"). You may not use this file except in
54.9 + * compliance with the License. A copy of the License is available at
54.10 + * http://www.sun.com/
54.11 + *
54.12 + * The Original Code is NetBeans. The Initial Developer of the Original
54.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
54.14 + * Microsystems, Inc. All Rights Reserved.
54.15 + */
54.16 +package org.netbeans.mdr.util;
54.17 +
54.18 +import org.openide.ErrorManager;
54.19 +
54.20 +/** Logger utility using org.openide.ErrorManager to log messages.
54.21 + *
54.22 + * @author Martin Matula
54.23 + */
54.24 +public abstract class Logger extends ErrorManager {
54.25 + private static final String PROP_MIN_SEVERITY = "org.netbeans.mdr.Logger";
54.26 + private static ErrorManager defaultManager = null;
54.27 +
54.28 + public static synchronized ErrorManager getDefault() {
54.29 + if (defaultManager == null) {
54.30 + defaultManager = ErrorManager.getDefault().getInstance(PROP_MIN_SEVERITY);
54.31 + }
54.32 + return defaultManager;
54.33 + }
54.34 +}
55.1 --- a/mdr/src/org/netbeans/mdr/util/RWMutex.java Fri Sep 06 12:21:51 2002 +0000
55.2 +++ b/mdr/src/org/netbeans/mdr/util/RWMutex.java Fri Sep 06 17:01:01 2002 +0000
55.3 @@ -43,7 +43,7 @@
55.4 try {
55.5 this.wait();
55.6 } catch (InterruptedException e) {
55.7 - e.printStackTrace();
55.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
55.9 }
55.10 }
55.11
56.1 --- a/mdr/src/org/netbeans/mdr/util/TransactionMutex.java Fri Sep 06 12:21:51 2002 +0000
56.2 +++ b/mdr/src/org/netbeans/mdr/util/TransactionMutex.java Fri Sep 06 17:01:01 2002 +0000
56.3 @@ -108,7 +108,7 @@
56.4 try {
56.5 this.wait();
56.6 } catch (InterruptedException e) {
56.7 - e.printStackTrace();
56.8 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
56.9 }
56.10 }
56.11
56.12 @@ -166,16 +166,15 @@
56.13 if (this.fail) {
56.14 notifier.fireCancelled();
56.15 storage.rollback();
56.16 - Thread.dumpStack();
56.17 - System.out.println("rolled back!");
56.18 + Logger.getDefault().notify(Logger.INFORMATIONAL, new DebugException("rollback"));
56.19 } else {
56.20 notifier.fireChanged();
56.21 storage.commit();
56.22 - //System.out.println("commited");
56.23 + //Logger.getDefault().log("commited");
56.24 }
56.25 } catch (StorageException e) {
56.26 try {
56.27 - e.printStackTrace();
56.28 + Logger.getDefault().notify(Logger.INFORMATIONAL, e);
56.29 storage.rollback();
56.30 } catch (StorageException fatal) {
56.31 throw new DebugException("Fatal I/O error: " + fatal.toString());
57.1 --- a/mdr/src/org/netbeans/mdr/util/XmiUtils.java Fri Sep 06 12:21:51 2002 +0000
57.2 +++ b/mdr/src/org/netbeans/mdr/util/XmiUtils.java Fri Sep 06 17:01:01 2002 +0000
57.3 @@ -168,11 +168,11 @@
57.4 public static String resolveFullNameAsString(String fullName) {
57.5 // [PENDING] here should be resolved by what should be the namespace name replaced
57.6 // the following line works ok for MOF, because namespace Model represents package Model
57.7 -// System.out.println("resolving full name: " + fullName);
57.8 +// Logger.getDefault().log("resolving full name: " + fullName);
57.9 if (fullName != null) {
57.10 int index;
57.11 if ((index = fullName.indexOf(':')) > 0) {
57.12 -// System.out.println(": found, the result is: " + namespaces.get(fullName.substring(0, index)) + "." + fullName.substring(index + 1));
57.13 +// Logger.getDefault().log(": found, the result is: " + namespaces.get(fullName.substring(0, index)) + "." + fullName.substring(index + 1));
57.14 return namespaces.get(fullName.substring(0, index)) + "." + fullName.substring(index + 1);
57.15 } else {
57.16 return fullName;
58.1 --- a/mdr/src/org/netbeans/mdr/util/XmlUtils.java Fri Sep 06 12:21:51 2002 +0000
58.2 +++ b/mdr/src/org/netbeans/mdr/util/XmlUtils.java Fri Sep 06 17:01:01 2002 +0000
58.3 @@ -51,22 +51,19 @@
58.4 if (c=='<') left = i;
58.5 buf[i++]=(byte)c; // must be ascii
58.6 }
58.7 -// System.out.println("left:"+left+" i:"+i);
58.8 -// System.out.println("buf:"+new String(buf, 0, i));
58.9 -// System.out.println("end:"+new String(buf, left+2, i-left-2));
58.10 try {
58.11 if (start.equals(new String(buf, left+2, i-left-2))) break;
58.12 } catch (StringIndexOutOfBoundsException e) {
58.13 - System.out.println(left + 2);
58.14 - System.out.println(i - left - 2);
58.15 - System.out.println(new String(buf, 0, i));
58.16 + Logger.getDefault().annotate(e, new Integer(left + 2).toString());
58.17 + Logger.getDefault().annotate(e, new Integer(i - left - 2).toString());
58.18 + Logger.getDefault().annotate(e, new String(buf, 0, i));
58.19 throw e;
58.20 }
58.21 buf[i++]=(byte)'>';
58.22 }
58.23
58.24 String value = new String(buf, 0, left);
58.25 -// System.out.println("result:"+value);
58.26 +// Logger.getDefault().log("result:"+value);
58.27 return value;
58.28 }
58.29
58.30 @@ -103,7 +100,7 @@
58.31 }
58.32
58.33 /* if (!sb.toString().equals(str)) {
58.34 - System.out.println("coded: " + str + " -> " + sb);
58.35 + Logger.getDefault().log("coded: " + str + " -> " + sb);
58.36 }
58.37 */
58.38 return sb.toString();
58.39 @@ -131,11 +128,11 @@
58.40 } else if (c.equals("apos")) {
58.41 sb.append("'");
58.42 } else {
58.43 - System.out.println("Error! Cannot substitute character: " + c);
58.44 + Logger.getDefault().log(Logger.WARNING, "Error! Cannot substitute character: " + c);
58.45 return "";
58.46 }
58.47 } else {
58.48 - System.out.println("Error! End of substitution not found.");
58.49 + Logger.getDefault().log(Logger.WARNING, "Error! End of substitution not found.");
58.50 return "";
58.51 }
58.52 }
58.53 @@ -143,7 +140,7 @@
58.54 sb.append(str.substring(j + 1));
58.55
58.56 /* if (!sb.toString().equals(str)) {
58.57 - System.out.println("decoded: " + str + " -> " + sb);
58.58 + Logger.getDefault().log("decoded: " + str + " -> " + sb);
58.59 }
58.60 */
58.61 return sb.toString();