Skip to content

NullPointer Exception When Restoring the backup #2

@rajanjha786

Description

@rajanjha786

I have taken a backup from the Ubuntu EC2 instance and tried to restore it in my local Jenkins setup
the backup file generated on the server was configOnly backup and the name of the backup files was backup_2021_04_07_17_59_25_791_1.zip and backup_2021_04_07_17_59_25_791.pbobj.
Since my server had a UTC timezone the timestamp in the file name has the UTC time. But in my local machine, I had IST timezone and while restoring it was showing me the restore option in ITC format

image

and due to the difference in timezone while restoring LocalDirectory.retrieveBackupFromLocation is throwing the PeriodicBackupException on line 105.

File[] files = path.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                return (pathname.getName().contains( Util.getFormattedDate(BackupObject.FILE_TIMESTAMP_PATTERN, backup.getTimestamp())) &&
                        !pathname.getName().endsWith(BackupObject.EXTENSION) &&
                        pathname.isFile());
            }
        });

The above code snippet is problematic it will give an empty File array if the timezone is different on the server where the backup was taken and on the server where the backup will be restored.

One possible solution is to convert the timestamp into UTC before comparing

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions