Java SDK: ClassCastException when casting to in SFOAuthService

  • 1
  • Problem
  • Updated 6 days ago
  • (Edited)
Using the ShareFile Java SDK 3.1.5 I get a ClassCasstException in SFOAuthService:authenticate on the following line: 
connection = (HttpsURLConnection)SFConnectionManager.openConnection(e)
I assume it occurs because it expects a, but as we use weblogic the openConnection(e)-call returns a, which cannot be cast to Both classes extends

Telling weblogic to use the Sun Http-handler by adding the line below works, but it is not a preferable option as our system has multiple Http-integrations.
set JAVA_OPTIONS=%JAVA_OPTIONS% -DUseSunHttpHandler=true
Another option seems to be replacing the SFOAuthService-class with my own implementation that casts to or simply a, but do anyone have any other suggestions?
Photo of Øystein Molnes

Øystein Molnes

  • 5 Posts
  • 0 Reply Likes

Posted 2 weeks ago

  • 1
Photo of Nilesh Pawar

Nilesh Pawar

  • 10 Posts
  • 1 Reply Like
@Øystein Molnes   Currently there is no other option than to do the explicit casting. Going forward SFConnectionManager  will be depreacated and replaced it with a connection factory which deals with a generic interface IHttpsConnection allowing us to switch between okhttp, HttpsUrlConnection etc. But there is no formal timeline to release this to public SDK yet.