User
User

Reputation: 483

Some parts of String missing - eclipse bug

I am trying to read all the words as a String from the url - http://www.puzzlers.org/pub/wordlists/unixdict.txt

But the outputted String has some part of the strings missing whenever there is a '

  1. Why I am getting the same.
  2. How to avoid the same.

I am getting the same error when using String builder instead of concatenating.

public static String getUrlContents(String theUrl) throws IOException {

        URL url = new URL(theUrl);

        URLConnection urlConnection = url.openConnection();

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));

        String line;
        String text = "";

        while ((line = bufferedReader.readLine()) != null) {

            text += line + " ";
        }

        bufferedReader.close();

        return text;
    }

Output:

After ain' huge blank and then continues from 'd anyhow

enter image description here

and it continues after

enter image description here

So it's eating up the text between two subsequent ' and '

Looks like the text is there, since when I search for antony which is between the blanks the eclipse highlights the word as seen below, but it's not visible on my screen :O

enter image description here

Upvotes: 1

Views: 166

Answers (1)

Akash Thakare
Akash Thakare

Reputation: 23012

As already answered by Naruto that console has buffer size and above that size content is not visible. To check whether your string is correct or not, just copy whole content from console CTRL+A and paste in notepad file, I'm sure you will see complete content.

Basically it's not a bug but predefined size of the console, you can change it as well at (Window > Preferences > Run/Debug > Console).

Another way is just use Fixed Width Console and set Max size which is 1000 and you will be able to see the content in the console.

enter image description here

Upvotes: 1

Related Questions