Merge pull request #1684 from millmanorama/dont-abort-tagging

don't check for duplicate tags at all
This commit is contained in:
Richard Cordovano 2015-10-30 14:29:37 -04:00
commit 718e13d32b

View File

@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.actions;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
@ -30,7 +29,6 @@ import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@ -120,25 +118,8 @@ public class AddContentTagAction extends AddTagAction {
continue;
}
}
// check if the same tag is being added for the same abstract file.
TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
List<ContentTag> contentTagList = tagsManager.getContentTagsByContent(file);
for (ContentTag contentTag : contentTagList) {
if (contentTag.getName().getDisplayName().equals(tagName.getDisplayName())) {
AbstractFile fileCopy = file;
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(),
"AddContentTagAction.tagExists",
fileCopy.getName(), tagName.getDisplayName()),
NbBundle.getMessage(this.getClass(),
"AddContentTagAction.cannotApplyTagErr"),
JOptionPane.WARNING_MESSAGE);
});
return;
}
}
tagsManager.addContentTag(file, tagName, comment);
Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment);
} catch (TskCoreException ex) {
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
AbstractFile fileCopy = file;