From 507b6206009ff2dc167f3d7554727b845467cbbc Mon Sep 17 00:00:00 2001 From: "HDS\\rammansoor" Date: Thu, 30 Jan 2025 15:07:17 -0500 Subject: [PATCH] [BISERVER-15169] Adding debug logging to backup and restore process --- .../services/importexport/CommandLineProcessor.java | 10 +++++++++- .../plugin/services/messages/messages.properties | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/importexport/CommandLineProcessor.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/importexport/CommandLineProcessor.java index 85d1fe3127..cbaed8256a 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/importexport/CommandLineProcessor.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/importexport/CommandLineProcessor.java @@ -57,6 +57,7 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -863,13 +864,20 @@ private void performRestore() throws ParseException { logResponseMessage( logFile, filePath, response, RequestType.RESTORE ); response.close(); } + } catch ( NoSuchFileException nsfe ) { + String message = Messages.getInstance().getErrorString( "CommandLineProcessor.ERROR_0010_FILE_DOES_NOT_EXIST", nsfe.getMessage() ); + System.err.println( message ); + log.error( message ); + writeToFile( message, logFile ); } catch ( Exception e ) { System.err.println( e.getMessage() ); log.error( e.getMessage() ); writeToFile( e.getMessage(), logFile ); } finally { // cleanup the jersey resources - client.destroy(); + if( client != null ) { + client.destroy(); + } } } diff --git a/extensions/src/main/resources/org/pentaho/platform/plugin/services/messages/messages.properties b/extensions/src/main/resources/org/pentaho/platform/plugin/services/messages/messages.properties index 9a2eaa2c4f..2de5a35855 100644 --- a/extensions/src/main/resources/org/pentaho/platform/plugin/services/messages/messages.properties +++ b/extensions/src/main/resources/org/pentaho/platform/plugin/services/messages/messages.properties @@ -206,6 +206,7 @@ CommandLineProcessor.ERROR_0006_NON_ADMIN_CREDENTIALS=Non admin credentials ente CommandLineProcessor.ERROR_0007_FORBIDDEN=User is not allowed to perform this operation: {0} CommandLineProcessor.ERROR_0008_INVALID_PARAMETER=Invalid parameter syntax: "{0}" CommandLineProcessor.ERROR_0009_INVALID_LOG_FILE_PATH=Invalid log file path: "{0}" +CommandLineProcessor.ERROR_0010_FILE_DOES_NOT_EXIST=File does not exist: "{0}" CommandLineProcessor.INFO_OPTION_HELP_DESCRIPTION=print this message CommandLineProcessor.INFO_OPTION_IMPORT_DESCRIPTION=import @@ -375,7 +376,7 @@ PentahoPlatformExporter.INFO_START_EXPORT_METASTORE=**************************** PentahoPlatformExporter.INFO_END_EXPORT_METASTORE=********************************* [ End: Backup Metastore ] ******************************* PentahoPlatformExporter.INFO_SUCCESSFUL_EXPORT_METASTORE=Finished adding the metastore to the backup manifest PentahoPlatformExporter.INFO_START_EXPORT_MONDRIAN_DATASOURCE=********************************* [ Start: Backup Mondrian DataSource(s) ] ******************************* -PentahoPlatformExporter.INFO_COUNT_MONDRIAN_DATASOURCE_TO_EXPORT=Found [ {0} ] Role(s) to backup +PentahoPlatformExporter.INFO_COUNT_MONDRIAN_DATASOURCE_TO_EXPORT=Found [ {0} ] Mondrian DataSource(s) to backup PentahoPlatformExporter.INFO_SUCCESSFUL_MONDRIAN_DATASOURCE_EXPORT_COUNT=Successfully perform backup of [ {0} ] out of [ {1} ] Mondrian datasource(s) PentahoPlatformExporter.ERROR_MONDRIAN_DATASOURCE_EXPORT=Error performing backup of Mondrian DataSource. Cause [ {0} ] PentahoPlatformExporter.INFO_END_EXPORT_MONDRIAN_DATASOURCE=********************************* [ End: Backup Mondrian DataSource(s) ] *******************************