<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [Java SDK V2] How to find out whether file exists or not in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-SDK-V2-How-to-find-out-whether-file-exists-or-not/m-p/195114#M8868</link>
    <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are migrating from Java SDK API V1 to Java SDK V2 and I am writing some integration tests.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, after I delete a file I need to check, that this file is no longer present on Drobpox or after upload I need to check, that file is there. What is the recommended way, how to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current ugly workaround is this:&lt;/P&gt;&lt;PRE&gt;    private boolean fileExistsOnDbx(String dropboxPath, DbxClientWrapper dbxClientWrapper) throws DbxException {
        try{
            dbxClientWrapper.files().getMetadata(dropboxPath);
            return true;
        }catch (GetMetadataErrorException e){
            if (e.getMessage().contains("{\".tag\":\"path\",\"path\":\"not_found\"}")) {
                return false;
            } else {
                throw e;
            }
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Michal&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:28:12 GMT</pubDate>
    <dc:creator>michal_k</dc:creator>
    <dc:date>2019-05-29T09:28:12Z</dc:date>
    <item>
      <title>[Java SDK V2] How to find out whether file exists or not</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-SDK-V2-How-to-find-out-whether-file-exists-or-not/m-p/195114#M8868</link>
      <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are migrating from Java SDK API V1 to Java SDK V2 and I am writing some integration tests.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, after I delete a file I need to check, that this file is no longer present on Drobpox or after upload I need to check, that file is there. What is the recommended way, how to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current ugly workaround is this:&lt;/P&gt;&lt;PRE&gt;    private boolean fileExistsOnDbx(String dropboxPath, DbxClientWrapper dbxClientWrapper) throws DbxException {
        try{
            dbxClientWrapper.files().getMetadata(dropboxPath);
            return true;
        }catch (GetMetadataErrorException e){
            if (e.getMessage().contains("{\".tag\":\"path\",\"path\":\"not_found\"}")) {
                return false;
            } else {
                throw e;
            }
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Michal&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:28:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-SDK-V2-How-to-find-out-whether-file-exists-or-not/m-p/195114#M8868</guid>
      <dc:creator>michal_k</dc:creator>
      <dc:date>2019-05-29T09:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: [Java SDK V2] How to find out whether file exists or not</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-SDK-V2-How-to-find-out-whether-file-exists-or-not/m-p/195167#M8879</link>
      <description>&lt;P&gt;You can access the structured error information like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        try {
            client.files().getMetadata(dropboxPath);
        } catch (GetMetadataErrorException e){
            if (e.errorValue.isPath() &amp;amp;&amp;amp; e.errorValue.getPathValue().isNotFound()) {
                System.out.println("File not found.");
            } else {
                throw e;
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Nov 2016 21:13:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-SDK-V2-How-to-find-out-whether-file-exists-or-not/m-p/195167#M8879</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-11-21T21:13:26Z</dc:date>
    </item>
  </channel>
</rss>

