12-12-2009 04:24 PM
I think this is a setup problem. This works fine using the simulator. But not on my Blackberry.
I have put a bunch of .csv files in another Blackberry Project called CSV.
My main project opens an InputSteam to read on of these files from the other project (let's call it ProjectA:
is = (InputStream) Connector.openInputStream(
"cod://CSV/" + company.csvFilename);
I get an exception on my Blackberry. Is there something that I need to do special when adding ProjectA to my Blackberry so that it can still "see" the CSV project?
Solved! Go to Solution.
12-12-2009 09:23 PM
And the exception is.....
12-13-2009 06:03 AM
If I'm not mistaken only applications signed with RIM internal apps key (these signatures aren't available to third-party application developers) can use the "cod" protocol. I suspect your code works in the simulator only because you are running the simulator with security checks disabled. I'm also guessing that the exception you are getting is a ControlledAccessException.
12-13-2009 12:12 PM - edited 12-13-2009 12:20 PM
I had a catch(Exception) in there so I had to fix that up to show the real exception.
Yes that's it ControlledAccessException.
I guess I'm stuck using the file:// protocol now and putting all of my csv files into the same project or is there some better way? I believe that I can use the file:// protocol to access files within my .cod but I still not sure what the correct path is to use.
12-13-2009 12:23 PM - edited 12-13-2009 12:25 PM
Not necessarily, you could create a class that contains a function to get the resource for you.
This way instead of doing {Class Variable}.getResourceAsStream, you would do something like ResourceClass.getResource and inside that it gets that class's Class and does the same getResourceAsStream. This way you maintain separation of resources and it will still work.
At least that's how I did it.
EDIT: Oops, didn't realize that you weren't using getResourceAsStream, either way it will return the desired result.
12-13-2009 12:38 PM
Thanks for everyone's help! I initially didn't want to do things that way, but at this point I think that's the way that I'll go.
12-13-2009 01:25 PM
Understandable, sometimes getting something working is better then getting it to work the way you want it to.