The code I'm running is this;
public class test {
static final String ACCESS_TOKEN = "<REDACTED>";
public static void main(String args[]) throws DbxException, IOException, InterruptedException
{
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
//System.out.println(config.httpRequestor.DefaultTimeoutMillis);
FullAccount account = null;
account = client.users.getCurrentAccount();
System.out.println(account);
List<Metadata> entries = client.files.listFolder("").getEntries();
//WritetoFile jal = new WritetoFile("/semesterProject.client/", "text.txt");
for (Metadata metadata : entries) {
System.out.println(metadata.getName());
//System.out.println(jal.getClass());
//jal.addtoFile(metadata.name);
}
File file = new File("/semesterProject.client/text.txt");
if(!file.exists()) {
System.out.println("File does not exist");
file.createNewFile();// create your file on the file system
}
if(file.exists())
{
System.out.println("File exists");
}
//InputStream in = new FileInputStream(file);
//FileMetadata metadata = client.files.uploadBuilder("/semesterProject.client/text.txt").uploadAndFinish(in);
//DisplayTextFile newfile = new DisplayTextFile("/semesterProject.client/text.txt");
//for(int i=0; i<newfile.getList().size(); i++)
//{
//System.out.println(newfile.getList().get(i));
//}
//System.out.println(DbxEntry.Folder.class);
DbxClientV1 client45 = new DbxClientV1(config, ACCESS_TOKEN);
client45.createFolder("/doggone");
DbxEntry.Folder fold= new DbxEntry.Folder("/doggone", "dog", false);
//System.out.println(fold.toString());
ArrayList kal = null;
//kal = new ArrayList(newfile.getList());
//OrderList kal2 = new OrderList(kal);
//Hashtable mak=kal2.orderAlphabetically();
//sortJava sorting =new sortJava(kal);
//final String[] get=sorting.sorted();
//System.out.println(get[2]);
JFrame frame = new JFrame("FrameDemo");
JTextArea text = new JTextArea();
int k=0;
//Set kalll=mak.keySet();
//Object[] objectarray= new Object[kalll.size()];
//kalll.toArray(objectarray);
//text.setColumns(objectarray.length);
/*while(k<objectarray.length)
{
/text.append((String) mak.get((objectarray[k]))+"\n");
k++;
}*/
frame.add(text);
frame.setVisible(true);
entries = client.files.listFolder("").getEntries();
for (Metadata metadata2 : entries) {
//System.out.println(metadata2.pathLower);
// jal.addtoFile(metadata.name);
}
frame.dispose();
getAllFolders(entries, client);
}
public static void getAllFolders(List <Metadata> entries, DbxClientV2 client ) throws DbxException, IOException
{
ArrayList<String> folders = new ArrayList<String>();
int count =0;
folders.add("");
getfolders(folders, count);
for(int foldercount=0; foldercount<folders.size();foldercount++)
{
System.out.println(folders.get(foldercount)+"KALL");
}
}
public static void getfolders(ArrayList<String> folders, int count) throws DbxException
{
for(int foldercount=count; foldercount<folders.size();foldercount++)
{
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
DbxClientV2 client2 = new DbxClientV2(config, ACCESS_TOKEN);
DbxClientV1 client3 = new DbxClientV1(config, ACCESS_TOKEN);
System.out.println(folders.get(foldercount));
List <Metadata>entries = client2.files.listFolder(folders.get(foldercount)).getEntries();
int hal=0;
for (Metadata metadata : entries)
{
DbxDelta<DbxEntry> result = null;
if(!folders.get(foldercount).startsWith("/"))
{
result = client3.getDeltaWithPathPrefix(null, "/"+folders.get(foldercount));
}
else
{
result = client3.getDeltaWithPathPrefix(null, folders.get(foldercount));
}
List<Entry<DbxEntry>> cursor = result.entries;
for (Entry<DbxEntry> entry : cursor)
{
if(entry.metadata.isFolder())
{
folders.add(entry.metadata.path);
}
}
hal++;
System.out.println(hal);
}
client3 = new DbxClientV1(config, ACCESS_TOKEN);
}
count++;
getfolders(folders, count);
}
}
And the error message I'm getting is this;
Exception in thread "main" com.dropbox.core.NetworkIOException: Read timed out
at com.dropbox.core.DbxRequestUtil.readJsonFromResponse(DbxRequestUtil.java:364)
at com.dropbox.core.v1.DbxClientV1$8.handle(DbxClientV1.java:1579)
at com.dropbox.core.v1.DbxClientV1$8.handle(DbxClientV1.java:1575)
at com.dropbox.core.DbxRequestUtil.finishResponse(DbxRequestUtil.java:432)
at com.dropbox.core.DbxRequestUtil$2.run(DbxRequestUtil.java:425)
at com.dropbox.core.DbxRequestUtil.runAndRetry(DbxRequestUtil.java:469)
at com.dropbox.core.DbxRequestUtil.doPostNoAuth(DbxRequestUtil.java:421)
at com.dropbox.core.DbxRequestUtil.doPost(DbxRequestUtil.java:410)
at com.dropbox.core.v1.DbxClientV1.doPost(DbxClientV1.java:2222)
at com.dropbox.core.v1.DbxClientV1._getDelta(DbxClientV1.java:1575)
at com.dropbox.core.v1.DbxClientV1.getDeltaWithPathPrefix(DbxClientV1.java:1536)
at test.getfolders(test.java:129)
at test.getAllFolders(test.java:108)
at test.main(test.java:101)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593)
at sun.security.ssl.InputRecord.read(InputRecord.java:532)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:244)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:689)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3335)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.loadMore(UTF8StreamJsonParser.java:207)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.slowParseName(UTF8StreamJsonParser.java:1877)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parseName(UTF8StreamJsonParser.java:1669)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:752)
at com.dropbox.core.json.JsonDateReader$1.read(JsonDateReader.java:29)
at com.dropbox.core.json.JsonDateReader$1.read(JsonDateReader.java:19)
at com.dropbox.core.json.JsonReader.readField(JsonReader.java:48)
at com.dropbox.core.v1.DbxEntry._read(DbxEntry.java:872)
at com.dropbox.core.v1.DbxEntry.read(DbxEntry.java:827)
at com.dropbox.core.v1.DbxEntry$1.read(DbxEntry.java:611)
at com.dropbox.core.v1.DbxEntry$1.read(DbxEntry.java:607)
at com.dropbox.core.json.JsonReader.readOptional(JsonReader.java:58)
at com.dropbox.core.v1.DbxDelta$Entry$Reader.read(DbxDelta.java:274)
at com.dropbox.core.v1.DbxDelta$Entry$Reader.read(DbxDelta.java:248)
at com.dropbox.core.v1.DbxDelta$Entry$Reader.read(DbxDelta.java:237)
at com.dropbox.core.json.JsonArrayReader.read(JsonArrayReader.java:44)
at com.dropbox.core.json.JsonArrayReader.read(JsonArrayReader.java:33)
at com.dropbox.core.json.JsonReader.readField(JsonReader.java:48)
at com.dropbox.core.v1.DbxDelta$Reader.read(DbxDelta.java:130)
at com.dropbox.core.v1.DbxDelta$Reader.read(DbxDelta.java:102)
at com.dropbox.core.v1.DbxDelta$Reader.read(DbxDelta.java:91)
at com.dropbox.core.json.JsonReader.readFully(JsonReader.java:565)
at com.dropbox.core.json.JsonReader.readFully(JsonReader.java:458)
at com.dropbox.core.DbxRequestUtil.readJsonFromResponse(DbxRequestUtil.java:359)
... 13 more
Is there any way of solving this without changing the timeout timer? If there isn't, how can I change the timeout period?