diff options
author | michal.banka <michal.banka@nokia.com> | 2019-07-10 16:14:27 +0200 |
---|---|---|
committer | Tomasz Golabek <tomasz.golabek@nokia.com> | 2019-07-25 10:11:05 +0000 |
commit | d0d5690f13b9c794044bfe6bd7ac87557dd3dcea (patch) | |
tree | 651bf59514a2ec3603e753094e0edae54296dc5c /src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java | |
parent | cad897335db0c7912782482fa71932cc2b4ce421 (diff) |
Fix checkstyle violations in sdc/jtosca
Number of checkstyle violations has decreased from about 8200 to 450.
Change-Id: I31f763d7f51fa66958aab68d094280189c612417
Issue-ID: SDC-2434
Signed-off-by: michal.banka <michal.banka@nokia.com>
Diffstat (limited to 'src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java')
-rw-r--r-- | src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java b/src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java index 65304dd..01fb9fc 100644 --- a/src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java +++ b/src/main/java/org/onap/sdc/toscaparser/api/elements/PortSpec.java @@ -7,9 +7,9 @@ * Licensed 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. @@ -38,16 +38,16 @@ public class PortSpec { private static final String SOURCE_RANGE = "source_range"; private static final String TARGET = "target"; private static final String TARGET_RANGE = "target_range"; - + private static final String PROPERTY_NAMES[] = { - PROTOCOL, SOURCE, SOURCE_RANGE, - TARGET, TARGET_RANGE + PROTOCOL, SOURCE, SOURCE_RANGE, + TARGET, TARGET_RANGE }; - + // todo(TBD) May want to make this a subclass of DataType // and change init method to set PortSpec's properties public PortSpec() { - + } // The following additional requirements MUST be tested: @@ -59,47 +59,44 @@ public class PortSpec { // 3) A valid PortSpec MUST have a value for the target property that is // within the numeric range specified by the property target_range // when target_range is specified. - public static void validateAdditionalReq(Object _properties, - String propName, - LinkedHashMap<String,Object> custom_def) { - + public static void validateAdditionalReq(Object _properties, + String propName, + LinkedHashMap<String, Object> custom_def) { + try { - LinkedHashMap<String,Object> properties = (LinkedHashMap<String,Object>)_properties; + LinkedHashMap<String, Object> properties = (LinkedHashMap<String, Object>) _properties; Object source = properties.get(PortSpec.SOURCE); Object sourceRange = properties.get(PortSpec.SOURCE_RANGE); Object target = properties.get(PortSpec.TARGET); Object targetRange = properties.get(PortSpec.TARGET_RANGE); // verify one of the specified values is set - if(source == null && sourceRange == null && - target == null && targetRange == null) { + if (source == null && sourceRange == null && + target == null && targetRange == null) { ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE129", String.format( - "InvalidTypeAdditionalRequirementsError: Additional requirements for type \"%s\" not met", - TYPE_URI))); + "InvalidTypeAdditionalRequirementsError: Additional requirements for type \"%s\" not met", + TYPE_URI))); } // Validate source value is in specified range - if(source != null && sourceRange != null) { - ValidateUtils.validateValueInRange(source,sourceRange,SOURCE); - } - else { + if (source != null && sourceRange != null) { + ValidateUtils.validateValueInRange(source, sourceRange, SOURCE); + } else { DataEntity portdef = new DataEntity("PortDef", source, null, SOURCE); portdef.validate(); } // Validate target value is in specified range - if(target != null && targetRange != null) { - ValidateUtils.validateValueInRange(target,targetRange,SOURCE); - } - else { + if (target != null && targetRange != null) { + ValidateUtils.validateValueInRange(target, targetRange, SOURCE); + } else { DataEntity portdef = new DataEntity("PortDef", source, null, TARGET); portdef.validate(); } - } - catch(Exception e) { + } catch (Exception e) { ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE130", String.format( - "ValueError: \"%s\" do not meet requirements for type \"%s\"", - _properties.toString(),SHORTNAME))); + "ValueError: \"%s\" do not meet requirements for type \"%s\"", + _properties.toString(), SHORTNAME))); } - } + } } |