This is an automated email from the ASF dual-hosted git repository. amichai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
commit bc5cee5184240342745ff2e45ba2263f3a1bae9d Author: Amichai Rothman <[email protected]> AuthorDate: Mon Jun 3 07:52:05 2024 +0300 Fix string concatenation in log messages --- .../apache/aries/rsa/discovery/endpoint/PropertiesMapper.java | 4 ++-- .../rsa/discovery/local/EndpointDescriptionBundleParser.java | 2 +- .../aries/rsa/discovery/zookeeper/client/ClientManager.java | 2 +- .../rsa/discovery/zookeeper/server/ZookeeperStarter.java | 2 +- .../java/org/apache/aries/rsa/eapub/EventAdminHelper.java | 2 +- .../rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java | 6 +++--- .../rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java | 4 ++-- .../apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java | 6 +++--- .../apache/aries/rsa/core/DistributionProviderTracker.java | 2 +- rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java | 7 +++---- .../org/apache/aries/rsa/core/RemoteServiceAdminCore.java | 11 ++++++----- .../rsa/topologymanager/importer/TopologyManagerImport.java | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java index cee5d2b9..1d5d9f33 100644 --- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java +++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java @@ -165,7 +165,7 @@ class PropertiesMapper { return null; } if (!"String".equals(type)) { - LOG.warn("Embedded XML must be of type String, found: " + type); + LOG.warn("Embedded XML must be of type String, found: {}", type); return null; } Node xmlContent = (Node)el.getAny(); @@ -225,7 +225,7 @@ class PropertiesMapper { return ctor.newInstance(value); } } catch (Exception e) { - LOG.warn("Could not create Endpoint Property of type " + type + " and value " + value); + LOG.warn("Could not create Endpoint Property of type {} and value {}", type, value); return null; } } diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java index e45af33f..339e215b 100644 --- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java +++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java @@ -51,7 +51,7 @@ public final class EndpointDescriptionBundleParser { try { elements.addAll(parser.readEndpoints(resourceURL.openStream())); } catch (Exception ex) { - LOG.warn("Problem parsing: " + resourceURL, ex); + LOG.warn("Problem parsing: {}", resourceURL, ex); } } return elements; diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java index ec5cc16e..388e7633 100644 --- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java +++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java @@ -105,7 +105,7 @@ public class ClientManager implements Watcher { /* Callback for ZooKeeper */ public void process(WatchedEvent event) { - LOG.debug("Got ZooKeeper event " + event); + LOG.debug("Got ZooKeeper event {}", event); if (event.getState() == KeeperState.SyncConnected) { LOG.info("Connection to ZooKeeper established. Publishing Zookeeper service"); diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java index 7c7fb20c..cdbd8bdf 100644 --- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java +++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java @@ -52,7 +52,7 @@ public class ZookeeperStarter { QuorumPeerConfig peerConfig = parseConfig(config, context); startFromConfig(peerConfig); } catch (Exception th) { - LOG.warn("Problem applying configuration update: " + config, th); + LOG.warn("Problem applying configuration update: {}", config, th); } } diff --git a/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java b/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java index 9c2392dd..88c19be6 100644 --- a/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java +++ b/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java @@ -92,7 +92,7 @@ public class EventAdminHelper implements RemoteServiceAdminListener { try { refs = bctx.getAllServiceReferences(EventAdmin.class.getName(), null); } catch (InvalidSyntaxException e) { - LOG.error("Failed to get EventAdmin: " + e.getMessage(), e); + LOG.error("Failed to get EventAdmin: {}", e.getMessage(), e); } if (refs != null) { diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java index 2e6b1493..f943431e 100644 --- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java +++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java @@ -119,13 +119,13 @@ public abstract class AbstractInvocationStrategy implements InvocationStrategy { } catch(Exception e) { - LOGGER.warn("Initial Encoding response for method "+method+" failed. Retrying", e); + LOGGER.warn("Initial Encoding response for method {} failed. Retrying", method, e); // we failed to encode the response.. reposition and write that error. try { responseStream.position(pos); serializationStrategy.encodeResponse(loader, null, null, new ServiceException(e.toString()), responseStream); } catch (Exception unexpected) { - LOGGER.error("Error while servicing "+method, unexpected); + LOGGER.error("Error while servicing {}", method, unexpected); } } finally { @@ -180,7 +180,7 @@ public abstract class AbstractInvocationStrategy implements InvocationStrategy { responseStream.position(pos); serializationStrategy.encodeResponse(loader, resultType, value, new ServiceException(e.toString()), responseStream); } catch (Exception unexpected) { - LOGGER.error("Error while servicing "+method, unexpected); + LOGGER.error("Error while servicing {}", method, unexpected); } } finally { onComplete.run(); diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java index 7844b380..32d27901 100644 --- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java +++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java @@ -115,13 +115,13 @@ public class BlockingInvocationStrategy extends AbstractInvocationStrategy { } catch(Exception e) { - LOGGER.warn("Initial Encoding response for method "+method+" failed. Retrying", e); + LOGGER.warn("Initial Encoding response for method {} failed. Retrying", method, e); // we failed to encode the response.. reposition and write that error. try { responseStream.position(pos); serializationStrategy.encodeResponse(loader, method.getReturnType(), null, new RemoteException(e.toString()), responseStream); } catch (Exception unexpected) { - LOGGER.error("Error while servicing "+method, unexpected); + LOGGER.error("Error while servicing {}", method, unexpected); } } finally { diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java index a3f52cac..32f69ab3 100644 --- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java +++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java @@ -108,7 +108,7 @@ public class TcpTransport implements Transport { if (onCompleted != null) { onCompleted.run(); } - LOG.error("start should not be called from state: " + _serviceState); + LOG.error("start should not be called from state: {}", _serviceState); } } }); @@ -137,7 +137,7 @@ public class TcpTransport implements Transport { if (onCompleted != null) { onCompleted.run(); } - LOG.error("stop should not be called from state: " + _serviceState); + LOG.error("stop should not be called from state: {}", _serviceState); } } }); @@ -497,7 +497,7 @@ public class TcpTransport implements Transport { if( LOG.isTraceEnabled() ) { final String label = dispatchQueue.getLabel(); if( label !=null ) { - LOG.trace(label +" | "+message); + LOG.trace("{} | {}", label, message); } else { LOG.trace(message); } diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java b/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java index 71589872..e1c948e5 100644 --- a/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java +++ b/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java @@ -65,7 +65,7 @@ public class DistributionProviderTracker extends ServiceTracker<DistributionProv Dictionary<String, Object> props = new Hashtable<>(); props.put(REMOTE_INTENTS_SUPPORTED, getPropertyNullSafe(reference, REMOTE_INTENTS_SUPPORTED)); props.put(REMOTE_CONFIGS_SUPPORTED, getPropertyNullSafe(reference, REMOTE_CONFIGS_SUPPORTED)); - LOG.info("Registering RemoteServiceAdmin for provider " + provider.getClass().getName()); + LOG.info("Registering RemoteServiceAdmin for provider {}", provider.getClass().getName()); return context.registerService(RemoteServiceAdmin.class.getName(), rsaf, props); } diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java b/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java index d4de961b..1b03825a 100644 --- a/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java +++ b/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java @@ -50,8 +50,8 @@ public class PackageUtil { try { Bundle b = pa.getBundle(iClass); if (b == null) { - LOG.info("Unable to find interface version for interface " + iClass.getName() - + ". Falling back to 0.0.0"); + LOG.info("Unable to find interface version for interface {}. Falling back to 0.0.0", + iClass.getName()); return "0.0.0"; } LOG.debug("Interface source bundle: {}", b.getSymbolicName()); @@ -79,8 +79,7 @@ public class PackageUtil { LOG.error("Was unable to obtain the package admin service -> can't resolve interface versions"); } - LOG.info("Unable to find interface version for interface " + iClass.getName() - + ". Falling back to 0.0.0"); + LOG.info("Unable to find interface version for interface {}. Falling back to 0.0.0", iClass.getName()); return "0.0.0"; } } diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java b/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java index 2d7dcc8e..de1953c4 100644 --- a/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java +++ b/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java @@ -228,7 +228,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin { final List<String> interfaceNames, final ServiceReference<?> serviceReference, final Map<String, Object> serviceProperties) { - LOG.info("interfaces selected for export: " + interfaceNames); + LOG.info("interfaces selected for export: {}", interfaceNames); try { checkPermission(new EndpointPermission("*", EndpointPermission.EXPORT)); @@ -497,7 +497,8 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin { imReg.setImportedServiceRegistration(csfReg); } catch (Exception ex) { // Only logging at debug level as this might be written to the log at the TopologyManager - LOG.debug("Can not proxy service with interfaces " + Arrays.toString(interfaceNames) + ": " + ex.getMessage(), ex); + LOG.debug("Can not proxy service with interfaces {}: {}", + Arrays.toString(interfaceNames), ex.getMessage(), ex); imReg.setException(ex); } return imReg; @@ -619,7 +620,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin { } public void close() { - LOG.info("Closing " + this.getClass().getSimpleName()); + LOG.info("Closing {}", this.getClass().getSimpleName()); closeImportRegistrations(); if (exportedServiceListener != null) { bctx.removeServiceListener(exportedServiceListener); @@ -639,8 +640,8 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin { if (org.osgi.framework.Constants.SERVICE_ID.toLowerCase().equals(lowerKey) || org.osgi.framework.Constants.OBJECTCLASS.toLowerCase().equals(lowerKey)) { // objectClass and service.id must not be overwritten - LOG.info("exportService called with additional properties map that contained illegal key: " - + key + ", the key is ignored"); + LOG.info("exportService called with additional properties map that contained illegal key: {}," + + " the key is ignored", key); } else { String origKey = keysLowerCase.get(lowerKey); if (origKey != null) { diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java index 896f1e0b..fe53007d 100644 --- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java +++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java @@ -152,7 +152,7 @@ public class TopologyManagerImport implements EndpointEventListener, RemoteServi LOG.debug("Service import was successful {}", ir); return Stream.of(ir); } else { - LOG.info("Error importing service " + endpoint, ir.getException()); + LOG.info("Error importing service {}", endpoint, ir.getException()); } } }
