diff --git a/packing_tool/frameworks/src/general_normalize.cpp b/packing_tool/frameworks/src/general_normalize.cpp index dee595e1e87227edf2229322aa0f48d7c2f28509..78f483afea07e60afe801ba997fb552cc32ab7b2 100644 --- a/packing_tool/frameworks/src/general_normalize.cpp +++ b/packing_tool/frameworks/src/general_normalize.cpp @@ -59,15 +59,15 @@ int32_t GeneralNormalize::PreProcess() { auto it = parameterMap_.find(Constants::PARAM_INPUT_LIST); if (it == parameterMap_.end()) { - LOGE("Input input-list is empty."); + LOGE("--input-list is empty."); return ERR_INVALID_VALUE; } if (!CompatibleProcess(it->second, hspOrhapList_, Constants::HAP_SUFFIX, Constants::HSP_SUFFIX)) { - LOGE("Input input-list is invalid."); + LOGE("--input-list is invalid."); return ERR_INVALID_VALUE; } if (hspOrhapList_.size() == 0) { - LOGE("Input input-list is empty."); + LOGE("--input-list is empty."); return ERR_INVALID_VALUE; } @@ -75,7 +75,7 @@ int32_t GeneralNormalize::PreProcess() std::regex pattern(Constants::VERSION_NAME_PATTERN); if (it != parameterMap_.end()) { if (!std::regex_match(it->second, pattern) || it->second.size() > Constants::MAX_VERSION_NAME_LENGTH) { - LOGE("Input version-name is not valid."); + LOGE("--device-types is invalid."); return ERR_INVALID_VALUE; } } @@ -83,7 +83,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_VERSION_CODE); if (it != parameterMap_.end()) { if (!Utils::IsPositiveInteger(it->second) || stoi(it->second)> Constants::MAX_VERSION_CODE) { - LOGE("Input version-code is invalid."); + LOGE("--version-code is invalid."); return ERR_INVALID_VALUE; } } @@ -92,12 +92,12 @@ int32_t GeneralNormalize::PreProcess() if (it != parameterMap_.end()) { std::list deviceTypeList; if (!Utils::StringToArray(it->second, deviceTypeList)) { - LOGE("Input device-type is invalid."); + LOGE("--device-types is invalid."); return ERR_INVALID_VALUE; } for (auto& item : deviceTypeList) { if ((std::find(DEVICE_TYPE_LIST.begin(), DEVICE_TYPE_LIST.end(), item) == DEVICE_TYPE_LIST.end())) { - LOGE("Input device-type is invalid."); + LOGE("--device-types is invalid."); return ERR_INVALID_VALUE; } } @@ -108,7 +108,7 @@ int32_t GeneralNormalize::PreProcess() if (it != parameterMap_.end()) { if (!std::regex_match(it->second, bundleNamePattern) || it->second.length() < Constants::BUNDLE_NAME_LEN_MIN || it->second.length() > Constants::BUNDLE_NAME_LEN_MAX) { - LOGE("Input bundle-name is invalid."); + LOGE("--bundle-name is invalid."); return ERR_INVALID_VALUE; } } @@ -116,7 +116,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_MIN_COMPATIBLE_VERSION_CODE); if (it != parameterMap_.end()) { if (!Utils::IsPositiveInteger(it->second) || stoi(it->second) > Constants::MAX_VERSION_CODE) { - LOGE("Input min-compatible-version-code is invalid."); + LOGE("--min-compatible-version-code is invalid."); return ERR_INVALID_VALUE; } } @@ -124,7 +124,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_MIN_API_VERSION); if (it != parameterMap_.end()) { if (!Utils::IsPositiveInteger(it->second) || stoi(it->second) > Constants::MAX_VERSION_CODE) { - LOGE("Input min-api-version is invalid."); + LOGE("--min-api-version is invalid."); return ERR_INVALID_VALUE; } } @@ -132,7 +132,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_TARGET_API_VERSION); if (it != parameterMap_.end()) { if (!Utils::IsPositiveInteger(it->second) || stoi(it->second) > Constants::MAX_VERSION_CODE) { - LOGE("Input target-api-version is invalid."); + LOGE("--target-api-version is invalid."); return ERR_INVALID_VALUE; } } @@ -141,7 +141,7 @@ int32_t GeneralNormalize::PreProcess() std::regex releaseTypePattern(Constants::API_RELEASE_TYPE_PATTERN); if (it != parameterMap_.end()) { if (!std::regex_match(it->second, releaseTypePattern)) { - LOGE("Input api-release-type is invalid."); + LOGE("--api-release-type is invalid."); return ERR_INVALID_VALUE; } } @@ -150,7 +150,7 @@ int32_t GeneralNormalize::PreProcess() if (it != parameterMap_.end()) { if ((std::find(Constants::BUNDLE_TYPE_LIST.begin(), Constants::BUNDLE_TYPE_LIST.end(), it->second) == Constants::BUNDLE_TYPE_LIST.end())) { - LOGE("Input bundle-type is invalid."); + LOGE("--bundle-type is invalid."); return ERR_INVALID_VALUE; } } @@ -158,7 +158,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_INSTALLATION_FREE); if (it != parameterMap_.end()) { if (it->second != "true" && it->second != "false") { - LOGE("Input installation-free is invalid."); + LOGE("--installation-free is invalid."); return ERR_INVALID_VALUE; } } @@ -166,7 +166,7 @@ int32_t GeneralNormalize::PreProcess() it = parameterMap_.find(Constants::PARAM_DELIVERY_WITH_INSTALL); if (it != parameterMap_.end()) { if (it->second != "true" && it->second != "false") { - LOGE("Input delivery-with-install is invalid."); + LOGE("--delivery-with-install is invalid."); return ERR_INVALID_VALUE; } } diff --git a/packing_tool/frameworks/src/packager.cpp b/packing_tool/frameworks/src/packager.cpp index 44da1a2b182b5f10f331cab246296f1b3ca9efd8..932409f7b0e7e9c8356c5806bafb2de7fbd57458 100644 --- a/packing_tool/frameworks/src/packager.cpp +++ b/packing_tool/frameworks/src/packager.cpp @@ -464,10 +464,10 @@ bool Packager::IsOutDirectoryValid() { auto it = parameterMap_.find(Constants::PARAM_OUT_PATH); if (it == parameterMap_.end()) { - LOGE("Validate out-path is empty"); + LOGE("--out-path is empty."); return false; } else if (!Utils::IsDirectory(it->second)) { - LOGE("Validate out-path is not a directory."); + LOGE("--out-path is not a directory."); return false; } return true; diff --git a/packing_tool/frameworks/src/utils.cpp b/packing_tool/frameworks/src/utils.cpp index 64fcaa8f259c5f26f71f28bc58266c27b3628326..d67067959f4778bdfb329ddef3d7e04ca86b9146 100644 --- a/packing_tool/frameworks/src/utils.cpp +++ b/packing_tool/frameworks/src/utils.cpp @@ -337,7 +337,7 @@ bool Utils::IsPositiveInteger(const std::string& str, int min, int max) } try { int number = std::stoi(str); - return number > 0 && number >= min && number <= max; + return number >= min && number <= max; } catch (const std::out_of_range& e) { LOGE("Number %s is Out of Range!", str.c_str()); return false;