* @return the translated text with the given value where required
*/
static public String trans(StringId id, Object... values) {
- return transService.getString(id, (Object[]) values);
+ return transService.getString(id, values);
}
/**
new RemoteBundle().updateFile(dir);
} catch (IOException e) {
e.printStackTrace();
+ System.err.flush();
System.exit(ERR_INTERNAL);
}
break;
File f = new File(dir, filename);
if (f.exists()) {
+ System.out.println("Loading " + f);
try {
- String b64 = StringUtils.fromImage(ImageIO
- .read(f));
+ String type = "jpeg";
+ int dotIndex = filename.indexOf('.');
+ if (dotIndex >= 0
+ && (dotIndex + 1) < filename.length()) {
+ type = filename.substring(dotIndex + 1)
+ .toLowerCase();
+ }
+
+ String b64 = StringUtils.fromImage(f);
// remove previous photos:
for (Data photo = contact
List<TypeInfo> types = new LinkedList<TypeInfo>();
types.add(new TypeInfo("ENCODING", "b"));
- types.add(new TypeInfo("TYPE", "png"));
+ types.add(new TypeInfo("TYPE", type));
Data photo = new Data(types, "PHOTO", b64, null);
contact.add(photo);
} catch (IOException e) {
if (photo != null) {
String filename = contact.toString(format, "");
File f = new File(dir, filename + ".png");
+ System.out.println("Saving " + f);
try {
ImageIO.write(
StringUtils.toImage(photo.getValue()),
else
System.err.println(trans(err, trans(suberr, subvalues)));
+ System.err.flush();
System.exit(CODE);
}
}