?
Solved

Please help me understand this Java exception

Posted on 2008-06-13
5
Medium Priority
?
802 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 450 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 550 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

765 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