1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

reformat.

This commit is contained in:
Alain Magloire 2002-10-17 14:00:25 +00:00
parent e38c670d27
commit 50fad5fe59
3 changed files with 114 additions and 89 deletions

View file

@ -1,3 +1,23 @@
2002-10-16 Alain Magloire
Some of the native functions were throwing exceptions
particularly on the windows platform and it was not
clearly advertise. Eclipse uses a tool to externalize strings,
to prevent this, strings need a comment "//$NON-NLS-1$".
* utils/../utils/pty/PTYInputStream.java (close0):
Advertise that we can throw an IOException.
* utils/../utils/pty/PTYOutputStream.java (close): Put
the "$NON-NLS-1$" magic.
(write0): Advertise we can throw IOException.
(close0): Advertise we can throw IOException.
* utils/../utils/spawner/ProcessFactory.java: Reformat.
* utils/../utils/spawner/Spawner.java (Reaper):
The run method when calling exec0 did not catch the exception.
And the waitFor() should not be done on a pid == -1;
* utils/../utils/spawner/SpawnerInputStream.java: Reformat.
* utils/../utils/spawner/SpawnerOutputStream.java: Reformat.
2002-10-15 Alain Magloire
By making the native methods package scope, the

View file

@ -37,8 +37,12 @@ class SpawnerInputStream extends InputStream {
public int read(byte[] buf, int off, int len) throws IOException {
if (buf == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > buf.length) || (len < 0) ||
((off + len) > buf.length) || ((off + len) < 0)) {
} else if (
(off < 0)
|| (off > buf.length)
|| (len < 0)
|| ((off + len) > buf.length)
|| ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
@ -53,7 +57,6 @@ class SpawnerInputStream extends InputStream {
return len;
}
/**
* Close the Reader
* @exception IOException on error.
@ -68,7 +71,7 @@ class SpawnerInputStream extends InputStream {
}
private native int read0(int fd, byte[] buf, int len) throws IOException;
native int close0 (int fd);
private native int close0(int fd) throws IOException;
static {
System.loadLibrary("spawner");

View file

@ -8,8 +8,7 @@ package org.eclipse.cdt.utils.spawner;
import java.io.OutputStream;
import java.io.IOException;
public class SpawnerOutputStream extends OutputStream
{
public class SpawnerOutputStream extends OutputStream {
private int fd;
/**
@ -26,8 +25,12 @@ public class SpawnerOutputStream extends OutputStream
public void write(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
} else if (
(off < 0)
|| (off > b.length)
|| (len < 0)
|| ((off + len) > b.length)
|| ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
@ -56,16 +59,15 @@ public class SpawnerOutputStream extends OutputStream
return;
int status = close0(fd);
if (status == -1)
throw new IOException ("close error");
throw new IOException("close error"); //$NON-NLS-1$
fd = -1;
}
private native int write0 (int fd, byte[] b, int len);
private native int write0(int fd, byte[] b, int len) throws IOException;
private native int close0(int fd);
static
{
System.loadLibrary ("spawner");
static {
System.loadLibrary("spawner"); //$NON-NLS-1$
}
}