|
From: Pavel V. <va...@us...> - 2002-07-17 21:37:15
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data
In directory usw-pr-cvs1:/tmp/cvs-serv4736
Modified Files:
SnapshotImpl.java
Log Message:
fixed exception handling
Index: SnapshotImpl.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/SnapshotImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** SnapshotImpl.java 11 Jul 2002 18:21:37 -0000 1.26
--- SnapshotImpl.java 17 Jul 2002 21:37:10 -0000 1.27
***************
*** 38,42 ****
public class SnapshotImpl implements Snapshot, Serializable {
private String name;
! private long time; //PENDING
transient private Map libIDs; //converts libIds to references
--- 38,42 ----
public class SnapshotImpl implements Snapshot, Serializable {
private String name;
! private long time; //PENDING //in milis, ? change to Date?
transient private Map libIDs; //converts libIds to references
***************
*** 173,185 ****
//maybe use some configuration object
public SnapshotImpl( IProf iprof, Configuration conf ) {
- libIDs = new HashMap();
try {
this.conf = (Configuration) conf.clone();
makeSnapshot( iprof );
! } catch( Exception e) {
! System.err.println( e );
}
- //PENDING
- libIDs = null;
}
--- 173,185 ----
//maybe use some configuration object
public SnapshotImpl( IProf iprof, Configuration conf ) {
try {
+ libIDs = new HashMap();
this.conf = (Configuration) conf.clone();
makeSnapshot( iprof );
! libIDs = null;
! }
! catch ( CloneNotSupportedException e ) {
! throw new RuntimeException( e.getMessage() );
}
}
***************
*** 384,390 ****
private void makeSnapshot( IProf iprof )
{
! //PENDING
! //if ( haveSnapshot )
! //throw vyjimku;
long start = System.currentTimeMillis();
--- 384,389 ----
private void makeSnapshot( IProf iprof )
{
! if ( haveSnapshot )
! throw new RuntimeException( "Can't create Snapshot, it already exists!");
long start = System.currentTimeMillis();
***************
*** 393,398 ****
try {
! //PENDING
! //Add some info like time, data, etc.
if (conf.withCPU || conf.withAlloc || conf.withMon) {
--- 392,396 ----
try {
! time = System.currentTimeMillis();
if (conf.withCPU || conf.withAlloc || conf.withMon) {
***************
*** 528,541 ****
}
catch ( COMMUN_Exception e ) {
! System.out.println( "Error in communication" );
! e.printStackTrace();
! }
! catch( Exception e ) {
! System.out.println( "Just error" );
! e.printStackTrace();
}
!
long end = System.currentTimeMillis();
! System.out.println( "\n\nTime: " + (end - start) );
}
--- 526,534 ----
}
catch ( COMMUN_Exception e ) {
! throw new VMDisconnectedException(e.getMessage());
}
!
long end = System.currentTimeMillis();
! //System.out.println( "\n\nTime: " + (end - start) );
}
***************
*** 605,609 ****
int i=0;
j++;
! //try {
while ( iterInner.hasNext() ) {
//dbg
--- 598,602 ----
int i=0;
j++;
!
while ( iterInner.hasNext() ) {
//dbg
***************
*** 616,625 ****
out.add( objInner );
}
! //dbg
! //} catch (Exception e)
! //{
! // System.out.print("zz" + e.toString() + " " );
! //};
!
if ( iter == null ) //one pass
break;
--- 609,613 ----
out.add( objInner );
}
!
if ( iter == null ) //one pass
break;
***************
*** 630,653 ****
postOpLst = null;
}
- //PENDING trow other exception
catch ( BAD_OBJ_ID_Exception e ) {
! System.out.println( "Bad objID\n" );
! }
! /* catch ( BAD_INFO_ID_Exception e ) {
! System.out.println( "Bad infoID\n" );
}
- catch ( BAD_INFO_TYPE_Exception e ) {
- System.out.println( "Bad info type\n" );
- }*/
catch ( BAD_COMMAND_Exception e ) {
! System.out.println( "Bad command\n" );
}
catch ( UNKNOWN_Exception e ) {
! System.out.println( "Uknown exception\n" );
}
- // catch ( Exception e ) {
- // System.out.println( "Exception\n" );
- // }
-
};
--- 618,630 ----
postOpLst = null;
}
catch ( BAD_OBJ_ID_Exception e ) {
! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg);
}
catch ( BAD_COMMAND_Exception e ) {
! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg);
}
catch ( UNKNOWN_Exception e ) {
! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg);
}
};
***************
*** 658,691 ****
*/
private CallTreeData threadCallTree (IProf iprof, int threadID) throws
! COMMUN_Exception, BAD_OBJ_ID_Exception, UNKNOWN_Exception {
! CallTreeData root = null;
! Iterator ctIt = iprof.getCallTreeThruIterator (threadID, true);
!
! if (ctIt == null)
! return null;
! if (ctIt.hasNext ()) {
! IProf.sCallTree sRoot = (IProf.sCallTree) ctIt.next();
! MethodData method = (MethodData) libIDs.get( new Integer(
! sRoot.methodObjId) );
! root = new CallTreeData(null, method, sRoot);
! root.missingChildrenCount = sRoot.numOfChildren;
! }
!
! CallTreeData current = root;
! while (current != null) {
! if (current.missingChildrenCount > 0) {
! IProf.sCallTree sChild = (IProf.sCallTree) ctIt.next();
MethodData method = (MethodData) libIDs.get( new Integer(
! sChild.methodObjId) );
! CallTreeData child = new CallTreeData(current, method, sChild);
! current.missingChildrenCount--;
! child.missingChildrenCount = sChild.numOfChildren;
! current = child;
! }
! else {
! current = current.getParentData();
}
}
- return root;
}
--- 635,677 ----
*/
private CallTreeData threadCallTree (IProf iprof, int threadID) throws
! COMMUN_Exception {
! try {
! CallTreeData root = null;
! Iterator ctIt = iprof.getCallTreeThruIterator (threadID, true);
!
! if (ctIt == null)
! return null;
! if (ctIt.hasNext ()) {
! IProf.sCallTree sRoot = (IProf.sCallTree) ctIt.next();
MethodData method = (MethodData) libIDs.get( new Integer(
! sRoot.methodObjId) );
! root = new CallTreeData(null, method, sRoot);
! root.missingChildrenCount = sRoot.numOfChildren;
! }
!
! CallTreeData current = root;
! while (current != null) {
! if (current.missingChildrenCount > 0) {
! IProf.sCallTree sChild = (IProf.sCallTree) ctIt.next();
! MethodData method = (MethodData) libIDs.get( new Integer(
! sChild.methodObjId) );
! CallTreeData child = new CallTreeData(current, method, sChild);
! current.missingChildrenCount--;
! child.missingChildrenCount = sChild.numOfChildren;
! current = child;
! }
! else {
! current = current.getParentData();
! }
}
+
+ return root;
+ }
+ catch ( BAD_OBJ_ID_Exception e ) {
+ throw new RuntimeException( e.getMessage() );
+ }
+ catch ( UNKNOWN_Exception e ) {
+ throw new RuntimeException( e.getMessage() );
}
}
***************
*** 1111,1118 ****
return newObj;
}
- //PENDING
default:
! return null;
! //throw some exception
}
--- 1097,1102 ----
return newObj;
}
default:
! throw new RuntimeException("Unknown IProf type. whatType: \n" + whatType );
}
***************
*** 1139,1148 ****
}
- //FIXME:
- //GCRef, ArenaRef
-
//TODO:
! //? shloud I test a duplicity in lists?
! // write exception handling code properly
// filters
--- 1123,1128 ----
}
//TODO:
! /// write exception handling code properly
// filters
***************
*** 1152,1155 ****
--- 1132,1138 ----
/*
* $Log$
+ * Revision 1.27 2002/07/17 21:37:10 vachis
+ * fixed exception handling
+ *
* Revision 1.26 2002/07/11 18:21:37 vachis
* no message
|