[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Fri Apr 16 20:36:17 UTC 2010
gordonp
Fri Apr 16 16:36:17 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv19820/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobyContentClipboard.java
Log Message:
Switched to java.util.logging.*
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentClipboard.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2010/04/11 02:25:03 1.10
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2010/04/16 20:36:17 1.11
@@ -21,6 +21,7 @@
import java.io.FileOutputStream;
import java.net.URL;
import java.util.*;
+import java.util.logging.*;
import java.util.regex.Pattern;
/**
@@ -54,7 +55,8 @@
// Clipboard editing variables
private JMenuItem deleteDataPopupItem;
private MobyDataInstance itemToDelete;
- private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(MobyContentClipboard.class);
+ private static Logger logger = Logger.getLogger(MobyContentClipboard.class.getName());
+
public MobyContentClipboard(MobyContentGUI cGUI, MobyServicesGUI sGUI, JTabbedPane parentComponent,
DataFlowRecorder recorder, JLabel statusBar){
super(cGUI, sGUI, parentComponent, recorder, statusBar);
@@ -66,7 +68,7 @@
if(clipboardIcon == null){
URL u = cl.getResource(CLIPBOARD_TAB_ICON_RESOURCE);
if(u == null){
- logger.warn("Could not find icon resource " + CLIPBOARD_TAB_ICON_RESOURCE);
+ logger.log(Level.WARNING, "Could not find icon resource " + CLIPBOARD_TAB_ICON_RESOURCE);
}
else{
clipboardIcon = new ImageIcon(u);
@@ -86,7 +88,7 @@
clipboardFile = File.createTempFile(CLIPBOARD_FILE_NAME, ".xml");
}
catch(Exception e){
- logger.error("Clipboard failed to initialize, cannot create temp file:" + e);
+ logger.log(Level.SEVERE, "Clipboard failed to initialize, cannot create temp file", e);
return;
}
clipboardFile.deleteOnExit();
@@ -134,7 +136,7 @@
// (i.e. don't delete subparts of object)
if(!(mdi instanceof MobyDataObject) || !collection.contains(mdi)){
mdi.setXmlMode(MobyDataInstance.SERVICE_XML_MODE);
- System.err.println("Skipping " + mdi.toXML());
+ logger.log(Level.WARNING, "Skipping " + mdi.toXML());
mdi.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE);
return;
}
@@ -160,7 +162,7 @@
}
}
else{
- logger.warn("Clipboard: ignoring unrecognized source of event " + e);
+ logger.log(Level.WARNING, "Clipboard: ignoring unrecognized source of event ", e);
}
}
@@ -186,7 +188,7 @@
public void addCollectionData(MobyDataInstance mdi, boolean updateDisplay){
if(mdi == null){
- logger.warn("Cannot add null object to the clipboard.");
+ logger.log(Level.WARNING, "Cannot add null object to the clipboard.");
return;
}
if(!query.containsKey(CLIPBOARD_COLLECTION_NAME)){
@@ -200,9 +202,9 @@
collection.add((MobyDataObject) mdi);
}
else{
- logger.warn("Cannot add object of class " + mdi.getClass() +
- " to the clipboard, only MobyDataObject and MobyDataObjectSet" +
- " are supported");
+ logger.log(Level.WARNING, "Cannot add object of class " + mdi.getClass() +
+ " to the clipboard, only MobyDataObject and MobyDataObjectSet" +
+ " are supported");
return;
}
@@ -246,26 +248,26 @@
return;
}
} catch(Exception e){
- logger.warn("Could not transform binary file ("+u+"): " + e);
+ logger.log(Level.WARNING, "Could not transform binary file ("+u+")", e);
}
// Not binary, see if it's text that's convertible to MOBY data
MobyClient client = servicesGUI.getMobyClient();
if(client == null){
- logger.warn("Could not get MOBY client from MOBY services GUI, " +
- "cannot transform incoming clipboard data to MOBY objects");
+ logger.log(Level.WARNING, "Could not get MOBY client from MOBY services GUI, " +
+ "cannot transform incoming clipboard data to MOBY objects");
}
String urlContents = null;
try{
urlContents = HTMLUtils.getURLContents(u);
} catch(Exception e){
- logger.warn("Could not read contents of the URL to import to the clipboard ("+u+"):" +e);
+ logger.log(Level.WARNING, "Could not read contents of the URL to import to the clipboard ("+u+")", e);
return;
}
if(urlContents.indexOf("<html") != -1 || urlContents.indexOf("<HTML") != -1){
urlContents = tagRegex.matcher(commentRegex.matcher(styleRegex.matcher(scriptRegex.matcher(urlContents).replaceAll("")).replaceAll("")).replaceAll("")).replaceAll("");
}
- System.err.println(urlContents);
+ logger.log(Level.FINE, urlContents);
MobyDataType targetDataType = null;
if(collection != null){
@@ -303,7 +305,7 @@
// Callback once user has selected the data to import from the DataImportChoiceDialog
public void importConfirmed(DataImportChoiceDialog dialog, MobyDataObject[] selectedData){
if(selectedData == null){
- logger.warn("Got null for import selection, abandoning import");
+ logger.log(Level.WARNING, "Got null for import selection, abandoning import");
return;
}
for(int i = 0; i < selectedData.length; i++){
@@ -334,7 +336,7 @@
return clipboardFile.toURI().toURL();
}
catch(java.net.MalformedURLException murle){
- logger.warn("Could not get clipboard file URL: " + murle);
+ logger.log(Level.WARNING, "Could not get clipboard file URL from "+clipboardFile, murle);
return null;
}
}
@@ -348,8 +350,7 @@
gotoURL(clipboardFile.toURI().toURL(), false);
}
catch(Exception e){
- logger.error("Clipboard failed to update the display, cannot write or load temp file:" + e);
- e.printStackTrace();
+ logger.log(Level.SEVERE, "Clipboard failed to update the display, cannot write or load temp file", e);
return;
}
tabbedPane.setTitleAt(tabbedPane.indexOfComponent(this), CLIPBOARD_TAB_NAME +
More information about the MOBY-guts
mailing list