* make sure validated filenames are trimmed just in case

This commit is contained in:
Reinhard Pointner 2012-07-24 17:29:38 +00:00
parent ea7fb729b6
commit 921554f126
2 changed files with 7 additions and 8 deletions

View File

@ -21,13 +21,12 @@ import java.util.concurrent.TimeoutException;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.TransformedList;
import ca.odell.glazedlists.event.ListEvent;
import net.sourceforge.filebot.similarity.Match; import net.sourceforge.filebot.similarity.Match;
import net.sourceforge.tuned.FileUtilities; import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.TunedUtilities; import net.sourceforge.tuned.ui.TunedUtilities;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.TransformedList;
import ca.odell.glazedlists.event.ListEvent;
public class RenameModel extends MatchModel<Object, File> { public class RenameModel extends MatchModel<Object, File> {
@ -284,9 +283,9 @@ public class RenameModel extends MatchModel<Object, File> {
future.cancel(true); future.cancel(true);
} }
private final PropertyChangeListener futureListener = new PropertyChangeListener() { private final PropertyChangeListener futureListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
int index = futures.indexOf(evt.getSource()); int index = futures.indexOf(evt.getSource());
@ -327,13 +326,13 @@ public class RenameModel extends MatchModel<Object, File> {
public String preview() { public String preview() {
return formatter.preview(match); return formatter.preview(match).trim();
} }
@Override @Override
protected String doInBackground() throws Exception { protected String doInBackground() throws Exception {
return formatter.format(match); return formatter.format(match).trim();
} }

View File

@ -436,7 +436,7 @@ public final class FileUtilities {
*/ */
public static String validateFileName(CharSequence filename) { public static String validateFileName(CharSequence filename) {
// strip invalid characters from file name // strip invalid characters from file name
return ILLEGAL_CHARACTERS.matcher(filename).replaceAll(""); return ILLEGAL_CHARACTERS.matcher(filename).replaceAll("").trim();
} }