Java 1.6+ compatibility (at least) instead of 1.8+ only
authorNiki Roo <roo.niki@gmail.com>
Tue, 8 Mar 2016 08:23:03 +0000 (09:23 +0100)
committerNiki Roo <roo.niki@gmail.com>
Tue, 8 Mar 2016 08:23:03 +0000 (09:23 +0100)
TODO: fix Locale problem (doesn't seem to work for non-default currently)

src/be/nikiroo/jvcard/i18n/Trans.java
src/be/nikiroo/jvcard/tui/Main.java
src/be/nikiroo/jvcard/tui/TuiLauncher.java
src/be/nikiroo/jvcard/tui/panes/ContactDetails.java

index b41fbdef46e095d468900fa7f3e93b20382cf8bd..0b2af474b5a3fafe24d6439f45dab234833461fb 100644 (file)
@@ -132,7 +132,7 @@ public class Trans {
                if (lang == null) {
                        locale = Locale.getDefault();
                } else {
                if (lang == null) {
                        locale = Locale.getDefault();
                } else {
-                       locale = Locale.forLanguageTag(lang);
+                       locale = new Locale(lang);
                }
 
                map = Bundles.getBundle("resources", locale);
                }
 
                map = Bundles.getBundle("resources", locale);
@@ -153,7 +153,7 @@ public class Trans {
        public static void main(String[] args) throws IOException {
                String path = args[0];
                for (int i = 1; i < args.length; i++) {
        public static void main(String[] args) throws IOException {
                String path = args[0];
                for (int i = 1; i < args.length; i++) {
-                       Locale locale = Locale.forLanguageTag(args[i].replaceAll("_", "-"));
+                       Locale locale = new Locale(args[i].replaceAll("_", "-"));
                        String code = locale.toString();
                        Trans trans = new Trans(code);
 
                        String code = locale.toString();
                        Trans trans = new Trans(code);
 
index db6e522c72ed61cc3b0a317e0fc21c97b2c255b8..4884e70f8d44efb5835ebbf121332fdad2209f68 100644 (file)
@@ -170,8 +170,10 @@ public class Main {
                        Field charset = Charset.class.getDeclaredField("defaultCharset");
                        charset.setAccessible(true);
                        charset.set(null, null);
                        Field charset = Charset.class.getDeclaredField("defaultCharset");
                        charset.setAccessible(true);
                        charset.set(null, null);
-               } catch (SecurityException | NoSuchFieldException
-                               | IllegalArgumentException | IllegalAccessException e) {
+               } catch (SecurityException e) {
+               } catch (NoSuchFieldException e) {
+               } catch (IllegalArgumentException e) {
+               } catch (IllegalAccessException e) {
                }
        }
 }
                }
        }
 }
index 2cfcc3eb9dfc03a8e2b1c32341101b7a6d5f51d6..deb09d4636e499c0cd5f2d3357e747309c9ec7c6 100644 (file)
@@ -36,7 +36,7 @@ public class TuiLauncher {
                }
 
                if (win instanceof MainWindow) {
                }
 
                if (win instanceof MainWindow) {
-                       MainWindow mwin = (MainWindow) win;
+                       final MainWindow mwin = (MainWindow) win;
                        mwin.refresh(terminal.getTerminalSize());
                        terminal.addResizeListener(new ResizeListener() {
                                @Override
                        mwin.refresh(terminal.getTerminalSize());
                        terminal.addResizeListener(new ResizeListener() {
                                @Override
index 2a69e41db2c64462d55a24449980c6be2672fab9..06c88fc9ec02a66f71011f6842ecb54d6e1e0603 100644 (file)
@@ -1,10 +1,10 @@
 package be.nikiroo.jvcard.tui.panes;
 
 import java.awt.Image;
 package be.nikiroo.jvcard.tui.panes;
 
 import java.awt.Image;
-import java.util.Base64;
 import java.util.LinkedList;
 import java.util.List;
 
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.xml.bind.DatatypeConverter;
 import javax.swing.ImageIcon;
 
 import be.nikiroo.jvcard.Contact;
 import javax.swing.ImageIcon;
 
 import be.nikiroo.jvcard.Contact;
@@ -116,7 +116,7 @@ public class ContactDetails extends MainContent {
                                if (encoding != null && encoding.getValue() != null
                                                && encoding.getValue().equalsIgnoreCase("b")) {
 
                                if (encoding != null && encoding.getValue() != null
                                                && encoding.getValue().equalsIgnoreCase("b")) {
 
-                                       image = new ImageIcon(Base64.getDecoder().decode(
+                                       image = new ImageIcon(DatatypeConverter.parseBase64Binary(
                                                        photo.getValue())).getImage();
                                }
                        }
                                                        photo.getValue())).getImage();
                                }
                        }