rdowner commented on a change in pull request #1150:
URL: https://github.com/apache/brooklyn-server/pull/1150#discussion_r582698944
##########
File path:
core/src/main/java/org/apache/brooklyn/util/core/ClassLoaderUtils.java
##########
@@ -332,25 +333,44 @@ public URL getResource(String name) {
String name) {
Framework framework = getFramework();
if (framework != null) {
- Maybe<Bundle> bundle = Osgis.bundleFinder(framework)
- .symbolicName(symbolicName)
- .version(version)
- .find();
- if (bundle.isAbsent()) {
+
+ if (Strings.isBlank(version)) {
+ try {
+ // if the class can be loaded using the default
classloader, and it comes from a bundle matching symbolic name, and version not
specified,read
+ // then use that version of the bundle, rather than the
latest version
+ ClassLoader cl =
classLoader.loadClass(name).getClassLoader();
+ if (cl instanceof BundleReference){
+// if (cl instanceof BundleClassLoader) {
Review comment:
No commented out code please
##########
File path: pom.xml
##########
@@ -191,7 +191,8 @@
5.x from json-path -> json-smart -> accessors-smart; pax-web-core
brings in 7.x -->
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<javax.mail.version>1.4.7</javax.mail.version> <!-- version should
align with 'jetty' feature -->
-
<cxf.javax.annotation-api.version>1.3.5</cxf.javax.annotation-api.version> <!--
cxf-specs feature v3.4.1 declares v1.3.5; jetty 9.4.35.v20201120 declares
v1.3.2 -->
+ <jakarta.annotation-api.version>1.3.5</jakarta.annotation-api.version>
+
<cxf.javax.annotation-api.version>${jakarta.annotation-api.version}</cxf.javax.annotation-api.version>
<!-- cxf-specs feature v3.4.1 declares v1.3.5; jetty 9.4.35.v20201120 declares
v1.3.2 -->
Review comment:
So version `cxf.javax.annotation-api.version` comes from
`jakarta.annotation-api.version`? Versions are deliberately in sync? This looks
a bit odd (I first thought you'd put the variable in the wrong line) so maybe
an comment would be a good idea.
##########
File path:
karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherImpl.java
##########
@@ -16,7 +16,7 @@
package org.apache.brooklyn.launcher.osgi;
import com.google.common.base.Stopwatch;
-import com.sun.xml.bind.v2.TODO;
+//import com.sun.xml.bind.v2.TODO;
Review comment:
No commented out code please
##########
File path:
core/src/main/java/org/apache/brooklyn/util/core/xstream/HashMultimapConverter.java
##########
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.util.core.xstream;
+
+import com.google.common.collect.HashMultimap;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.converters.collections.CollectionConverter;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Collection;
+import java.util.Set;
+
+/** serialization of HashMultimap changed after Guava 18;
+ * to support pre-Guava-18 serialized objects we just continue to use the old
logic.
+ * To test, note that this is testable with the RebingTest.testSshFeed_2018_...
+ */
+public class HashMultimapConverter extends CollectionConverter{
+
+ public HashMultimapConverter(Mapper mapper) {
+ super(mapper);
+ }
+
+ // TODO how do we convert this from ObjectOutputStream to XStream mapper ?
+ // (code below copied from HashMultimap.readObject / writeObject)
Review comment:
Where was this copied from? Are we OK to do this under the code's
license?
Assuming this is from Google Guava, which is Apache License 2, we're OK. Can
you confirm?
##########
File path:
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/ScannerInjectHelper.java
##########
@@ -15,13 +15,18 @@
*/
package org.apache.brooklyn.rest.util;
+import io.swagger.jaxrs.config.SwaggerContextService;
+import io.swagger.jaxrs.config.SwaggerScannerLocator;
import org.apache.brooklyn.rest.apidoc.RestApiResourceScanner;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import io.swagger.config.ScannerFactory;
public class ScannerInjectHelper {
public void setServer(JAXRSServerFactoryBean server) {
- RestApiResourceScanner.install(server.getResourceClasses());
+ RestApiResourceScanner scanner = new
RestApiResourceScanner(server.getResourceClasses());
+ ScannerFactory.setScanner(scanner);
+ // Above method broken in Swagger 1.6.2
Review comment:
What's the consequence of that broken method? Can you expand this
comment please?
##########
File path: pom.xml
##########
@@ -122,7 +122,7 @@
<activator.servicemix.version>2.9.0</activator.servicemix.version>
<!-- double-check downstream projects before changing jackson version
-->
<fasterxml.jackson.version>2.11.3</fasterxml.jackson.version>
- <cxf.version>3.4.1</cxf.version>
+ <cxf.version>3.3.9</cxf.version>
Review comment:
Moving *back* a version?
##########
File path: karaf/features/src/main/feature/feature.xml
##########
@@ -111,7 +112,7 @@
<bundle
dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsr305/${jsr305.bundle.version}</bundle>
<bundle
dependency='true'>mvn:com.google.code.gson/gson/${gson.version}</bundle>
- <bundle
dependency='true'>wrap:mvn:javax.activation/activation/${javax-activation.version}</bundle>
+<!-- <bundle
dependency='true'>wrap:mvn:javax.activation/activation/${javax-activation.version}</bundle>-->
Review comment:
No commented out code please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]