jersey
  1. jersey
  2. JERSEY-1671

NullPointer using JAXRS 2.0 client apis over SSL

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0-m12
    • Fix Version/s: 2.0-m12, 2.0
    • Component/s: connectors
    • Labels:
      None
    • Environment:

      Standalone Java 7 (Oracle). Ubuntu Linux 12.11 (64)

      Description

      The code:

       
      Client client = ClientFactory.newClient();
      WebTarget target = client.target("https://api.stackexchange.com/2.1/users")
         .path("1305740").queryParam("site", "stackoverflow");
      Response v=target.request().get();
      

      produces the exception:

      Exception in thread "main" javax.ws.rs.client.ClientException
      	at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:220)
      ...
      Caused by: java.lang.NullPointerException
      	at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:258)
      

      Turns out that the connector does not find the SslConfig property.

       
      client.setProperty( ClientProperties.SSL_CONFIG, new SslConfig(null,SSLContext.getDefault()));
      

      does the trick, but binds the client to a specific implementation.

        Activity

        Hide
        cpellegrini added a comment -

        I'm not sure of the component...
        In any case I submitted a pull request on GitHub for the (trivial) fix.
        It is available at https://github.com/jersey/jersey/pull/7

        Show
        cpellegrini added a comment - I'm not sure of the component... In any case I submitted a pull request on GitHub for the (trivial) fix. It is available at https://github.com/jersey/jersey/pull/7
        Hide
        Marek Potociar added a comment -

        Fixed by uptaking a patch from an external contributor.

        Show
        Marek Potociar added a comment - Fixed by uptaking a patch from an external contributor.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            cpellegrini
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 hour
              1h