X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fstrategy%2FReplaceEditConfigStrategy.java;h=8cc2b9e68dc53c2b65d2342d60c019ea16da5b7d;hb=refs%2Fchanges%2F40%2F62940%2F4;hp=9821a8b79efa7e02a33126a489208ece1c9ce381;hpb=b197d75e803beac663033287d769dce62c108490;p=controller.git diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReplaceEditConfigStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReplaceEditConfigStrategy.java index 9821a8b79e..8cc2b9e68d 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReplaceEditConfigStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReplaceEditConfigStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -26,20 +26,18 @@ public class ReplaceEditConfigStrategy extends AbstractEditConfigStrategy { @Override void handleMissingInstance(Map configuration, ConfigTransactionClient ta, - String module, String instance, ServiceRegistryWrapper services) throws - ConfigHandlingException { - throw new ConfigHandlingException( - String.format("Unable to handle missing instance, no missing instances should appear at this point, missing: %s : %s ", - module, - instance), - DocumentedException.ErrorType.APPLICATION, - DocumentedException.ErrorTag.OPERATION_FAILED, - DocumentedException.ErrorSeverity.ERROR); + String module, String instance, ServiceRegistryWrapper services) throws ConfigHandlingException { + throw new ConfigHandlingException(String.format( + "Unable to handle missing instance, no missing instances should appear" + + " at this point, missing: %s : %s ", + module, instance), DocumentedException.ErrorType.APPLICATION, + DocumentedException.ErrorTag.OPERATION_FAILED, DocumentedException.ErrorSeverity.ERROR); } @Override - void executeStrategy(Map configuration, ConfigTransactionClient ta, ObjectName on, ServiceRegistryWrapper services) throws - ConfigHandlingException { + @SuppressWarnings("IllegalCatch") + void executeStrategy(Map configuration, ConfigTransactionClient ta, ObjectName on, + ServiceRegistryWrapper services) throws ConfigHandlingException { for (Entry configAttributeEntry : configuration.entrySet()) { try { AttributeConfigElement ace = configAttributeEntry.getValue(); @@ -47,15 +45,13 @@ public class ReplaceEditConfigStrategy extends AbstractEditConfigStrategy { if (!ace.getResolvedValue().isPresent()) { Object value = ace.getResolvedDefaultValue(); ta.setAttribute(on, ace.getJmxName(), new Attribute(ace.getJmxName(), value)); - LOG.debug("Attribute {} set to default value {} for {}", configAttributeEntry.getKey(), value, - on); + LOG.debug("Attribute {} set to default value {} for {}", configAttributeEntry.getKey(), value, on); } else { Object value = ace.getResolvedValue().get(); ta.setAttribute(on, ace.getJmxName(), new Attribute(ace.getJmxName(), value)); LOG.debug("Attribute {} set to value {} for {}", configAttributeEntry.getKey(), value, on); } - - } catch (Exception e) { + } catch (RuntimeException e) { throw new IllegalStateException("Unable to set attributes for " + on + ", Error with attribute " + configAttributeEntry.getKey() + ":" + configAttributeEntry.getValue(), e); }