Add more warnings source to 1.6) and fix warnings
authorNiki Roo <niki@nikiroo.be>
Sat, 8 Jul 2017 04:21:22 +0000 (06:21 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 8 Jul 2017 04:21:22 +0000 (06:21 +0200)
18 files changed:
src/be/nikiroo/utils/Base64.java
src/be/nikiroo/utils/ImageText.java
src/be/nikiroo/utils/Progress.java
src/be/nikiroo/utils/Version.java
src/be/nikiroo/utils/resources/Bundle.java
src/be/nikiroo/utils/resources/FixedResourceBundleControl.java
src/be/nikiroo/utils/resources/TransBundle.java
src/be/nikiroo/utils/resources/TransBundle_ResourceList.java
src/be/nikiroo/utils/serial/ConnectAction.java
src/be/nikiroo/utils/serial/Exporter.java
src/be/nikiroo/utils/serial/SerialUtils.java
src/be/nikiroo/utils/serial/Server.java
src/be/nikiroo/utils/test/ProgressBarManualTest.java
src/be/nikiroo/utils/test/ProgressTest.java
src/be/nikiroo/utils/test/SerialTest.java
src/be/nikiroo/utils/test/TestCase.java
src/be/nikiroo/utils/ui/ConfigEditor.java
src/be/nikiroo/utils/ui/ProgressBar.java

index 5ee3d2eb8424e3581d4bf8a50d1effe4c7f3b362..efb57b4a0cf1d62fa8025d96f26361bc2a61ec2f 100644 (file)
@@ -934,62 +934,58 @@ class Base64
         }   // end if: compress
 
         // Else, don't compress. Better not to use streams at all then.
-        else {
-            boolean breakLines = (options & DO_BREAK_LINES) != 0;
-
-            //int    len43   = len * 4 / 3;
-            //byte[] outBuff = new byte[   ( len43 )                      // Main 4:3
-            //                           + ( (len % 3) > 0 ? 4 : 0 )      // Account for padding
-            //                           + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
-            // Try to determine more precisely how big the array needs to be.
-            // If we get it right, we don't have to do an array copy, and
-            // we save a bunch of memory.
-            int encLen = ( len / 3 ) * 4 + ( len % 3 > 0 ? 4 : 0 ); // Bytes needed for actual encoding
-            if( breakLines ){
-                encLen += encLen / MAX_LINE_LENGTH; // Plus extra newline characters
-            }
-            byte[] outBuff = new byte[ encLen ];
+        boolean breakLines = (options & DO_BREAK_LINES) != 0;
+
+        //int    len43   = len * 4 / 3;
+        //byte[] outBuff = new byte[   ( len43 )                      // Main 4:3
+        //                           + ( (len % 3) > 0 ? 4 : 0 )      // Account for padding
+        //                           + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
+        // Try to determine more precisely how big the array needs to be.
+        // If we get it right, we don't have to do an array copy, and
+        // we save a bunch of memory.
+        int encLen = ( len / 3 ) * 4 + ( len % 3 > 0 ? 4 : 0 ); // Bytes needed for actual encoding
+        if( breakLines ){
+            encLen += encLen / MAX_LINE_LENGTH; // Plus extra newline characters
+        }
+        byte[] outBuff = new byte[ encLen ];
 
 
-            int d = 0;
-            int e = 0;
-            int len2 = len - 2;
-            int lineLength = 0;
-            for( ; d < len2; d+=3, e+=4 ) {
-                encode3to4( source, d+off, 3, outBuff, e, options );
+        int d = 0;
+        int e = 0;
+        int len2 = len - 2;
+        int lineLength = 0;
+        for( ; d < len2; d+=3, e+=4 ) {
+            encode3to4( source, d+off, 3, outBuff, e, options );
 
-                lineLength += 4;
-                if( breakLines && lineLength >= MAX_LINE_LENGTH )
-                {
-                    outBuff[e+4] = NEW_LINE;
-                    e++;
-                    lineLength = 0;
-                }   // end if: end of line
-            }   // en dfor: each piece of array
-
-            if( d < len ) {
-                encode3to4( source, d+off, len - d, outBuff, e, options );
-                e += 4;
-            }   // end if: some padding needed
-
-
-            // Only resize array if we didn't guess it right.
-            if( e <= outBuff.length - 1 ){
-                // If breaking lines and the last byte falls right at
-                // the line length (76 bytes per line), there will be
-                // one extra byte, and the array will need to be resized.
-                // Not too bad of an estimate on array size, I'd say.
-                byte[] finalOut = new byte[e];
-                System.arraycopy(outBuff,0, finalOut,0,e);
-                //System.err.println("Having to resize array from " + outBuff.length + " to " + e );
-                return finalOut;
-            } else {
-                //System.err.println("No need to resize array.");
-                return outBuff;
-            }
+            lineLength += 4;
+            if( breakLines && lineLength >= MAX_LINE_LENGTH )
+            {
+                outBuff[e+4] = NEW_LINE;
+                e++;
+                lineLength = 0;
+            }   // end if: end of line
+        }   // en dfor: each piece of array
+
+        if( d < len ) {
+            encode3to4( source, d+off, len - d, outBuff, e, options );
+            e += 4;
+        }   // end if: some padding needed
+
+
+        // Only resize array if we didn't guess it right.
+        if( e <= outBuff.length - 1 ){
+            // If breaking lines and the last byte falls right at
+            // the line length (76 bytes per line), there will be
+            // one extra byte, and the array will need to be resized.
+            // Not too bad of an estimate on array size, I'd say.
+            byte[] finalOut = new byte[e];
+            System.arraycopy(outBuff,0, finalOut,0,e);
+            //System.err.println("Having to resize array from " + outBuff.length + " to " + e );
+            return finalOut;
+        }
         
-        }   // end else: don't compress
-
+        //System.err.println("No need to resize array.");
+        return outBuff;
     }   // end encodeBytesToBytes
     
 
@@ -1145,7 +1141,8 @@ class Base64
      * @throws java.io.IOException If bogus characters exist in source data
      * @since 1.3
      */
-    public static byte[] decode( byte[] source, int off, int len, int options )
+    @SuppressWarnings("cast")
+       public static byte[] decode( byte[] source, int off, int len, int options )
     throws java.io.IOException {
         
         // Lots of error checking and exception throwing
@@ -1260,7 +1257,8 @@ class Base64
         boolean dontGunzip = (options & DONT_GUNZIP) != 0;
         if( (bytes != null) && (bytes.length >= 4) && (!dontGunzip) ) {
             
-            int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+            @SuppressWarnings("cast")
+                       int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
             if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )  {
                 java.io.ByteArrayInputStream  bais = null;
                 java.util.zip.GZIPInputStream gzis = null;
@@ -1363,9 +1361,8 @@ class Base64
                                                Class c = Class.forName(streamClass.getName(), false, loader);
                         if( c == null ){
                             return super.resolveClass(streamClass);
-                        } else {
-                            return c;   // Class loader knows of this class.
-                        }   // end else: not null
+                        }
+                        return c;   // Class loader knows of this class.
                     }   // end resolveClass
                 };  // end ois
             }   // end else: no custom class loader
@@ -1777,26 +1774,21 @@ class Base64
                     lineLength = 0;
                     return '\n';
                 }   // end if
-                else {
-                    lineLength++;   // This isn't important when decoding
-                                    // but throwing an extra "if" seems
-                                    // just as wasteful.
-                    
-                    int b = buffer[ position++ ];
+                lineLength++;   // This isn't important when decoding
+                                // but throwing an extra "if" seems
+                                // just as wasteful.
+                
+                int b = buffer[ position++ ];
 
-                    if( position >= bufferLength ) {
-                        position = -1;
-                    }   // end if: end
+                if( position >= bufferLength ) {
+                    position = -1;
+                }   // end if: end
 
-                    return b & 0xFF; // This is how you "cast" a byte that's
-                                     // intended to be unsigned.
-                }   // end else
+                return b & 0xFF; // This is how you "cast" a byte that's
+                                 // intended to be unsigned.
             }   // end if: position >= 0
             
-            // Else error
-            else {
-                throw new java.io.IOException( "Error in Base64 code reading stream." );
-            }   // end else
+            throw new java.io.IOException( "Error in Base64 code reading stream." );
         }   // end read
         
         
index 00bf3e49117a3ed074d43b1e6f9dfa7446b9f0f0..53d8def784848ca7f186de33e94ffc7508b1bb73 100644 (file)
@@ -156,12 +156,14 @@ public class ImageText {
        public String getText() {
                if (text == null) {
                        if (image == null || size == null || size.width == 0
-                                       || size.height == 0)
+                                       || size.height == 0) {
                                return "";
+                       }
 
                        int mult = 1;
-                       if (mode == Mode.DOUBLE_RESOLUTION || mode == Mode.DOUBLE_DITHERING)
+                       if (mode == Mode.DOUBLE_RESOLUTION || mode == Mode.DOUBLE_DITHERING) {
                                mult = 2;
+                       }
 
                        int w = size.width * mult;
                        int h = size.height * mult;
@@ -191,6 +193,7 @@ public class ImageText {
                        }
 
                        if (gfx.drawImage(image, x, y, w, h, new ImageObserver() {
+                               @Override
                                public boolean imageUpdate(Image img, int infoflags, int x,
                                                int y, int width, int height) {
                                        ImageText.this.ready = true;
@@ -212,8 +215,9 @@ public class ImageText {
                        StringBuilder builder = new StringBuilder();
 
                        for (int row = 0; row < buff.getHeight(); row += mult) {
-                               if (row > 0)
+                               if (row > 0) {
                                        builder.append('\n');
+                               }
 
                                for (int col = 0; col < buff.getWidth(); col += mult) {
                                        if (mult == 1) {
@@ -313,14 +317,19 @@ public class ImageText {
        private char getBlockChar(int upperleft, int upperright, int lowerleft,
                        int lowerright, boolean dithering) {
                int choice = 0;
-               if (getBrightness(upperleft) > 0.5f)
+
+               if (getBrightness(upperleft) > 0.5f) {
                        choice += 1;
-               if (getBrightness(upperright) > 0.5f)
+               }
+               if (getBrightness(upperright) > 0.5f) {
                        choice += 2;
-               if (getBrightness(lowerleft) > 0.5f)
+               }
+               if (getBrightness(lowerleft) > 0.5f) {
                        choice += 4;
-               if (getBrightness(lowerright) > 0.5f)
+               }
+               if (getBrightness(lowerright) > 0.5f) {
                        choice += 8;
+               }
 
                switch (choice) {
                case 0:
@@ -363,9 +372,9 @@ public class ImageText {
                                avg /= 4;
 
                                return getDitheringChar(avg, " â–‘â–’â–“â–ˆ");
-                       } else {
-                               return 'â–ˆ';
                        }
+
+                       return 'â–ˆ';
                }
 
                return ' ';
@@ -385,8 +394,10 @@ public class ImageText {
         * @return the brightness to sue for computations
         */
        private float getBrightness(int argb) {
-               if (invert)
+               if (invert) {
                        return 1 - rgb2hsb(argb, tmp)[2];
+               }
+
                return rgb2hsb(argb, tmp)[2];
        }
 
@@ -415,8 +426,10 @@ public class ImageText {
                g = ((argb & 0x0000ff00) >> 8);
                b = ((argb & 0x000000ff));
 
-               if (array == null)
+               if (array == null) {
                        array = new float[4];
+               }
+
                Color.RGBtoHSB(r, g, b, array);
 
                array[3] = a;
index 5ee32217d466c1ad7bbb13e21ecf24e6fe457f57..2872530b68542585783467e3241835072e75570a 100644 (file)
@@ -294,6 +294,7 @@ public class Progress {
         *            the progress to set
         */
        private void setTotalProgress(Progress pg, String name, int progress) {
+               // TODO: name is not used... and this is probably a bug in this case
                synchronized (getLock()) {
                        progress = Math.max(min, progress);
                        progress = Math.min(max, progress);
@@ -379,6 +380,7 @@ public class Progress {
                }
 
                progress.addProgressListener(new ProgressListener() {
+                       @Override
                        public void progress(Progress pg, String name) {
                                synchronized (getLock()) {
                                        double total = ((double) localProgress) / (max - min);
index 2c6f3d0913578601c9ee65dcc0c3486fd8971648..269edb6fc1e6914d4233bc01d6410337c115fe00 100644 (file)
@@ -308,6 +308,7 @@ public class Version implements Comparable<Version> {
                return new Version(version);
        }
 
+       @Override
        public int compareTo(Version o) {
                if (equals(o)) {
                        return 0;
index 1dbb251f942b4d3a95d0720e29a8ddcdc48a444e..40177da6cbfc23050e4e266d65253fde52060f27 100644 (file)
@@ -384,7 +384,7 @@ public class Bundle<E extends Enum<E>> {
                for (Field field : type.getDeclaredFields()) {
                        Meta meta = field.getAnnotation(Meta.class);
                        if (meta != null) {
-                               E id = E.valueOf(type, field.getName());
+                               E id = Enum.valueOf(type, field.getName());
                                String info = getMetaInfo(meta);
 
                                if (info != null) {
@@ -671,7 +671,7 @@ public class Bundle<E extends Enum<E>> {
                        }
                }
        }
-       
+
        /**
         * Take a snapshot of the changes in memory in this {@link Bundle} made by
         * the "set" methods ( {@link Bundle#setString(Enum, String)}...) at the
@@ -739,9 +739,9 @@ public class Bundle<E extends Enum<E>> {
                        file = new File(dir, name + loc + ".properties");
                        if (file.exists()) {
                                break;
-                       } else {
-                               file = null;
                        }
+                       
+                       file = null;
                }
 
                return file;
index 30c588951aa159fe89f810e4edf3d540037010f9..b53da9d5ba2aeefc999c8b3333ccadba9334ebdc 100644 (file)
@@ -17,7 +17,7 @@ import java.util.ResourceBundle.Control;
  * the resources.
  * 
  * @author niki
- *
+ * 
  */
 class FixedResourceBundleControl extends Control {
        @Override
@@ -40,9 +40,9 @@ class FixedResourceBundleControl extends Control {
                                }
                        }
                } else {
-                       if (stream == null)
-                               stream = loader.getResourceAsStream(resourceName);
+                       stream = loader.getResourceAsStream(resourceName);
                }
+
                if (stream != null) {
                        try {
                                // This line is changed to make it to read properties files
index 51e090f6fab208f7bb6eb3f40fcb3910fe5c7901..ec5b2d0af93d7d17a629dca51c1d2a0b365fece0 100644 (file)
@@ -127,10 +127,11 @@ public class TransBundle<E extends Enum<E>> extends Bundle<E> {
                        result = null;
                }
 
-               if (values != null && values.length > 0 && result != null)
+               if (values != null && values.length > 0 && result != null) {
                        return String.format(locale, result, values);
-               else
-                       return result;
+               }
+
+               return result;
        }
 
        /**
index 519b33a660b2798972338cfd4535e02aaa9812ec..e1c874034c0bd35024e9307e9e756cca4c30a68b 100644 (file)
@@ -66,7 +66,7 @@ class TransBundle_ResourceList {
                }
                final Enumeration<? extends ZipEntry> e = zf.entries();
                while (e.hasMoreElements()) {
-                       final ZipEntry ze = (ZipEntry) e.nextElement();
+                       final ZipEntry ze = e.nextElement();
                        final String fileName = ze.getName();
                        final boolean accept = pattern.matcher(fileName).matches();
                        if (accept) {
index ec49a1dd7f3c235c32614c0c04bee9db902e1166..1f9833624c552516efa821c214cbb74765f82a55 100644 (file)
@@ -35,6 +35,7 @@ abstract class ConnectAction {
 
        public void connectAsync() {
                new Thread(new Runnable() {
+                       @Override
                        public void run() {
                                connect();
                        }
@@ -94,12 +95,23 @@ abstract class ConnectAction {
                return new Importer().read(str).getValue();
        }
 
-       protected void onClientVersionReceived(Version clientVersion) {
-
+       /**
+        * Handler called when the client {@link Version} is received.
+        * 
+        * @param clientVersion
+        *            the client {@link Version}
+        */
+       protected void onClientVersionReceived(
+                       @SuppressWarnings("unused") Version clientVersion) {
        }
 
-       protected void onError(Exception e) {
-
+       /**
+        * Handler called when an unexpected error occurs in the code.
+        * 
+        * @param e
+        *            the exception that occurred
+        */
+       protected void onError(@SuppressWarnings("unused") Exception e) {
        }
 
        // \n included in line, but not in rep (also, server never get anything)
@@ -111,10 +123,10 @@ abstract class ConnectAction {
                        if (server) {
                                out.flush();
                                return null;
-                       } else {
-                               contentToSend = true;
-                               return flushString();
                        }
+
+                       contentToSend = true;
+                       return flushString();
                }
        }
 
@@ -139,9 +151,9 @@ abstract class ConnectAction {
                                }
 
                                return line;
-                       } else {
-                               return null;
                        }
+
+                       return null;
                }
        }
 }
\ No newline at end of file
index 8b04111979ddaa751548d11b56f7572381cc1fe2..8b522e9556054dea43572f6a5e4226f738e116b8 100644 (file)
@@ -41,9 +41,9 @@ public class Exporter {
 
                if (zip) {
                        return "ZIP:" + StringUtils.zip64(builder.toString());
-               } else {
-                       return builder.toString();
                }
+
+               return builder.toString();
        }
 
        /**
index be18769ee06967cd5c5a78439fcfe2afccb27d50..c222bc3e3d6334a76dcf03ad133a846609aed0b0 100644 (file)
@@ -299,10 +299,9 @@ public class SerialUtils {
                        String type = CustomSerializer.typeOf(encodedValue);
                        if (customTypes.containsKey(type)) {
                                return customTypes.get(type).decode(encodedValue);
-                       } else {
-                               throw new UnknownFormatConversionException(
-                                               "Unknown custom type: " + type);
                        }
+                       throw new UnknownFormatConversionException("Unknown custom type: "
+                                       + type);
                } else if (encodedValue.equals("NULL") || encodedValue.equals("null")) {
                        return null;
                } else if (encodedValue.endsWith("\"")) {
index 50b8f46116ab2c4f7b4d2d81530ccbae1932ada3..bc4e637a7d65d0e8bbdc154c6b45c32b0197a80f 100644 (file)
@@ -16,7 +16,6 @@ import be.nikiroo.utils.Version;
 abstract public class Server implements Runnable {
        static private final String[] ANON_CIPHERS = getAnonCiphers();
 
-       private Version serverVersion = new Version();
        private int port;
        private boolean ssl;
        private ServerSocket ss;
@@ -26,8 +25,13 @@ abstract public class Server implements Runnable {
        private Object lock = new Object();
        private Object counterLock = new Object();
 
-       public Server(Version version, int port, boolean ssl) throws IOException {
-               this.serverVersion = version;
+       @Deprecated
+       public Server(@SuppressWarnings("unused") Version notUsed, int port,
+                       boolean ssl) throws IOException {
+               this(port, ssl);
+       }
+
+       public Server(int port, boolean ssl) throws IOException {
                this.port = port;
                this.ssl = ssl;
                this.ss = createSocketServer(port, ssl);
@@ -53,6 +57,7 @@ abstract public class Server implements Runnable {
                        stop(timeout);
                } else {
                        new Thread(new Runnable() {
+                               @Override
                                public void run() {
                                        stop(timeout);
                                }
@@ -97,6 +102,7 @@ abstract public class Server implements Runnable {
                }
        }
 
+       @Override
        public void run() {
                try {
                        while (started && !exiting) {
@@ -129,12 +135,12 @@ abstract public class Server implements Runnable {
                                                } finally {
                                                        count(-1);
                                                }
-                                       };
+                                       }
 
                                        @Override
                                        protected void onClientVersionReceived(Version clientVersion) {
                                                this.clientVersion = clientVersion;
-                                       };
+                                       }
                                }.connectAsync();
                        }
 
index c94ea61592c24c4bcbde579750ea5b461e0d01f5..9b281336bf369df1be253f8d529980599c2ab1f4 100644 (file)
@@ -24,6 +24,7 @@ public class ProgressBarManualTest extends JFrame {
 
                final JButton b = new JButton("Set pg to 10%");
                b.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                switch (i) {
                                case 0:
index 05ca03415b8e040a5fbdba5657f27496bcd7d737..bd05bc5b4dbf2d6fb6cf9c4ca17735aa0fc0ef4d 100644 (file)
@@ -38,6 +38,7 @@ class ProgressTest extends TestLauncher {
                                        public void test() throws Exception {
                                                Progress p = new Progress();
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                pg = progress.getProgress();
                                                        }
@@ -102,6 +103,7 @@ class ProgressTest extends TestLauncher {
                                                p.addProgress(child2, 50);
 
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                pg = p.getProgress();
                                                        }
@@ -132,6 +134,7 @@ class ProgressTest extends TestLauncher {
                                                p.addProgress(child2, 500);
 
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                pg = p.getProgress();
                                                        }
@@ -164,6 +167,7 @@ class ProgressTest extends TestLauncher {
                                                // 200 = local progress
 
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                pg = p.getProgress();
                                                        }
@@ -208,6 +212,7 @@ class ProgressTest extends TestLauncher {
                                                child111.addProgress(child1115, 20);
 
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                pg = p.getProgress();
                                                        }
@@ -248,6 +253,7 @@ class ProgressTest extends TestLauncher {
                                                p.addProgress(child2, 100);
 
                                                p.addProgressListener(new Progress.ProgressListener() {
+                                                       @Override
                                                        public void progress(Progress progress, String name) {
                                                                int now = p.getProgress();
                                                                if (now < pg) {
@@ -262,6 +268,7 @@ class ProgressTest extends TestLauncher {
                                                for (int i = 0; i <= 100; i++) {
                                                        final int step = i;
                                                        new Thread(new Runnable() {
+                                                               @Override
                                                                public void run() {
                                                                        synchronized (lock1) {
                                                                                if (step > currentStep1) {
@@ -273,6 +280,7 @@ class ProgressTest extends TestLauncher {
                                                        }).start();
 
                                                        new Thread(new Runnable() {
+                                                               @Override
                                                                public void run() {
                                                                        synchronized (lock2) {
                                                                                if (step > currentStep2) {
index 517d286154e0d54eace1fe2d01a093c9b2e4b918..22f04c65f5f84b2777b75d3303237dc28c29f8da 100644 (file)
@@ -7,10 +7,11 @@ import be.nikiroo.utils.serial.Importer;
 import be.nikiroo.utils.serial.Server;
 
 class SerialTest extends TestLauncher {
+       @SuppressWarnings("unused")
        private void not_used() {
                // TODO: test Server ; but this will at least help dependency checking
                try {
-                       Server server = new Server(null, 0, false) {
+                       Server server = new Server(0, false) {
                                @Override
                                protected Object onRequest(ConnectActionServer action,
                                                Version clientVersion, Object data) throws Exception {
index 243acac2b28243a781c5de9eef56b31ab76e5a9e..490edbb4ec9d47db7f2c24cf21630ac303dc7044 100644 (file)
@@ -130,10 +130,10 @@ abstract public class TestCase {
                        if (errorMessage == null) {
                                throw new AssertException(generateAssertMessage(expected,
                                                actual));
-                       } else {
-                               throw new AssertException(errorMessage, new AssertException(
-                                               generateAssertMessage(expected, actual)));
                        }
+
+                       throw new AssertException(errorMessage, new AssertException(
+                                       generateAssertMessage(expected, actual)));
                }
        }
 
@@ -258,10 +258,10 @@ abstract public class TestCase {
 
                        if (errorMessage == null) {
                                throw new AssertException(defaultReason);
-                       } else {
-                               throw new AssertException(errorMessage, new AssertException(
-                                               defaultReason));
                        }
+
+                       throw new AssertException(errorMessage, new AssertException(
+                                       defaultReason));
                }
        }
 
index 2651db10e481abef512290a2859dcde672be31b2..7bdf17a24abe3adeec66af828674f2258b902119 100644 (file)
@@ -15,7 +15,6 @@ import javax.swing.JScrollPane;
 import javax.swing.border.EmptyBorder;
 
 import be.nikiroo.utils.resources.Bundle;
-import be.nikiroo.utils.resources.TransBundle;
 
 /**
  * A configuration panel for a {@link Bundle}.
@@ -61,6 +60,7 @@ public class ConfigEditor<E extends Enum<E>> extends JPanel {
                }
 
                main.add(createButton("Reset", new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                for (ConfigItem<E> item : items) {
                                        item.reload();
@@ -69,6 +69,7 @@ public class ConfigEditor<E extends Enum<E>> extends JPanel {
                }));
 
                main.add(createButton("Default", new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                Object snap = bundle.takeSnapshot();
                                bundle.reload(true);
@@ -81,6 +82,7 @@ public class ConfigEditor<E extends Enum<E>> extends JPanel {
                }));
 
                main.add(createButton("Save", new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                for (ConfigItem<E> item : items) {
                                        item.save();
index 3e854f791d10dbb212c885f98d5a7256d0bacdf2..2c91c70dcd5db543285816353841fe9fee7e8337 100644 (file)
@@ -39,6 +39,7 @@ public class ProgressBar extends JPanel {
                this.pg = pg;
 
                SwingUtilities.invokeLater(new Runnable() {
+                       @Override
                        public void run() {
                                if (pg != null) {
                                        final JProgressBar bar = new JProgressBar();
@@ -53,9 +54,11 @@ public class ProgressBar extends JPanel {
                                        bar.setString(pg.getName());
 
                                        pg.addProgressListener(new Progress.ProgressListener() {
+                                               @Override
                                                public void progress(Progress progress, String name) {
                                                        final Progress.ProgressListener l = this;
                                                        SwingUtilities.invokeLater(new Runnable() {
+                                                               @Override
                                                                public void run() {
                                                                        Map<Progress, JProgressBar> newBars = new HashMap<Progress, JProgressBar>();
                                                                        newBars.put(pg, bar);