This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Bug report
- To: java at gcc dot gnu dot org
- Subject: Bug report
- From: Eduard Bloch <edi at gmx dot de>
- Date: Thu, 18 Oct 2001 23:40:03 +0200
Hello,
a Debian developer told me to report this bug to you:
----- Forwarded message from Eduard Bloch <blade@debian.org> -----
Date: Thu, 18 Oct 2001 20:46:41 +0200
From: Eduard Bloch <blade@debian.org>
Subject: gcj-3.0: FileWriter problems
To: Debian Bug Tracking System <submit@bugs.debian.org>
Package: gcj-3.0
Version: 1:3.0.2-0pre011014
Severity: normal
Hello, following simple Java program crashes when compiled with gcj. If
I compile with javac and run it in kaffe, it works flawless. When
compiled with gcj...
gcj-3.0 -g fromFileToFile.java --main=fromFileToFile
then following happens:
./a.out einsteiger.txt asdf
Error while creating the new file...
And if I change the Exception to IOExcepion (as it should be), it
crashes or exits.
./a.out einsteiger.txt asdf
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at 0x4018e174: java.lang.Throwable.Throwable() (/usr/lib/libgcj.so.2)
at 0x4018475c: java.lang.Exception.Exception() (/usr/lib/libgcj.so.2)
at 0x40188Abgebrochen
inet@zombie:~/studium/essy2/aufg.bl.2> addr2line: /proc/10926/exe: No such file or directory
inet@zombie:~/studium/essy2/aufg.bl.2> ./a.out einsteiger.txt asdf
Exception in thread "main" Abgebrochen
Gruss/Regards,
Eduard.
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux zombie 2.4.10-ac12 #5 Son Okt 14 18:55:14 CEST 2001 i686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro
Versions of packages gcj-3.0 depends on:
ii gcc-3.0 1:3.0.2-0pre011014 The GNU C compiler.
ii gcc-3.0-base 1:3.0.2-0pre011014 The GNU Compiler Collection (base
ii java-common 0.7 Base of all Java packages
ii libc6 2.2.4-3 GNU C Library: Shared libraries an
ii libgcj2-dev 1:3.0.2-0pre011014 Java development headers and stati
ii zlib1g 1:1.1.3-16 compression library - runtime
--
Akkulicht-Radler!
Foliengriller!
Anonymspender!
Vorfahrtverzichter!
----- End forwarded message -----
--
And 1.1.81 is officially BugFree(tm), so if you receive any bug-reports
on it, you know they are just evil lies."
(By Linus Torvalds, Linus.Torvalds@cs.helsinki.fi)
/* Eduard Bloch <blade@debian.org>, 2001
Demo programm, aka FromHumanToKlingon
Writtes each line in reverted char order from file a to file b
License: GPL, feel free to modify */
import java.io.*;
public class fromFileToFile {
private static String line;
private static BufferedReader quelle;
private static BufferedWriter ziel;
public static void main(String[] args) {
String fromFile;
String toFile;
try {
fromFile = args[0];
toFile = args[1];
}
catch (ArrayIndexOutOfBoundsException e) {
System.err.println("Please give me a file to read from and one to write to.");
return;
}
try {
quelle = new BufferedReader(new FileReader(fromFile));
} catch (FileNotFoundException e) {
System.err.println("Source file not found, aborting...");
return;
}
try {
ziel = new BufferedWriter(new FileWriter(toFile));
} catch (IOException e) {
System.err.println("Error while creating the new file...");
}
try {
while ( (line = quelle.readLine()) != null) {
for(int i=line.length()-1; i>=0; i--) {
try {
// System.out.println("Will crash soon!");
ziel.write(line,i,1);
// debug
// System.out.print(line.charAt(i));
}
// "IOException" is broken too, the whole program crashes instead of doing the
// catch routine
catch (IOException e) {
// catch (Exception e) {
System.err.println("Error while creating the new file...");
quelle.close();
ziel.close();
return;
}
}
ziel.newLine();
}
} catch (IOException e) {
System.err.println("Error while creating the new file...");
}
try {
quelle.close(); /* IMPORTANT */
ziel.close();
} catch (IOException e) {
System.err.println("Error closing files.");
}
}
}