projects
/
deliverable
/
tracecompass.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ctf: Throw CTFReaderException in the BitBuffer API
[deliverable/tracecompass.git]
/
org.eclipse.linuxtools.tmf.core
/
src
/
org
/
eclipse
/
linuxtools
/
tmf
/
core
/
ctfadaptor
/
CtfIterator.java
diff --git
a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
index 753ff29b38c962f2abe8c45b4ca653d12d1a0e25..d7529bcab22f8d481ad14bdac1c7f75dc38c5754 100644
(file)
--- a/
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
+++ b/
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
@@
-10,16
+10,18
@@
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The CTF trace reader iterator.
*
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The CTF trace reader iterator.
*
- * It doesn't reserve a file handle, so many iterators can be used without
worries
- * of I/O errors or resource exhaustion.
+ * It doesn't reserve a file handle, so many iterators can be used without
+ *
worries
of I/O errors or resource exhaustion.
*
* @version 1.0
* @author Matthew Khouzam
*
* @version 1.0
* @author Matthew Khouzam
@@
-32,7
+34,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* An invalid location
*/
/**
* An invalid location
*/
-
final public static
CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
+
public static final
CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
private CtfLocation curLocation;
private long curRank;
private CtfLocation curLocation;
private long curRank;
@@
-43,8
+45,10
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
*
* @param trace
* the trace to iterate over
*
* @param trace
* the trace to iterate over
+ * @throws CTFReaderException
+ * error
*/
*/
- public CtfIterator(final CtfTmfTrace trace) {
+ public CtfIterator(final CtfTmfTrace trace)
throws CTFReaderException
{
super(trace.getCTFTrace());
this.ctfTmfTrace = trace;
if (this.hasMoreEvents()) {
super(trace.getCTFTrace());
this.ctfTmfTrace = trace;
if (this.hasMoreEvents()) {
@@
-69,10
+73,12
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
* long the timestamp in ns of the trace for positioning
* @param rank
* long the index of the trace for positioning
* long the timestamp in ns of the trace for positioning
* @param rank
* long the index of the trace for positioning
+ * @throws CTFReaderException
+ * error
* @since 2.0
*/
public CtfIterator(final CtfTmfTrace trace,
* @since 2.0
*/
public CtfIterator(final CtfTmfTrace trace,
- final CtfLocationInfo ctfLocationData, final long rank) {
+ final CtfLocationInfo ctfLocationData, final long rank)
throws CTFReaderException
{
super(trace.getCTFTrace());
this.ctfTmfTrace = trace;
super(trace.getCTFTrace());
this.ctfTmfTrace = trace;
@@
-89,6
+95,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method getCtfTmfTrace. gets a CtfTmfTrace
/**
* Method getCtfTmfTrace. gets a CtfTmfTrace
+ *
* @return CtfTmfTrace
*/
public CtfTmfTrace getCtfTmfTrace() {
* @return CtfTmfTrace
*/
public CtfTmfTrace getCtfTmfTrace() {
@@
-97,6
+104,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method getCurrentEvent. gets the current event
/**
* Method getCurrentEvent. gets the current event
+ *
* @return CtfTmfEvent
*/
public CtfTmfEvent getCurrentEvent() {
* @return CtfTmfEvent
*/
public CtfTmfEvent getCurrentEvent() {
@@
-118,7
+126,8
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
*
* @param ctfLocationData
* The LocationData representing the position to seek to
*
* @param ctfLocationData
* The LocationData representing the position to seek to
- * @return boolean
+ * @return boolean True if the seek was successful, false if there was an
+ * error seeking.
* @since 2.0
*/
public synchronized boolean seek(final CtfLocationInfo ctfLocationData) {
* @since 2.0
*/
public synchronized boolean seek(final CtfLocationInfo ctfLocationData) {
@@
-132,12
+141,16
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/* Adjust the timestamp depending on the trace's offset */
long currTimestamp = ctfLocationData.getTimestamp();
final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp);
/* Adjust the timestamp depending on the trace's offset */
long currTimestamp = ctfLocationData.getTimestamp();
final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp);
- if (offsetTimestamp < 0) {
- ret = super.seek(0L);
- } else {
- ret = super.seek(offsetTimestamp);
+ try {
+ if (offsetTimestamp < 0) {
+ ret = super.seek(0L);
+ } else {
+ ret = super.seek(offsetTimestamp);
+ }
+ } catch (CTFReaderException e) {
+ Activator.logError(e.getMessage(), e);
+ return false;
}
}
-
/*
* Check if there is already one or more events for that timestamp, and
* assign the location index correctly
/*
* Check if there is already one or more events for that timestamp, and
* assign the location index correctly
@@
-170,6
+183,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method getRank.
/**
* Method getRank.
+ *
* @return long
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getRank()
*/
* @return long
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getRank()
*/
@@
-180,7
+194,9
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method setRank.
/**
* Method setRank.
- * @param rank long
+ *
+ * @param rank
+ * long
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setRank(long)
*/
@Override
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setRank(long)
*/
@Override
@@
-191,12
+207,17
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
@Override
public CtfIterator clone() {
CtfIterator clone = null;
@Override
public CtfIterator clone() {
CtfIterator clone = null;
- clone = new CtfIterator(ctfTmfTrace, this.getLocation().getLocationInfo(), curRank);
+ try {
+ clone = new CtfIterator(ctfTmfTrace, this.getLocation().getLocationInfo(), curRank);
+ } catch (CTFReaderException e) {
+ Activator.logError(e.getMessage(), e);
+ }
return clone;
}
/**
* Method dispose.
return clone;
}
/**
* Method dispose.
+ *
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#dispose()
*/
@Override
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#dispose()
*/
@Override
@@
-206,7
+227,9
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method setLocation.
/**
* Method setLocation.
- * @param location ITmfLocation<?>
+ *
+ * @param location
+ * ITmfLocation<?>
* @since 3.0
*/
@Override
* @since 3.0
*/
@Override
@@
-218,6
+241,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method getLocation.
/**
* Method getLocation.
+ *
* @return CtfLocation
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
*/
* @return CtfLocation
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
*/
@@
-228,6
+252,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method increaseRank.
/**
* Method increaseRank.
+ *
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#increaseRank()
*/
@Override
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#increaseRank()
*/
@Override
@@
-240,6
+265,7
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method hasValidRank, if the iterator is valid
/**
* Method hasValidRank, if the iterator is valid
+ *
* @return boolean
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#hasValidRank()
*/
* @return boolean
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#hasValidRank()
*/
@@
-250,13
+276,19
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method advance go to the next event
/**
* Method advance go to the next event
+ *
* @return boolean successful or not
*/
@Override
public synchronized boolean advance() {
long index = curLocation.getLocationInfo().getIndex();
long timestamp = curLocation.getLocationInfo().getTimestamp();
* @return boolean successful or not
*/
@Override
public synchronized boolean advance() {
long index = curLocation.getLocationInfo().getIndex();
long timestamp = curLocation.getLocationInfo().getTimestamp();
- boolean ret = super.advance();
+ boolean ret = false;
+ try {
+ ret = super.advance();
+ } catch (CTFReaderException e) {
+ Activator.logError(e.getMessage(), e);
+ }
if (ret) {
final long timestampValue = getCurrentEvent().getTimestamp().getValue();
if (ret) {
final long timestampValue = getCurrentEvent().getTimestamp().getValue();
@@
-273,7
+305,9
@@
public class CtfIterator extends CTFTraceReader implements ITmfContext,
/**
* Method compareTo.
/**
* Method compareTo.
- * @param o CtfIterator
+ *
+ * @param o
+ * CtfIterator
* @return int -1, 0, 1
*/
@Override
* @return int -1, 0, 1
*/
@Override
This page took
0.029694 seconds
and
5
git commands to generate.