[Title] Code enhancement as static analysis
authorBon-Yong Lee <bonyong.lee@samsung.com>
Tue, 28 Aug 2012 02:09:27 +0000 (11:09 +0900)
committerBon-Yong Lee <bonyong.lee@samsung.com>
Tue, 28 Aug 2012 02:09:27 +0000 (11:09 +0900)
[Type]      Enhancement
[Module]    Sub
[Priority]  Minor
[CQ#]       // CQ Issue Number
[Redmine#]  // Redmine Isuue Number
[Problem]   // Problem Description
[Cause]     // Cause Description
[Solution]  // Solution Description
[TestCase]  // Executed the test-target (How to)

org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java [changed mode: 0644->0755]
org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileContentProvider.java [changed mode: 0644->0755]
org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java [changed mode: 0644->0755]
org.tizen.common/src/org/tizen/common/ui/view/console/AnsicodeAdapter.java
org.tizen.common/src/org/tizen/common/ui/widget/PictureLabel.java [changed mode: 0644->0755]
org.tizen.common/src/org/tizen/common/util/CollectionUtil.java [changed mode: 0644->0755]
org.tizen.common/src/org/tizen/common/util/StringUtil.java
org.tizen.common/test/src/org/tizen/common/util/CollectionUtilTest.java [changed mode: 0644->0755]

index 13cb202..d44e1a3 100755 (executable)
@@ -146,7 +146,9 @@ public class AddViewDialog extends Dialog
         while (!shell.isDisposed())
         {
             if (!display.readAndDispatch())
+            {
                 display.sleep();
+            }
         }
 
         return bOk;
@@ -178,7 +180,9 @@ public class AddViewDialog extends Dialog
 
         tabNameText = new Text(top, SWT.SINGLE | SWT.BORDER);
         if (tabName != null)
+        {
             tabNameText.setText(tabName);
+        }
         tabNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
         l = new Label(top, SWT.NONE);
@@ -195,7 +199,9 @@ public class AddViewDialog extends Dialog
             for (IDevice d : devices)
             {
                 if (d.isOnline())
+                {
                     dCombo.add(d.getSerialNumber());
+                }
             }
 
             if (device != null)
@@ -225,7 +231,9 @@ public class AddViewDialog extends Dialog
 
         tagText = new Text(mid, SWT.SINGLE | SWT.BORDER);
         if (tagKeyword != null)
+        {
             tagText.setText(tagKeyword);
+        }
         tagText.setMessage("Separated by a space and comma");
         tagText.setToolTipText("Search Tag Keywords are separated by a space as well as a comma");
         tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -235,7 +243,9 @@ public class AddViewDialog extends Dialog
 
         pidText = new Text(mid, SWT.SINGLE | SWT.BORDER);
         if (pidKeyword != null)
+        {
             pidText.setText(pidKeyword);
+        }
         pidText.setMessage("Separated by a space and comma");
         pidText.setToolTipText("Search Pid Keywords are separated by a space as well as a comma");
         pidText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -245,7 +255,9 @@ public class AddViewDialog extends Dialog
 
         msgText = new Text(mid, SWT.SINGLE | SWT.BORDER);
         if (msgKeyword != null)
+        {
             msgText.setText(msgKeyword);
+        }
         msgText.setMessage("Separated by a space and comma");
         msgText.setToolTipText("Search Message Keywords are separated by a space as well as a comma");
         msgText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -268,10 +280,14 @@ public class AddViewDialog extends Dialog
                     if (tab.getLogTabName().equals(newName))
                     {
                         if (oldTab != null && oldTab == tab)
+                        {
                             continue;
+                        }
                         int ret = FileDialogUtils.checkTabName(newName);
                         if (ret == IDialogConstants.OK_ID)
+                        {
                             return;
+                        }
                     }
                 }
 
index 2f9427d..cb7fca8 100755 (executable)
@@ -277,7 +277,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         for (IDevice device : getDevices())
         {
             if (device.isOffline())
+            {
                 continue;
+            }
             LogTab dTab = createLogTab(ConnectionExplorerLabelProvider.getDeviceSerialWithName(device), device, true);
             dTab.start();
         }
@@ -559,7 +561,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     public boolean save()
     {
         if (getSelectionLogTab() == null)
+        {
             return false;
+        }
         FileDialog dlg = new FileDialog(parent.getShell(), SWT.SAVE);
 
         dlg.setText(LogUIMessages.Log_Title_Tab_Export);
@@ -583,7 +587,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
             again = false;
             fileName = dlg.open();
             if (fileName == null)
+            {
                 return false;
+            }
             checkFile = new File(fileName);
             if (checkFile.exists())
             {
@@ -624,7 +630,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     {
         LogTab tab = getSelectionLogTab();
         if ( tab != null)
+        {
             tab.clear();
+        }
     }
 
     /**
@@ -656,7 +664,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         LogTab tab = getSelectionLogTab();
 
         if (tab == null)
+        {
             return;
+        }
 
         if (!checkTabConnection(tab, LogUIMessages.Log_Title_Tab_AddTab_Error))
         {
@@ -666,7 +676,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         AddViewDialog dlg = new AddViewDialog(parent.getShell(), tab.getDeviceSerialNumber());
 
         if (dlg.getDevice() == null)
+        {
             return;
+        }
 
         if (dlg.open())
         {
@@ -687,7 +699,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
                 }
             }
         } else
+        {
             return;
+        }
     }
 
     public void removeTab(LogTab tab)
@@ -703,7 +717,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     {
         int index = tabFolder.getSelectionIndex();
         if (index < 0)
+        {
             return;
+        }
         LogTab tab = logTabList.get(index);
         removeTab(tab);
         logTabList.remove(tab);
@@ -722,7 +738,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         LogTab oldTab = getSelectionLogTab();
 
         if (oldTab == null)
+        {
             return;
+        }
 
         if (oldTab.isDefault())
         {
@@ -794,7 +812,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
             for(LogTab logTab : logTabList)
             {
                 if(logTab.getTabItem() == item)
+                {
                     return logTab;
+                }
             }
         }
         return null;
@@ -814,9 +834,13 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         IDevice[] devices;
         SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
         if(sdbBridge != null)
+        {
             devices = sdbBridge.getDevices();
+        }
         else
+        {
             devices = new IDevice[0];
+        }
         return devices;
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index bfd7b6d..e52f7af
@@ -25,6 +25,8 @@
  */
 package org.tizen.common.connection.log;
 
+import static org.tizen.common.util.SWTUtil.syncExec;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
@@ -131,27 +133,39 @@ public class LogTab
     {
         pidInput = pid;
         if (pid != null)
+        {
             pidFilters = setFilter(pid.split("[\\s\t,]"));
+        }
         else
+        {
             pidFilters = null;
+        }
     }
 
     public void setTagFilter(String tag)
     {
         tagInput = tag;
         if (tag != null)
+        {
             tagFilters = setFilter(tag.split("[\\s\t,]"));
+        }
         else
+        {
             tagFilters = null;
+        }
     }
 
     public void setMsgFilter(String msg)
     {
         msgInput = msg;
         if (msg != null)
+        {
             msgFilters = setFilter(msg.split("[\\s\t,]"));
+        }
         else
+        {
             msgFilters = null;
+        }
     }
 
     private String[] setFilter(String[] array)
@@ -195,9 +209,13 @@ public class LogTab
     public String getDeviceSerialNumber()
     {
         if (device != null)
+        {
             return device.getSerialNumber();
+        }
         else
+        {
             return null;
+        }
     }
 
     public void setTabItem(TabItem tabItem)
@@ -304,7 +322,9 @@ public class LogTab
             {
                 filteredMessages.add(newMessage);
                 if(filteredByIconAndText(newMessage))
+                {
                     newMessages.add(newMessage);
+                }
             }
         }
     }
@@ -347,7 +367,9 @@ public class LogTab
                 for (String filter : pidFilters)
                 {
                     if (logMessage.data.pidString.contains(filter))
+                    {
                         return true;
+                    }
                 }
             }
 
@@ -356,7 +378,9 @@ public class LogTab
                 for (String filter : tagFilters)
                 {
                     if (logMessage.data.tag.toLowerCase().contains(filter.toLowerCase()))
+                    {
                         return true;
+                    }
                 }
             }
 
@@ -365,7 +389,9 @@ public class LogTab
                 for (String filter : msgFilters)
                 {
                     if (logMessage.msg.toLowerCase().contains(filter.toLowerCase()))
+                    {
                         return true;
+                    }
                 }
             }
             return false;
@@ -382,7 +408,9 @@ public class LogTab
     boolean filteredByIconAndText(LogMessage logMessage)
     {
         if (logMessage == null)
+        {
             return false;
+        }
 
         if (levelMode != LEVEL_ALL)
         {
@@ -390,7 +418,9 @@ public class LogTab
             a = (levelMode & (0x1 << (logMessage.data.logLevel.getPriority() - 2)));
 
             if (a == 0)
+            {
                 return false;
+            }
         }
 
         if (filteredByText(logMessage))
@@ -746,10 +776,8 @@ public class LogTab
                 table.removeAll();
             } else
             {
-                Display d = table.getDisplay();
-
                 // run sync as we need to update right now.
-                d.syncExec(new Runnable()
+                syncExec(new Runnable()
                 {
                     @Override
                     public void run()
old mode 100644 (file)
new mode 100755 (executable)
index 164482c..7fe5d7e
@@ -62,9 +62,13 @@ public class TizenRemoteFileContentProvider  implements ITreeContentProvider {
             FileEntry[] children = null;
 
             if (isInitialized == false)
+            {
                 children = parent.getCachedChildren();
+            }
             else
+            {
                 children = parent.getFileListingService().getChildren(parent, false, null);
+            }
 
             List<FileEntry> entries = new ArrayList<FileEntry>();
                 for (FileEntry child : children) {
@@ -78,7 +82,9 @@ public class TizenRemoteFileContentProvider  implements ITreeContentProvider {
                 }
             return entries.toArray();
         } else 
+        {
             return new Object[0];
+        }
     }
 
     @Override
@@ -115,17 +121,29 @@ public class TizenRemoteFileContentProvider  implements ITreeContentProvider {
         if (arg0 instanceof FileEntry) {
             FileEntry entry = (FileEntry) arg0;
             if (entry.getType() == FileListingService.TYPE_DIRECTORY_LINK)
+            {
                 return true;
+            }
             else if (entry.getType() == FileListingService.TYPE_LINK)
+            {
                 return true;
+            }
             else if (entry.getType() == FileListingService.TYPE_DIRECTORY)
+            {
                 return true;
+            }
             else if (entry.getType() == FileListingService.TYPE_ROOT_EMULATOR)
+            {
                 return true;
+            }
             else if (entry.getType() == FileListingService.TYPE_ROOT_DEVICE)
+            {
                 return true;
+            }
             else
+            {
                 return false;
+            }
         }
         return false;
     }
old mode 100644 (file)
new mode 100755 (executable)
index d0d268e..57d8a60
@@ -25,6 +25,8 @@
 
 package org.tizen.common.core.application;
 
+import static org.tizen.common.util.IOUtil.tryClose;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -132,9 +134,13 @@ final public class InstallPathConfig {
     public static String getSDBPath() {
         String toolsPath = getToolsPath();
         if (OSChecker.isWindows())
+        {
             return toolsPath + File.separator + "sdb.exe";
+        }
         else
+        {
             return toolsPath + File.separator + "sdb";
+        }
     }
 
     public static String getSdbWinUsbApiPath() {
@@ -162,7 +168,9 @@ final public class InstallPathConfig {
         if (HostUtil.exists(sdkPath)) {
             String[] fileContent = HostUtil.getContents(sdkPath).split("=");
             if (HostUtil.exists(fileContent[1]))
+            {
                 sdkInstallPath = fileContent[1];
+            }
             else {
                 status = false;
             }
@@ -198,13 +206,7 @@ final public class InstallPathConfig {
         } catch (IOException e) {
             e.printStackTrace();
         } finally {
-            if (br != null) {
-                try {
-                    br.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
+            tryClose( br );
         }
 
         return value;
index 822d5ea..f303ce0 100755 (executable)
@@ -151,21 +151,31 @@ public class AnsicodeAdapter {
             if (codes[j].length() > 0 && codes[j].matches("[\\d]*")) {
                 int code = Integer.parseInt(codes[j]);
                 if (code == 0)
+                {
                     brighter = false;
+                }
                 else if (code == 1)
+                {
                     brighter = true;
+                }
                 else if (code >= 30 && code <= 39) {
                     if (code == 39)
+                    {
                        color[0] = BLACK; //default foreground color
+                    }
                     else if (code >= 30 && code <= 37) {
                        color[0] = getColorFromANSICode(code, brighter);
                         brighter = false;
                     }
                 } else if (code >= 40 && code <= 49) {
                     if (code == 49)
+                    {
                        color[1] = WHITE; //default background color
+                    }
                     else if (code >= 40 && code <= 47)
+                    {
                        color[1] = getColorFromANSICode(code, brighter);
+                    }
                 }
             }
         }
@@ -196,10 +206,6 @@ public class AnsicodeAdapter {
        }
        public static List<TextStyle> getStringStyles(String newLineStr) {
                List<TextStyle> styles = parseAnsiString(newLineStr);
-               if (styles != null) {
-                       return styles;
-               }else {
-                       return null;
-               }
+               return styles;
        }
 }
old mode 100644 (file)
new mode 100755 (executable)
index c56ed62..fb871f3
 \r
 package org.tizen.common.ui.widget;\r
 \r
-import java.util.List;\r
 import java.util.ArrayList;\r
+import java.util.List;\r
 \r
-import org.eclipse.swt.*;\r
-import org.eclipse.swt.graphics.*;\r
-import org.eclipse.swt.widgets.*;\r
-import org.eclipse.swt.events.*;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
+import org.eclipse.swt.events.MouseAdapter;\r
+import org.eclipse.swt.events.MouseEvent;\r
+import org.eclipse.swt.events.MouseTrackAdapter;\r
+import org.eclipse.swt.events.PaintEvent;\r
+import org.eclipse.swt.events.PaintListener;\r
+import org.eclipse.swt.graphics.GC;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.graphics.Rectangle;\r
+import org.eclipse.swt.widgets.Canvas;\r
+import org.eclipse.swt.widgets.Composite;\r
 \r
 /**\r
  * Reference to http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm\r
@@ -162,7 +172,9 @@ public class PictureLabel extends Canvas {
                        int imageHeight = image.getBounds().height;\r
                        gc.dispose();\r
                        if (imageWidth >= textWidth)\r
+                       {\r
                                width = imageWidth + 2;\r
+                       }\r
                        else\r
                                width = textWidth + 2;\r
                        height = textHeight + imageHeight + 7;\r
@@ -178,9 +190,13 @@ public class PictureLabel extends Canvas {
                        height = extent.y + 2;\r
                }\r
                if (wHint != -1)\r
+               {\r
                        width = wHint;\r
+               }\r
                if (hHint != -1)\r
+               {\r
                        height = hHint;\r
+               }\r
 \r
                return new Point(width + 2, height + 2);\r
        }\r
old mode 100644 (file)
new mode 100755 (executable)
index 2d5a024..4077279
@@ -27,6 +27,7 @@ package org.tizen.common.util;
 import static org.tizen.common.util.StringUtil.EMPTY_STRING;
 import static org.tizen.common.util.StringUtil.NULL_STRING;
 
+import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -871,411 +872,31 @@ public class CollectionUtil
                else if ( obj instanceof Object[] )
                {
                        return toString( ( Object[] ) obj );
-               }
-               else if ( obj instanceof boolean[] )
-               {
-                       return toString( ( boolean[] ) obj );
-               }
-               else if ( obj instanceof byte[] )
-               {
-                       return toString( ( byte[] )obj );
-               }
-               else if ( obj instanceof char[] )
-               {
-                       return toString( ( char[] ) obj );
-               }
-               else if ( obj instanceof double[] )
-               {
-                       return toString( ( double[] ) obj );
-               }
-               else if ( obj instanceof float[] )
-               {
-                       return toString( (float[] ) obj );
-               }
-               else if ( obj instanceof int[] )
-               {
-                       return toString( (int[] ) obj );
-               }
-               else if ( obj instanceof long[] )
-               {
-                       return toString( ( long[] ) obj );
-               }
-               else if ( obj instanceof short[] )
-               {
-                       return toString( ( short[] )obj );
+               } else if ( obj.getClass().isArray() )
+               {
+                   int length = Array.getLength( obj );
+                   
+                   if ( 0 == length )
+                   {
+                       return EMPTY_ARRAY; 
+                   }
+                   
+                   final StringBuilder buffer= new StringBuilder();
+                   
+                   buffer.append( ARRAY_START);
+                   for ( int i=0 ; i<length ; ++i )
+                   {
+                       if ( 0 != i ) {
+                           buffer.append( ARRAY_ELEMENT_SEPARATOR );
+                       }
+                       
+                       buffer.append( toString( Array.get( obj, i ) ) );
+                   }
+                   buffer.append( ARRAY_END );
+                   return buffer.toString();
                }
                return ObjectUtil.nvl( obj.toString(), EMPTY_STRING );
        }
-       
-       /**
-        * Converts <code>array</code> boolean[] to String.
-        * 
-        * @param array boolean[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final boolean[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING;
-               }
-               
-               final int length = array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer= new StringBuilder();
-               
-               buffer.append( ARRAY_START);
-               for ( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 != i ) {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( toString( array[i] ) );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> byte[] to String.
-        * 
-        * @param array byte[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final byte[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING;
-               }
-
-               final int length = array.length;
-
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer= new StringBuilder();
-               
-               buffer.append( ARRAY_START);
-               for ( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 != i ) {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( toString( array[i] ) );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> char[] to String.
-        * 
-        * @param array char[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final char[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING;
-               }
-               
-               final int length = array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer= new StringBuilder();
-               
-               buffer.append( ARRAY_START);
-               for ( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 != i )
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( toString( array[i] ) );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-       
-
-       /**
-        * Converts <code>array</code> short[] to String.
-        * 
-        * @param array short[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final short[] array
-       )
-       {
-               if ( null == array ) 
-               {
-                       return NULL_STRING; 
-               }
-
-               final int length = array.length;
-               
-               if ( 0 == length ) 
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer = new StringBuilder();
-               for( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 == i )
-                       {
-                               buffer.append( ARRAY_START );
-                       }
-                       else
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( array[i] );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-       
-       /**
-        * Converts <code>array</code> int[] to String.
-        * 
-        * @param array int[] to String
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final int[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING; 
-               }
-
-               final int length = array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer = new StringBuilder();
-               for( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 == i )
-                       {
-                               buffer.append( ARRAY_START );
-                       }
-                       else
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( array[i] );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> long[] to String.
-        * 
-        * @param array long[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final long[] array
-       )
-       {
-               if ( null == array ) 
-               {
-                       return NULL_STRING; 
-               }
-
-               int length = array.length;
-               
-               if ( 0 == length ) 
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer = new StringBuilder();
-               for( int i=0 ; i<length ; ++i)
-               {
-                       if ( 0 == i )
-                       {
-                               buffer.append( ARRAY_START );
-                       }
-                       else
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( array[i] );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> double[] to String.
-        * 
-        * @param array double[] to convert 
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final double[] array
-       )
-       {
-               if ( null == array )
-               { 
-                       return NULL_STRING;
-               }
-               
-               int length= array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               StringBuilder buffer = new StringBuilder();
-               for( int i=0 ; i<length ; ++i )
-               {
-                       if ( 0 == i )
-                       {
-                               buffer.append( ARRAY_START);
-                       }
-                       else
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR);
-                       }
-
-                       buffer.append( array[i] );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> float[] to String.
-        * 
-        * @param array float[] to convert
-        * 
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final float[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING; 
-               }
-
-               int length = array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer = new StringBuilder();
-               for( int i=0 ; i < length ; ++i )
-               {
-                       if ( 0 == i )
-                       {
-                               buffer.append( ARRAY_START );
-                       }
-                       else
-                       {
-                               buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-
-                       buffer.append( array[i] );
-               }
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
-
-       /**
-        * Converts <code>array</code> Object[] to String.
-        * 
-        * @param array Object[] to convert
-        * 
-        * @return converted String
-        */
-       public static <T>
-       String
-       toString(
-               final T[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return NULL_STRING;
-               }
-               
-               final int length = array.length;
-               
-               if ( 0 == length )
-               {
-                       return EMPTY_ARRAY; 
-               }
-
-               final StringBuilder buffer= new StringBuilder();
-               
-               buffer.append( ARRAY_START);
-               buffer.append( concatenate( array, ARRAY_ELEMENT_SEPARATOR ) );
-               buffer.append( ARRAY_END );
-               return buffer.toString();
-       }
 
        /**
         * Returns a String from <code>array</code> Object[] with String separator.
index 8b97822..c00cae2 100755 (executable)
@@ -225,7 +225,9 @@ public class StringUtil
         byte[] b = new byte[4096];
 
         for (int n; (n = is.read(b)) != -1;)
+        {
             out.append(new String(b,0,n));
+        }
         return out.toString();
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index cbce552..e991acf
@@ -703,6 +703,8 @@ CollectionUtilTest
         assertEquals( "{T, i, Z, e, N}", result );
         result = CollectionUtil.toString( charArray2 );
         assertEquals( "{}", result );
+        
+        assertEquals( "{true, false}", CollectionUtil.toString( new boolean[] { true, false } ) );
     }
 
     /**