http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java index ce5b202..381d8a3 100755 --- a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java +++ b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java @@ -21,6 +21,7 @@ import org.apache.oodt.profile.Profile; import org.apache.oodt.profile.ProfileElement; import org.apache.oodt.profile.RangedProfileElement; import org.apache.oodt.profile.gui.pstructs.ProfilePrinter; + import org.xml.sax.SAXException; import java.awt.BorderLayout; @@ -33,6 +34,8 @@ import java.io.FileReader; import java.io.IOException; import java.util.Enumeration; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JEditorPane; @@ -56,6 +59,7 @@ import javax.swing.tree.TreeNode; * a license - please visit www.cloudgarden.com for details. */ public class ProfileBuilderGUI extends javax.swing.JFrame { + private static Logger LOG = Logger.getLogger(ProfileBuilderGUI.class.getName()); private JButton jButton1; private JEditorPane jEditorPane1; private JScrollPane jPanel3; @@ -97,7 +101,7 @@ public class ProfileBuilderGUI extends javax.swing.JFrame { try { javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch(Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } jPanel1 = new JPanel(); jPanel2 = new JScrollPane(); @@ -264,7 +268,7 @@ public class ProfileBuilderGUI extends javax.swing.JFrame { postInitGUI(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } /** Add your pre-init code in here */ @@ -288,7 +292,7 @@ public class ProfileBuilderGUI extends javax.swing.JFrame { inst.getJTree1().addMouseListener(new LeafListener(inst.getJTree1())); inst.getJTree1().setExpandsSelectedPaths(true); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -311,7 +315,7 @@ public class ProfileBuilderGUI extends javax.swing.JFrame { ProfileBuilderGUI inst = new ProfileBuilderGUI(); inst.setVisible(true); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } /** @@ -863,7 +867,7 @@ return jEditorPane1; } fr = new FileReader(selFile); } catch(FileNotFoundException fne){ - fne.printStackTrace(); + LOG.log(Level.SEVERE, fne.getMessage()); System.out.println(fne.getMessage()); } @@ -881,7 +885,7 @@ return jEditorPane1; } } } catch(IOException ioe){ - ioe.printStackTrace(); + LOG.log(Level.SEVERE, ioe.getMessage()); System.out.println(ioe.getMessage()); } @@ -893,7 +897,7 @@ return jEditorPane1; } getJTree1().setModel(generateModelFromProfile(createdProfile)); //getJTree1().addMouseListener(new LeafListener(getJTree1())); }catch(SAXException se){ - se.printStackTrace(); + LOG.log(Level.SEVERE, se.getMessage()); System.out.println(se.getMessage()); } @@ -937,11 +941,11 @@ return jEditorPane1; } fos.write(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString().getBytes()); } catch(FileNotFoundException fne){ - fne.printStackTrace(); + LOG.log(Level.SEVERE, fne.getMessage()); System.out.println(fne.getMessage()); } catch(IOException ioe){ - ioe.printStackTrace(); + LOG.log(Level.SEVERE, ioe.getMessage()); System.out.println(ioe.getMessage()); } finally{
http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java b/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java index 72be8da..6bc5b3c 100755 --- a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java +++ b/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java @@ -225,7 +225,7 @@ public abstract class DatabaseProfileManager implements ProfileManager } } - public int size() throws ProfileException { + public int size() { return(size(conn)); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java b/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java index 13d0ba6..ea628cb 100755 --- a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java +++ b/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java @@ -137,7 +137,7 @@ public interface ProfileManager extends ProfileHandler { * @return The number of available profiles. * @throws ProfileException If any error occurs. */ - int size() throws ProfileException; + int size(); /** * Replace a profile into the set of profiles managed by this profile server. http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java b/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java index 945508a..c1997ec 100644 --- a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java +++ b/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java @@ -134,7 +134,7 @@ public class CASProfileHandler implements ProfileHandler { try { types = fmClient.getProductTypes(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return types; @@ -146,7 +146,7 @@ public class CASProfileHandler implements ProfileHandler { try { products = fmClient.getProductsByProductType(type); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return products; @@ -158,7 +158,7 @@ public class CASProfileHandler implements ProfileHandler { try { type = fmClient.getProductTypeByName(name); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return type; @@ -170,7 +170,7 @@ public class CASProfileHandler implements ProfileHandler { try { met = fmClient.getMetadata(p); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return met; @@ -182,7 +182,7 @@ public class CASProfileHandler implements ProfileHandler { try { references = fmClient.getProductReferences(p); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return references; @@ -194,7 +194,7 @@ public class CASProfileHandler implements ProfileHandler { try { elem = fmClient.getElementByName(name); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return elem; @@ -272,7 +272,7 @@ public class CASProfileHandler implements ProfileHandler { profiles.add(ProfileUtils.buildProfile(p, met, dataDelivBaseUrlStr)); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java ---------------------------------------------------------------------- diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java index 290f3ea..05b0824 100644 --- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java +++ b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java @@ -17,6 +17,19 @@ package org.apache.oodt.cas.protocol.imaps; //JDK imports +import org.apache.oodt.cas.protocol.Protocol; +import org.apache.oodt.cas.protocol.ProtocolFile; +import org.apache.oodt.cas.protocol.auth.Authentication; +import org.apache.oodt.cas.protocol.exceptions.ProtocolException; +import org.apache.oodt.cas.protocol.util.ProtocolFileFilter; +import org.apache.tika.exception.TikaException; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.parser.html.HtmlParser; +import org.apache.tika.sax.BodyContentHandler; +import org.apache.tika.sax.TextContentHandler; + +import org.xml.sax.SAXException; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; @@ -29,7 +42,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -//Javamail imports import javax.mail.Address; import javax.mail.Flags; import javax.mail.Folder; @@ -40,24 +52,11 @@ import javax.mail.Multipart; import javax.mail.Part; import javax.mail.Session; import javax.mail.Store; -import org.xml.sax.SAXException; +//Javamail imports //APACHE imports -import org.apache.commons.codec.DecoderException; - //OODT imports -import org.apache.oodt.cas.protocol.Protocol; -import org.apache.oodt.cas.protocol.ProtocolFile; -import org.apache.oodt.cas.protocol.auth.Authentication; -import org.apache.oodt.cas.protocol.exceptions.ProtocolException; -import org.apache.oodt.cas.protocol.util.ProtocolFileFilter; - //TIKA imports -import org.apache.tika.exception.TikaException; -import org.apache.tika.metadata.Metadata; -import org.apache.tika.parser.html.HtmlParser; -import org.apache.tika.sax.BodyContentHandler; -import org.apache.tika.sax.TextContentHandler; /** * IMAP Secure {@link Protocol} implementation @@ -192,7 +191,7 @@ public class ImapsProtocol implements Protocol { } private void writeMessageToLocalFile(Message message, File toLocalFile) - throws MessagingException, IOException, DecoderException, SAXException, + throws MessagingException, IOException, SAXException, TikaException { PrintStream ps = new PrintStream(new FileOutputStream(toLocalFile)); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java index 0dd26af..2cdd2eb 100644 --- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java +++ b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java @@ -17,26 +17,14 @@ package org.apache.oodt.cas.protocol.sftp; //JUnit imports -import java.io.*; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; -//JAVAX imports -import javax.xml.parsers.ParserConfigurationException; - -//OODT imports import org.apache.commons.io.FileUtils; import org.apache.mina.util.AvailablePortFinder; import org.apache.oodt.cas.protocol.ProtocolFile; import org.apache.oodt.cas.protocol.exceptions.ProtocolException; import org.apache.oodt.cas.protocol.sftp.auth.HostKeyAuthentication; import org.apache.oodt.cas.protocol.util.ProtocolFileFilter; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.xml.sax.SAXException; -//SshTools imports import com.sshtools.daemon.SshDaemon; import com.sshtools.daemon.configuration.PlatformConfiguration; import com.sshtools.daemon.configuration.ServerConfiguration; @@ -44,13 +32,36 @@ import com.sshtools.daemon.configuration.XmlServerConfigurationContext; import com.sshtools.j2ssh.configuration.ConfigurationException; import com.sshtools.j2ssh.configuration.ConfigurationLoader; -//JUnit imports +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.xml.sax.SAXException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.parsers.ParserConfigurationException; + import junit.framework.TestCase; -import org.mockito.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +//JAVAX imports +//OODT imports +//SshTools imports +//JUnit imports + /** * Test class for {@link JschSftpProtocol}. * @@ -82,7 +93,7 @@ public class TestJschSftpProtocol extends TestCase { try { SshDaemon.start(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } @@ -184,7 +195,7 @@ public class TestJschSftpProtocol extends TestCase { } return build.toString(); }catch(IOException ioe){ - ioe.printStackTrace(); + LOG.log(Level.SEVERE, ioe.getMessage()); }finally{ try{ buffReader.close(); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java index 10a55ed..9eaa4c0 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java @@ -173,7 +173,7 @@ public class Config implements ConfigMetKeys { * @throws ClassNotFoundException * @throws ClassNotFoundException */ - void loadProperties() throws ConfigException, InstantiationException { + void loadProperties() throws ConfigException { this.loadExternalConfigFiles(); this.loadProtocolTypes(); this.loadParserInfo(); @@ -261,7 +261,7 @@ public class Config implements ConfigMetKeys { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ConfigException("Failed to load Ingester : " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java index 7806cd5..3f84e95 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java @@ -35,6 +35,8 @@ import java.io.FileInputStream; import java.net.URL; import java.util.HashMap; import java.util.LinkedList; +import java.util.logging.Level; +import java.util.logging.Logger; /** @@ -43,7 +45,7 @@ import java.util.LinkedList; * @author bfoster (Brian Foster) */ public class RemoteSpecs implements ConfigParserMetKeys { - + private static Logger LOG = Logger.getLogger(RemoteSpecs.class.getName()); LinkedList<Parser> parsers; LinkedList<RenamingConvention> renamingConvs; @@ -282,7 +284,7 @@ public class RemoteSpecs implements ConfigParserMetKeys { period, epsilon, runOnReboot, pfi, dfi)); } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ConfigException("Failed to load crawl elements : " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java index 42c5f6a..3e12268 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java @@ -115,8 +115,7 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface, * @throws SecurityException */ public Daemon(int rmiRegPort, int daemonID, Config config, - DaemonInfo daemonInfo, SiteInfo siteInfo) throws RemoteException, - InstantiationException { + DaemonInfo daemonInfo, SiteInfo siteInfo) throws RemoteException { super(); this.rmiRegPort = rmiRegPort; @@ -155,15 +154,14 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface, return "Daemon" + this.getDaemonID(); } - private void registerRMIServer() throws RemoteException, - MalformedURLException, NotBoundException, AlreadyBoundException { + private void registerRMIServer() throws RemoteException { try { Naming.bind("//localhost:" + this.rmiRegPort + "/daemon" + this.getDaemonID(), this); LOG.log(Level.INFO, "Created Daemon ID = " + this.getDaemonID() + " on RMI registry port " + this.rmiRegPort); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new RemoteException("Failed to bind Daemon with ID = " + this.getDaemonID() + " to RMI registry at port " + this.rmiRegPort); @@ -214,7 +212,7 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface, rs.retrieveFiles(daemonInfo.getPropFilesInfo(), daemonInfo.getDataFilesInfo()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { numberOfCrawls++; } @@ -250,7 +248,7 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface, UnicastRemoteObject.unexportObject(this, true); this.daemonListener.wasUnregisteredWith(this); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java index 6c3621d..40b7ca9 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java @@ -19,8 +19,11 @@ package org.apache.oodt.cas.pushpull.daemon; //JDK imports + import java.rmi.Naming; import java.rmi.RemoteException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @author bfoster @@ -35,7 +38,7 @@ import java.rmi.RemoteException; * </p>. */ public class DaemonController { - + private static Logger LOG = Logger.getLogger(DaemonController.class.getName()); private DaemonRmiInterface daemon; /** @@ -48,7 +51,7 @@ public class DaemonController { daemon = (DaemonRmiInterface) Naming.lookup(rmiUrl); System.out.println(!daemon.getHasBeenToldToQuit()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java index 41e0162..4d951d2 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java @@ -19,11 +19,15 @@ package org.apache.oodt.cas.pushpull.expressions; //OODT imports + import org.apache.oodt.cas.pushpull.exceptions.MethodException; -//JDK imports import java.util.LinkedList; import java.util.Stack; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @@ -36,6 +40,7 @@ import java.util.Stack; */ public class Method { + private static Logger LOG = Logger.getLogger(Method.class.getName()); private String name; private String infix; @@ -126,7 +131,7 @@ public class Method { output.addLast(GlobalVariables.hashMap.get(variable .toString())); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } else { i--; http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java index 2ff73a9..b3dd672 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java @@ -19,21 +19,24 @@ package org.apache.oodt.cas.pushpull.filerestrictions.parsers; //OODT imports + import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.pushpull.exceptions.ParserException; import org.apache.oodt.cas.pushpull.filerestrictions.Parser; import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile; import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure; import org.apache.oodt.cas.pushpull.protocol.RemoteSite; -import org.apache.oodt.cas.pushpull.exceptions.ParserException; - -//JDK imports import java.io.FileInputStream; import java.net.URL; import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +//JDK imports + /** * * @author bfoster @@ -42,7 +45,7 @@ import java.util.regex.Pattern; * <p>Describe your class here</p>. */ public class ClassNoaaEmailParser implements Parser { - + private static Logger LOG = Logger.getLogger(ClassNoaaEmailParser.class.getName()); public ClassNoaaEmailParser() {} public VirtualFileStructure parse(FileInputStream emailFile, Metadata metadata) @@ -100,7 +103,7 @@ public class ClassNoaaEmailParser implements Parser { return new VirtualFileStructure(remoteSite, "/", root); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ParserException("Failed to parse IASI email : " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java index a6094fc..155aa82 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java @@ -99,7 +99,7 @@ public class DirStructXmlParser implements Parser { } return new VirtualFileStructure(initialCdDir, root); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ParserException("Failed to parse XML file : " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java index 1c1f243..862a76a 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java @@ -231,7 +231,7 @@ public class ProtocolHandler { return page; } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new RemoteConnectionException( "Failed getting next page for protocol " + protocol + "-- pgStart = " + pgInfo.getPageLoc() + " pgSize = " + pi.getPageSize() + " : " @@ -486,7 +486,7 @@ public class ProtocolHandler { protocol.cdHome(); return new RemoteSiteFile(protocol.pwd(), site); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return null; } } @@ -496,7 +496,7 @@ public class ProtocolHandler { protocol.cd(new ProtocolFile(path, isDir)); return protocol.pwd().getAbsoluteFile().getPath(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return null; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java index 8a765e1..dbfa94f 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java @@ -98,7 +98,7 @@ public class ListRetriever implements RetrievalMethod { } catch (UndefinedTypeException e) { LOG.log(Level.WARNING, "Skipping file : " + e.getMessage()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); linker.markAsFailed(propFile, "Failed to download " + file + " from " + remoteSite + " : " + e.getMessage()); throw new RetrievalMethodException("Uknown error accured while downloading " http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java index 81ed683..d2ae8fa 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java @@ -19,14 +19,18 @@ package org.apache.oodt.cas.pushpull.retrievalsystem; //OODT imports + import org.apache.oodt.cas.pushpull.exceptions.ThreadEvaluatorException; -//JDK imports import java.io.File; import java.util.HashMap; import java.util.LinkedList; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @@ -38,7 +42,7 @@ import java.util.Map.Entry; * </p>. */ public class DownloadThreadEvaluator { - + private static Logger LOG = Logger.getLogger(DownloadThreadEvaluator.class.getName()); private HashMap<File, DownloadingFileInfo> fileAndDownloadingFileInfo; private final int MAX_THREADS; @@ -115,7 +119,7 @@ public class DownloadThreadEvaluator { this.downloadSpeedsForEachThread[avgThreadCountForFile] = (currentAvgSpeed + downloadSpeed) / 2; } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ThreadEvaluatorException("Failed to register file " + file + " as downloaded : " + e.getMessage()); } finally { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java index 1559069..4bd5c92 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java @@ -201,7 +201,7 @@ public class FileRetrievalSystem { mimeTypeDetection = new MimeTypeUtils(config .getProductTypeDetectionFile()); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new InstantiationException( "Failed to create FileRetrievalSystem : " + e.getMessage()); } @@ -296,7 +296,7 @@ public class FileRetrievalSystem { } public void changeToDir(String dir, RemoteSite remoteSite) - throws MalformedURLException, ProtocolException { + throws ProtocolException { if (validate(remoteSite)) { this .changeToDir(protocolHandler.getProtocolFileFor(remoteSite, @@ -656,7 +656,7 @@ public class FileRetrievalSystem { } Protocol modifyAvailableSessionForPath(RemoteSiteFile file) - throws ProtocolException, RemoteConnectionException { + throws RemoteConnectionException { Protocol session = getAvailableSession(); if (!file.getSite().getURL().getHost().equals( file.getSite().getURL().getHost()) @@ -673,7 +673,7 @@ public class FileRetrievalSystem { new RemoteSiteFile(file.getParent(), file.getSite())); } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); try { protocolHandler.disconnect(session); } catch (Exception ignored) { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java index 4b547be..7567911 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java @@ -128,7 +128,7 @@ public class RetrievalSetup { this.movePropsFileToFinalDestination(pfi, propFile, linker.getErrorsAndEraseLinks(propFile)); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, "Error occurred while writing errors to error dir for file '" + propFile + "' : " + e.getMessage()); @@ -137,7 +137,7 @@ public class RetrievalSetup { } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (dataFilesFRS != null) { dataFilesFRS.shutdown(); @@ -184,7 +184,7 @@ public class RetrievalSetup { .getDownloadInfo()), linker); } } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { if (frs != null) { frs.shutdown(); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java index ea3f49f..0e821d6 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java @@ -19,6 +19,7 @@ package org.apache.oodt.cas.pushpull.util; //AWT Imports + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -26,8 +27,9 @@ import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.logging.Level; +import java.util.logging.Logger; -//Swing Imports import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFormattedTextField; @@ -36,6 +38,8 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; +//Swing Imports + /** * * @author bfoster @@ -46,7 +50,7 @@ import javax.swing.SwingUtilities; * </p>. */ public class ExpressionValidator extends JPanel { - + private static Logger LOG = Logger.getLogger(ExpressionValidator.class.getName()); private static final long serialVersionUID = -2840589940304298547L; private JLabel exprLabel; @@ -97,7 +101,7 @@ public class ExpressionValidator extends JPanel { boolean value = ((String) validateField.getText()).matches((String) exprField.getText()); resultField.setText(value + ""); }catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } }); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java b/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java index 79916ad..8125dd3 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java @@ -92,10 +92,10 @@ public class XmlRpcBatchMgrProxy extends Thread implements Runnable { try { result = (Boolean) client.execute("batchstub.killJob", argList); } catch (XmlRpcException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); result = false; } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); result = false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/examples/LongJob.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/examples/LongJob.java b/resource/src/main/java/org/apache/oodt/cas/resource/examples/LongJob.java index d07e57b..1e4684c 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/examples/LongJob.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/examples/LongJob.java @@ -19,12 +19,16 @@ package org.apache.oodt.cas.resource.examples; //OODT imports + import org.apache.oodt.cas.resource.metadata.JobMetadata; import org.apache.oodt.cas.resource.structs.JobInput; import org.apache.oodt.cas.resource.structs.JobInstance; import org.apache.oodt.cas.resource.structs.NameValueJobInput; import org.apache.oodt.cas.resource.structs.exceptions.JobInputException; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * * @author woollard @@ -35,7 +39,7 @@ import org.apache.oodt.cas.resource.structs.exceptions.JobInputException; * </p> */ public class LongJob implements JobInstance, JobMetadata { - + private static Logger LOG = Logger.getLogger(LongJob.class.getName()); /* * (non-Javadoc) * @@ -58,7 +62,7 @@ public class LongJob implements JobInstance, JobMetadata { try { Thread.sleep(waitTime * 1000); } catch (InterruptedException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } System.out.println("LongJob finished."); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/examples/TestResmgr.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/examples/TestResmgr.java b/resource/src/main/java/org/apache/oodt/cas/resource/examples/TestResmgr.java index e8e3e70..b24a655 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/examples/TestResmgr.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/examples/TestResmgr.java @@ -19,12 +19,16 @@ package org.apache.oodt.cas.resource.examples; //OODT imports + import org.apache.oodt.cas.resource.structs.Job; import org.apache.oodt.cas.resource.structs.NameValueJobInput; import org.apache.oodt.cas.resource.system.XmlRpcResourceManagerClient; -//JDK imports import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; + +//JDK imports /** * @@ -36,7 +40,7 @@ import java.net.URL; * </p>. */ public class TestResmgr { - + private static Logger LOG = Logger.getLogger(TestResmgr.class.getName()); public static void main(String[] Args) { if (Args.length != 1) { @@ -59,7 +63,7 @@ public class TestResmgr { client.submitJob(hw1, hw1Input); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java index cb2a938..f4a36e3 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java @@ -22,9 +22,7 @@ import org.apache.oodt.cas.resource.monitor.Monitor; import org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator; import org.apache.oodt.cas.resource.structs.ResourceNode; import org.apache.oodt.cas.resource.structs.exceptions.MonitorException; -import static org.apache.oodt.cas.resource.monitor.ganglia.GangliaMetKeys.NAME; -//JDK imports import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; @@ -34,6 +32,10 @@ import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; +import static org.apache.oodt.cas.resource.monitor.ganglia.GangliaMetKeys.NAME; + +//JDK imports + /** * @author rajith * @author mattmann @@ -67,7 +69,7 @@ public class GangliaResourceMonitor implements Monitor { try { this.initGmetaNodes(gmetadHost, gmetadPort); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "URL exception initializing gmetad nodes: [" + gmetadHost + ":" + gmetadPort + "]: Message: " @@ -139,7 +141,7 @@ public class GangliaResourceMonitor implements Monitor { try { nodes.add(this.nodeFromMap(map)); } catch (MalformedURLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new MonitorException(e.getMessage()); } } @@ -154,7 +156,7 @@ public class GangliaResourceMonitor implements Monitor { try { return this.nodeFromMap(this.locateNode(nodeId)); } catch (MalformedURLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new MonitorException(e.getMessage()); } } @@ -175,7 +177,7 @@ public class GangliaResourceMonitor implements Monitor { try { return this.nodeFromMap(aNodes.get(aNodeId)); } catch (MalformedURLException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new MonitorException(e.getMessage()); } } @@ -218,7 +220,7 @@ public class GangliaResourceMonitor implements Monitor { LOG.log(Level.WARNING, "MonitorException contacting Ganglia: [" + adapter.getUrlString() + "]"); - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java index e0ad30f..66332f0 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/noderepo/XmlNodeRepository.java @@ -88,7 +88,7 @@ public class XmlNodeRepository implements NodeRepository { .getDocumentRoot(new FileInputStream( nodesFile)); } catch (FileNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return null; } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java index 0c9917b..329342e 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/queuerepo/XmlQueueRepository.java @@ -90,7 +90,7 @@ public class XmlQueueRepository implements QueueRepository { .getDocumentRoot(new FileInputStream( nodesFile)); } catch (FileNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return null; } @@ -133,7 +133,7 @@ public class XmlQueueRepository implements QueueRepository { } } } catch (URISyntaxException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG .log( Level.WARNING, http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java index 9157d6d..ec29690 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java @@ -272,16 +272,16 @@ public class XmlRpcResourceManager { } } - public List<String> getQueues() throws QueueManagerException { + public List<String> getQueues() { return new Vector<String>(this.scheduler.getQueueManager().getQueues()); } - public boolean addQueue(String queueName) throws QueueManagerException { + public boolean addQueue(String queueName) { this.scheduler.getQueueManager().addQueue(queueName); return true; } - public boolean removeQueue(String queueName) throws QueueManagerException { + public boolean removeQueue(String queueName) { this.scheduler.getQueueManager().removeQueue(queueName); return true; } @@ -318,7 +318,7 @@ public class XmlRpcResourceManager { return new Vector<String>(this.scheduler.getQueueManager().getNodes(queueName)); } - public List<String> getQueuesWithNode(String nodeId) throws QueueManagerException { + public List<String> getQueuesWithNode(String nodeId) { return new Vector<String>(this.scheduler.getQueueManager().getQueues(nodeId)); } @@ -339,7 +339,7 @@ public class XmlRpcResourceManager { return load + "/" + capacity; } - public List getQueuedJobs() throws JobQueueException{ + public List getQueuedJobs() { Vector jobs = new Vector(); List jobSpecs = this.scheduler.getJobQueue().getQueuedJobs(); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java index 9427c42..3fe2c3a 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java @@ -129,8 +129,7 @@ public class XmlRpcBatchStub { return true; } - private boolean genericExecuteJob(Hashtable jobHash, Object jobInput) - throws JobException { + private boolean genericExecuteJob(Hashtable jobHash, Object jobInput) { JobInstance exec = null; JobInput in = null; try { @@ -178,7 +177,7 @@ public class XmlRpcBatchStub { return runner.wasSuccessful(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return false; } } @@ -231,7 +230,7 @@ public class XmlRpcBatchStub { try { this.successful = job.execute(in); } catch (JobInputException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); this.successful = false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/tools/JobSubmitter.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/tools/JobSubmitter.java b/resource/src/main/java/org/apache/oodt/cas/resource/tools/JobSubmitter.java index 16fd3bb..e600cb6 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/tools/JobSubmitter.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/tools/JobSubmitter.java @@ -73,7 +73,7 @@ public final class JobSubmitter { LOG.log(Level.INFO, "Job Submitted: id: [" + id + "]"); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Exception submitting job file: [" + jobFile + "]: Message: " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java b/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java index f70a33c..8a38d1c 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java @@ -76,17 +76,17 @@ public final class GenericResourceManagerObjectFactory { Class inputClass = Class.forName(className); return (JobInput) inputClass.newInstance(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading job input class " + className + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading job input class " + className + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading job input class " + className + " Message: " + e.getMessage()); @@ -109,17 +109,17 @@ public final class GenericResourceManagerObjectFactory { Class instClass = Class.forName(className); return (JobInstance) instClass.newInstance(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading job instance class " + className + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading job instance class " + className + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading job instance class " + className + " Message: " + e.getMessage()); @@ -143,17 +143,17 @@ public final class GenericResourceManagerObjectFactory { factory = (QueueRepositoryFactory) clazz.newInstance(); return factory.createQueueRepository(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading queue repository factory class " + queueRepositoryFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading queue repository factory class " + queueRepositoryFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading queue repository factory class " + queueRepositoryFactory + " Message: " + e.getMessage()); @@ -179,17 +179,17 @@ public final class GenericResourceManagerObjectFactory { factory = (BackendRepositoryFactory) clazz.newInstance(); return factory.createBackendRepository(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading backend repository factory class " + backendRepositoryFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading backend repository factory class " + backendRepositoryFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading backend repository factory class " + backendRepositoryFactory + " Message: " + e.getMessage()); @@ -212,17 +212,17 @@ public final class GenericResourceManagerObjectFactory { factory = (NodeRepositoryFactory) clazz.newInstance(); return factory.createNodeRepository(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading node repository factory class " + nodeRepositoryFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading node repository factory class " + nodeRepositoryFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading node repository factory class " + nodeRepositoryFactory + " Message: " + e.getMessage()); @@ -249,17 +249,17 @@ public final class GenericResourceManagerObjectFactory { factory = (JobQueueFactory) clazz.newInstance(); return factory.createQueue(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading jobqueue factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading jobqueue factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading jobqueue factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -286,17 +286,17 @@ public final class GenericResourceManagerObjectFactory { factory = (BatchmgrFactory) clazz.newInstance(); return factory.createBatchmgr(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading batchmgr factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading batchmgr factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading batchmgr factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -323,17 +323,17 @@ public final class GenericResourceManagerObjectFactory { factory = (MonitorFactory) clazz.newInstance(); return factory.createMonitor(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading monitor factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading monitor factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading monitor factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -361,17 +361,17 @@ public final class GenericResourceManagerObjectFactory { factory = (SchedulerFactory) clazz.newInstance(); return factory.createScheduler(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading scheduler factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading scheduler factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading scheduler factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -396,17 +396,17 @@ public final class GenericResourceManagerObjectFactory { factory = (JobRepositoryFactory) clazz.newInstance(); return factory.createRepository(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading job repo factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading job rep factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading job repo factory class " + serviceFactory + " Message: " + e.getMessage()); @@ -433,17 +433,17 @@ public final class GenericResourceManagerObjectFactory { factory = (LoadCalculatorFactory) clazz.newInstance(); return factory.createLoadCalculator(); } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading load calculator factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading load calculator factory class " + serviceFactory + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading load calculator factory class " + serviceFactory + " Message: " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/util/JobBuilder.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/util/JobBuilder.java b/resource/src/main/java/org/apache/oodt/cas/resource/util/JobBuilder.java index 1d96263..d8d3a5a 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/util/JobBuilder.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/util/JobBuilder.java @@ -19,14 +19,18 @@ package org.apache.oodt.cas.resource.util; //JDK imports -import java.io.File; -import java.io.FileInputStream; + +import org.apache.oodt.cas.resource.structs.JobSpec; +import org.apache.oodt.commons.xml.XMLUtils; import org.w3c.dom.Document; +import java.io.File; +import java.io.FileInputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + //OODT imports -import org.apache.oodt.commons.xml.XMLUtils; -import org.apache.oodt.cas.resource.structs.JobSpec; /** * @author mattmann @@ -37,7 +41,7 @@ import org.apache.oodt.cas.resource.structs.JobSpec; * </p>. */ public final class JobBuilder { - + private static Logger LOG = Logger.getLogger(JobBuilder.class.getName()); private JobBuilder() throws InstantiationException { throw new InstantiationException("Don't construct utility classes!"); } @@ -52,7 +56,7 @@ public final class JobBuilder { doc = XMLUtils.getDocumentRoot(new FileInputStream(new File( jobFilePath))); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return null; } return XmlStructFactory.getJobSpec(doc.getDocumentElement()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/util/Ulimit.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/util/Ulimit.java b/resource/src/main/java/org/apache/oodt/cas/resource/util/Ulimit.java index 434f262..e556068 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/util/Ulimit.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/util/Ulimit.java @@ -29,6 +29,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @author mattmann @@ -40,6 +42,7 @@ import java.util.Vector; * </p>. */ public final class Ulimit implements UlimitMetKeys { + private static Logger LOG = Logger.getLogger(Ulimit.class.getName()); private static final String shell = "/bin/bash"; private static final String runShellCmdOption = "-c"; @@ -53,7 +56,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( CORE_FILE_SIZE)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -64,7 +67,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( DATA_SEGMENT_SIZE)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -75,7 +78,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get(FILE_SIZE)) .getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -86,7 +89,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_LOCKED_MEMORY)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -97,7 +100,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_MEMORY_SIZE)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -108,7 +111,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_OPEN_FILES)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -119,7 +122,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap() .get(MAX_PIPE_SIZE)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -130,7 +133,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_STACK_SIZE)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -141,7 +144,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get(MAX_CPU_TIME)) .getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -152,7 +155,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_USER_PROCESSES)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -163,7 +166,7 @@ public final class Ulimit implements UlimitMetKeys { return ((UlimitProperty) getUlimitPropertiesMap().get( MAX_VIRTUAL_MEMORY)).getValue(); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_VALUE; } @@ -175,7 +178,7 @@ public final class Ulimit implements UlimitMetKeys { p = Runtime.getRuntime().exec( new String[] { shell, runShellCmdOption, ulimitCommand }); } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ResourceException( "IOException executing ulimit command: Message: " + e.getMessage()); @@ -206,7 +209,7 @@ public final class Ulimit implements UlimitMetKeys { p = Runtime.getRuntime().exec( new String[] { shell, runShellCmdOption, ulimitCommand }); } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); throw new ResourceException( "IOException executing ulimit command: Message: " + e.getMessage(), e); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/main/java/org/apache/oodt/cas/resource/util/XmlStructFactory.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/util/XmlStructFactory.java b/resource/src/main/java/org/apache/oodt/cas/resource/util/XmlStructFactory.java index eb0a18b..b8f5409 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/util/XmlStructFactory.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/util/XmlStructFactory.java @@ -19,22 +19,26 @@ package org.apache.oodt.cas.resource.util; //JDK imports + +import org.apache.oodt.cas.metadata.util.PathUtils; +import org.apache.oodt.cas.resource.structs.Job; +import org.apache.oodt.cas.resource.structs.JobInput; +import org.apache.oodt.cas.resource.structs.JobSpec; +import org.apache.oodt.cas.resource.structs.ResourceNode; +import org.apache.oodt.commons.xml.XMLUtils; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + import java.net.URL; import java.util.List; import java.util.Properties; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Element; //OODT imports -import org.apache.oodt.commons.xml.XMLUtils; -import org.apache.oodt.cas.metadata.util.PathUtils; -import org.apache.oodt.cas.resource.structs.Job; -import org.apache.oodt.cas.resource.structs.JobInput; -import org.apache.oodt.cas.resource.structs.JobSpec; -import org.apache.oodt.cas.resource.structs.ResourceNode; /** * @author woollard @@ -72,7 +76,7 @@ public final class XmlStructFactory { : resourceNodeRoot.getAttribute("ip")); capacity = new Integer(resourceNodeRoot.getAttribute("capacity")); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return new ResourceNode(id, ip, capacity); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/test/java/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java ---------------------------------------------------------------------- diff --git a/resource/src/test/java/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java b/resource/src/test/java/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java index ead68a5..a7564df 100644 --- a/resource/src/test/java/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java +++ b/resource/src/test/java/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java @@ -45,7 +45,7 @@ public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore { } } - public Set<CmdLineAction> loadSupportedActions() throws CmdLineActionStoreException { + public Set<CmdLineAction> loadSupportedActions() { Set<CmdLineAction> actions = super.loadSupportedActions(); for (CmdLineAction action : actions) { if (action instanceof ResourceCliAction) { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/resource/src/test/java/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java ---------------------------------------------------------------------- diff --git a/resource/src/test/java/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java b/resource/src/test/java/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java index 6e9a5e0..846e935 100644 --- a/resource/src/test/java/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java +++ b/resource/src/test/java/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java @@ -18,21 +18,23 @@ package org.apache.oodt.cas.resource.monitor; //Junit imports -import junit.framework.TestCase; - -//OODT imports import org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitor; import org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitorFactory; import org.apache.oodt.cas.resource.monitor.utils.MockGmetad; import org.apache.oodt.cas.resource.structs.ResourceNode; - -//JDK imports import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import junit.framework.TestCase; + +//OODT imports +//JDK imports /** * @author rajith @@ -42,6 +44,7 @@ import java.util.List; * Test Suite for the {@link org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitor} */ public class TestGangliaResourceMonitor extends TestCase { + private static Logger LOG = Logger.getLogger(TestGangliaResourceMonitor.class.getName()); private GangliaResourceMonitor gangliaResourceMonitor; private ThreadLocal<MockGmetad> mockGmetad = new ThreadLocal<MockGmetad>(); @@ -66,7 +69,7 @@ public class TestGangliaResourceMonitor extends TestCase { resourceNode.setId("localhost"); assertEquals(1, gangliaResourceMonitor.getLoad(resourceNode)); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -76,7 +79,7 @@ public class TestGangliaResourceMonitor extends TestCase { gangliaResourceMonitor.removeNodeById("localhost"); assertNull(gangliaResourceMonitor.getNodeById("remotenode")); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -105,7 +108,7 @@ public class TestGangliaResourceMonitor extends TestCase { assertTrue(hasLocal&&hasLocal2&&hasRemote); } catch (Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } @@ -123,7 +126,7 @@ public class TestGangliaResourceMonitor extends TestCase { assertEquals("remotenode", node.getNodeId()); } catch(Exception e){ - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); fail(e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java ---------------------------------------------------------------------- diff --git a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java b/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java index 1688d4f..0c0db54 100755 --- a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java +++ b/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.Cookie; @@ -63,7 +64,7 @@ public class OpenSSOImpl extends AbstractWebBasedSingleSignOn implements try { details = this.ssoProxy.getUserAttributes(ssoToken); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return UNKNOWN_USER; } return details.getAttributes().getMetadata(UID_ATTRIBUTE_NAME) != null ? details @@ -91,7 +92,7 @@ public class OpenSSOImpl extends AbstractWebBasedSingleSignOn implements try { ssoToken = this.ssoProxy.authenticate(username, password); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); return false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java ---------------------------------------------------------------------- diff --git a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java b/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java index dd6b892..e3753a6 100644 --- a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java +++ b/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java @@ -46,17 +46,17 @@ public final class SingleSignOnFactory { sso = clazz.newInstance(); return sso; } catch (ClassNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "ClassNotFoundException when loading web based sso class " + className + " Message: " + e.getMessage()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "InstantiationException when loading web based sso class " + className + " Message: " + e.getMessage()); } catch (IllegalAccessException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "IllegalAccessException when loading web based sso class " + className + " Message: " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java ---------------------------------------------------------------------- diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java index 137238d..5d77083 100755 --- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java +++ b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java @@ -103,7 +103,7 @@ public class SSOProxy implements SSOMetKeys { response = post.getResponseBodyAsString().trim(); ssoToken = response.substring(9); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { post.releaseConnection(); } @@ -165,10 +165,10 @@ public class SSOProxy implements SSOMetKeys { } } catch (HttpException e) { // TODO Auto-generated catch block - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } finally { post.releaseConnection(); } @@ -212,7 +212,7 @@ public class SSOProxy implements SSOMetKeys { } } } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error reading service response line: [" + line + "]: Message: " + e.getMessage()); } finally { @@ -262,7 +262,7 @@ public class SSOProxy implements SSOMetKeys { } } } catch (IOException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Error reading service response line: [" + line + "]: Message: " + e.getMessage()); } finally { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/streaming/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/ResourceExecutor.java ---------------------------------------------------------------------- diff --git a/streaming/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/ResourceExecutor.java b/streaming/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/ResourceExecutor.java index 84e9fd6..60dad3d 100644 --- a/streaming/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/ResourceExecutor.java +++ b/streaming/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/ResourceExecutor.java @@ -57,7 +57,7 @@ public class ResourceExecutor implements Executor { str = new PrintStream(new FileOutputStream(tmp)); str.println(id+"Starting up new<<<<<"); } catch (FileNotFoundException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } /* (non-Javadoc) @@ -111,7 +111,7 @@ public class ResourceExecutor implements Executor { status = TaskStatus.newBuilder().setTaskId(info.getTaskId()) .setState(TaskState.TASK_FINISHED).build(); } catch (JobInputException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); status = TaskStatus.newBuilder().setTaskId(info.getTaskId()) .setState(TaskState.TASK_FAILED).build(); } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/streaming/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/ResourceMesosSchedulerFactory.java ---------------------------------------------------------------------- diff --git a/streaming/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/ResourceMesosSchedulerFactory.java b/streaming/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/ResourceMesosSchedulerFactory.java index 051e2e6..09d888b 100644 --- a/streaming/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/ResourceMesosSchedulerFactory.java +++ b/streaming/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/ResourceMesosSchedulerFactory.java @@ -91,7 +91,7 @@ public class ResourceMesosSchedulerFactory implements SchedulerFactory { return scheduler; } catch(IOException ioe) { LOG.log(Level.SEVERE,"Exception detected: "+ioe.getMessage()); - ioe.printStackTrace(); + ioLOG.log(Level.SEVERE, e.getMessage()); throw new RuntimeException(ioe); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java ---------------------------------------------------------------------- diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java index 588e5a8..2cb5a77 100644 --- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java +++ b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java @@ -91,7 +91,7 @@ public class FilemgrCheckStep extends BaseStep implements StepInterface { logError("loading ingester"); oodt.loadIngester(meta.getServerURLField()); } catch (InstantiationException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } return super.init(meta, data); @@ -154,7 +154,7 @@ public class FilemgrCheckStep extends BaseStep implements StepInterface { try { logError("does file exist?"+oodtproc.isAlreadyInDatabase(oodt, (String)r[idx])); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } // safely add the string "Hello World!" at the end of the output row http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java ---------------------------------------------------------------------- diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java index b2a48df..47f3a31 100644 --- a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java +++ b/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java @@ -150,7 +150,7 @@ public class FilemgrDeleteStep extends BaseStep implements StepInterface { logDetailed("Deleting Product: "+(String)r[idx]); worked = oodtproc.deleteProductByName(oodt, (String)r[idx]); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } // safely add the string "Hello World!" at the end of the output row http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStep.java ---------------------------------------------------------------------- diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStep.java b/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStep.java index db91055..d6b3900 100644 --- a/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStep.java +++ b/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStep.java @@ -158,7 +158,7 @@ public class FilemgrIngestStep extends BaseStep implements StepInterface { /*try { logError("does file exist?"+oodtproc.isAlreadyInDatabase(oodt, (String)r[idx])); } catch (Exception e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); }*/ try { http://git-wip-us.apache.org/repos/asf/oodt/blob/f286ded4/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStepDialog.java ---------------------------------------------------------------------- diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStepDialog.java b/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStepDialog.java index c08d6d0..9625b73 100644 --- a/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStepDialog.java +++ b/tools/pdi_plugin/src/org/apache/oodt/filemgringest/FilemgrIngestStepDialog.java @@ -381,7 +381,7 @@ public class FilemgrIngestStepDialog extends BaseStepDialog implements StepDialo } } catch (KettleStepException e) { - e.printStackTrace(); + LOG.log(Level.SEVERE, e.getMessage()); } } }
