I have a little problem here I have been hacking away at it for the past hour and have exhausted my knowledge and am extending to here to ask for help. I am trying to create my download method for dropBox and am having a hard time evrytime I run this code when my user activates the ActionEvent for my Button ("Select") I will list the code below long with exception;
Debug your code.
Never make assumptions about the values you are getting. We all think the code we write is correct and that the values we get in our methods are the ones we are expecting. We are quite often wrong.
So debug. Print out the values you are having issues with (usually as given by whatever exception you are getting) and work backwards from there, revisiting the assumptions you made when writing the code.
This doesn't make sense to me. if FileDbxPath doesn't have any "/" in it (as you say is true), then this will cause an exception.
If FileDbxPath does have slashes (say, for example, "/home/users/abcdef/dbxPath" ) you will end up with filename = "/dbxPath" but there is (probably)no such file.
I think you want
which will work regardless of whether there are any slashes in the name.
I have applied the context and it seems to be moving through . Only problem Im getting now is this exception:
an 15, 2016 2:49:01 PM daword.dropboxFolder actionPerformed
java.io.FileNotFoundException: . (Is a directory)
at java.io.FileOutputStream.open0(Native Method)
Now I have checked over and tried track down and change the context but still to no prevail I keep getting the same exception..I don't really understand what I'm missing here as the files clearly exist because I am using a JTree and when the user selects the file that is displayed in this JTree the metadata is extracted and appended to a JText area where is is shown ( " fileILike.txt etc...) than the download method is executed in which when executed the exception is thrown ^ Is there something I am missing or confusing in here?
The error traceback tells it all. In DbxDoenloadFile you are tryoing to open an output stream for file SaveAsFile (NOTE: don't name variables starting with a capital letter).
But that file instance is created from fileName, which is the string ".", which is a directory, not a file.
Thanks for everyones help; I finally got it working for the most part now to add the fancy stuff... What I did was used the modified code Fred gave to me and removed the "." to "" in targetLocalPath and it essentially worked.. Had to look for a few moments for the photo I uploaded then downloaded back to test everything is going through well and was in my APP folder project for tonight is to make the user aware where the file is and to let them save it to a specified file. SO thanks everyone for your input, I appreciate it.