Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http-Client: packages in OSGI Import-Package removed #1439

Closed
danthe1st opened this issue Aug 30, 2021 · 1 comment · Fixed by #1440
Closed

Http-Client: packages in OSGI Import-Package removed #1439

danthe1st opened this issue Aug 30, 2021 · 1 comment · Fixed by #1440
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@danthe1st
Copy link
Contributor

danthe1st commented Aug 30, 2021

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types
  2. OS type and version: Windows 10
  3. Java version: 14.0.1
  4. google-http-client version(s): 1.40.0

Steps to reproduce

  1. Download google-http-client version 1.39.2-sp.1 and 1.40.0 (note that 1.40.0 is not present in the directory list of maven central for whatever reason)
  2. Compare the META-INF/MANIFEST.MF files of those JARs.
  3. The Import-Package declaration in the MANIFEST.MF of version 1.39.2-sp.1 declared the packages used with javax.annotation as a mandatory package (Mandatory dependence to javax.annotation in osgi environment #1323). while the MANIFEST.MF of version 1.40.0 only includes javax.annotation as an optional package but the other packages are missing.

Code example

1.39.2-sp1:

Import-Package: com.google.common.base;version="[30.1,31)",com.google.
 common.collect;version="[30.1,31)",com.google.common.io;version="[30.
 1,31)",com.google.common.util.concurrent;version="[30.1,31)",io.openc
 ensus.common,io.opencensus.contrib.http.util,io.opencensus.trace,io.o
 pencensus.trace.export,io.opencensus.trace.propagation,javax.annotati
 on;version="[3.0,4)",javax.net.ssl,org.apache.http,org.apache.http.cl
 ient,org.apache.http.client.methods,org.apache.http.conn,org.apache.h
 ttp.conn.params,org.apache.http.conn.routing,org.apache.http.conn.sch
 eme,org.apache.http.conn.ssl,org.apache.http.entity,org.apache.http.i
 mpl.client,org.apache.http.impl.conn,org.apache.http.impl.conn.tsccm,
 org.apache.http.message,org.apache.http.params,org.apache.http.protoc
 ol

1.40.0:

Import-Package: javax.annotation;resolution:=optional;version="[3.0,4)
 "

Any additional information below

This is because I made a mistake in #1405 that fixed #1323 by explicitely adding the Import-Package declaration of javax.annotation without the other dependencies.

The other packages can be added by adding ,* to the Import-Package declaration in the pom.xml as follows:

<Import-Package>javax.annotation;resolution:=optional,*</Import-Package>

This adds the other packages just like before while still declaring javax.annotation as being optional.

The resulting Import-Package declaration looks like this (from target/classes/META-INF/MANIFEST.MF after fixing it and running mvn bundle:manifest):

Import-Package: javax.annotation;resolution:=optional;version="[3.0,4)",
 com.google.common.base;version="[30.1,31)",com.google.common.collect;ve
 rsion="[30.1,31)",com.google.common.io;version="[30.1,31)",com.google.c
 ommon.util.concurrent;version="[30.1,31)",io.opencensus.common,io.openc
 ensus.contrib.http.util,io.opencensus.trace,io.opencensus.trace.export,
 io.opencensus.trace.propagation,javax.net.ssl,org.apache.http,org.apach
 e.http.client,org.apache.http.client.methods,org.apache.http.conn,org.a
 pache.http.conn.params,org.apache.http.conn.routing,org.apache.http.con
 n.scheme,org.apache.http.conn.ssl,org.apache.http.entity,org.apache.htt
 p.impl.client,org.apache.http.impl.conn,org.apache.http.impl.conn.tsccm
 ,org.apache.http.message,org.apache.http.params,org.apache.http.protoco
 l
danthe1st added a commit to danthe1st/google-http-java-client that referenced this issue Aug 30, 2021
@Neenu1995 Neenu1995 added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 30, 2021
@lesv lesv closed this as completed in #1440 Sep 1, 2021
@lesv
Copy link
Contributor

lesv commented Sep 1, 2021

Thank you for the fix.

gcf-merge-on-green bot pushed a commit that referenced this issue Oct 7, 2021
🤖 I have created a release \*beep\* \*boop\*
---
### [1.40.1](https://www.github.com/googleapis/google-http-java-client/compare/v1.40.0...v1.40.1) (2021-10-07)


### Bug Fixes

* add used packages to OSGI manifest again ([#1439](https://www.github.com/googleapis/google-http-java-client/issues/1439)) ([#1440](https://www.github.com/googleapis/google-http-java-client/issues/1440)) ([59fc8b0](https://www.github.com/googleapis/google-http-java-client/commit/59fc8b03e5518864c60ce4dd47664e8935da343b))
* update NetHttpRequest to prevent silent retry of DELETE requests ([#1472](https://www.github.com/googleapis/google-http-java-client/issues/1472)) ([57ef11a](https://www.github.com/googleapis/google-http-java-client/commit/57ef11a0e1904bb932e5493a30f0a2ca2a2798cf)), closes [#1471](https://www.github.com/googleapis/google-http-java-client/issues/1471)


### Dependencies

* update dependency com.fasterxml.jackson.core:jackson-core to v2.12.5 ([#1437](https://www.github.com/googleapis/google-http-java-client/issues/1437)) ([0ce8467](https://www.github.com/googleapis/google-http-java-client/commit/0ce84676bfbe4cc8e237d5e33dfaa532b13e798c))
* update dependency com.fasterxml.jackson.core:jackson-core to v2.13.0 ([#1469](https://www.github.com/googleapis/google-http-java-client/issues/1469)) ([7d9a042](https://www.github.com/googleapis/google-http-java-client/commit/7d9a042110b8879b592d7e80bd73e77c7a84d8b7))
* update dependency com.google.protobuf:protobuf-java to v3.18.0 ([#1454](https://www.github.com/googleapis/google-http-java-client/issues/1454)) ([cc63e41](https://www.github.com/googleapis/google-http-java-client/commit/cc63e41fac8295c7fea751191a6fe9537c1f70e3))
* update dependency com.google.protobuf:protobuf-java to v3.18.1 ([#1470](https://www.github.com/googleapis/google-http-java-client/issues/1470)) ([c36637a](https://www.github.com/googleapis/google-http-java-client/commit/c36637acbca536992349970664026cf145ad8964))
* update dependency com.puppycrawl.tools:checkstyle to v9 ([#1441](https://www.github.com/googleapis/google-http-java-client/issues/1441)) ([a95cd97](https://www.github.com/googleapis/google-http-java-client/commit/a95cd9717fc8accd80252b12357971cb71887d90))
* update project.appengine.version to v1.9.91 ([#1287](https://www.github.com/googleapis/google-http-java-client/issues/1287)) ([09ebf8d](https://www.github.com/googleapis/google-http-java-client/commit/09ebf8d7e3860f2b94a6fea0ef134c93904d4ed1))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants