This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
core-client/src/main/java/org/glassfish/jersey/client Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,18 @@ private static void setRequestMethodViaJreBugWorkaround(final HttpURLConnection
358358 AccessController .doPrivileged (new PrivilegedExceptionAction <Object >() {
359359 @ Override
360360 public Object run () throws NoSuchFieldException , IllegalAccessException {
361- final Field methodField = httpURLConnectionClass .getSuperclass ().getDeclaredField ("method" );
361+ final Class <?> parentClass = httpURLConnectionClass
362+ .getSuperclass ();
363+ final Field methodField ;
364+ // If the implementation class is an HTTPS URL Connection, we
365+ // need to go up one level higher in the heirarchy to modify the
366+ // 'method' field.
367+ if (parentClass == HttpsURLConnection .class ) {
368+ methodField = parentClass .getSuperclass ().getDeclaredField (
369+ "method" );
370+ } else {
371+ methodField = parentClass .getDeclaredField ("method" );
372+ }
362373 methodField .setAccessible (true );
363374 methodField .set (httpURLConnection , method );
364375 return null ;
You can’t perform that action at this time.
0 commit comments