incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r828657 - in /incubator/kato/branches/experimental/thirdview/org.apache.kato: kato.api/src/main/java/javax/tools/diagnostics/image/ kato.common/src/main/java/org/apache/kato/common/ kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/
Date Thu, 22 Oct 2009 11:19:40 GMT
Author: spoole
Date: Thu Oct 22 11:19:40 2009
New Revision: 828657

URL: http://svn.apache.org/viewvc?rev=828657&view=rev
Log:
Updated ImageThread to deal with list to query conversion

Added:
    incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.common/src/main/java/org/apache/kato/common/EmptyQueryResult.java
Modified:
    incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.api/src/main/java/javax/tools/diagnostics/image/ImageThread.java
    incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/ImageStackFrameTest.java

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.api/src/main/java/javax/tools/diagnostics/image/ImageThread.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.api/src/main/java/javax/tools/diagnostics/image/ImageThread.java?rev=828657&r1=828656&r2=828657&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.api/src/main/java/javax/tools/diagnostics/image/ImageThread.java
(original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.api/src/main/java/javax/tools/diagnostics/image/ImageThread.java
Thu Oct 22 11:19:40 2009
@@ -16,6 +16,8 @@
 import java.util.List;
 import java.util.Properties;
 
+import javax.tools.diagnostics.QueryResult;
+
 /**
  * A low-level thread instance
  */
@@ -44,7 +46,7 @@
      * @see ImageStackFrame
      * 
      */
-    List<ImageStackFrame> getStackFrames() throws DataUnavailable;
+    QueryResult<ImageStackFrame> getStackFrames() throws DataUnavailable;
     
     /**
      * Get the set of image sections which make up the stack.

Added: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.common/src/main/java/org/apache/kato/common/EmptyQueryResult.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.common/src/main/java/org/apache/kato/common/EmptyQueryResult.java?rev=828657&view=auto
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.common/src/main/java/org/apache/kato/common/EmptyQueryResult.java
(added)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.common/src/main/java/org/apache/kato/common/EmptyQueryResult.java
Thu Oct 22 11:19:40 2009
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.common;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.tools.diagnostics.QueryResult;
+
+/**
+ * 
+ */
+public class EmptyQueryResult<T> implements QueryResult<T> {
+
+	/* (non-Javadoc)
+	 * @see javax.tools.diagnostics.QueryResult#dispose()
+	 */
+	@Override
+	public void dispose() throws IOException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.tools.diagnostics.QueryResult#get(long)
+	 */
+	@Override
+	public T get(long element) throws IOException, IndexOutOfBoundsException {
+		
+		throw new IndexOutOfBoundsException("element "+element+ " is out of bounds. result is empty");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.tools.diagnostics.QueryResult#isEmpty()
+	 */
+	@Override
+	public boolean isEmpty() {
+	
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.tools.diagnostics.QueryResult#size()
+	 */
+	@Override
+	public long size() throws IOException {
+	
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Iterable#iterator()
+	 */
+	@Override
+	public Iterator<T> iterator() {
+		
+		return new Iterator<T>() {
+
+			@Override
+			public boolean hasNext() {
+				
+				return false;
+			}
+
+			@Override
+			public T next() {
+			
+				return null;
+			}
+
+			@Override
+			public void remove() {
+			
+				
+			}};
+	}
+
+}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/ImageStackFrameTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/ImageStackFrameTest.java?rev=828657&r1=828656&r2=828657&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/ImageStackFrameTest.java
(original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/ImageStackFrameTest.java
Thu Oct 22 11:19:40 2009
@@ -13,8 +13,10 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
 import java.util.Iterator;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
@@ -37,10 +39,16 @@
 				ImageThread thread = (ImageThread) it.next();
 				try {
 					if (thread.getStackFrames().isEmpty()==false) {
-						return (ImageStackFrame) thread.getStackFrames().get(0);
+						QueryResult<ImageStackFrame> frames=thread.getStackFrames();
+						ImageStackFrame first=frames.get(0);
+						frames.dispose();
+						return first;
 					}
 				} catch (DataUnavailable e1) {
 					// Ignore
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
 				}
 			}
 			// although this is accepted by the spec, it has no real meaning for the test so just
choose to be unimplemented



Mime
View raw message