aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron2013-11-27 00:37:40 (EST)
committerMatthew Khouzam2013-12-04 09:26:35 (EST)
commitbe758d1efd92b847dd4df4d774f74852c47f21bb (patch)
treec04617858f8d0410cd79f0f1a25bc11388b65fd3
parent4fe61a7ad7bfafc4a14029d22608a7270a07456e (diff)
downloadorg.eclipse.linuxtools-be758d1efd92b847dd4df4d774f74852c47f21bb.zip
org.eclipse.linuxtools-be758d1efd92b847dd4df4d774f74852c47f21bb.tar.gz
org.eclipse.linuxtools-be758d1efd92b847dd4df4d774f74852c47f21bb.tar.bz2
tmf: fix multiples coding style issues.refs/changes/42/19242/4
There is no behavior change in this patch. Change-Id: I892fe351754363768210ba4bd333e39e339533ca Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/19242 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java4
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java248
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/AbstractTmfStateProvider.java4
7 files changed, 133 insertions, 136 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
index 58c03fc..3f6ded3 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
@@ -129,7 +129,7 @@ public class IntegerDeclaration implements IDeclaration {
}
@Override
- public long getAlignment(){
+ public long getAlignment() {
return alignment;
}
@@ -137,7 +137,7 @@ public class IntegerDeclaration implements IDeclaration {
* The integer's clock, since timestamps are stored in ints
* @return the integer's clock, can be null. (most often it is)
*/
- public String getClock(){
+ public String getClock() {
return clock;
}
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java
index 3369298..5b1c568 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java
@@ -40,7 +40,7 @@ public class TmfCoalescedEventRequest extends TmfEventRequest {
/**
* We do not use super.fRange, because in the case of coalesced requests,
- * the global range can be modified as sub-requets are added.
+ * the global range can be modified as sub-request are added.
*/
private TmfTimeRange fRange;
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
index e1f1c5b..88f9c5f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java
@@ -53,14 +53,14 @@ public final class AttributeTree {
}
/**
- * "Existing file" constructor Builds a attribute tree from a "mapping file"
- * or mapping section previously saved somewhere.
+ * "Existing file" constructor. Builds an attribute tree from a
+ * "mapping file" or mapping section previously saved somewhere.
*
* @param ss
* StateSystem to which this AT is attached
* @param fis
* File stream where to read the AT information. Make sure it's
- * seeked at the right place!
+ * sought at the right place!
* @throws IOException
*/
AttributeTree(StateSystem ss, FileInputStream fis) throws IOException {
@@ -138,7 +138,7 @@ public final class AttributeTree {
* FileOutputStream defines where (which file/position).
*
* @param fos
- * Where to write. Make sure it's seeked at the right position
+ * Where to write. Make sure it's sought at the right position
* you want.
* @return The total number of bytes written.
*/
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
index 03e92be..4a978b1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
@@ -358,6 +358,5 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
super.handleCompleted();
}
-
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
index c33d6c2..fb3f45e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
@@ -129,7 +129,7 @@ public final class CtfLocation extends TmfLocation {
@Override
public String toString() {
- if( this.getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
+ if (this.getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
}
return super.toString();
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java
index 99b9b64..6e6e3be 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java
@@ -26,21 +26,21 @@ import java.nio.charset.Charset;
*/
public class BufferedRandomAccessFile extends RandomAccessFile {
- private static final int DEFAULT_BUF_SIZE = 8192;
- private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); //$NON-NLS-1$
+ private static final int DEFAULT_BUF_SIZE = 8192;
+ private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); //$NON-NLS-1$
- private final int BUF_SIZE;
- private final byte buffer[];
- private int buf_end = 0;
- private int buf_pos = 0;
- private long real_pos = 0;
- private final StringBuilder sb = new StringBuilder();
+ private final int BUF_SIZE;
+ private final byte buffer[];
+ private int buf_end = 0;
+ private int buf_pos = 0;
+ private long real_pos = 0;
+ private final StringBuilder sb = new StringBuilder();
/**
* Constructor using the default buffer size
*
* @param name
- * File path. This is passed as-is to the RandomeAccessFile's
+ * File path. This is passed as-is to the RandomAccessFile's
* constructor.
* @param mode
* File open mode ("r", "rw", etc.). This is passed as-is to
@@ -49,15 +49,15 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
* If the file was not found or couldn't be opened with the
* request permissions
*/
- public BufferedRandomAccessFile(String name, String mode) throws IOException {
- this(name, mode, DEFAULT_BUF_SIZE);
- }
+ public BufferedRandomAccessFile(String name, String mode) throws IOException {
+ this(name, mode, DEFAULT_BUF_SIZE);
+ }
/**
* Constructor using the default buffer size
*
* @param file
- * File object. This is passed as-is to the RandomeAccessFile's
+ * File object. This is passed as-is to the RandomAccessFile's
* constructor.
* @param mode
* File open mode ("r", "rw", etc.). This is passed as-is to
@@ -66,15 +66,15 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
* If the file was not found or couldn't be opened with the
* request permissions
*/
- public BufferedRandomAccessFile(File file, String mode) throws IOException {
- this(file, mode, DEFAULT_BUF_SIZE);
- }
+ public BufferedRandomAccessFile(File file, String mode) throws IOException {
+ this(file, mode, DEFAULT_BUF_SIZE);
+ }
/**
* Standard constructor.
*
* @param name
- * File path. This is passed as-is to the RandomeAccessFile's
+ * File path. This is passed as-is to the RandomAccessFile's
* constructor.
* @param mode
* File open mode ("r", "rw", etc.). This is passed as-is to
@@ -85,18 +85,18 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
* If the file was not found or couldn't be opened with the
* request permissions
*/
- public BufferedRandomAccessFile(String name, String mode, int bufsize) throws IOException {
- super(name, mode);
- invalidate();
- BUF_SIZE = bufsize;
- buffer = new byte[BUF_SIZE];
+ public BufferedRandomAccessFile(String name, String mode, int bufsize) throws IOException {
+ super(name, mode);
+ invalidate();
+ BUF_SIZE = bufsize;
+ buffer = new byte[BUF_SIZE];
}
/**
* Standard constructor.
*
* @param file
- * File object. This is passed as-is to the RandomeAccessFile's
+ * File object. This is passed as-is to the RandomAccessFile's
* constructor.
* @param mode
* File open mode ("r", "rw", etc.). This is passed as-is to
@@ -107,61 +107,61 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
* If the file was not found or couldn't be opened with the
* request permissions
*/
- public BufferedRandomAccessFile(File file, String mode, int bufsize) throws IOException {
- super(file, mode);
- invalidate();
- BUF_SIZE = bufsize;
- buffer = new byte[BUF_SIZE];
+ public BufferedRandomAccessFile(File file, String mode, int bufsize) throws IOException {
+ super(file, mode);
+ invalidate();
+ BUF_SIZE = bufsize;
+ buffer = new byte[BUF_SIZE];
}
- @Override
- public final int read() throws IOException{
- if (buf_pos >= buf_end) {
- if (fillBuffer() < 0) {
- return -1;
- }
- }
- if (buf_end == 0) {
- return -1;
- }
+ @Override
+ public final int read() throws IOException {
+ if (buf_pos >= buf_end) {
+ if (fillBuffer() < 0) {
+ return -1;
+ }
+ }
+ if (buf_end == 0) {
+ return -1;
+ }
return (buffer[buf_pos++] & 0xff);
- }
+ }
- @Override
+ @Override
public int read(byte b[], int off, int len) throws IOException {
- int leftover = buf_end - buf_pos;
- if (len <= leftover) {
- System.arraycopy(buffer, buf_pos, b, off, len);
- buf_pos += len;
- return len;
- }
- for(int i = 0; i < len; i++) {
- int c = this.read();
- if (c != -1) {
- b[off+i] = (byte) c;
- } else {
- return i;
- }
- }
- return len;
- }
-
- @Override
- public long getFilePointer() throws IOException{
- long l = real_pos;
- return (l - buf_end + buf_pos);
- }
-
- @Override
+ int leftover = buf_end - buf_pos;
+ if (len <= leftover) {
+ System.arraycopy(buffer, buf_pos, b, off, len);
+ buf_pos += len;
+ return len;
+ }
+ for (int i = 0; i < len; i++) {
+ int c = this.read();
+ if (c != -1) {
+ b[off + i] = (byte) c;
+ } else {
+ return i;
+ }
+ }
+ return len;
+ }
+
+ @Override
+ public long getFilePointer() throws IOException {
+ long l = real_pos;
+ return (l - buf_end + buf_pos);
+ }
+
+ @Override
public void seek(long pos) throws IOException {
- int n = (int) (real_pos - pos);
- if(n >= 0 && n <= buf_end) {
- buf_pos = buf_end - n;
- } else {
- super.seek(pos);
- invalidate();
- }
- }
+ int n = (int) (real_pos - pos);
+ if (n >= 0 && n <= buf_end) {
+ buf_pos = buf_end - n;
+ } else {
+ super.seek(pos);
+ invalidate();
+ }
+ }
/**
* Read the next line from the buffer (ie, until the next '\n'). The bytes
@@ -171,56 +171,56 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
* @throws IOException
* If we failed reading the file
*/
- public final String getNextLine() throws IOException {
- String str = null;
- if (buf_end - buf_pos <= 0) {
- if (fillBuffer() < 0) {
- return null;
- }
- }
- int lineend = -1;
- for (int i = buf_pos; i < buf_end; i++) {
- if (buffer[i] == '\n') {
- lineend = i;
- break;
- }
- }
- if (lineend < 0) {
- sb.delete(0, sb.length());
- int c;
- while (((c = read()) != -1) && (c != '\n')) {
- sb.append((char) c);
- }
- if ((c == -1) && (sb.length() == 0)) {
- return null;
- }
- if (sb.charAt(sb.length() - 1) == '\r') {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }
- if (lineend > 0 && buffer[lineend - 1] == '\r' && lineend > buf_pos) {
- str = new String(buffer, buf_pos, lineend - buf_pos - 1, CHARSET_UTF8);
- } else {
- str = new String(buffer, buf_pos, lineend - buf_pos, CHARSET_UTF8);
- }
- buf_pos = lineend + 1;
- return str;
- }
-
- private int fillBuffer() throws IOException {
- int n = super.read(buffer, 0, BUF_SIZE);
- if (n >= 0) {
- real_pos += n;
- buf_end = n;
- buf_pos = 0;
- }
- return n;
- }
-
- private void invalidate() throws IOException {
- buf_end = 0;
- buf_pos = 0;
- real_pos = super.getFilePointer();
- }
+ public final String getNextLine() throws IOException {
+ String str = null;
+ if (buf_end - buf_pos <= 0) {
+ if (fillBuffer() < 0) {
+ return null;
+ }
+ }
+ int lineend = -1;
+ for (int i = buf_pos; i < buf_end; i++) {
+ if (buffer[i] == '\n') {
+ lineend = i;
+ break;
+ }
+ }
+ if (lineend < 0) {
+ sb.delete(0, sb.length());
+ int c;
+ while (((c = read()) != -1) && (c != '\n')) {
+ sb.append((char) c);
+ }
+ if ((c == -1) && (sb.length() == 0)) {
+ return null;
+ }
+ if (sb.charAt(sb.length() - 1) == '\r') {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ return sb.toString();
+ }
+ if (lineend > 0 && buffer[lineend - 1] == '\r' && lineend > buf_pos) {
+ str = new String(buffer, buf_pos, lineend - buf_pos - 1, CHARSET_UTF8);
+ } else {
+ str = new String(buffer, buf_pos, lineend - buf_pos, CHARSET_UTF8);
+ }
+ buf_pos = lineend + 1;
+ return str;
+ }
+
+ private int fillBuffer() throws IOException {
+ int n = super.read(buffer, 0, BUF_SIZE);
+ if (n >= 0) {
+ real_pos += n;
+ buf_end = n;
+ buf_pos = 0;
+ }
+ return n;
+ }
+
+ private void invalidate() throws IOException {
+ buf_end = 0;
+ buf_pos = 0;
+ real_pos = super.getFilePointer();
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/AbstractTmfStateProvider.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/AbstractTmfStateProvider.java
index 78e5e8c..36eb476 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/AbstractTmfStateProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/AbstractTmfStateProvider.java
@@ -72,7 +72,6 @@ public abstract class AbstractTmfStateProvider implements ITmfStateProvider {
String id2 = (id == null ? "Unamed" : id); //$NON-NLS-1$
eventHandlerThread = new Thread(new EventProcessor(), id2 + " Event Handler"); //$NON-NLS-1$
-
}
@Override
@@ -146,7 +145,7 @@ public abstract class AbstractTmfStateProvider implements ITmfStateProvider {
try {
eventsQueue.put(ev);
while (!eventsQueue.isEmpty()) {
- Thread.sleep(100);
+ Thread.sleep(100);
}
} catch (InterruptedException e) {
e.printStackTrace();
@@ -200,7 +199,6 @@ public abstract class AbstractTmfStateProvider implements ITmfStateProvider {
}
/* We've received the last event, clean up */
closeStateSystem();
- return;
} catch (InterruptedException e) {
/* We've been interrupted abnormally */
System.out.println("Event handler interrupted!"); //$NON-NLS-1$