List of usage examples for java.util.logging Level SEVERE
Level SEVERE
To view the source code for java.util.logging Level SEVERE.
Click Source Link
From source file:ebay.Ebay.java
/** * @param args the command line arguments *//*w w w . j a v a2 s. c o m*/ public static void main(String[] args) { HttpClient client = null; HttpResponse response = null; BufferedReader rd = null; Document doc = null; String xml = ""; EbayDAO<Producto> db = new EbayDAO<>(Producto.class); String busqueda; while (true) { busqueda = JOptionPane.showInputDialog(null, "ingresa una busqueda"); if (busqueda != null) { busqueda = busqueda.replaceAll(" ", "%20"); try { client = new DefaultHttpClient(); /* peticion GET */ HttpGet request = new HttpGet("http://open.api.ebay.com/shopping?" + "callname=FindPopularItems" + "&appid=student11-6428-4bd4-ac0d-6ed9d84e345" + "&version=517&QueryKeywords=" + busqueda + "&siteid=0" + "&responseencoding=XML"); /* se ejecuta la peticion GET */ response = client.execute(request); rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); /* comienza la lectura de la respuesta a la peticion GET */ String line; while ((line = rd.readLine()) != null) { xml += line + "\n"; } } catch (IOException ex) { Logger.getLogger(Ebay.class.getName()).log(Level.SEVERE, null, ex); } /* creamos nuestro documentBulder(documento constructor) y obtenemos nuestro objeto documento apartir de documentBuilder */ try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = documentBuilder.parse(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8")))); } catch (ParserConfigurationException | SAXException | IOException ex) { Logger.getLogger(Ebay.class.getName()).log(Level.SEVERE, null, ex); } Element raiz = doc.getDocumentElement(); if (raiz == null) { System.exit(0); } if (raiz.getElementsByTagName("Ack").item(0).getTextContent().equals("Success")) { NodeList array = raiz.getElementsByTagName("ItemArray").item(0).getChildNodes(); for (int i = 0; i < array.getLength(); ++i) { Node n = array.item(i); if (n.getNodeType() != Node.TEXT_NODE) { Producto p = new Producto(); if (((Element) n).getElementsByTagName("ItemID").item(0) != null) p.setId(new Long( ((Element) n).getElementsByTagName("ItemID").item(0).getTextContent())); if (((Element) n).getElementsByTagName("EndTime").item(0) != null) p.setEndtime( ((Element) n).getElementsByTagName("EndTime").item(0).getTextContent()); if (((Element) n).getElementsByTagName("ViewItemURLForNaturalSearch").item(0) != null) p.setViewurl(((Element) n).getElementsByTagName("ViewItemURLForNaturalSearch") .item(0).getTextContent()); if (((Element) n).getElementsByTagName("ListingType").item(0) != null) p.setListingtype( ((Element) n).getElementsByTagName("ListingType").item(0).getTextContent()); if (((Element) n).getElementsByTagName("GalleryURL").item(0) != null) p.setGalleryurl( ((Element) n).getElementsByTagName("GalleryURL").item(0).getTextContent()); if (((Element) n).getElementsByTagName("PrimaryCategoryID").item(0) != null) p.setPrimarycategoryid(new Integer(((Element) n) .getElementsByTagName("PrimaryCategoryID").item(0).getTextContent())); if (((Element) n).getElementsByTagName("PrimaryCategoryName").item(0) != null) p.setPrimarycategoryname(((Element) n).getElementsByTagName("PrimaryCategoryName") .item(0).getTextContent()); if (((Element) n).getElementsByTagName("BidCount").item(0) != null) p.setBidcount(new Integer( ((Element) n).getElementsByTagName("BidCount").item(0).getTextContent())); if (((Element) n).getElementsByTagName("ConvertedCurrentPrice").item(0) != null) p.setConvertedcurrentprice(new Double(((Element) n) .getElementsByTagName("ConvertedCurrentPrice").item(0).getTextContent())); if (((Element) n).getElementsByTagName("ListingStatus").item(0) != null) p.setListingstatus(((Element) n).getElementsByTagName("ListingStatus").item(0) .getTextContent()); if (((Element) n).getElementsByTagName("TimeLeft").item(0) != null) p.setTimeleft( ((Element) n).getElementsByTagName("TimeLeft").item(0).getTextContent()); if (((Element) n).getElementsByTagName("Title").item(0) != null) p.setTitle(((Element) n).getElementsByTagName("Title").item(0).getTextContent()); if (((Element) n).getElementsByTagName("ShippingServiceCost").item(0) != null) p.setShippingservicecost(new Double(((Element) n) .getElementsByTagName("ShippingServiceCost").item(0).getTextContent())); if (((Element) n).getElementsByTagName("ShippingType").item(0) != null) p.setShippingtype(((Element) n).getElementsByTagName("ShippingType").item(0) .getTextContent()); if (((Element) n).getElementsByTagName("WatchCount").item(0) != null) p.setWatchcount(new Integer( ((Element) n).getElementsByTagName("WatchCount").item(0).getTextContent())); if (((Element) n).getElementsByTagName("ListedShippingServiceCost").item(0) != null) p.setListedshippingservicecost( new Double(((Element) n).getElementsByTagName("ListedShippingServiceCost") .item(0).getTextContent())); try { db.insert(p); } catch (Exception e) { db.update(p); } } } } Ventana.crear(xml); } else System.exit(0); } }
From source file:groovesquid.Main.java
public static void main(String[] args) { System.setSecurityManager(null); log.log(Level.INFO, "Groovesquid v{0} running on {1} {2} ({3}) in {4}", new Object[] { version, System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"), System.getProperty("java.vm.vendor"), System.getProperty("java.home") }); // show gui/*w w w . j a v a2s .c o m*/ // apple os x System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Groovesquid"); // antialising System.setProperty("awt.useSystemAAFontSettings", "lcd"); System.setProperty("swing.aatext", "true"); // flackering bg fix System.setProperty("sun.awt.noerasebackground", "true"); System.setProperty("sun.java2d.noddraw", "true"); Toolkit.getDefaultToolkit().setDynamicLayout(true); try { //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { log.log(Level.SEVERE, null, ex); } // load languages languages = loadLanguages(); // Load config config = loadConfig(); // GUI try { gui = (GUI) config.getGuiClass().newInstance(); } catch (InstantiationException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } settings = new Settings(); about = new About(); // Update Checker new UpdateCheckThread().start(); // init grooveshark (every 25min) new InitThread().start(); }
From source file:MainProgram.MainProgram.java
public static void main(String[] args) throws InterruptedException, FileNotFoundException { MainFrame mainFrame = new MainFrame(); errorLog = new PrintStream(file); try {//w w w . ja va2 s .c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(errorLog); Logger.getLogger(MainProgram.class.getName()).log(Level.SEVERE, null, ex); } SwingUtilities.updateComponentTreeUI(mainFrame); mainFrame.setVisible(true); mainFrame.setSize(445, 415); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setResizable(false); }
From source file:com.googlecode.promnetpp.main.Main.java
/** * Main function (entry point for the tool). * * @param args Command-line arguments.// w w w . j a v a 2 s . c om */ public static void main(String[] args) { //Prepare logging try { Handler fileHandler = new FileHandler("promnetpp-log.xml"); Logger logger = Logger.getLogger(""); logger.removeHandler(logger.getHandlers()[0]); logger.addHandler(fileHandler); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } String PROMNeTppHome = System.getenv("PROMNETPP_HOME"); if (PROMNeTppHome == null) { String userDir = System.getProperty("user.dir"); System.err.println("WARNING: PROMNETPP_HOME environment variable" + " not set."); System.err.println("PROMNeT++ will assume " + userDir + " as" + " home."); PROMNeTppHome = userDir; } System.setProperty("promnetpp.home", PROMNeTppHome); Logger.getLogger(Main.class.getName()).log(Level.INFO, "PROMNeT++ home" + " set to {0}", System.getProperty("promnetpp.home")); if (args.length == 1) { fileNameOrPath = args[0]; configurationFilePath = PROMNeTppHome + "/default-configuration.xml"; } else if (args.length == 2) { fileNameOrPath = args[0]; configurationFilePath = args[1]; } else { System.err.println("Invalid number of command-line arguments."); System.err.println("Usage #1: promnetpp.jar <PROMELA model>.pml"); System.err.println("Usage #2: promnetpp.jar <PROMELA model>.pml" + " <configuration file>.xml"); System.exit(1); } //We must have a file name or path at this point assert fileNameOrPath != null : "Unspecified file name or" + " path to file!"; //Log basic info Logger.getLogger(Main.class.getName()).log(Level.INFO, "Running" + " PROMNeT++ from {0}", System.getProperty("user.dir")); //Final steps loadXMLFile(); Verifier verifier = new StandardVerifier(fileNameOrPath); verifier.doVerification(); assert verifier.isErrorFree() : "Errors reported during model" + " verification!"; verifier.finish(); buildAbstractSyntaxTree(); Translator translator = new StandardTranslator(); translator.init(); translator.translate(abstractSyntaxTree); translator.finish(); }
From source file:com.left8.evs.evs.EvS.java
/** * Main method that provides a simple console input interface for the user, * if she wishes to execute the tool as a .jar executable. * @param args A list of arguments./*from www. j a v a 2 s. c o m*/ * @throws org.apache.commons.cli.ParseException ParseExcetion */ public static void main(String[] args) throws ParseException { Config config = null; try { config = new Config(); } catch (IOException ex) { Utilities.printMessageln("Configuration file 'config.properties' " + "not in classpath!"); Logger.getLogger(EvS.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } if (args.length != 0) { //If the user supplied arguments Console console = new Console(args, config); //Read the console showMongoLogging = console.showMongoLogging(); showInlineInfo = console.showInlineInfo(); hasExtCommands = console.hasExternalCommands(); choice = console.getChoiceValue(); } if (!showMongoLogging) { //Stop reporting logging information Logger mongoLogger = Logger.getLogger("org.mongodb.driver"); mongoLogger.setLevel(Level.SEVERE); } System.out.println("\n----EvS----"); if (!hasExtCommands) { System.out.println("Select one of the following options"); System.out.println("1. Run Offline Peak Finding experiments."); System.out.println("2. Run EDCoW experiments."); System.out.println("3. Run each of the above methods without " + "the sentiment annotations."); System.out.println("Any other key to exit."); System.out.println(""); System.out.print("Your choice: "); Scanner keyboard = new Scanner(System.in); choice = keyboard.nextInt(); } switch (choice) { case 1: { //Offline Peak Finding int window = 10; double alpha = 0.85; int taph = 1; int pi = 5; Dataset ds = new Dataset(config); PeakFindingCorpus corpus = new PeakFindingCorpus(config, ds.getTweetList(), ds.getSWH()); corpus.createCorpus(window); List<BinPair<String, Integer>> bins = BinsCreator.createBins(corpus, config, window); PeakFindingSentimentCorpus sCorpus = new PeakFindingSentimentCorpus(corpus); SentimentPeakFindingExperimenter exper = new SentimentPeakFindingExperimenter(sCorpus, bins, alpha, taph, pi, window, config); //Experiment with Taph List<String> lines = exper.experimentUsingTaph(1, 10, 1, 0, showInlineInfo); exper.exportToFile("stanford.txt", lines); lines = exper.experimentUsingTaph(1, 10, 1, 1, showInlineInfo); exper.exportToFile("naive_bayes.txt", lines); lines = exper.experimentUsingTaph(1, 10, 1, 2, showInlineInfo); exper.exportToFile("bayesian_net.txt", lines); //Experiment with Alpha lines = exper.experimentUsingAlpha(0.85, 0.99, 0.01, 0, showInlineInfo); exper.exportToFile("stanford.txt", lines); lines = exper.experimentUsingAlpha(0.85, 0.99, 0.01, 1, showInlineInfo); exper.exportToFile("naive_bayes.txt", lines); lines = exper.experimentUsingAlpha(0.85, 0.99, 0.01, 2, showInlineInfo); exper.exportToFile("bayesian_net.txt", lines); break; } case 2: { //EDCoW Dataset ds = new Dataset(config); SentimentEDCoWCorpus corpus = new SentimentEDCoWCorpus(config, ds.getTweetList(), ds.getSWH(), 10); corpus.getEDCoWCorpus().createCorpus(); corpus.getEDCoWCorpus().setDocTermFreqIdList(); int delta = 5, delta2 = 11, gamma = 6; double minTermSupport = 0.001, maxTermSupport = 0.01; SentimentEDCoWExperimenter exper = new SentimentEDCoWExperimenter(corpus, delta, delta2, gamma, minTermSupport, maxTermSupport, choice, choice, config); //Experiment with delta List<String> lines = exper.experimentUsingDelta(1, 20, 1, 0, showInlineInfo); exper.exportToFile("stanford.txt", lines); lines = exper.experimentUsingDelta(1, 20, 1, 1, showInlineInfo); exper.exportToFile("naive_bayes.txt", lines); lines = exper.experimentUsingDelta(1, 20, 1, 2, showInlineInfo); exper.exportToFile("bayesian_net.txt", lines); //Experiment with gamma lines = exper.experimentUsingGamma(6, 10, 1, 0, showInlineInfo); exper.exportToFile("stanford.txt", lines); lines = exper.experimentUsingGamma(6, 10, 1, 1, showInlineInfo); exper.exportToFile("naive_bayes.txt", lines); lines = exper.experimentUsingGamma(6, 10, 1, 2, showInlineInfo); exper.exportToFile("bayesian_net.txt", lines); break; } case 3: { EDMethodPicker.selectEDMethod(config, showInlineInfo, 0); break; } case 4: { //Directly run OPF EDMethodPicker.selectEDMethod(config, showInlineInfo, 1); break; } case 5: { //Directly run EDCoW EDMethodPicker.selectEDMethod(config, showInlineInfo, 2); break; } default: { System.out.println("Exiting now..."); System.exit(0); } } }
From source file:eval.dataset.ParseWikiLog.java
public static void main(String[] ss) throws FileNotFoundException, ParserConfigurationException, IOException { FileInputStream fin = new FileInputStream("data/enwiki-20151201-pages-logging.xml.gz"); GzipCompressorInputStream gzIn = new GzipCompressorInputStream(fin); InputStreamReader reader = new InputStreamReader(gzIn); BufferedReader br = new BufferedReader(reader); PrintWriter pw = new PrintWriter(new FileWriter("data/user_page.txt")); pw.println(//from w w w. ja va2 s .c o m "#list of user names and pages that they have edited, deleted or created. These info are mined from logitems of enwiki-20150304-pages-logging.xml.gz"); TreeMap<String, Set<String>> userPageList = new TreeMap(); TreeSet<String> pageList = new TreeSet(); int counterEntry = 0; String currentUser = null; String currentPage = null; try { for (String line = br.readLine(); line != null; line = br.readLine()) { if (line.trim().equals("</logitem>")) { counterEntry++; if (currentUser != null && currentPage != null) { updateMap(userPageList, currentUser, currentPage); pw.println(currentUser + "\t" + currentPage); pageList.add(currentPage); } currentUser = null; currentPage = null; } else if (line.trim().startsWith("<username>")) { currentUser = line.trim().split(">")[1].split("<")[0].replace(" ", "_"); } else if (line.trim().startsWith("<logtitle>")) { String content = line.trim().split(">")[1].split("<")[0]; if (content.split(":").length == 1) { currentPage = content.replace(" ", "_"); } } } } catch (IOException ex) { Logger.getLogger(ParseWikiLog.class.getName()).log(Level.SEVERE, null, ex); } pw.println("#analysed " + counterEntry + " entries of wikipesia log file"); pw.println("#gathered a list of unique user of size " + userPageList.size()); pw.println("#gathered a list of pages of size " + pageList.size()); pw.close(); gzIn.close(); PrintWriter pwUser = new PrintWriter(new FileWriter("data/user_list_page_edited.txt")); pwUser.println( "#list of unique users and pages that they have edited, extracted from logitems of enwiki-20150304-pages-logging.xml.gz"); for (String user : userPageList.keySet()) { pwUser.print(user); Set<String> getList = userPageList.get(user); for (String page : getList) { pwUser.print("\t" + page); } pwUser.println(); } pwUser.close(); PrintWriter pwPage = new PrintWriter(new FileWriter("data/all_pages.txt")); pwPage.println("#list of the unique pages that are extracted from enwiki-20150304-pages-logging.xml.gz"); for (String page : pageList) { pwPage.println(page); } pwPage.close(); System.out.println("#analysed " + counterEntry + " entries of wikipesia log file"); System.out.println("#gathered a list of unique user of size " + userPageList.size()); System.out.println("#gathered a list of pages of size " + pageList.size()); }
From source file:com.fantasy.Application.java
public static void main(String[] args) throws ParseException, Exception { ConfigurableApplicationContext context; context = SpringApplication.run(AggregatorConfig.class); SpaceDelimitedCommandLineParser<YearFlag, YearContainer> argParser; argParser = context.getBean(SpaceDelimitedCommandLineParser.class); YearContainer container = argParser.parseFor(YearFlag.class, args); String packageName = container.getPackageName(); String className = container.getClassName(); int year = container.getYear(); List<Class> taskRunners = findTypes(packageName); Class runner = null;//w ww . j a va 2s .c om if (Objects.nonNull(taskRunners)) { for (Class cl : taskRunners) { if (cl.getSimpleName().equalsIgnoreCase(className)) { runner = cl; break; } } if (Objects.nonNull(runner)) { Task task = (Task) context.getBean(runner); if (Objects.nonNull(task)) { if (task instanceof ContextUser) { ((ContextUser) task).haveContext(context); } if (task instanceof YearlyTask) { ((YearlyTask) task).setYear(year); } try { task.run(); } catch (InterruptedException ex) { Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex); } finally { if (Objects.nonNull(context)) { context.close(); } } } } } }
From source file:com.rest.samples.getReportFromJasperServerWithSeparateAuth.java
public static void main(String[] args) { // TODO code application logic here String host = "10.49.28.3"; String port = "8081"; String reportName = "vencimientos"; String params = "feini=2016-09-30&fefin=2016-09-30"; String url = "http://{host}:{port}/jasperserver/rest_v2/reports/Reportes/{reportName}.pdf?{params}"; url = url.replace("{host}", host); url = url.replace("{port}", port); url = url.replace("{reportName}", reportName); url = url.replace("{params}", params); try {/*from www . j a v a2 s . c om*/ CredentialsProvider cp = new BasicCredentialsProvider(); cp.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("username", "password")); CloseableHttpClient hc = HttpClientBuilder.create().setDefaultCredentialsProvider(cp).build(); HttpGet getMethod = new HttpGet(url); getMethod.addHeader("accept", "application/pdf"); HttpResponse res = hc.execute(getMethod); if (res.getStatusLine().getStatusCode() != 200) { throw new RuntimeException("Failed : HTTP eror code: " + res.getStatusLine().getStatusCode()); } InputStream is = res.getEntity().getContent(); OutputStream os = new FileOutputStream(new File("vencimientos.pdf")); int read = 0; byte[] bytes = new byte[2048]; while ((read = is.read(bytes)) != -1) { os.write(bytes, 0, read); } is.close(); os.close(); if (Desktop.isDesktopSupported()) { File pdfFile = new File("vencimientos.pdf"); Desktop.getDesktop().open(pdfFile); } } catch (IOException ex) { Logger.getLogger(SamplesUseHttpclient.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:business.management.system.TeamStatistics.java
/** * @param args the command line arguments *///from w ww .j ava 2 s . c om public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TeamStatistics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TeamStatistics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TeamStatistics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TeamStatistics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { new TeamStatistics().setVisible(true); } catch (SQLException ex) { Logger.getLogger(TeamStatistics.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:org.jaqpot.core.service.client.jpdi.JPDIClientFactory.java
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException { CloseableHttpAsyncClient asyncClient = HttpAsyncClientBuilder.create().build(); asyncClient.start();//from w w w. j a v a2s .c om HttpGet request = new HttpGet("http://www.google.com"); request.addHeader("Accept", "text/html"); Future f = asyncClient.execute(request, new FutureCallback<HttpResponse>() { @Override public void completed(HttpResponse t) { System.out.println("completed"); try { String result = new BufferedReader(new InputStreamReader(t.getEntity().getContent())).lines() .collect(Collectors.joining("\n")); System.out.println(result); } catch (IOException ex) { Logger.getLogger(JPDIClientFactory.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedOperationException ex) { Logger.getLogger(JPDIClientFactory.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void failed(Exception excptn) { System.out.println("failed"); } @Override public void cancelled() { System.out.println("cancelled"); } }); f.get(); asyncClient.close(); }