<?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 Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/542310#M25969</link>
    <description>&lt;P&gt;This is fixed in v4.0.1 of the Java SDK.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Aug 2021 19:43:46 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2021-08-31T19:43:46Z</dc:date>
    <item>
      <title>Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/454732#M23470</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to upload a file using dropbox Java SDK (version 3.1.5). I amgetting file from a ajax form and then trying to upload it but getting the below exception when calling &lt;STRONG&gt;uploadAndFinish()&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;com.dropbox.core.BadResponseException: Bad JSON: expected object value.
 at [Source: ; line: 1, column: 1]
	at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:347)
	at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:324)
	at com.dropbox.core.DbxUploader.finish(DbxUploader.java:268)
	at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:126)
	at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:96)
	at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92)
	at com.muletutorials.dropbox.DropboxService.uploadFile(DropboxService.java:81)
	at com.muletutorials.controller.MuletutorialsController.uploadArticle(MuletutorialsController.java:317)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:213)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1627)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.fasterxml.jackson.core.JsonParseException: expected object value.
 at [Source: ; line: 1, column: 1]
	at com.dropbox.core.stone.StoneSerializer.expectStartObject(StoneSerializer.java:91)
	at com.dropbox.core.ApiErrorResponse$Serializer.deserialize(ApiErrorResponse.java:53)
	at com.dropbox.core.ApiErrorResponse$Serializer.deserialize(ApiErrorResponse.java:36)
	at com.dropbox.core.stone.StoneSerializer.deserialize(StoneSerializer.java:55)
	at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:343)
	... 74 more&lt;/PRE&gt;&lt;P&gt;This is what I have tried yet&lt;/P&gt;&lt;PRE&gt;public boolean uploadFile(StringBuilder fileName, InputStream fileStream) throws DbxException {
		DbxClientV2 client = createClient();
		String path = "/" + fileName.toString();
		try {
			System.out.println("STARTING...............");
			UploadBuilder ub = client.files().uploadBuilder(path);
			System.out.println("ub done");
			ub.withMode(WriteMode.ADD);
			System.out.println("write mode done");
			FileMetadata metadata = ub.uploadAndFinish(fileStream);
			System.out.println("File Uploaded");
			System.out.println(metadata.toStringMultiline());
			System.out.println("FINISHED...............");
			return true;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return false;
	}&lt;/PRE&gt;&lt;P&gt;The code works till &lt;STRONG&gt;write Mode Done&lt;/STRONG&gt; logger. It is failing at the next call, don't know what I am doing wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help !!!&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2020 09:40:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/454732#M23470</guid>
      <dc:creator>Abhay Yadav</dc:creator>
      <dc:date>2020-09-20T09:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455016#M23477</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/63973139/bad-json-expected-object-value-dropbox-api-file-upload-error" target="_self"&gt;https://stackoverflow.com/questions/63973139/bad-json-expected-object-value-dropbox-api-file-upload-error&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the report! This error doesn't reproduce for me with this code though, so we'll need to investigate more. Does this error occur for you when uploading to any file path, or just some path(s) in particular?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 14:48:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455016#M23477</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-09-21T14:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455038#M23479</link>
      <description>&lt;P&gt;I debugged the flow and found the issue. When calling the uploadAndFinish(), somehwere down the line, the API was returning 401&amp;nbsp; status code, the stack trace was not much helpful though to get the root cause.&lt;/P&gt;&lt;P&gt;I regenerated the access token and it worked!!!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 15:45:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455038#M23479</guid>
      <dc:creator>Abhay Yadav</dc:creator>
      <dc:date>2020-09-21T15:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455069#M23483</link>
      <description>&lt;P&gt;Thanks for following up. That actually sounds like a bug in the SDK then. The SDK should automatically convert the 'invalid_access_token' error response to a proper exception. I'll look into it and ask the team to fix that up.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 17:49:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/455069#M23483</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-09-21T17:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493111#M24642</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the same problem, using Dropbox Java SDK 3.1.5. I suspect the issue could be related to new short-lived access tokens and scoped apps, as I don't see this error with "no expiration" token and "full Dropbox" permission type (created in the past).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, my first idea was that some scoped permissions were missing, as all read operations work fine, and the problem occurs only with "uploadAndFinish(inputStream)" method. However, I checked the permissions and I didn't see anything wrong there - there are checked checkboxes at files.metadata.write, files.metadata.read, files.content.write, files.content.read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help, please? I am out of ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filip&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 07:49:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493111#M24642</guid>
      <dc:creator>FilipRachunek</dc:creator>
      <dc:date>2021-02-03T07:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493295#M24649</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1407356"&gt;@FilipRachunek&lt;/a&gt;&amp;nbsp;This is a bug in the Java SDK. This is still open with engineering, but I don't have an update on it yet. I'll follow up here once I do.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 16:10:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493295#M24649</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-03T16:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493298#M24652</link>
      <description>&lt;P&gt;@Greg-DB Thanks for your prompt response. I'll wait for the SDK update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filip&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 16:17:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/493298#M24652</guid>
      <dc:creator>FilipRachunek</dc:creator>
      <dc:date>2021-02-03T16:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/523662#M25470</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is still there, even in version 4.0.0 of the Java SDK.&lt;/P&gt;&lt;LI-CODE lang="java"&gt;com.dropbox.core.BadResponseException: Bad JSON: expected object value.
 at [Source: (String)""; line: 1, column: 1]
	at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:347) ~[dropbox-core-sdk-4.0.0.jar:na]
	at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:324) ~[dropbox-core-sdk-4.0.0.jar:na]
	at com.dropbox.core.DbxUploader.finish(DbxUploader.java:268) ~[dropbox-core-sdk-4.0.0.jar:na]
	at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:126) ~[dropbox-core-sdk-4.0.0.jar:na]
	at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:96) ~[dropbox-core-sdk-4.0.0.jar:na]
	at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92) ~[dropbox-core-sdk-4.0.0.jar:na]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Any chance to fix it soon? I understand that long-lived access tokens will stop working by the end of September 2021, so we'll have to switch to short-lived. However, it's not possible as long as the SDK throws this exception.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 07:19:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/523662#M25470</guid>
      <dc:creator>FilipRachunek</dc:creator>
      <dc:date>2021-05-31T07:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/523755#M25474</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1407356"&gt;@FilipRachunek&lt;/a&gt; This issue is still open with engineering, but I don't have an update or timeline right now. I'll follow up here once I do.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 15:03:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/523755#M25474</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-05-31T15:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/542310#M25969</link>
      <description>&lt;P&gt;This is fixed in v4.0.1 of the Java SDK.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 19:43:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Bad-JSON-expected-object-value-exception-while-uplaoding-a-file/m-p/542310#M25969</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-08-31T19:43:46Z</dc:date>
    </item>
  </channel>
</rss>

