diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 16491e6d026e..cc4e671e1204 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,21 @@ +2003-02-13 Michael Koch + + * gnu/java/nio/natByteBufferImpl.cc, + gnu/java/nio/natCharBufferImpl.cc, + gnu/java/nio/natDoubleBufferImpl.cc, + gnu/java/nio/natFloatBufferImpl.cc, + gnu/java/nio/natIntBufferImpl.cc, + gnu/java/nio/natLongBufferImpl.cc, + gnu/java/nio/natShortBufferImpl.cc: + Added copyright and license. + * java/nio/DoubleBuffer.java, + java/nio/FloatBuffer.java, + java/nio/IntBuffer.java, + java/nio/LongBuffer.java, + java/nio/ShortBuffer.java + (array): Throw exceptions. + (arrayOffset): Throw exceptions. + 2003-02-13 Michael Koch * gnu/java/util/prefs/FileBasedFactory.java, diff --git a/libjava/gnu/java/nio/natByteBufferImpl.cc b/libjava/gnu/java/nio/natByteBufferImpl.cc index b98b694e87b6..2bb1e41a622d 100644 --- a/libjava/gnu/java/nio/natByteBufferImpl.cc +++ b/libjava/gnu/java/nio/natByteBufferImpl.cc @@ -1,3 +1,13 @@ +// natByteBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natCharBufferImpl.cc b/libjava/gnu/java/nio/natCharBufferImpl.cc index 6f9bf6474d62..9fb54e145612 100644 --- a/libjava/gnu/java/nio/natCharBufferImpl.cc +++ b/libjava/gnu/java/nio/natCharBufferImpl.cc @@ -1,3 +1,13 @@ +// natCharBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natDoubleBufferImpl.cc b/libjava/gnu/java/nio/natDoubleBufferImpl.cc index c71fd032082c..6c66a337417d 100644 --- a/libjava/gnu/java/nio/natDoubleBufferImpl.cc +++ b/libjava/gnu/java/nio/natDoubleBufferImpl.cc @@ -1,3 +1,13 @@ +// natDoubleBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natFloatBufferImpl.cc b/libjava/gnu/java/nio/natFloatBufferImpl.cc index 3464c7656c2b..9785454634cc 100644 --- a/libjava/gnu/java/nio/natFloatBufferImpl.cc +++ b/libjava/gnu/java/nio/natFloatBufferImpl.cc @@ -1,3 +1,13 @@ +// natFloatBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natIntBufferImpl.cc b/libjava/gnu/java/nio/natIntBufferImpl.cc index 399062804eb4..eff70f838bb9 100644 --- a/libjava/gnu/java/nio/natIntBufferImpl.cc +++ b/libjava/gnu/java/nio/natIntBufferImpl.cc @@ -1,3 +1,13 @@ +// natIntBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natLongBufferImpl.cc b/libjava/gnu/java/nio/natLongBufferImpl.cc index 81181e035d6f..a84248136e51 100644 --- a/libjava/gnu/java/nio/natLongBufferImpl.cc +++ b/libjava/gnu/java/nio/natLongBufferImpl.cc @@ -1,3 +1,13 @@ +// natLongBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/gnu/java/nio/natShortBufferImpl.cc b/libjava/gnu/java/nio/natShortBufferImpl.cc index 576573a90480..188bff9575e6 100644 --- a/libjava/gnu/java/nio/natShortBufferImpl.cc +++ b/libjava/gnu/java/nio/natShortBufferImpl.cc @@ -1,3 +1,13 @@ +// natShortBufferImpl.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + #include #include diff --git a/libjava/java/nio/DoubleBuffer.java b/libjava/java/nio/DoubleBuffer.java index 72a6c09078de..036579a802b4 100644 --- a/libjava/java/nio/DoubleBuffer.java +++ b/libjava/java/nio/DoubleBuffer.java @@ -125,11 +125,23 @@ public abstract class DoubleBuffer extends Buffer implements Comparable public final double[] array() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return backing_buffer; } public final int arrayOffset() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return array_offset; } diff --git a/libjava/java/nio/FloatBuffer.java b/libjava/java/nio/FloatBuffer.java index b780ff597d82..8531cb99f9d1 100644 --- a/libjava/java/nio/FloatBuffer.java +++ b/libjava/java/nio/FloatBuffer.java @@ -126,11 +126,23 @@ public abstract class FloatBuffer extends Buffer implements Comparable public final float[] array() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return backing_buffer; } public final int arrayOffset() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return array_offset; } diff --git a/libjava/java/nio/IntBuffer.java b/libjava/java/nio/IntBuffer.java index aca6e0f1902c..ddf03d8364dd 100644 --- a/libjava/java/nio/IntBuffer.java +++ b/libjava/java/nio/IntBuffer.java @@ -126,11 +126,23 @@ public abstract class IntBuffer extends Buffer implements Comparable public final int[] array() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return backing_buffer; } public final int arrayOffset() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return array_offset; } diff --git a/libjava/java/nio/LongBuffer.java b/libjava/java/nio/LongBuffer.java index 0ddc7938a496..63eb5af1a115 100644 --- a/libjava/java/nio/LongBuffer.java +++ b/libjava/java/nio/LongBuffer.java @@ -126,11 +126,23 @@ public abstract class LongBuffer extends Buffer implements Comparable public final long[] array() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return backing_buffer; } public final int arrayOffset() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return array_offset; } diff --git a/libjava/java/nio/ShortBuffer.java b/libjava/java/nio/ShortBuffer.java index 512c9fd8bec1..7a71cad6d856 100644 --- a/libjava/java/nio/ShortBuffer.java +++ b/libjava/java/nio/ShortBuffer.java @@ -126,11 +126,23 @@ public abstract class ShortBuffer extends Buffer implements Comparable public final short[] array() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return backing_buffer; } public final int arrayOffset() { + if (backing_buffer == null) + throw new UnsupportedOperationException (); + + if (isReadOnly ()) + throw new ReadOnlyBufferException (); + return array_offset; }