| Reply | « Previous Thread | Next Thread » |
|
hi @all,
i'm trying to delete a File by usiing this code: Code:
try
{
String dir2 = "file:///" + settingsCtrl.getLocal_dir() + filename;
FileConnection filecon = (FileConnection)Connector.open(dir2);
if(filecon.exists()) {
System.out.println(dir2);
filecon.delete();
}
filecon.close();
display.setCurrent(parent);
}catch (Exception e) {
System.out.println(e.toString());
}
Code:
file:///root/Documents/xml/test.xml java.io.IOException: Execution completed. Even though, the file exists! as you can see, the System.out.println(e.toString()); does not give me a hint, whats going wrong. can you maybe help me? thank you very much in advance, martin |
|
Hi,
Where are you getting the exception.While you do file connection or when u delete a file. Thanks Soku |
|
hi soku123,
i did some changes do debug: Code:
try
{
String dir2 = "file:///" + settingsCtrl.getLocal_dir() + filename;
FileConnection filecon = (FileConnection)Connector.open(dir2);
try
{
if(filecon.exists()) {
System.out.println(dir2);
filecon.delete();
}
filecon.close();
display.setCurrent(parent);
}catch (Exception e) {
System.out.println("delete:" + e.toString());
}
}catch (Exception e) {
System.out.println("connection:" + e.toString());
}
}
Quote:
thanks, Martin |
|
Hi,
Did it print System.out.println(dir2);???? Thanks Soku |
|
jeah i do get the dir2 output ;)
|
|
Hi,
Debug the code using system.out.println() befor filecon.close(), display.setCurrent(parent); and ensure that the exception occurs at delete(). Thanks Soku |
|
Code:
try
{
String dir2 = "file:///" + settingsCtrl.getLocal_dir() + getFilename();
System.out.println(dir2);
FileConnection filecon = (FileConnection)Connector.open(dir2);
if(filecon.exists()) {
filecon.delete();
}
try
{
filecon.close();
display.setCurrent(parent);
}catch (Exception e) {
System.out.println("delete:" + e.toString());
}
}catch (Exception e)
{
System.out.println("connection:" + e.toString());
}
connection:java.io.IOException: so it's the if(filecon.exists()) { filecon.delete(); } part .. hmmm |
|
Hi,
Have u given the fileconnection READ_WRITE permission. Thanks Soku |
|
hi, here is my newest code:
Code:
try
{
String dir2 = "file:///" + settingsCtrl.getLocal_dir() + getFilename();
System.out.println(dir2);
FileConnection filecon = (FileConnection)Connector.open(dir2, Connector.READ_WRITE);
try
{
if(filecon.exists()) {
filecon.delete();
}
filecon.close();
display.setCurrent(parent);
}catch (Exception e) {
System.out.println("delete:" + e.toString());
}
}catch (Exception e)
{
System.out.println("connection:" + e.toString());
}
|
|
Hi,
Debug the code using system.out.println() befor filecon.close(), display.setCurrent(parent);and please post the output.. Thanks Soku |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Tips on using NDS 1.1 | mitts | Symbian Tools & SDKs | 7 | 2006-01-18 17:07 |
| Strange behavior on sending jar file via WAP for different mobile network | thone | Mobile Java General | 0 | 2005-10-27 21:51 |
| What is the error in my code here? Unable to Save document to file | yuva69 | General Symbian C++ | 1 | 2005-05-26 15:22 |
| How to reformat the file? | ryanfunghk | Symbian Networking & Messaging | 0 | 2005-03-26 18:43 |
| nokia 7210 modem via IR doesn't work ! | oussamaaiadi | PC Suite API and PC Connectivity SDK | 1 | 2003-03-06 11:46 |