Solved

Please help me understand this Java exception

Posted on 2008-06-13
5
796 Views
Last Modified: 2012-05-05
I have a Java applet that basically downloads a file and draws a progress bar across the screen showing how much of the file is downloaded. I'm getting the following exception, but I don't understand where it's coming from. Can anybody help me? Thanks.

Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: Invalid remove
   at javax.swing.JTextArea.replaceRange(Unknown Source)
   at com.sun.deploy.util.ConsoleWindow$25.run(Unknown Source)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
0
Comment
Question by:tjgquicken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:ebertk
ID: 21779833
This execption is thrown when you attempt to replace an invalid section of the JTextArea with the method replaceRange.  Do you call this method, if so, could you post some code.  

IllegalArgumentException - if part of the range is an invalid position in the model

replaceRange(String str, int start, int end)

Make sure the start and end are valid for the text currently in the JTextArea.  As a first test, I would simply eliminate the use of the replaceRange and set the entire piece of text in the JTextArea.  If the exception goes away, then it is just a matter of checking the start and end of the JTextArea contents before you call this method (to make sure they are valid)  Or - catch the exception and a handle gracefully.
0
 

Author Comment

by:tjgquicken
ID: 21779910
Here's the problem: I don't have a JTextArea (or anything that extends JTextArea) anywhere in my applet. Could the JTextArea that the exception is referring to be the Java console?
0
 
LVL 5

Assisted Solution

by:ebertk
ebertk earned 225 total points
ID: 21780515
Yes - that could be.  Odd, but yes.  Do you have any code you could post for the applet, I would be happy to take a look.  
0
 
LVL 92

Accepted Solution

by:
objects earned 275 total points
ID: 21787899
Yes thats an exception from the console
0
 

Author Comment

by:tjgquicken
ID: 21789830
Do you know how I can deal with it gracefully? It sort of interrupts my application.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question