Solved

Please help me understand this Java exception

Posted on 2008-06-13
5
788 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes thats an exception from the console
0
 

Author Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now