Performance improvement:
[jvcard.git] / src / be / nikiroo / jvcard / launcher / Main.java
index 85223d878560efb1d5dc55a8e6d9f5b781a8639f..eeeae4153a57eada0b58e04da065ea2d119101bc 100644 (file)
@@ -37,7 +37,7 @@ import be.nikiroo.jvcard.resources.enums.StringId;
  */
 public class Main {
        static public final String APPLICATION_TITLE = "jVcard";
-       static public final String APPLICATION_VERSION = "1.0";
+       static public final String APPLICATION_VERSION = "1.0-dev";
 
        static private final int ERR_NO_FILE = 1;
        static private final int ERR_SYNTAX = 2;
@@ -63,7 +63,7 @@ public class Main {
         * @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);
        }
 
        /**
@@ -278,6 +278,7 @@ public class Main {
                                new RemoteBundle().updateFile(dir);
                        } catch (IOException e) {
                                e.printStackTrace();
+                               System.err.flush();
                                System.exit(ERR_INTERNAL);
                        }
                        break;
@@ -316,6 +317,7 @@ public class Main {
                                                File f = new File(dir, filename);
 
                                                if (f.exists()) {
+                                                       System.out.println("Loading " + f);
                                                        try {
                                                                String b64 = StringUtils.fromImage(ImageIO
                                                                                .read(f));
@@ -330,7 +332,7 @@ public class Main {
 
                                                                List<TypeInfo> types = new LinkedList<TypeInfo>();
                                                                types.add(new TypeInfo("ENCODING", "b"));
-                                                               types.add(new TypeInfo("TYPE", "png"));
+                                                               types.add(new TypeInfo("TYPE", "jpeg"));
                                                                Data photo = new Data(types, "PHOTO", b64, null);
                                                                contact.add(photo);
                                                        } catch (IOException e) {
@@ -356,6 +358,7 @@ public class Main {
                                                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()),
@@ -630,6 +633,7 @@ public class Main {
                else
                        System.err.println(trans(err, trans(suberr, subvalues)));
 
+               System.err.flush();
                System.exit(CODE);
        }
 }