質問

I'm fairly new to android and java, my background is c# .net.

I have a network share mounted to /mnt/cifs/Audio by using CifsManager. Other apps on the device can display the files in that directory.

My problem is that my app goes into a loop when calling listFiles() on a File object. I noticed that it is because there is a file or folder in that share with an invalid Modified UTF-8 name. From LogCat I can see that it is when NewStringUTF is instantiated, obviously this is done internally when I list all the files.

How can I get around this issue? Is there a way to handle that error/exception or is there another way to get all the files & folders without running into this issue?

Any help would be greatly appreciated.

役に立ちましたか?

解決

Not really the answer to my question, but it does allow me to do what I intended.

I am now using the JCIFS library to handle all the mounting and so forth. This library then handles the encoding internally and with good results.

It seems to skip those file/directory names that it doesn't recognize and thus provides some form of error handling on the file/directory names.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top