diff options
author | nancylizi <li.zi30@zte.com.cn> | 2016-10-13 12:39:32 +0800 |
---|---|---|
committer | nancylizi <li.zi30@zte.com.cn> | 2016-10-13 12:39:32 +0800 |
commit | 9386579264e640c804ed79dd03a41e55fd0472e9 (patch) | |
tree | 010d9e1a051a8f6ad1e51fa19ad8fd18ceb9a03d /catalog-core | |
parent | c2d6aa2b98f683fd84f6f157eceae4a7977d029a (diff) |
Fix the problem "when upload package throws an exception "String index out of range: -1"
Change-Id: I594c2e47b104d237390dc9f45d4447e3129f2594
Issue-id:TOSCA-115
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
Diffstat (limited to 'catalog-core')
-rw-r--r-- | catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java index 763e2009..3ae5fef1 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java @@ -403,19 +403,21 @@ public class PackageWrapperUtil { reader = new BufferedReader(new FileReader(file)); String tempString = null; while ((tempString = reader.readLine()) != null) { - int count1 = tempString.indexOf(":"); - String meta = tempString.substring(0, count1).trim(); - if (meta.equalsIgnoreCase(CommonConstant.CSAR_TYPE_META)) { - int count = tempString.indexOf(":") + 1; - basicInfo.setType(EnumType.valueOf(tempString.substring(count).trim())); - } - if (meta.equalsIgnoreCase(CommonConstant.CSAR_PROVIDER_META)) { - int count = tempString.indexOf(":") + 1; - basicInfo.setProvider(tempString.substring(count).trim()); - } - if (meta.equalsIgnoreCase(CommonConstant.CSAR_VERSION_META)) { - int count = tempString.indexOf(":") + 1; - basicInfo.setVersion(tempString.substring(count).trim()); + if (!tempString.equals("")) { + int count1 = tempString.indexOf(":"); + String meta = tempString.substring(0, count1).trim(); + if (meta.equalsIgnoreCase(CommonConstant.CSAR_TYPE_META)) { + int count = tempString.indexOf(":") + 1; + basicInfo.setType(EnumType.valueOf(tempString.substring(count).trim())); + } + if (meta.equalsIgnoreCase(CommonConstant.CSAR_PROVIDER_META)) { + int count = tempString.indexOf(":") + 1; + basicInfo.setProvider(tempString.substring(count).trim()); + } + if (meta.equalsIgnoreCase(CommonConstant.CSAR_VERSION_META)) { + int count = tempString.indexOf(":") + 1; + basicInfo.setVersion(tempString.substring(count).trim()); + } } } reader.close(); |