basic code review
This commit is contained in:
parent
9765c9495e
commit
4ae0e5aad5
@ -37,15 +37,17 @@ public final class Siba
|
|||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger(Siba.class);
|
private static Logger logger = LoggerFactory.getLogger(Siba.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private Siba()
|
private Siba()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
* arguments
|
* arguments if no argument launch GUI else CLI
|
||||||
*/
|
*/
|
||||||
public static void main(final String[] args)
|
public static void main(final String[] args)
|
||||||
{
|
{
|
||||||
|
@ -40,13 +40,15 @@ public final class SibaCLI
|
|||||||
private static Logger logger = LoggerFactory.getLogger(SibaCLI.class);
|
private static Logger logger = LoggerFactory.getLogger(SibaCLI.class);
|
||||||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.cli.messages");
|
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.cli.messages");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private SibaCLI()
|
private SibaCLI()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param directoryToSave
|
* @param directoryToSave
|
||||||
* the name of the directory to save
|
* the name of the directory to save
|
||||||
* @throws SibaException
|
* @throws SibaException
|
||||||
@ -79,12 +81,12 @@ public final class SibaCLI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This method is called for Check from CLI. anObject
|
* This method is called for Check from CLI.
|
||||||
*
|
*
|
||||||
* @param fileToCheck
|
* @param fileToCheck
|
||||||
* The file to be check
|
* The file to be check
|
||||||
* @throws SibaException
|
* @throws SibaException
|
||||||
* specific exception
|
* specific exception file not found
|
||||||
*/
|
*/
|
||||||
public static void check(final File fileToCheck) throws SibaException
|
public static void check(final File fileToCheck) throws SibaException
|
||||||
{
|
{
|
||||||
@ -222,7 +224,6 @@ public final class SibaCLI
|
|||||||
System.out.println(BUNDLE.getString("badUsage.text"));
|
System.out.println(BUNDLE.getString("badUsage.text"));
|
||||||
help();
|
help();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SibaException exception)
|
catch (SibaException exception)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,6 @@ public class AboutDialog extends JDialog
|
|||||||
*/
|
*/
|
||||||
public AboutDialog() throws IOException
|
public AboutDialog() throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
setMinimumSize(new Dimension(600, 350));
|
setMinimumSize(new Dimension(600, 350));
|
||||||
setMaximumSize(new Dimension(600, 500));
|
setMaximumSize(new Dimension(600, 500));
|
||||||
setIconImage(Toolkit.getDefaultToolkit()
|
setIconImage(Toolkit.getDefaultToolkit()
|
||||||
@ -130,5 +129,4 @@ public class AboutDialog extends JDialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,7 @@ public class BackupPanel extends JPanel
|
|||||||
{
|
{
|
||||||
BackupPanel.this.sourceDirectoryField.setText(file.getPath());
|
BackupPanel.this.sourceDirectoryField.setText(file.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
choosePanel.add(btnSourceDirectory, "6, 2");
|
choosePanel.add(btnSourceDirectory, "6, 2");
|
||||||
|
|
||||||
@ -129,13 +127,11 @@ public class BackupPanel extends JPanel
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e)
|
public void actionPerformed(final ActionEvent e)
|
||||||
{
|
{
|
||||||
|
|
||||||
File file = TargetDirectorySelector.showSelectorDialog(BackupPanel.this, null);
|
File file = TargetDirectorySelector.showSelectorDialog(BackupPanel.this, null);
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
BackupPanel.this.targetDirectoryField.setText(file.getPath());
|
BackupPanel.this.targetDirectoryField.setText(file.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
choosePanel.add(btnTarget, "6, 4");
|
choosePanel.add(btnTarget, "6, 4");
|
||||||
@ -204,7 +200,6 @@ public class BackupPanel extends JPanel
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,6 @@ public class TargetDirectorySelector extends JFileChooser
|
|||||||
if ((targetFile == null) || (StringUtils.isBlank(targetFile.getAbsolutePath())))
|
if ((targetFile == null) || (StringUtils.isBlank(targetFile.getAbsolutePath())))
|
||||||
{
|
{
|
||||||
file = null;
|
file = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (targetFile.isFile())
|
else if (targetFile.isFile())
|
||||||
{
|
{
|
||||||
|
@ -33,11 +33,10 @@ import javax.swing.UIManager;
|
|||||||
public final class GUIToolBox
|
public final class GUIToolBox
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private GUIToolBox()
|
private GUIToolBox()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,9 +42,11 @@ public final class SibaUtils
|
|||||||
{
|
{
|
||||||
static final String DEFAULT_CHARSET = "UTF-8";
|
static final String DEFAULT_CHARSET = "UTF-8";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private SibaUtils()
|
private SibaUtils()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,6 +91,7 @@ public final class SibaUtils
|
|||||||
public static File createMD5File(final String md5, final String fileName, final String target) throws IOException
|
public static File createMD5File(final String md5, final String fileName, final String target) throws IOException
|
||||||
{
|
{
|
||||||
File result;
|
File result;
|
||||||
|
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -121,6 +124,7 @@ public final class SibaUtils
|
|||||||
public static String loadMD5Sum(final File choosenFile) throws IOException
|
public static String loadMD5Sum(final File choosenFile) throws IOException
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
FileReader in = null;
|
FileReader in = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -189,6 +193,7 @@ public final class SibaUtils
|
|||||||
}
|
}
|
||||||
fileInputStream.close();
|
fileInputStream.close();
|
||||||
|
|
||||||
|
//
|
||||||
result = hashString.toString();
|
result = hashString.toString();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user