idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
- From: "Apache" <apache AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r732 - branches/opensource/java/ch/idok/qtgui
- Date: Mon, 11 Feb 2008 11:30:36 +0100
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: geus AT PSI.CH
Date: Mon Feb 11 11:30:35 2008
New Revision: 732
Log:
Fixed NullPointerException in GUI client occurring when i18n translation for
locale is not available
Modified:
branches/opensource/java/ch/idok/qtgui/DmsGui.java
Modified: branches/opensource/java/ch/idok/qtgui/DmsGui.java
==============================================================================
--- branches/opensource/java/ch/idok/qtgui/DmsGui.java (original)
+++ branches/opensource/java/ch/idok/qtgui/DmsGui.java Mon Feb 11 11:30:35
2008
@@ -81,17 +81,22 @@
l.fine("Locale used for i18n translations is " + locale);
Class<DmsGui> c = DmsGui.class;
File f;
- f = copyToTemp(c.getResourceAsStream("translations/iDok_"
- + locale + ".qm"));
- f.deleteOnExit();
- l.fine("Wrote i18n translations to " + f.getPath());
- QTranslator translator = new QTranslator();
- if (translator.load(f.getPath())) {
- l.fine("i18n translations installed");
- QApplication.installTranslator(translator);
+ InputStream is = c.getResourceAsStream("translations/iDok_"
+ + locale + ".qm");
+ if (is == null) {
+ l.info("No i18n translations found for locale " +
locale);
} else {
- l
- .warning("Could not install i18n translations,
QTranslator returned with error code.");
+ f = copyToTemp(is);
+ f.deleteOnExit();
+ l.fine("Wrote i18n translations to " + f.getPath());
+ QTranslator translator = new QTranslator();
+ if (translator.load(f.getPath())) {
+ l.fine("i18n translations installed");
+ QApplication.installTranslator(translator);
+ } else {
+ l
+ .warning("Could not install i18n
translations, QTranslator returned with error code.");
+ }
}
} catch (IOException e) {
l.log(Level.WARNING,
@@ -116,7 +121,7 @@
}
}
- static protected File copyToTemp(InputStream is) throws IOException {
+ static private File copyToTemp(InputStream is) throws IOException {
File t = File.createTempFile("idok_temp", null);
FileOutputStream os = new FileOutputStream(t);
byte[] buf = new byte[4096];
- [idok-commit] idok commit r732 - branches/opensource/java/ch/idok/qtgui, Apache, 02/11/2008
Archive powered by MHonArc 2.6.19.