diff --git a/adapter/ohos/CompressVerify.java b/adapter/ohos/CompressVerify.java index c0a1bb58dd7f8b6239972caef258aa1b7e9b29d9..ba1371c47f234683891509ab1ce33aa5a6ec6b40 100644 --- a/adapter/ohos/CompressVerify.java +++ b/adapter/ohos/CompressVerify.java @@ -241,7 +241,7 @@ public class CompressVerify { return false; } if (!RPCID_PROFILE.equals(file.getName())) { - String errMsg = "--rpcid-path must be rpcid.sc file."; + String errMsg = "--rpcid-path must be the rpcid.sc file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -258,7 +258,7 @@ public class CompressVerify { return false; } if (!PACK_INFO.equals(file.getName())) { - String errMsg = "--pack-info-path must be pack.info file."; + String errMsg = "--pack-info-path must be the pack.info file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -274,7 +274,7 @@ public class CompressVerify { } if (!isPathValid(utility.getJsonPath(), TYPE_FILE, JSON_PROFILE) && !isPathValid(utility.getJsonPath(), TYPE_FILE, MODULE_PROFILE)) { - String errMsg = "--json-path must be config.json file."; + String errMsg = "--json-path must be the config.json file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -293,7 +293,7 @@ public class CompressVerify { if (!utility.getProfilePath().isEmpty()) { File file = new File(utility.getProfilePath()); if (!file.isFile() || !PROFILE_NAME.equals(file.getName())) { - String errMsg = "--profile-path must be CAPABILITY.profile file."; + String errMsg = "--profile-path must be the CAPABILITY.profile file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -322,7 +322,7 @@ public class CompressVerify { if (!utility.getPkgContextPath().isEmpty()) { File file = new File(utility.getPkgContextPath()); if (!file.isFile() || !PKG_CONTEXT_INFO.equals(file.getName())) { - String errMsg = "--pkg-context-path file must be " + PKG_CONTEXT_INFO + "."; + String errMsg = "--pkg-context-path file must be the pkgContextInfo.json file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -339,7 +339,7 @@ public class CompressVerify { private static boolean isVerifyValidInHapMode(Utility utility) { File file = new File(utility.getIndexPath()); if (!utility.getIndexPath().isEmpty() && !file.isFile() && INDEX_PROFILE.equals(file.getName())) { - String errMsg = "--index-path must be resources.index file."; + String errMsg = "--index-path must be the resources.index file."; LOG.error(PackingToolErrMsg.HAP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -500,7 +500,7 @@ public class CompressVerify { */ private static boolean isVerifyValidInAppMode(Utility utility) { if (!checkBundleTypeConsistency(utility)) { - String errMsg = "Check bundleType is inconsistent."; + String errMsg = "The bundleType is inconsistent for different HAP and HSP modules."; LOG.error(PackingToolErrMsg.APP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -588,7 +588,7 @@ public class CompressVerify { HapVerifyInfo hapVerifyInfo = Compressor.parseStageHapVerifyInfo(hapPath); if (!bundleType.equals(hapVerifyInfo.getBundleType())) { LOG.error(PackingToolErrMsg.CHECK_BUNDLETYPE_CONSISTENCY_FAILED.toString( - "bundleType is not same for different hap modules.")); + "The bundleType is not same for different HAP modules.")); return false; } } @@ -596,7 +596,7 @@ public class CompressVerify { HapVerifyInfo hapVerifyInfo = Compressor.parseStageHapVerifyInfo(hspPath); if (!bundleType.equals(hapVerifyInfo.getBundleType())) { LOG.error(PackingToolErrMsg.CHECK_BUNDLETYPE_CONSISTENCY_FAILED.toString( - "bundleType is not same for different hsp modules.")); + "The bundleType is not same for different HSP modules.")); return false; } } @@ -959,7 +959,7 @@ public class CompressVerify { } if (!isPathValid(utility.getJsonPath(), TYPE_FILE, MODULE_PROFILE)) { - String errMsg = "--json-path must be module.json file."; + String errMsg = "--json-path must be the module.json file."; LOG.error(PackingToolErrMsg.HSP_MODE_ARGS_INVALID.toString(errMsg)); return false; } @@ -1052,7 +1052,7 @@ public class CompressVerify { if (!utility.getPkgContextPath().isEmpty()) { File file = new File(utility.getPkgContextPath()); if (!file.isFile() || !PKG_CONTEXT_INFO.equals(file.getName())) { - String errMsg = "--pkg-context-path file must be "+ PKG_CONTEXT_INFO; + String errMsg = "--pkg-context-path file must be the pkgContextInfo.json file."; LOG.error(PackingToolErrMsg.HSP_MODE_ARGS_INVALID.toString(errMsg)); return false; } diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index 068db3df554b353eb76204ee4ffc9e4c18c8c13b..9f60ff048584d66f3f73b2cf994b3c795482793a 100644 --- a/adapter/ohos/Compressor.java +++ b/adapter/ohos/Compressor.java @@ -348,7 +348,7 @@ public class Compressor { File outParentFile = destFile.getParentFile(); if ((outParentFile != null) && (!outParentFile.exists())) { if (!outParentFile.mkdirs()) { - String errMsg = "Create out file parent directory failed."; + String errMsg = "Create output file's parent directory failed."; String solution = "Check the --out-path parameter."; LOG.error(PackingToolErrMsg.COMPRESS_PROCESS_FAILED.toString(errMsg, solution)); return false; @@ -368,7 +368,7 @@ public class Compressor { LOG.error(PackingToolErrMsg.FILE_NOT_FOUND.toString("Compress exist FileNotFoundException: " + exception.getMessage())); } catch (BundleException ex) { compressResult = false; - LOG.error(PackingToolErrMsg.COMPRESS_PROCESS_EXCEPTION.toString("BundleException: " + ex.getMessage())); + LOG.error(PackingToolErrMsg.COMPRESS_PROCESS_EXCEPTION.toString("Compress exist BundleException: " + ex.getMessage())); } finally { closeZipOutputStream(); Utility.closeStream(zipOut); @@ -385,12 +385,12 @@ public class Compressor { // if compress failed, delete out file. if (!compressResult) { - String errMsg = "Execute compress failed."; + String errMsg = "Compress process failed."; String solution = "Please check the first error message for more details and modify accordingly."; LOG.error(PackingToolErrMsg.COMPRESS_PROCESS_FAILED.toString(errMsg, solution)); if (!destFile.delete()) { - errMsg = "Delete out file " + utility.getOutPath() + " failed."; - solution = "Try to close the out file using programme."; + errMsg = "Delete the output file " + utility.getOutPath() + " failed."; + solution = "Try to close the output file using programme."; LOG.error(PackingToolErrMsg.FILE_DELETE_FAILED.toString(errMsg, solution)); } } @@ -434,35 +434,35 @@ public class Compressor { Optional optional = FileUtils.getFileContent(utility.getJsonPath()); String jsonString = optional.get(); if (!checkStageAsanTsanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check Stage AsanTsanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the asanTsanEnabled parameter in the Stage module failed.")); throw new BundleException("Compress hsp failed."); } if (!checkStageHwasanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check Stage HwasanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the hwasanEnabled parameter in the Stage module failed.")); throw new BundleException("Compress hsp failed."); } if (!checkStageUbsanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check Stage UbsanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the ubsanEnabled parameter in the Stage module failed.")); throw new BundleException("Compress hsp failed."); } if (!checkStageAtomicService(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check Stage AtomicService failed.")); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the atomicService parameter in the Stage module failed.")); throw new BundleException("Check stage AtomicService failed."); } // check continueBundleName in module.json if (!checkContinueBundleNameIsValid(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check ContinueBundleName is valid failed.")); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the continueBundleName parameter in the Stage module failed.")); throw new BundleException("Compress hsp failed."); } // check whether is an overlay hsp or not if (!checkStageOverlayCfg(jsonString)) { - LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check Stage overlay config failed.")); - throw new BundleException("Check stage OverlayCfg failed."); + LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Check the overlay config in the Stage module failed.")); + throw new BundleException("Compress hsp failed."); } String moduleType = ModuleJsonUtil.parseModuleType(jsonString); if (!TYPE_SHARED.equals(moduleType)) { LOG.error(PackingToolErrMsg.COMPRESS_HSP_FAILED.toString("Module type must be shared.")); - throw new BundleException("compressHsp failed."); + throw new BundleException("Compress hsp failed."); } } compressHSPMode(utility); @@ -521,11 +521,11 @@ public class Compressor { res = true; } } catch (BundleException exception) { - LOG.error(PackingToolErrMsg.HAS_GENERATE_BUILD_HASH.toString("Check has generate build hash exist BundleException: " + exception.getMessage())); + LOG.error(PackingToolErrMsg.HAS_GENERATE_BUILD_HASH.toString("The check has generate build hash exist BundleException: " + exception.getMessage())); throw new BundleException("Verify has generate build hash failed."); } catch (JSONException | IOException e) { LOG.error(PackingToolErrMsg.HAS_GENERATE_BUILD_HASH.toString( - "Check has generate build hash exist Exception(JSONException | IOException): " + e.getMessage())); + "The check has generate build hash exist Exception(JSONException | IOException): " + e.getMessage())); throw new BundleException("Verify has generate build hash failed."); } finally { FileUtils.closeStream(json); @@ -541,7 +541,7 @@ public class Compressor { copyFileToTempDir(utility); File file = new File(utility.getJsonPath()); if (!file.exists()) { - String errMsg = "Parse --json-path file does not exist."; + String errMsg = "The --json-path file does not exist."; LOG.error(PackingToolErrMsg.SET_GENERATE_BUILD_HASH.toString(errMsg)); throw new BundleException("Set generate build hash failed for --json-path file does not exist."); } @@ -552,7 +552,7 @@ public class Compressor { JSONObject jsonObject = JSON.parseObject(json, JSONObject.class); if (!jsonObject.containsKey(APP) || !jsonObject.containsKey(MODULE)) { LOG.error(PackingToolErrMsg.SET_GENERATE_BUILD_HASH.toString("Parse --json-path file is invalid.")); - throw new BundleException("json file is invalid."); + throw new BundleException("The --json-path file is invalid."); } JSONObject appJson = jsonObject.getJSONObject(APP); JSONObject moduleJson = jsonObject.getJSONObject(MODULE); @@ -597,7 +597,7 @@ public class Compressor { String jsonPath = utility.getJsonPath(); File oldfile = new File(jsonPath); if (!oldfile.exists()) { - String errMsg = "Parse json file not found, parse json path is " + jsonPath + "."; + String errMsg = "Parse --json-path file does not found, parse json path is " + jsonPath + "."; LOG.error(PackingToolErrMsg.FILE_NOT_EXIST.toString(errMsg)); throw new BundleException("Copy file to temp dir failed for json file not found."); } @@ -622,7 +622,7 @@ public class Compressor { utility.setJsonPath(tempPath); } catch (IOException e) { LOG.error(PackingToolErrMsg.IO_EXCEPTION.toString( - "copy file to temp dir exist IOException:" + e.getMessage())); + "Copy file to temp dir exist IOException:" + e.getMessage())); throw new BundleException("Copy file to temp dir failed."); } } @@ -688,7 +688,7 @@ public class Compressor { String jsonPath = utility.getJsonPath(); File file = new File(jsonPath); if (!file.exists()) { - String errMsg = "Parse json file not found, parse json path is " + jsonPath + "."; + String errMsg = "The --json-path file does not exist."; LOG.error(PackingToolErrMsg.FILE_NOT_EXIST.toString(errMsg)); throw new BundleException("Put build hash failed for json file not exist."); } @@ -707,7 +707,7 @@ public class Compressor { LOG.error(PackingToolErrMsg.IO_EXCEPTION.toString("Put build hash exist IOException: " + e.getMessage())); throw new BundleException("Put build hash failed."); } catch (NullPointerException e) { - LOG.error(PackingToolErrMsg.NULL_POINTER_EXPECTION.toString("json data err, exist NullPointerException: " + e.getMessage())); + LOG.error(PackingToolErrMsg.NULL_POINTER_EXCEPTION.toString("The json data err, exist NullPointerException: " + e.getMessage())); throw new BundleException("Put build hash failed, json data err."); } finally { FileUtils.closeStream(json); @@ -766,25 +766,25 @@ public class Compressor { Optional optional = FileUtils.getFileContent(utility.getJsonPath()); String jsonString = optional.get(); if (!checkStageAsanTsanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check Stage AsanTsanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check the asanTsanEnabled parameter in the Stage module failed.")); return false; } if (!checkStageHwasanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check Stage HwasanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check the hwasanEnabled parameter in the Stage module failed.")); return false; } if (!checkStageUbsanEnabledValid(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check Stage UbsanEnabled valid failed.")); + LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check the ubsanEnabled parameter in the Stage module failed.")); return false; } // check atomicService in module.json if (!checkStageAtomicService(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check Stage atomicService failed.")); + LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check the atomicService parameter in the Stage module failed.")); return false; } // check continueBundleName in module.json if (!checkContinueBundleNameIsValid(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check ContinueBundleName valid failed.")); + LOG.error(PackingToolErrMsg.CHECK_STAGE_HAP_FAILED.toString("Check the continueBundleName parameter in the Stage module failed.")); return false; } return true; @@ -795,7 +795,7 @@ public class Compressor { boolean tsanEnabled = ModuleJsonUtil.getStageTsanEnabled(jsonString); if (asanEnabled && tsanEnabled) { LOG.error(PackingToolErrMsg.CHECK_AS_TSAN_ENABLED.toString( - "asanEnabled and tsanEnabled can not be true at the same time.")); + "asanEnabled and tsanEnabled cannot be true at the same time.")); return false; } return true; @@ -808,17 +808,17 @@ public class Compressor { boolean hwasanEnabled = ModuleJsonUtil.getStageHwasanEnabled(jsonString); if (hwasanEnabled && asanEnabled) { LOG.error(PackingToolErrMsg.CHECK_HWASAN_ENABLED_INVALID.toString( - "hwasanEnabled and asanEnabled can not be true at the same time")); + "hwasanEnabled and asanEnabled cannot be true at the same time.")); return false; } if (hwasanEnabled && tsanEnabled) { LOG.error(PackingToolErrMsg.CHECK_HWASAN_ENABLED_INVALID.toString( - "hwasanEnabled and tsanEnabled can not be true at the same time")); + "hwasanEnabled and tsanEnabled cannot be true at the same time.")); return false; } if (hwasanEnabled && gwpAsanEnabled) { LOG.error(PackingToolErrMsg.CHECK_HWASAN_ENABLED_INVALID.toString( - "hwasanEnabled and GWPAsanEnabled can not be true at the same time")); + "hwasanEnabled and GWPAsanEnabled cannot be true at the same time.")); return false; } return true; @@ -851,17 +851,17 @@ public class Compressor { boolean ubsanEnabled = ModuleJsonUtil.getStageUbsanEnabled(jsonString); if (ubsanEnabled && asanEnabled) { LOG.error(PackingToolErrMsg.CHECK_UBASAN_ENABLED_INVALID.toString( - "ubsanEnabled and asanEnabled can not be true at the same time.")); + "ubsanEnabled and asanEnabled cannot be true at the same time.")); return false; } if (ubsanEnabled && tsanEnabled) { LOG.error(PackingToolErrMsg.CHECK_UBASAN_ENABLED_INVALID.toString( - "ubsanEnabled and tsanEnabled can not be true at the same time.")); + "ubsanEnabled and tsanEnabled cannot be true at the same time.")); return false; } if (ubsanEnabled && hwasanEnabled) { LOG.error(PackingToolErrMsg.CHECK_UBASAN_ENABLED_INVALID.toString( - "ubsanEnabled and hwasanEnabled can not be true at the same time.")); + "ubsanEnabled and hwasanEnabled cannot be true at the same time.")); return false; } return true; @@ -876,13 +876,13 @@ public class Compressor { } // check entry module must have ability if (!ModuleJsonUtil.checkEntryInAtomicService(jsonString)) { - LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_FAILED.toString("Check atomicService entry module failed.")); + LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_FAILED.toString("Check the atomicService entry module failed.")); return false; } // check installationFree if (!ModuleJsonUtil.checkAtomicServiceInstallationFree(jsonString)) { LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_FAILED.toString( - "Check atomicService installationFree failed.")); + "Check the installationFree parameter failed.")); return false; } @@ -903,7 +903,7 @@ public class Compressor { // check targetModuleName and name if (targetModuleName.equals(moduleName)) { LOG.error(PackingToolErrMsg.CHECK_OVERLAY_CFG_FAILED.toString( - "The targetModuleName of module (" + moduleName + ") cannot be itself.")); + "The targetModuleName of module(" + moduleName + ") cannot be itself.")); return false; } } else { @@ -923,13 +923,13 @@ public class Compressor { } if (targetBundleName.equals(ModuleJsonUtil.parseBundleName(jsonString))) { LOG.error(PackingToolErrMsg.CHECK_OVERLAY_CFG_FAILED.toString( - "The module(" + moduleName + ") targetBundleName can not be same with the bundleName.")); + "The module(" + moduleName + ") targetBundleName cannot be same with the bundleName.")); return false; } } else { if (ModuleJsonUtil.isExistedStageAppTargetPriority(jsonString)) { LOG.error(PackingToolErrMsg.CHECK_OVERLAY_CFG_FAILED.toString( - "The module(" + moduleName + ") targetPriority can not be existed without the targetBundleName in app.json.")); + "The module(" + moduleName + ") targetPriority cannot be existed without the targetBundleName in app.json.")); return false; } } @@ -1246,7 +1246,7 @@ public class Compressor { utility.getCompressLevel()); } catch (IOException e) { LOG.error(PackingToolErrMsg.COMPRESS_APP_IO_EXCEPTION.toString( - "compress pack.info into hsp exist IOException: " + e.getMessage())); + "Compress pack.info into hsp exist IOException: " + e.getMessage())); throw new BundleException("Compress pack.info into hsp failed."); } } @@ -1849,7 +1849,7 @@ public class Compressor { append.closeEntry(); } catch (IOException exception) { LOG.error(PackingToolErrMsg.COMPRESS_FILE_EXCEPTION.toString( - "Compress PackInfo into hap exist IOException: " + exception.getMessage())); + "Compress pack.info into hap exist IOException: " + exception.getMessage())); throw new BundleException("Compress PackInfo into hap IOException."); } finally { sourceHapFile.close(); @@ -2853,7 +2853,7 @@ public class Compressor { zipOut.flush(); } } catch (IOException exception) { - LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXPECTION.toString( + LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXCEPTION.toString( "Close zip output stream flush IOException: " + exception.getMessage())); } try { @@ -2861,7 +2861,7 @@ public class Compressor { zipOut.closeArchiveEntry(); } } catch (IOException exception) { - LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXPECTION.toString( + LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXCEPTION.toString( "Close entry IOException: " + exception.getMessage())); } try { @@ -2869,7 +2869,7 @@ public class Compressor { zipOut.finish(); } } catch (IOException exception) { - LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXPECTION.toString( + LOG.error(PackingToolErrMsg.CLOSE_ZIP_OUTPUT_STREAM_EXCEPTION.toString( "Close zip output stream flush IOException: " + exception.getMessage())); } } @@ -2917,19 +2917,19 @@ public class Compressor { List hapVerifyInfos = new ArrayList<>(); for (String hapPath : fileLists) { if (hapPath.isEmpty()) { - LOG.error(PackingToolErrMsg.INVALID_HAP_FILE.toString("Input wrong hap or hsp file.")); - throw new BundleException("Check hap and hsp is valid exist that input wrong hap or hsp file."); + LOG.error(PackingToolErrMsg.INVALID_HAP_FILE.toString("Invalid hap or hsp file input.")); + throw new BundleException("The hap or hsp files are invalid, or the wrong file was provided."); } File srcFile = new File(hapPath); String fileStr = srcFile.getName(); if (fileStr.isEmpty()) { LOG.error(PackingToolErrMsg.INVALID_HAP_FILE.toString("Get file name failed.")); - throw new BundleException("Check hap and hsp is valid exist that get file name failed."); + throw new BundleException("Get file name from the provided path failed."); } if (!fileStr.toLowerCase(Locale.ENGLISH).endsWith(HAP_SUFFIX) && !fileStr.toLowerCase(Locale.ENGLISH).endsWith(HSP_SUFFIX)) { - LOG.error(PackingToolErrMsg.INVALID_HAP_FILE.toString("Input wrong hap or hsp file.")); - throw new BundleException("Check hap and hsp is valid exist that input wrong hap or hsp file."); + LOG.error(PackingToolErrMsg.INVALID_HAP_FILE.toString("Invalid hap or hsp file input.")); + throw new BundleException("The provided file is not a valid hap or hsp file."); } if (isModuleHap(hapPath)) { hapVerifyInfos.add(parseStageHapVerifyInfo(hapPath)); @@ -2954,8 +2954,8 @@ public class Compressor { for (HapVerifyInfo hapVerifyInfo : hapVerifyInfos) { String bundleType = hapVerifyInfo.getBundleType(); if (TYPE_SHARED.equals(bundleType)) { - String cause = "Only one item can be entered in the --hsp-path when bundleType is 'shared'."; - String solution = "Ensure that only one item entered in the --hsp-path when bundleType is 'shared'"; + String cause = "Only one item can be entered in the --hsp-path when bundleType is shared."; + String solution = "Ensure that only one item entered in the --hsp-path when bundleType is shared."; LOG.error(PackingToolErrMsg.CHECK_BUNDLETYPE_INVALID.toString(cause, solution)); return false; } @@ -3036,8 +3036,8 @@ public class Compressor { hapVerifyInfo.setProfileStr(FileUtils.getFileStringFromZip(MODULE_JSON, zipFile)); } catch (IOException e) { LOG.error(PackingToolErrMsg.READ_STAGE_HAP_VERIFY_INFO_FAILED.toString( - "Read Stage hap verify info file exist IOExpection: " + e.getMessage())); - throw new BundleException("Parse stage hap verify info file exist IOExpection."); + "Read Stage hap verify info file exist IOException: " + e.getMessage())); + throw new BundleException("Parse Stage hap verify info file exist IOException."); } finally { Utility.closeStream(zipFile); } @@ -3060,8 +3060,8 @@ public class Compressor { hapVerifyInfo.setProfileStr(FileUtils.getFileStringFromZip(CONFIG_JSON, zipFile)); } catch (IOException e) { LOG.error(PackingToolErrMsg.READ_FA_HAP_VERIFY_INFO_FAILED.toString( - "Read FA hap verify info file exist IOExpection: " + e.getMessage())); - throw new BundleException("Parse FA hap verify info file exist IOExpection."); + "Read FA hap verify info file exist IOException: " + e.getMessage())); + throw new BundleException("Parse FA hap verify info file exist IOException."); } finally { Utility.closeStream(zipFile); } @@ -3209,12 +3209,12 @@ public class Compressor { private static boolean checkSharedAppIsValid(List hapVerifyInfos) throws BundleException { if (hapVerifyInfos.isEmpty()) { String cause = "Hap verify infos is empty."; - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString(cause)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } if (hapVerifyInfos.size() > SHARED_APP_HSP_LIMIT) { - String cause = "Shared app only can contain one module."; - String solution = "Please ensure that there is only one module in Shared App."; + String cause = "The shared App only can contain one module."; + String solution = "Please ensure that there is only one module in the shared App."; LOG.error(PackingToolErrMsg.CHECK_SHARED_APP_INVALID.toString(cause, solution)); return false; } diff --git a/adapter/ohos/FileUtils.java b/adapter/ohos/FileUtils.java index 07025dbc970ebd77bf979b6fa75187590658e8f5..8162464147a810ee014bd371ae1662df220f5f86 100644 --- a/adapter/ohos/FileUtils.java +++ b/adapter/ohos/FileUtils.java @@ -177,7 +177,7 @@ class FileUtils { fileStream.close(); } } catch (IOException msg) { - LOG.error(PackingToolErrMsg.CLOSE_STREAM_EXPECTION.toString( + LOG.error(PackingToolErrMsg.CLOSE_STREAM_EXCEPTION.toString( "Close stream exist IOException: " + msg.getMessage())); } } diff --git a/adapter/ohos/HapVerify.java b/adapter/ohos/HapVerify.java index 9d9f45a18d4a2e91a2645124e2ed6bd9739a5e94..c336d05b234de137bbddb19dda401a0c5f446c24 100644 --- a/adapter/ohos/HapVerify.java +++ b/adapter/ohos/HapVerify.java @@ -59,7 +59,7 @@ class HapVerify { public static boolean checkHapIsValid(List hapVerifyInfos) throws BundleException { if (hapVerifyInfos == null || hapVerifyInfos.isEmpty()) { String errMsg = "Hap verify infos is null or empty."; - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString(errMsg)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(errMsg)); return false; } // check app variable is same @@ -74,7 +74,7 @@ class HapVerify { } // check package is valid if (!checkPackageNameIsValid(hapVerifyInfos)) { - String errMsg = "Check packageName duplicated."; + String errMsg = "Check packageName is duplicated."; LOG.error(PackingToolErrMsg.CHECK_HAP_INVALID.toString(errMsg)); return false; } @@ -90,7 +90,7 @@ class HapVerify { } // check atomic service is valid if (!checkAtomicServiceIsValid(hapVerifyInfos)) { - String errMsg = "Check AtomicService valid failed."; + String errMsg = "Check atomicService is invalid."; LOG.error(PackingToolErrMsg.CHECK_HAP_INVALID.toString(errMsg)); return false; } @@ -100,17 +100,17 @@ class HapVerify { } // check targetModuleName if (!checkTargetModuleNameIsExisted(hapVerifyInfos)) { - String errMsg = "Target module is not found."; + String errMsg = "Target module cannot found."; LOG.error(PackingToolErrMsg.CHECK_HAP_INVALID.toString(errMsg)); return false; } if (!checkCompileSdkIsValid(hapVerifyInfos)) { - String errMsg = "Compile sdk config is not same."; + String errMsg = "Compile sdk config is different."; LOG.error(PackingToolErrMsg.CHECK_HAP_INVALID.toString(errMsg)); return false; } if (!checkProxyDataUriIsUnique(hapVerifyInfos)) { - String errMsg = "uris in proxy data are not unique."; + String errMsg = "The values of uri in proxyData of module.json are not unique."; LOG.error(PackingToolErrMsg.CHECK_HAP_INVALID.toString(errMsg)); return false; } @@ -157,7 +157,7 @@ class HapVerify { abilityNames.get(j) + ") have same continueType.\n"; cause += "Ability(" + abilityNames.get(i) + ") have continueType: " + typeList + ", "; cause += "Another Ability(" + abilityNames.get(j) + ") have continueType: " + typeList2 + "."; - String solution = "Please ensure that the continueType for different abilities do not overlap."; + String solution = "Please ensure that the continueType for different abilities does not overlap."; LOG.error(PackingToolErrMsg.CONTINUE_TYPE_INVALID.toString(cause, solution)); return false; } @@ -201,27 +201,27 @@ class HapVerify { public static boolean checkSharedApppIsValid(List hapVerifyInfos) throws BundleException { if (hapVerifyInfos == null || hapVerifyInfos.isEmpty()) { String cause = "Hap verify infos is null or empty"; - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString(cause)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } String moduleName = hapVerifyInfos.get(0).getModuleName(); for (HapVerifyInfo hapVerifyInfo : hapVerifyInfos) { if (!moduleName.equals(hapVerifyInfo.getModuleName())) { - String cause = "module name is different."; - String solution = "Ensure that all module have the same module name."; + String cause = "The module name is different."; + String solution = "Ensure that all modules have the same module name."; LOG.error(PackingToolErrMsg.CHECK_SHARED_APP_INVALID.toString(cause, solution)); return false; } if (!hapVerifyInfo.getDependencyItemList().isEmpty()) { - String cause = "Shared app can not depend on other modules."; + String cause = "The shared App cannot depend on other modules."; String solution = "Remove dependencies settings in 'module.json5' and ensure module does not contain dependencies."; LOG.error(PackingToolErrMsg.CHECK_SHARED_APP_INVALID.toString(cause, solution)); return false; } if (!TYPE_SHARED.equals(hapVerifyInfo.getModuleType())) { - String cause = "Module type is not shared app."; - String solution = "Ensure module type is 'shared' for all module."; + String cause = "The module type is not shared."; + String solution = "Ensure module type is shared for all modules."; LOG.error(PackingToolErrMsg.CHECK_SHARED_APP_INVALID.toString(cause, solution)); return false; } @@ -249,7 +249,7 @@ class HapVerify { private static boolean checkAppFieldsIsSame(List hapVerifyInfos) { if (hapVerifyInfos.isEmpty()) { String cause = "Hap verify infos is empty."; - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString(cause)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } HapVerifyInfo verifyInfo = hapVerifyInfos.get(0); @@ -345,25 +345,25 @@ class HapVerify { private static boolean appFieldsIsSame(VerifyCollection verifyCollection, HapVerifyInfo hapVerifyInfo) { if (hapVerifyInfo.getBundleName().isEmpty() || !verifyCollection.bundleName.equals(hapVerifyInfo.getBundleName())) { - String errMsg = "Input module bundleName is different."; + String errMsg = "The bundleName parameter values are different."; String solution = "Check if the bundleName is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; } if (!verifyCollection.getBundleType().equals(hapVerifyInfo.getBundleType())) { - String errMsg = "Input module bundleType is different."; + String errMsg = "The bundleType parameter values are different."; String solution = "Check if the bundleType is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; } if (verifyCollection.versionCode != hapVerifyInfo.getVersion().versionCode) { - String errMsg = "Input module versionCode is different."; + String errMsg = "The versionCode parameter values are different."; String solution = "Check if the versionCode is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; } if (verifyCollection.compatibleApiVersion != hapVerifyInfo.getApiVersion().getCompatibleApiVersion()) { - String errMsg = "Input module minApiVersion is different."; + String errMsg = "The minApiVersion parameter values are different."; String solution = "Check if the minApiVersion is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); } @@ -373,20 +373,20 @@ class HapVerify { LOG.warning("Module: (" + verifyCollection.getModuleName() + ") and Module: (" + hapVerifyInfo.getModuleName() + ") has different releaseType."); } else { - String errMsg = "Input module releaseType is different."; + String errMsg = "The module releaseType parameter values are different."; String solution = "Check if the releaseType is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; } } if (!verifyCollection.targetBundleName.equals(hapVerifyInfo.getTargetBundleName())) { - String errMsg = "Input targetBundleName is different."; + String errMsg = "The targetBundleName parameter values are different."; String solution = "Check if the targetBundleName is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; } if (verifyCollection.targetPriority != hapVerifyInfo.getTargetPriority()) { - String errMsg = "Input targetPriority is different."; + String errMsg = "The targetPriority parameter values are different."; String solution = "Check if the targetPriority is the same in different modules."; LOG.error(PackingToolErrMsg.APP_FIELDS_DIFFERENT_ERROR.toString(errMsg, solution)); return false; @@ -446,7 +446,7 @@ class HapVerify { ".\n" + "Another Module: " + hapVerifyInfos.get(j).getModuleName() + " has deviceType " + hapVerifyInfos.get(j).getDeviceType() + "."; if (!EMPTY_STRING.equals(hapVerifyInfos.get(i).getDistroFilter().dump())) { - cause += "\n" + "Module: " + hapVerifyInfos.get(i).getModuleName() + " DistroFilter is : " + + cause += "\n" + "Module: " + hapVerifyInfos.get(i).getModuleName() + " DistroFilter is " + hapVerifyInfos.get(i).getDistroFilter().dump() + "."; } if (!EMPTY_STRING.equals(hapVerifyInfos.get(j).getDistroFilter().dump())) { @@ -485,7 +485,7 @@ class HapVerify { ".\n" + "Another Module: " + hapVerifyInfos.get(j).getModuleName() + " has deviceType " + hapVerifyInfos.get(j).getDeviceType() + "."; if (!EMPTY_STRING.equals(hapVerifyInfos.get(i).getDistroFilter().dump())) { - cause += "\n" + "Module: " + hapVerifyInfos.get(i).getModuleName() + " DistroFilter is : " + + cause += "\n" + "Module: " + hapVerifyInfos.get(i).getModuleName() + " DistroFilter is " + hapVerifyInfos.get(i).getDistroFilter().dump() + "."; } if (!EMPTY_STRING.equals(hapVerifyInfos.get(j).getDistroFilter().dump())) { @@ -572,14 +572,14 @@ class HapVerify { } if (nonOverlayHap.isEmpty()) { LOG.error(PackingToolErrMsg.TARGET_MODULE_NAME_NOT_EXIST.toString( - "Target hap modules are needed to pack with overlay hap module.")); + "The target modules are needed to pack with the overlay module.")); return false; } if (!moduleList.containsAll(targetModuleList)) { List missingModules = new ArrayList<>(targetModuleList); missingModules.removeAll(moduleList); LOG.error(PackingToolErrMsg.TARGET_MODULE_NAME_NOT_EXIST.toString( - "The following target overlay hap modules are missing: " + missingModules)); + "The following target overlay modules are missing: " + missingModules)); return false; } @@ -590,8 +590,7 @@ class HapVerify { private static boolean checkCompileSdkIsValid(List hapVerifyInfos) throws BundleException { if (hapVerifyInfos.isEmpty()) { String cause = "Hap verify infos is empty"; - String solution = "Ensure the App contains at least one module before proceeding."; - LOG.error(PackingToolErrMsg.CHECK_APP_FIELDS_INVALID.toString(cause, solution)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } String compileSdkType = hapVerifyInfos.get(0).getCompileSdkType(); @@ -609,8 +608,7 @@ class HapVerify { private static boolean checkProxyDataUriIsUnique(List hapVerifyInfos) throws BundleException { if (hapVerifyInfos.isEmpty()) { String cause = "Hap verify infos is empty"; - String solution = "Ensure the App contains at least one module before proceeding."; - LOG.error(PackingToolErrMsg.CHECK_APP_FIELDS_INVALID.toString(cause, solution)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } Set uriSet = new HashSet<>(); @@ -666,7 +664,7 @@ class HapVerify { entryHapVerifyInfos.get(j).getDeviceType() + "."; if (!EMPTY_STRING.equals(entryHapVerifyInfos.get(i).getDistroFilter().dump())) { - cause += "\n" + "Module: " + entryHapVerifyInfos.get(i).getModuleName() + " DistroFilter is : " + + cause += "\n" + "Module: " + entryHapVerifyInfos.get(i).getModuleName() + " DistroFilter is " + entryHapVerifyInfos.get(i).getDistroFilter().dump() + "."; } if (!EMPTY_STRING.equals(entryHapVerifyInfos.get(j).getDistroFilter().dump())) { @@ -920,7 +918,7 @@ class HapVerify { } if (hapVerifyInfo.getDistroFilter().apiVersion.policy == null) { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Entry module(" + hapVerifyInfo.getModuleName() + ") policy is null.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") apiVersion policy is null.")); return false; } if (INCLUDE.equals(hapVerifyInfo.getDistroFilter().apiVersion.policy)) { @@ -938,7 +936,7 @@ class HapVerify { flatMap(Collection::stream).distinct().collect(Collectors.toList()); } else { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Entry module(" + hapVerifyInfo.getModuleName() + ") policy '" + hapVerifyInfo.getDistroFilter().apiVersion.policy + + "Entry module(" + hapVerifyInfo.getModuleName() + ") apiVersion policy '" + hapVerifyInfo.getDistroFilter().apiVersion.policy + "' is invalid.")); throw new BundleException("Check ApiVersion covered input policy is invalid."); } @@ -973,8 +971,7 @@ class HapVerify { } if (hapVerifyInfo.getDistroFilter().screenShape.policy == null) { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenShape is subset of entry module screenShape failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy is null.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenShape policy is null.")); return false; } if (INCLUDE.equals(hapVerifyInfo.getDistroFilter().screenShape.policy)) { @@ -990,9 +987,7 @@ class HapVerify { flatMap(Collection::stream).distinct().collect(Collectors.toList()); } else { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenShape is subset of entry module screenShape failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy '" + hapVerifyInfo.getDistroFilter().screenShape.policy + - "' is invalid.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenShape policy '" + hapVerifyInfo.getDistroFilter().screenShape.policy + "' is invalid.")); throw new BundleException("Check ScreenShape covered input policy is invalid."); } } @@ -1025,8 +1020,7 @@ class HapVerify { } if (hapVerifyInfo.getDistroFilter().screenWindow.policy == null) { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenWindow is subset of entry module screenWindow failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy is null.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenWindow policy is null.")); return false; } if (INCLUDE.equals(hapVerifyInfo.getDistroFilter().screenWindow.policy)) { @@ -1042,10 +1036,8 @@ class HapVerify { flatMap(Collection::stream).distinct().collect(Collectors.toList()); } else { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenWindow is subset of entry module screenWindow failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy '" + hapVerifyInfo.getDistroFilter().screenWindow.policy + - "' is invalid.")); - throw new BundleException("Check ScreenWindow covered input policy is invalid."); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenWindow policy '" + hapVerifyInfo.getDistroFilter().screenWindow.policy + "' is invalid.")); + throw new BundleException("Check screenWindow covered input policy is invalid."); } } if (include != null) { @@ -1077,8 +1069,7 @@ class HapVerify { } if (hapVerifyInfo.getDistroFilter().screenDensity.policy == null) { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenDensity is subset of entry module screenDensity failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy is null.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenDensity policy is null.")); return false; } if (INCLUDE.equals(hapVerifyInfo.getDistroFilter().screenDensity.policy)) { @@ -1094,9 +1085,7 @@ class HapVerify { flatMap(Collection::stream).distinct().collect(Collectors.toList()); } else { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module screenDensity is subset of entry module screenDensity failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy '" + hapVerifyInfo.getDistroFilter().screenDensity.policy + - "' is invalid.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") screenDensity policy '" + hapVerifyInfo.getDistroFilter().screenDensity.policy + "' is invalid.")); throw new BundleException("Check ScreenDensity covered input policy is invalid."); } } @@ -1129,8 +1118,7 @@ class HapVerify { } if (hapVerifyInfo.getDistroFilter().countryCode.policy == null) { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module countryCode is subset of entry module countryCode failed, Entry module(" + - hapVerifyInfo.getModuleName() + ") policy is null.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") countryCode policy is null.")); return false; } if (INCLUDE.equals(hapVerifyInfo.getDistroFilter().countryCode.policy)) { @@ -1146,9 +1134,7 @@ class HapVerify { flatMap(Collection::stream).distinct().collect(Collectors.toList()); } else { LOG.error(PackingToolErrMsg.CHECK_FEATURE_DISTRO_FILTER_INVALID.toString( - "Check feature module countryCode is subset of entry module countryCode failed, Entry module " + - hapVerifyInfo.getModuleName() + ") policy '" + hapVerifyInfo.getDistroFilter().countryCode.policy + - "' is invalid.")); + "Entry module(" + hapVerifyInfo.getModuleName() + ") countryCode policy '" + hapVerifyInfo.getDistroFilter().countryCode.policy + "' is invalid.")); throw new BundleException("Check CountryCode covered input policy is invalid."); } } @@ -1249,9 +1235,8 @@ class HapVerify { */ private static boolean checkDependencyIsValid(List allHapVerifyInfo) throws BundleException { if (allHapVerifyInfo.isEmpty()) { - String cause = "No module included."; - String solution = "Ensure the App contains at least one module before proceeding."; - LOG.error(PackingToolErrMsg.CHECK_APP_FIELDS_INVALID.toString(cause, solution)); + String cause = "Hap verify infos is empty"; + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); throw new BundleException("HapVerify::checkDependencyIsValid failed, input none hap."); } boolean isInstallationFree = allHapVerifyInfo.get(0).isInstallationFree(); @@ -1412,7 +1397,8 @@ class HapVerify { private static boolean checkAtomicServiceModuleSize(List hapVerifyInfoList) throws BundleException { if (hapVerifyInfoList.isEmpty()) { - LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString()); + String cause = "Hap verify infos is empty"; + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } int entryLimit = hapVerifyInfoList.get(0).getEntrySizeLimit(); @@ -1432,13 +1418,13 @@ class HapVerify { fileSize += dependency.getFileLength(); } if (hapVerifyInfo.getModuleType().equals(ENTRY) && (fileSize >= entryLimit * FILE_LENGTH_1M)) { - String errMsg = "module " + hapVerifyInfo.getModuleName() + " and it's dependencies size sum is " + + String errMsg = "Module " + hapVerifyInfo.getModuleName() + " and it's dependencies size sum is " + getCeilFileSize(fileSize, entryLimit) + "MB, which is overlarge than " + entryLimit + "MB."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_MODULE_SIZE.toString(errMsg)); return false; } if (!hapVerifyInfo.getModuleType().equals(ENTRY) && (fileSize >= notEntryLimit * FILE_LENGTH_1M)) { - String errMsg = "module " + hapVerifyInfo.getModuleName() + " and it's dependencies size sum is " + + String errMsg = "Module " + hapVerifyInfo.getModuleName() + " and it's dependencies size sum is " + getCeilFileSize(fileSize, notEntryLimit) + "MB, which is overlarge than " + notEntryLimit + "MB."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_MODULE_SIZE.toString(errMsg)); return false; @@ -1460,7 +1446,8 @@ class HapVerify { private static Map> getDeviceHapVerifyInfoMap(List hapVerifyInfoList) throws BundleException { if (hapVerifyInfoList.isEmpty()) { - LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString()); + String cause = "Hap verify infos is empty"; + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); throw new BundleException("getDeviceHapVerifyInfoMap failed, hapVerifyInfoList is empty."); } Map> deviceInfoMap = new HashMap>(); @@ -1481,9 +1468,8 @@ class HapVerify { private static boolean checkAtomicServiceIsValid(List hapVerifyInfoList) throws BundleException { if (hapVerifyInfoList.isEmpty()) { - String cause = "No module included."; - String solution = "Ensure the App contains at least one module before proceeding."; - LOG.error(PackingToolErrMsg.CHECK_APP_FIELDS_INVALID.toString(cause, solution)); + String cause = "Hap verify infos is empty"; + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); return false; } String bundleType = hapVerifyInfoList.get(0).getBundleType(); @@ -1500,7 +1486,7 @@ class HapVerify { List hapVerifyInfos = deviceInfoMap.get(device); if (!checkAtomicServicePreloadsIsValid(hapVerifyInfos)) { LOG.error(PackingToolErrMsg.CHECK_ATOMICSERVICE_INVALID.toString( - "Check whether AtomicService preloads are valid failed on device "+ device + ".")); + "Check whether atomicService preloads are valid failed on device "+ device + ".")); return false; } } @@ -1529,7 +1515,7 @@ class HapVerify { throws BundleException { if (hapVerifyInfoList.isEmpty()) { String cause = "Hap verify infos is empty."; - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString(cause)); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString(cause)); throw new BundleException("checkAtomicServicePreloadsIsValid failed, hapVerifyInfoList is empty."); } List moduleNames = new ArrayList<>(); @@ -1543,19 +1529,19 @@ class HapVerify { for (PreloadItem preloadItem : preloadItems) { String moduleName = preloadItem.getModuleName(); if (preloadModuleName.contains(moduleName)) { - LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Preloads a duplicate module, " - + moduleName + " cannot on module " + hapVerifyInfo.getModuleName() + ".")); + LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Preloads a duplicate module, module(" + + hapVerifyInfo.getModuleName() + ") cannot preloads module (" + moduleName + ").")); return false; } preloadModuleName.add(moduleName); if (!moduleNames.contains(moduleName)) { - LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Preloads a not exist module, " - + moduleName + " cannot on module " + hapVerifyInfo.getModuleName() + ".")); + LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Preloads a not exist module, module(" + + hapVerifyInfo.getModuleName() + ") cannot preloads module(" + moduleName + ").")); return false; } if (moduleName.equals(hapVerifyInfo.getModuleName())) { - LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Can not preload self, module " - + hapVerifyInfo.getModuleName() + " cannot preload self.")); + LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString("Cannot preload self, module " + + hapVerifyInfo.getModuleName() + " cannot preloads self.")); return false; } } @@ -1572,8 +1558,8 @@ class HapVerify { if (moduleNameWithType.get(moduleName).equals(ENTRY) || moduleNameWithType.get(moduleName).equals(HAR)) { LOG.error(PackingToolErrMsg.ATOMICSERVICE_PRELOADS_INVALID.toString( - "feature or shared can not preload entry or har, module(" + hapVerifyInfo.getModuleName() + - ") cannot preloads module(" + moduleNameWithType.get(moduleName) + ").")); + "feature or shared cannot preload entry or har, module(" + hapVerifyInfo.getModuleName() + + ") cannot preloads module(" + moduleName + ").")); return false; } } @@ -1590,7 +1576,7 @@ class HapVerify { */ public static boolean checkFileSizeIsValid(List hapVerifyInfoList) throws BundleException { if (hapVerifyInfoList.isEmpty()) { - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString("Hap verify infos is empty.")); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString("Hap verify infos is empty.")); } if (!checkFileSize(hapVerifyInfoList)) { return false; @@ -1600,7 +1586,7 @@ class HapVerify { private static boolean checkFileSize(List hapVerifyInfoList) throws BundleException { if (hapVerifyInfoList.isEmpty()) { - LOG.error(PackingToolErrMsg.HAP_VERIFY_INFO_EMPTY.toString("Hap verify infos is empty.")); + LOG.error(PackingToolErrMsg.CHECK_HAP_VERIFY_INFO_LIST_EMPTY.toString("Hap verify infos is empty.")); throw new BundleException("checkFileSizeWhenSplit failed, hapVerifyInfoList is empty."); } // check single file length @@ -1609,7 +1595,7 @@ class HapVerify { for (HapVerifyInfo hapVerifyInfo : hapVerifyInfoList) { if (hapVerifyInfo.getModuleType().equals(ENTRY) && (hapVerifyInfo.getFileLength() >= entryLimit * FILE_LENGTH_1M)) { - String errMsg = "module " + hapVerifyInfo.getModuleName() + "'s size is " + + String errMsg = "Module " + hapVerifyInfo.getModuleName() + "'s size is " + getCeilFileSize(hapVerifyInfo.getFileLength(), entryLimit) + "MB, which is overlarge than " + entryLimit + "MB."; LOG.error(PackingToolErrMsg.CHECK_FILE_SIZE_INVALID.toString(errMsg)); @@ -1617,7 +1603,7 @@ class HapVerify { } if (!hapVerifyInfo.getModuleType().equals(ENTRY) && (hapVerifyInfo.getFileLength() >= notEntryLimit * FILE_LENGTH_1M)) { - String errMsg = "module " + hapVerifyInfo.getModuleName() + "'s size is " + + String errMsg = "Module " + hapVerifyInfo.getModuleName() + "'s size is " + getCeilFileSize(hapVerifyInfo.getFileLength(), notEntryLimit) + "MB, which is overlarge than " + notEntryLimit + "MB."; LOG.error(PackingToolErrMsg.CHECK_FILE_SIZE_INVALID.toString(errMsg)); @@ -1629,7 +1615,7 @@ class HapVerify { for (String device : deviceInfoMap.keySet()) { ListhapVerifyInfoList1 = deviceInfoMap.get(device); if (!checkAtomicServiceModuleSize(hapVerifyInfoList1)) { - String errMsg = "Check AtomicService module size failed on device " + device + "."; + String errMsg = "Check the atomicService module size failed on device " + device + "."; LOG.error(PackingToolErrMsg.CHECK_FILE_SIZE_INVALID.toString(errMsg)); return false; } diff --git a/adapter/ohos/ModuleJsonUtil.java b/adapter/ohos/ModuleJsonUtil.java index eaf2237f3fa2b6a32dd673ade04d8f9c24d5eda3..de6fb974791e7b45322fa57166925ad51a01188b 100644 --- a/adapter/ohos/ModuleJsonUtil.java +++ b/adapter/ohos/ModuleJsonUtil.java @@ -131,7 +131,7 @@ class ModuleJsonUtil { version.versionCode = appObj.getIntValue(VERSIONCODE); version.versionName = appObj.getString(VERSIONNAME); } else { - String errMsg = "The module.json file does not contain versionCode or versionName."; + String errMsg = "The module.json file does not contain 'versionCode' or 'versionName'."; LOG.error(PackingToolErrMsg.PARSE_STAGE_JSON_FAILED.toString(errMsg)); throw new BundleException(errMsg); } @@ -241,9 +241,9 @@ class ModuleJsonUtil { public static ModuleApiVersion parseFAModuleApiVersion(String jsonString) throws BundleException { JSONObject appObj = getAppObj(jsonString); if (!appObj.containsKey(API_VERSION)) { - String errMsg = "The config.json file does not contain apiVersion."; + String errMsg = "The config.json file does not contain 'apiVersion'."; LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString(errMsg)); - throw new BundleException("Parse FA module APIVersion --json-path file do not contain apiVersion."); + throw new BundleException("Parse FA module APIVersion failed: The config.json file does not contain 'apiVersion'."); } JSONObject apiVersionObj = appObj.getJSONObject(API_VERSION); ModuleApiVersion moduleApiVersion = new ModuleApiVersion(); @@ -272,7 +272,7 @@ class ModuleJsonUtil { if (moduleObj.containsKey(NAME)) { moduleName = moduleObj.getString(NAME); } else { - String errMsg = "The module.json file do not contain module name."; + String errMsg = "The module.json file does not contain 'name'."; LOG.error(PackingToolErrMsg.PARSE_STAGE_JSON_FAILED.toString(errMsg)); throw new BundleException(errMsg); } @@ -291,12 +291,12 @@ class ModuleJsonUtil { JSONObject moduleObj = getModuleObj(jsonString); JSONObject distroObj = moduleObj.getJSONObject(DISTRO); if (distroObj == null) { - String errMsg = "The config.json file does not contain distro."; + String errMsg = "The config.json file does not contain 'distro'."; LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString(errMsg)); throw new BundleException(errMsg); } if (!distroObj.containsKey(MODULE_NAME)) { - String errMsg = "The config.json file does not contain moduleName."; + String errMsg = "The config.json file does not contain 'moduleName'."; LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString(errMsg)); throw new BundleException(errMsg); } @@ -315,7 +315,7 @@ class ModuleJsonUtil { String moduleName; JSONObject moduleObj = getModuleObj(jsonString); if (!moduleObj.containsKey(NAME)) { - String errMsg = "The patch.json file do not contain moduleName."; + String errMsg = "The patch.json file does not contain 'name'."; LOG.error(PackingToolErrMsg.PARSE_PATCH_MODULE_NAME_FAILED.toString(errMsg)); throw new BundleException(errMsg); } @@ -336,8 +336,8 @@ class ModuleJsonUtil { if (moduleObj.containsKey(PACKAGE)) { packageStr = moduleObj.getString(PACKAGE); } else { - LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString("The config.json file do not contain package.")); - throw new BundleException("ModuleJsonUtil:parseFaPackageStr failed: json file do not contain package."); + LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString("The config.json file does not contain 'package'.")); + throw new BundleException("The config.json file does not contain 'package'."); } return packageStr; } @@ -355,8 +355,8 @@ class ModuleJsonUtil { if (appObject.containsKey(BUNDLE_NAME)) { bundleName = appObject.getString(BUNDLE_NAME); } else { - LOG.error(PackingToolErrMsg.PARSE_BUNDLE_NAME_FAILED.toString("json object do not contain bundleName.")); - throw new BundleException("Parse stage bundleName json object do not contain bundleNames."); + LOG.error(PackingToolErrMsg.PARSE_BUNDLE_NAME_FAILED.toString("The module.json or config.json file does not contain 'bundleName'.")); + throw new BundleException("Parse module.json or config.json file does not contain 'bundleName'."); } return bundleName; } @@ -1077,7 +1077,7 @@ class ModuleJsonUtil { } } } catch (JSONException exception) { - String errMsg = "parse metadata info exist JSONException: " + exception.getMessage(); + String errMsg = "Parse the metadata info exist JSONException: " + exception.getMessage(); LOG.error(PackingToolErrMsg.PARSE_JSON_OBJECT_EXCEPTION.toString(exception.getMessage())); throw new BundleException(errMsg); } @@ -1316,7 +1316,7 @@ class ModuleJsonUtil { JSONObject moduleObj = getModuleObj(jsonString); String moduleName = parseStageModuleName(jsonString); if (!moduleObj.containsKey(TYPE)) { - String errMsg = "Module: '" + moduleName + "' has no +'type' field in module.json."; + String errMsg = "Module: '" + moduleName + "' does not contain 'type' in module.json."; String solution = "Ensure the module.json file includes a valid 'type' field for module '" + moduleName + "'."; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); throw new BundleException(errMsg); @@ -1326,7 +1326,7 @@ class ModuleJsonUtil { JSONObject appObj = getAppObj(jsonString); if (!appObj.containsKey(BUNDLE_TYPE)) { if (installationFree) { - String errMsg = "The app.json5 file configuration does not match the installationFree true settings."; + String errMsg = "The app.json5 file configuration does not match the 'installationFree' setting of true."; String solution = "Add the bundleType field to the app.json5 file or set it atomicService."; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); throw new BundleException(errMsg); @@ -1336,25 +1336,25 @@ class ModuleJsonUtil { String bundleType = getJsonString(appObj, BUNDLE_TYPE); if (bundleType.equals(APP)) { if (installationFree) { - String errMsg = "installationFree must be false in module '" + moduleName + "' when bundleType is app."; - String solution = "Set 'installationFree' to false in the module configuration when 'bundleType' is 'app'."; + String errMsg = "'installationFree' must be false in module '" + moduleName + "' when 'bundleType' is app."; + String solution = "Set 'installationFree' to false in the module.json when 'bundleType' is app."; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); throw new BundleException(errMsg); } return APP; } else if (bundleType.equals(ATOMIC_SERVICE)) { if (!installationFree) { - String errMsg = "installationFree must be true in module '" + moduleName + "' when bundleType is atomicService."; - String solution = "Set 'installationFree' to true in the module configuration when 'bundleType'" + - "is 'atomicService'."; + String errMsg = "'installationFree' must be true in module '" + moduleName + "' when 'bundleType' is atomicService."; + String solution = "Set 'installationFree' to true in the module.json when 'bundleType'" + + "is atomicService."; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); throw new BundleException(errMsg); } return ATOMIC_SERVICE; } else if (SHARED.equals(bundleType)) { if (!SHARED.equals(type)) { - String errMsg = "type must be shared in module '" + moduleName + "' when bundleType is shared."; - String solution = "Set the 'type' to 'shared' in the module configuration when 'bundleType' is 'shared'.";; + String errMsg = "'type' must be shared in module '" + moduleName + "' when 'bundleType' is shared."; + String solution = "Set the 'type' to shared in the module.json when 'bundleType' is shared.";; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); throw new BundleException(errMsg); } @@ -1362,7 +1362,7 @@ class ModuleJsonUtil { } else if (APP_SERVICE.equals(bundleType)) { return APP_SERVICE; } else { - String errMsg = "bundleType is invalid in app.json."; + String errMsg = "'bundleType' is invalid in app.json."; String solution = "Ensure that the 'bundleType' field in the app.json file is correctly set to one of" + "the valid types: 'app', 'atomicService', 'shared', or 'appService'."; LOG.error(PackingToolErrMsg.PARSE_STAGE_BUNDLE_TYPE_FAILED.toString(errMsg, solution)); @@ -1440,7 +1440,7 @@ class ModuleJsonUtil { } JSONObject appObj = jsonObject.getJSONObject(APP); if (appObj == null) { - LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("module.json or config.json do not contain app.")); + LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("The module.json or config.json does not contain 'app'.")); throw new BundleException("json do not contain app."); } return appObj; @@ -1456,13 +1456,13 @@ class ModuleJsonUtil { throw new BundleException(errMsg); } if (jsonObj == null) { - LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("jsonObj is null.")); + LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("The jsonObj is null.")); throw new BundleException("Parse jsonObj is null."); } JSONObject moduleObj = jsonObj.getJSONObject(MODULE); if (moduleObj == null) { - LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("--json-path file do not contain module.")); - throw new BundleException("json file do not contain module."); + LOG.error(PackingToolErrMsg.PARSE_JSON_FAILED.toString("The module.json or config.json file does not contain 'module'.")); + throw new BundleException("The module.json or config.json file does not contain 'module'."); } return moduleObj; } @@ -1507,8 +1507,8 @@ class ModuleJsonUtil { JSONObject moduleObj = getModuleObj(jsonString); JSONObject distroObj = moduleObj.getJSONObject(DISTRO); if (distroObj == null) { - LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString("The config.json do not contain distro.")); - throw new BundleException("Parse FA installationFree json do not contain distro."); + LOG.error(PackingToolErrMsg.PARSE_FA_JSON_FAILED.toString("The config.json file does not contain 'distro'.")); + throw new BundleException("Parse FA installationFree failed: config.json file does not contain 'distro'."); } if (distroObj.containsKey(INSTALLATION_FREE)) { return distroObj.getBoolean(INSTALLATION_FREE); @@ -1715,8 +1715,8 @@ class ModuleJsonUtil { try { jsonObject = JSON.parseObject(jsonString); } catch (JSONException exception) { - PackingToolErrMsg.PARSE_JSON_FAILED.toString("Parse json object failed when get debug in config.json. JSONException: " + exception.getMessage()); - throw new BundleException("parse JSONObject failed when get debug in config.json."); + PackingToolErrMsg.PARSE_JSON_FAILED.toString("Parse json object failed when get debug parameter in config.json, JSONException: " + exception.getMessage()); + throw new BundleException("Parse JSONObject failed when get debug parameter in config.json."); } JSONObject deviceConfigObj = jsonObject.getJSONObject(DEVICE_CONFIG); if (deviceConfigObj == null) { @@ -1916,7 +1916,7 @@ class ModuleJsonUtil { if (moduleObj.containsKey(ATOMIC_SERVICE) && (!appObj.containsKey(BUNDLE_TYPE) || !getJsonString(appObj, BUNDLE_TYPE).equals(ATOMIC_SERVICE))) { - String errMsg = "Module can not config atomicService when bundleType is not atomicService."; + String errMsg = "Module cannot config atomicService when 'bundleType' is not atomicService."; LOG.error(PackingToolErrMsg.CHECK_MODULE_ATOMIC_SERVICE_FAILED.toString(errMsg)); return false; } @@ -1956,8 +1956,8 @@ class ModuleJsonUtil { boolean installationFree = getJsonBooleanValue(moduleObj, INSTALLATION_FREE, false); if (!appObj.containsKey(BUNDLE_TYPE)) { if (installationFree) { - String errMsg = "The app.json5 file configuration does not match the installationFree true settings."; - String solution = "Add the bundleType field to the app.json5 file and set it atomicService."; + String errMsg = "The app.json5 file configuration does not match the 'installationFree' setting of true."; + String solution = "Add the 'bundleType' field to the app.json5 file and set it atomicService."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); return false; } @@ -1966,35 +1966,35 @@ class ModuleJsonUtil { String bundleType = getJsonString(appObj, BUNDLE_TYPE); if (bundleType.equals(APP)) { if (installationFree) { - String errMsg = "installationFree must be false when bundleType is app."; - String solution = "Set 'installationFree' to false in the module configuration when 'bundleType' is 'app'."; + String errMsg = "'installationFree' must be false when bundleType is app."; + String solution = "Set 'installationFree' to false in the module.json when 'bundleType' is app."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); return false; } } else if (bundleType.equals(ATOMIC_SERVICE)) { if (!installationFree) { - String errMsg = "installationFree must be true when bundleType is atomicService."; - String solution = "Set 'installationFree' to true in the module configuration when 'bundleType'" + - "is 'atomicService'."; + String errMsg = "'installationFree' must be true when 'bundleType' is atomicService."; + String solution = "Set 'installationFree' to true in the module.json when 'bundleType'" + + "is atomicService."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); return false; } } else if (SHARED.equals(bundleType)) { if (installationFree) { - String errMsg = "installationFree must be false when bundleType is shared."; - String solution = "Set 'installationFree' to false in the module configuration when 'bundleType' is 'shared'."; + String errMsg = "'installationFree' must be false when bundleType is shared."; + String solution = "Set 'installationFree' to false in the module.json when 'bundleType' is shared."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); return false; } } else if (APP_SERVICE.equals(bundleType)) { if (installationFree) { - String errMsg = "installationFree must be false when bundleType is appService."; - String solution = "Set 'installationFree' to false in the module configuration when 'bundleType' is 'appService'."; + String errMsg = "'installationFree' must be false when 'bundleType' is appService."; + String solution = "Set 'installationFree' to false in the module.json when 'bundleType' is appService."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); return false; } } else { - String errMsg = "bundleType is invalid in app.json."; + String errMsg = "'bundleType' is invalid in the app.json."; String solution = "Ensure that the 'bundleType' field in the app.json file is correctly set to one of " + "the valid types: 'app', 'atomicService', 'shared', or 'appService'."; LOG.error(PackingToolErrMsg.CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED.toString(errMsg, solution)); diff --git a/adapter/ohos/PackingToolErrMsg.java b/adapter/ohos/PackingToolErrMsg.java index 73fa4e216baac0689817acb611a11a5c2db69425..e8d48fef8237134cafafa2bf3c582218ebe2d423 100644 --- a/adapter/ohos/PackingToolErrMsg.java +++ b/adapter/ohos/PackingToolErrMsg.java @@ -111,7 +111,7 @@ public class PackingToolErrMsg { public static final ErrorMsg BUNDLE_TYPE_APPSERVICE_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("11") .setErrCode("013") - .setDescription("Check BundleTypeAppService invalid.") + .setDescription("Check the bundleType is appService failed.") .setCause("%s") .build(); @@ -151,7 +151,7 @@ public class PackingToolErrMsg { public static final ErrorMsg HAS_HOME_EXTENSION_ABILITY_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("11") .setErrCode("017") - .setDescription("Check hsp has entry ExtensionAbility failed.") + .setDescription("Check hsp has entry extensionAbility failed.") .setCause("%s") .build(); @@ -183,7 +183,7 @@ public class PackingToolErrMsg { public static final ErrorMsg COMPRESS_HAP_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("002") - .setDescription("Compress Stage Hap failed.") + .setDescription("Compress Stage hap failed.") .setCause("%s") .addSolution("Please check the first error message for more details and modify accordingly.") .build(); @@ -194,7 +194,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_STAGE_HAP_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("003") - .setDescription("Verify stage hap info failed.") + .setDescription("Verify Stage hap info failed.") .setCause("%s") .addSolution("Please check the first error message for more details and modify accordingly.") .build(); @@ -308,7 +308,7 @@ public class PackingToolErrMsg { public static final ErrorMsg READ_STAGE_HAP_VERIFY_INFO_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("013") - .setDescription("Read stage hap verify info io exception.") + .setDescription("Read Stage hap verify info exist exception.") .setCause("%s") .addSolution("Please check the exception message for more details and modify accordingly.") .build(); @@ -321,7 +321,7 @@ public class PackingToolErrMsg { .setErrCode("014") .setDescription("Parallel compress exception.") .setCause("%s") - .addSolution("Please check the related expection message and modify the operation.") + .addSolution("Please check the related exception message and modify the operation.") .build(); /** @@ -341,7 +341,7 @@ public class PackingToolErrMsg { public static final ErrorMsg INVALID_HAP_FILE = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("016") - .setDescription("check input hap or hsp file is invalid.") + .setDescription("Check input hap or hsp file is invalid.") .setCause("%s") .build(); @@ -351,7 +351,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_SHARED_APP_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("017") - .setDescription("Check shared App mode invalid.") + .setDescription("Check shared App invalid.") .setCause("%s") .addSolution("%s") .build(); @@ -383,7 +383,7 @@ public class PackingToolErrMsg { public static final ErrorMsg READ_FA_HAP_VERIFY_INFO_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("020") - .setDescription("Read FA hap verify info io exception.") + .setDescription("Read FA hap verify info exist exception.") .setCause("%s") .addSolution("Please check the first error message for more details and modify accordingly.") .build(); @@ -396,7 +396,7 @@ public class PackingToolErrMsg { .setErrCode("021") .setDescription("IO exception when compress app.") .setCause("%s") - .addSolution("Please check the related expection message and modify the operation.") + .addSolution("Please check the related exception message and modify the operation.") .build(); /** @@ -418,7 +418,7 @@ public class PackingToolErrMsg { .setErrCode("023") .setDescription("Json special process exist exception.") .setCause("%s") - .addSolution("Please check the expection message and modify.") + .addSolution("Please check the exception message and modify.") .build(); /** @@ -427,7 +427,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_ATOMIC_SERVICE_SIZE_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("12") .setErrCode("024") - .setDescription("Atomic service size check failed.") + .setDescription("Check atomicService size failed.") .setCause("%s") .addSolution("Please check the related size check error message and reduce related module size.") .build(); @@ -439,7 +439,7 @@ public class PackingToolErrMsg { public static final ErrorMsg PARSE_JSON_OBJECT_EXCEPTION = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("13") .setErrCode("001") - .setDescription("Parse json Object expection.") + .setDescription("Parse json object exception.") .setCause("%s") .build(); @@ -469,7 +469,7 @@ public class PackingToolErrMsg { public static final ErrorMsg PARSE_STAGE_JSON_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("13") .setErrCode("004") - .setDescription("Failed to parse module.json for stage module.") + .setDescription("Failed to parse module.json for the Stage module.") .setCause("%s") .build(); @@ -501,7 +501,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_ATOMIC_SERVICE_INSTALLATION_FREE_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("13") .setErrCode("007") - .setDescription("Check module atomicService installationFree invalid.") + .setDescription("Check module atomicService and installationFree invalid.") .setCause("%s") .addSolution("%s") .build(); @@ -533,7 +533,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_BUNDLETYPE_CONSISTENCY_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("13") .setErrCode("010") - .setDescription("BundleType consistency check failed.") + .setDescription("Failed to check the consistency of bundleType.") .setCause("%s") .addSolution("Make sure the bundleType is consistency for different modules.") .build(); @@ -564,7 +564,7 @@ public class PackingToolErrMsg { public static final ErrorMsg PARSE_FA_JSON_FAILED = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("13") .setErrCode("013") - .setDescription("Failed to parse config.json for FA module.") + .setDescription("Failed to parse config.json for the FA module.") .setCause("%s") .build(); @@ -582,24 +582,24 @@ public class PackingToolErrMsg { .build(); /** - * CLOSE_ZIP_OUTPUT_STREAM_EXPECTION + * CLOSE_ZIP_OUTPUT_STREAM_EXCEPTION */ - public static final ErrorMsg CLOSE_ZIP_OUTPUT_STREAM_EXPECTION = ErrorMsg.getPackingToolErrBuilder() + public static final ErrorMsg CLOSE_ZIP_OUTPUT_STREAM_EXCEPTION = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("14") .setErrCode("002") - .setDescription("close zip output stream exception.") + .setDescription("Close zip output stream exception.") .setCause("%s") - .addSolution("Please check the related error message and modify the operation.") + .addSolution("Please check the related exception message and modify the operation.") .build(); /** - * CLOSE_STREAM_EXPECTION + * CLOSE_STREAM_EXCEPTION */ - public static final ErrorMsg CLOSE_STREAM_EXPECTION = ErrorMsg.getPackingToolErrBuilder() + public static final ErrorMsg CLOSE_STREAM_EXCEPTION = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("14") .setErrCode("003") .setDescription("IO exception when closing stream.") - .setCause("%s") + .addSolution("Please check the related exception message for more details and modify accordingly.") .build(); /** @@ -610,7 +610,7 @@ public class PackingToolErrMsg { .setErrCode("004") .setDescription("Get file content failed.") .setCause("%s") - .addSolution("Please check the related expection message for more details and modify accordingly.") + .addSolution("Please check the related exception message for more details and modify accordingly.") .build(); /** @@ -686,14 +686,14 @@ public class PackingToolErrMsg { .build(); /* - * NULL_POINTER_EXPECTION + * NULL_POINTER_EXCEPTION */ - public static final ErrorMsg NULL_POINTER_EXPECTION = ErrorMsg.getPackingToolErrBuilder() + public static final ErrorMsg NULL_POINTER_EXCEPTION = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("15") .setErrCode("002") .setDescription("Null pointer exception.") .setCause("%s") - .addSolution("Please review the related error message for further insights.") + .addSolution("Please review the related exception message for further insights.") .build(); // hap verify error @@ -758,7 +758,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_HAP_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("006") - .setDescription("Verify hap info is invalid.") + .setDescription("Check hap info is invalid.") .setCause("%s") .addSolution("Please check the first error message for more details and modify accordingly.") .build(); @@ -769,7 +769,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_ENTRY_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("007") - .setDescription("Check entry module invalid.") + .setDescription("Check entry module is invalid.") .setCause("%s") .addSolution("%s") .build(); @@ -815,7 +815,7 @@ public class PackingToolErrMsg { .setErrCode("011") .setDescription("Atomicservice preloads is invalid.") .setCause("%s") - .addSolution("Please check related error message and modify preloads settings.") + .addSolution("Please check related preload message and modify preloads settings.") .build(); /** @@ -847,7 +847,7 @@ public class PackingToolErrMsg { public static final ErrorMsg PROXY_DATA_URI_NOT_UNIQUE = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("014") - .setDescription("Proxy data uri is not unique.") + .setDescription("The values of uri in proxyData of module.json are not unique.") .setCause("%s") .addSolution("%s") .build(); @@ -880,8 +880,8 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_HAP_VERIFY_INFO_LIST_EMPTY = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("017") - .setDescription("The provided list of HapVerifyInfo is empty, unable to process.") - .setCause("Input list of HapVerifyInfo is empty.") + .setDescription("The provided list of HapVerifyInfos is empty.") + .setCause("%s") .build(); /** @@ -890,7 +890,7 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_ATOMIC_SERVICE_MODULE_SIZE = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("018") - .setDescription("AtomicService module size check failed.") + .setDescription("Check the atomicService module size failed.") .setCause("%s") .addSolution("Please check and reduced related module size.") .build(); @@ -901,19 +901,9 @@ public class PackingToolErrMsg { public static final ErrorMsg CHECK_FEATURE_DISTRO_FILTER_INVALID = ErrorMsg.getPackingToolErrBuilder() .setTypeCode("16") .setErrCode("019") - .setDescription("Check feature module distributionFilter is invalid.") + .setDescription("Check the entry module distributionFilter is invalid.") .setCause("%s") .addSolution("Ensure the Entry type module distributionFilter file policy " + "settings is 'exclude' or 'include'.") .build(); - - /** - * HAP_VERIFY_INFO_NULL - */ - public static final ErrorMsg HAP_VERIFY_INFO_EMPTY = ErrorMsg.getPackingToolErrBuilder() - .setTypeCode("16") - .setErrCode("020") - .setDescription("Hap verify infos is empty.") - .setCause("%s") - .build(); } diff --git a/adapter/ohos/Utility.java b/adapter/ohos/Utility.java index ecf5266eb5117c61decccf8370489ffa3c964846..496930cae599e3d3f0e30cdd9920854c50cc1b3b 100644 --- a/adapter/ohos/Utility.java +++ b/adapter/ohos/Utility.java @@ -721,7 +721,7 @@ public class Utility { try { stream.close(); } catch (IOException exception) { - LOG.error(PackingToolErrMsg.CLOSE_STREAM_EXPECTION.toString( + LOG.error(PackingToolErrMsg.CLOSE_STREAM_EXCEPTION.toString( "Close stream exist IOException: " + exception.getMessage())); } }