Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4947
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jeff Higgins <jeff@invalid.invalid> |
| Newsgroups | comp.lang.java.gui |
| Subject | Re: Strange JTable issue in Sun's Java code |
| Date | Mon, 16 Jan 2012 17:57:55 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 57 |
| Message-ID | <jf29j4$8fn$1@dont-email.me> (permalink) |
| References | <Xns9FDC8ADEB9988jpnasty@94.75.214.39> <jf1ufa$kt$1@dont-email.me> <jf20am$cuv$1@dont-email.me> <jf211c$gg2$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 16 Jan 2012 22:50:12 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="qwFw1g9RsQ6TkML5yezG9A"; logging-data="8695"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mtPilxLfNGN/5ht2fCqeU1MFV61Ffj8U=" |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11 |
| In-Reply-To | <jf211c$gg2$1@dont-email.me> |
| Cancel-Lock | sha1:vKq16iYqobD6uFvY/sSD4hP+IEA= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:4947 |
Show key headers only | View raw
I get:
java.lang.NegativeArraySizeException
at NullTest.removeEntries(NullTest.java:43)
when I run this.
Maybe another precondition needs checking.
public class Test {
private static int[] a = {};
public static void main(String[] args) {
try {
removeEntries(0,3);
} catch (Exception e) {
e.printStackTrace();
}
}
private static int[] getSizes() {
return new int[]{1,2,3,4,5};
}
/**
* Removes a contiguous group of entries
* from this <code>SizeSequence</code>.
* Note that the values of <code>start</code> and
* <code>length</code> must satisfy the following
* conditions: <code>(0 <= start < getSizes().length)
* AND (length >= 0)</code>. If these conditions are
* not met, the behavior is unspecified and an exception
* may be thrown.
*
* @param start the index of the first entry to be removed
* @param length the number of entries to be removed
*/
public static void removeEntries(int start, int length) {
assert getSizes() != null;
assert 0 <= start;
assert start < getSizes().length;
assert length >= 0;
assert a != null;
int sizes[] = getSizes();
//int end = start + length;
int n = a.length - length;
a = new int[n];
for (int i = 0; i < start; i++) {
a[i] = sizes[i] ;
}
for (int i = start; i < n; i++) {
a[i] = sizes[i+length] ;
}
//setSizes(a);
}
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-16 18:34 +0000
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-16 14:48 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-16 14:55 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-16 15:19 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-16 15:31 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-16 17:57 -0500
Re: Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-17 01:48 +0000
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 03:22 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 03:29 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 03:49 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 03:55 -0500
Re: Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-17 22:21 +0000
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 18:18 -0500
Re: Strange JTable issue in Sun's Java code Jeff Higgins <jeff@invalid.invalid> - 2012-01-17 20:56 -0500
Re: Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-18 05:24 +0000
Re: Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-18 17:40 +0000
Re: Strange JTable issue in Sun's Java code Novice <novice@example..com> - 2012-01-18 05:37 +0000
Re: Strange JTable issue in Sun's Java code Christian Kaufhold <chka@ucuri.chka.de> - 2012-01-19 21:00 +0100
csiph-web