Community
Participate
Working Groups
Given the Class below to test some code why I am getting strange behavior I am getting an error from Eclipse: "Unhandled exception type IOException" On lines of the .append(ch); Where I am appending only a char. To either StringBuilder or StringBuffer I must surround the invocation with a try catch and it works only in eclipse, but since the method does not throw an exception. If I try to compile the code with the try catch outside of Eclipse. It will flag the error as the following: Test.java:32: exception java.io.IOException is never thrown in body of corresponding try statement catch (IOException e) I am also getting another Error. On the Line Where I am chaining several appends together of strings. "The type AbstractStringBuilder is not visible" This ocurrs on the line of code where I am doing the following. sb.append("Hello").append(" ").append("World"); Interesting. When I make each append() invocation terminted with a semicolon, it works fine. I have compiled the Code outside of eclipse, and there are no errors nor warnings. and the code also runs - I am attaching the code and the Java Version. I am doing this on both a Windows 2000 OS and Windows XP OS C:\Temp>javac -version javac 1.5.0-beta javac: no source files public class Test { public static void main( String[] args ) { int n = 10; char ch = '*'; StringBuilder szBuild = new StringBuilder(n); for (int nPos = 0; nPos < n; nPos++) { szBuild.append(ch); // append 1 to n characters ch } StringBuffer szBuff = new StringBuffer(n); for (int nPos = 0; nPos < n; nPos++) { szBuff.append(ch); // append 1 to n characters ch } System.out.println(szBuild.toString() ); System.out.println(szBuff.toString() ); StringBuffer sb = new StringBuffer(""); sb.append("Hello").append(" ").append("World"); System.out.println(sb); } }
I cannot reproduce the first problem with the IOException. Could you please specify the following points? - what libraries are you using to compile? - what Eclipse build are you using? The second problem is a duplicate of bug 51353.
Created attachment 7811 [details] System Info and Configuration details pulled from Eclipse Here is a File containing all the Configuration details
I had attached in case you were also interested, the Configuration info. I am using the Following jar libraries from the JRE1.5.0 These libraries are the ones that are pulled in from eclise when it first comes up, in otherwords, nothing added, nothing deleted from the original selection. rt.jar jsse.jar jce.jar charsets.jar dnsns.jar localedata.jar sunjce_provider.jar sunpkcs11.jar The eclipse build is: Version: 3.0.0 Build id: 2003121820000
Created attachment 7879 [details] Screen Shots of the Error. Attaching a word Document, showing the Error and the resoltion ( inside eclipse ) External to Eclispe the Resolution creates a error.
This should work better on build I20040304 (today's). Need to double check
Verified this is a dup. *** This bug has been marked as a duplicate of 51353 ***