Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

JAXRSConnector compares integer with string port values #192

Open
t-mazgalov opened this issue Jul 6, 2017 · 1 comment
Open

JAXRSConnector compares integer with string port values #192

t-mazgalov opened this issue Jul 6, 2017 · 1 comment

Comments

@t-mazgalov
Copy link

The JAXRSConnector checks if the ports of the HTTP Service implementation and the registered resource are equal. In some cases, the value of HTTP Service port is Integer and the check fails.

I'm using the Equinox HTTP Service implementation which registers

{org.osgi.service.http.HttpService}={http.port=80, service.pid=org.eclipse.equinox.http.HttpService-http, http.address=ALL, service.vendor=IBM, service.description=OSGi Http Service - IBM Implementation, http.scheme=http, http.timeout=30, service.id=106, service.bundleid=91, service.scope=bundle}

  private HttpService findHttpServiceForPort( Object port ) {
    ServiceHolder[] serviceHolders = httpServices.getServices();
    HttpService result = null;
    for( ServiceHolder serviceHolder : serviceHolders ) {
      Object servicePort = getPort( serviceHolder );
      // servicePort is Integer
      // port is String
      if( servicePort.equals( port ) ) {
        result = ( HttpService )serviceHolder.getService();
      }
    }
    return result;
  }
@t-mazgalov
Copy link
Author

Pull request opened #193

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant