近日开发一个本地播放器,在自动扫描上出现问题,在真机上N97会弹出java.lang.SecurityException: Access denied
这个错误,网上找说是真机上某些地方不允许创建文件夹,但是我只是扫描,没有创建啊。求各位大虾指点指点~~
扫描代码如下
/**
* 扫描文件
* **/
public void getTreeList(String path){
FileConnection fc = null;
try {
fc = (FileConnection)Connector.open(path,Connector.READ_WRITE);
Enumeration enums = fc.list();
Vector folderVector = new Vector();
while(enums.hasMoreElements()){
String name = enums.nextElement().toString();
table.put(path+name, new Integer(level));
PlayerUI.strRoot=(path+name);
if(name.indexOf("/") > 0){
folderVector.addElement(name);
}
}
int size = folderVector.size();
if(size > 0) {
level++;
for(int i = 0; i < size; i++){
String tmpPath = path+folderVector.elementAt(i).toString();
getTreeList(tmpPath);
}
}else{
return;
}
}catch (IOException e){
e.printStackTrace();
}finally{
try{
if(fc != null){
fc.close();
}
}catch(IOException e) {
e.printStackTrace();
}
}
}
这个错误,网上找说是真机上某些地方不允许创建文件夹,但是我只是扫描,没有创建啊。求各位大虾指点指点~~
扫描代码如下
/**
* 扫描文件
* **/
public void getTreeList(String path){
FileConnection fc = null;
try {
fc = (FileConnection)Connector.open(path,Connector.READ_WRITE);
Enumeration enums = fc.list();
Vector folderVector = new Vector();
while(enums.hasMoreElements()){
String name = enums.nextElement().toString();
table.put(path+name, new Integer(level));
PlayerUI.strRoot=(path+name);
if(name.indexOf("/") > 0){
folderVector.addElement(name);
}
}
int size = folderVector.size();
if(size > 0) {
level++;
for(int i = 0; i < size; i++){
String tmpPath = path+folderVector.elementAt(i).toString();
getTreeList(tmpPath);
}
}else{
return;
}
}catch (IOException e){
e.printStackTrace();
}finally{
try{
if(fc != null){
fc.close();
}
}catch(IOException e) {
e.printStackTrace();
}
}
}