Results 1 to 16 of 16
Thread: Error trace in swing application
- 10-20-2008, 07:53 AM #1
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
Error trace in swing application
I have got the following trace in one of my swing based applications,
java.io.IOException: Bad file descriptor
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$ConverterSD.implRead(Unkn own Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
171)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
the associated code is:-
String line;
String query="c:\\WINNT\\system32\\tasklist.exe /FO CSV /v /nh";
Process p = Runtime.getRuntime().exec(query);
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
if (!line.trim().equals("")) {
do something
.....
}
}
p.destroy();
input.close();
can someone help??Last edited by dnyan123; 10-20-2008 at 08:46 AM.
- 10-20-2008, 08:16 AM #2
Why did you delete a part of the stack trace line?at java.io.BufferedReader.readLine(Unknown Source)
171)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
db
- 10-20-2008, 08:43 AM #3
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
part of the company's copyright policy.... however, i've already put the code snippet that i've used... also below is the trace that i deleted..
at biz.***n.ta.c****nt.cl***ient.Ru***ter(cl###ent.ja va:867)
at biz.a***n.ta.cl***ent.clo***ent.access$1100(clo*** nt.java:55)
at biz.au***n.ta.cl***nt.clo***nt$1.actionPerformed(c l***ent.java:171)
hope this helps...
- 10-20-2008, 11:01 AM #4
So what's on line 867?
Maybe your company needs an improved recruitment policy.
db
- 10-20-2008, 11:12 AM #5
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
may be this site needs to revise the criteria it uses to determine so called senior members. The stars and hashes indicate that I am not allowed to indicate the class names. I guess anyone would understand. One more thing. Please help me if you want to. I have attached the code snippet as well the full error trace. And if you doubt the company's recruitment policy so much, may be I can forward you my resume and then you can safely remove the comments that you made.
- 10-20-2008, 11:29 AM #6
Once again, so what's on line 867?
Do you seriously expect that anyone here will be able to get to the root of your problem without even knowing the content of the one line that triggers the exception? After all, you have access to the entire codebase and you're stuck.
db
- 10-20-2008, 11:52 AM #7
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
here' the whole stack without any deletions...
13 Sep 08 11:01:28 ERROR [biz.autoscan.ta.clockingclient.clockingclient:RunC lientUpdater] - RunClientUpdater
java.io.IOException: Bad file descriptor
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$ConverterSD.implRead(Unkn own Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at biz.autoscan.ta.clockingclient.clockingclient.RunC lientUpdater(clockingclient.java:867)
at biz.autoscan.ta.clockingclient.clockingclient.acce ss$1100(clockingclient.java:55)
at biz.autoscan.ta.clockingclient.clockingclient$1.ac tionPerformed(clockingclient.java:171)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
hope this helps. thanks and sorry for being rude in the previous post.
- 10-20-2008, 12:22 PM #8
Not the stack, dnyan123, the line of code that triggers the exception.
Line 867 of clockingclient.java
db
- 10-20-2008, 02:10 PM #9
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
yes, i realize that, and the piece of code that i feel is responsible is as follows, but im not able to figure out why this happens, as it happens not always, only after a certain amount of time..
String line;
String query="c:\\WINNT\\system32\\tasklist.exe /FO CSV /v /nh";
Process p = Runtime.getRuntime().exec(query);
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
if (!line.trim().equals("")) {
do something
.....
}
- 10-20-2008, 02:55 PM #10
The error message seems to say the problem is with reading a file from disk.
The code you've posted is reading the STD output from the process.
How are they related?
- 10-20-2008, 03:56 PM #11
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
ya thats true...however, the error messages say that the exception originates from this particular method of the class..and nowhere else in the stack trace did i find any other possible origins. Also, the piece of code i put is the only place in this method that a file is read. Is there anything you can suggest that I can do for these messages? Because I really cannot find any other place where this can originate from :(
- 10-20-2008, 04:39 PM #12
These three lines of the error message give the source line numbers. You should be able to go into the source and position to those line numbers to get the source for the error.at biz.autoscan.ta.clockingclient.clockingclient.RunC lientUpdater(clockingclient.java:867)
at biz.autoscan.ta.clockingclient.clockingclient.acce ss$1100(clockingclient.java:55)
at biz.autoscan.ta.clockingclient.clockingclient$1.ac tionPerformed(clockingclient.java:171)
- 10-21-2008, 04:17 AM #13
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
Hi Darryl,
the whole method is as under:-
private static void RunClientUpdater(){
// CreateTaskBat();
boolean running=false;
boolean error = false;
logger.info("RunClientUpdater|Checking Whether the Updater is running");
try {
String line;
//String query="c:\\WINNT\\system32\\tasklist.exe /FI " +"\"" + "username eq " + System.getProperty("user.name")+"\"" +" /FI " +"\"" +"imagename eq javaw.exe"+"\"" + " /FO CSV /v /nh";
String query="c:\\WINNT\\system32\\tasklist.exe /FO CSV /v /nh";
Process p = Runtime.getRuntime().exec(query);
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
if (!line.trim().equals("")) {
// get the process id
logger.info("RunClientUpdater|line=>"+line);
String appname=line.substring(0,line.indexOf(","));
appname=appname.replaceAll("\"","");
String processid=line.substring(line.indexOf(",")+1,line. indexOf(",",line.indexOf(",")+1));
processid=processid.replaceAll("\"","");
String processname= line.substring(line.lastIndexOf(",")+1,line.length ());
String user=line.substring(line.indexOf("\\")+1,line.inde xOf(",",line.indexOf("\\")+1));
user=user.replaceAll("\"","");
processname=processname.replaceAll("\"","");
if((processname.length()>=3 && processname.substring(0,3).equals("N/A")) && appname.equals("javaw.exe") && user.equals(System.getProperty("user.name"))){
logger.info("RunClientUpdater|processname=>"+proce ssname.substring(0,3));
logger.info("RunClientUpdater|Updater is running");
running=true;
break;
}
}
}
p.destroy();
input.close();
} catch (Exception err) {
error=true;
logger.error("RunClientUpdater",err);
}
//File file=new File("task.bat");
//file.delete();
if(running==false && error==false){
logger.info("RunClientUpdater|Starting Updater");
String startApp="javaw -jar "+"\""+System.getProperty("user.dir")+"\\ECTAClien tUpdate\\ClockingClientUpdate.jar"+"\"";
logger.info("RunClientUpdater|startApp=>"+startApp );
try {
String directory=System.getProperty("user.dir")+"\\ECTACl ientUpdate";
logger.info("RunClientUpdater|directory=>"+directo ry);
Process p = Runtime.getRuntime().exec(startApp,null,new File(directory));
} catch (IOException ex) {
logger.error("RunClientUpdater",ex);
}
}
}
- 10-21-2008, 07:08 AM #14
Once again, and for the last time, what's on line 867?
Use code tags to post codes and it will look like this --dbJava Code:CODE
- 10-21-2008, 09:19 AM #15
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
the stack trace is an old trace from the user. after that a lot of commented code has been removed. hence, i can't find the corresponding line number. can you let me know something from the code i gave. i went through the bug database of sun, and there was one bug associated with the class BufferReader. the close() method to be specific. So in from the code i gave,
Code: input.close()
i think its not closing the InputStreamReader instance and the inputstream instance while closing the bufferReader instance. Is this why there is a Bad file descriptor error?
- 10-21-2008, 02:50 PM #16
Similar Threads
-
Swing Application Framework
By jurka in forum AWT / SwingReplies: 0Last Post: 10-09-2008, 06:01 PM -
Stack Trace
By Java Tip in forum Java TipReplies: 0Last Post: 12-10-2007, 05:29 PM -
EventHandling code for Swing application
By Java Tip in forum Java TipReplies: 0Last Post: 12-07-2007, 12:06 PM -
swing application consumes much memory
By oregon in forum AWT / SwingReplies: 1Last Post: 08-05-2007, 08:25 AM -
Patterns to application with swing and hibernate
By Peter in forum JDBCReplies: 2Last Post: 07-04-2007, 06:58 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks