Ticket #18462: 18462.patch
| File 18462.patch, 2.4 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/data/Preferences.java
607 607 } 608 608 } 609 609 } 610 File possiblyGoodBackupFile = new File(prefDir, "preferences.xml_backup"); 610 611 try { 611 612 load(); 612 613 initSuccessful = true; … … 617 618 JOptionPane.showMessageDialog( 618 619 MainApplication.getMainFrame(), 619 620 tr("<html>Preferences file had errors.<br> Making backup of old one to <br>{0}<br> " + 620 "and creating a new default preference file.</html>",621 backupFile.getAbsoluteFile() ),621 "and trying to read last good preference file <br>{1}<br>.</html>", 622 backupFile.getAbsoluteFile(), possiblyGoodBackupFile.getAbsoluteFile()), 622 623 tr("Error"), 623 624 JOptionPane.ERROR_MESSAGE 624 625 ); 625 626 } 626 627 PlatformManager.getPlatform().rename(preferenceFile, backupFile); 628 } 629 if (!initSuccessful) { 627 630 try { 631 if (possiblyGoodBackupFile.exists() && possiblyGoodBackupFile.length() > 0) { 632 Utils.copyFile(possiblyGoodBackupFile, preferenceFile); 633 } 634 635 load(); 636 initSuccessful = true; 637 } catch (IOException | SAXException | XMLStreamException e) { 638 Logging.error(e); 639 Logging.warn(tr("Failed to initialize preferences. Failed to reset preference file to default: {0}", getPreferenceFile())); 640 } 641 } 642 if (!initSuccessful) { 643 try { 644 if (!GraphicsEnvironment.isHeadless()) { 645 JOptionPane.showMessageDialog( 646 MainApplication.getMainFrame(), 647 tr("<html>Preferences file had errors.<br> Creating a new default preference file.</html>"), 648 tr("Error"), 649 JOptionPane.ERROR_MESSAGE 650 ); 651 } 628 652 resetToDefault(); 629 653 save(); 630 654 } catch (IOException e1) {
