Solved

Please help me understand this Java exception

Posted on 2008-06-13
5
792 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
  • 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI builder for Eclipse? 8 35
print map entry 34 69
check java version using powershell 13 92
how to see all occupied ports on windows 10 laptop 15 65
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

773 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