List of usage examples for java.lang Error printStackTrace
public void printStackTrace()
From source file:org.radeox.filter.regex.RegexReplaceFilter.java
public String filter(String input, FilterContext context) { String result = input;//from w w w .j a v a 2s .c om int size = pattern.size(); Pattern p; String s; for (int i = 0; i < size; i++) { p = (Pattern) pattern.get(i); s = (String) substitute.get(i); try { Matcher matcher = Matcher.create(result, p); result = matcher.substitute(s); // Util.substitute(matcher, p, new Perl5Substitution(s, // interps), result, limit); } catch (Exception e) { // log.warn("<span class=\"error\">Exception</span>: " + this + // ": " + e); log.warn("Exception for: " + this + " " + e); } catch (Error err) { // log.warn("<span class=\"error\">Error</span>: " + this + ": " // + err); log.warn("Error for: " + this); err.printStackTrace(); } } return result; }
From source file:org.mule.config.builders.DeployableMuleXmlContextListener.java
public void initialize(ServletContext context) { String config = context.getInitParameter(MuleXmlBuilderContextListener.INIT_PARAMETER_MULE_CONFIG); if (config == null) { config = MuleServer.DEFAULT_CONFIGURATION; if (logger.isDebugEnabled()) { logger.debug("No Mule config file(s) specified, using default: " + config); }//from w w w . j ava2 s. c om } else { if (logger.isDebugEnabled()) { logger.debug("Mule config file(s): " + config); } } if (muleContext == null) { throw new RuntimeException("MuleContext is not available"); } try { configurationBuilder = new WebappMuleXmlConfigurationBuilder(context, config); configurationBuilder.setUseDefaultConfigResource(false); // Support Spring-first configuration in webapps final ApplicationContext parentContext = (ApplicationContext) context .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (parentContext != null) { configurationBuilder.setParentContext(parentContext); } configurationBuilder.configure(muleContext); } catch (MuleException ex) { context.log(ex.getMessage(), ex); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. ex.printStackTrace(); } catch (Error error) { // WSAD doesn't always report the java.lang.Error, log it context.log(error.getMessage(), error); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. error.printStackTrace(); throw error; } }
From source file:gr.iti.mklab.reveal.forensics.maps.dq.DQExtractor.java
public DQExtractor(String fileName) throws IOException { String imageFormat = gr.iti.mklab.reveal.forensics.util.Util.getImageFormat(new File(fileName)); try {//from w ww .j a va2s.c o m if (imageFormat.equalsIgnoreCase("JPEG") | imageFormat.equalsIgnoreCase("JPG")) { dcts = getDCTCoeffsFromFile(fileName); } else { System.out.println( "Not a JPEG image, getting DCT coefficients from pixel values (in case it is a resave from an older JPEG)."); BufferedImage origImage; try { origImage = ImageIO.read(new File(fileName)); int[][] dcts2 = dctCoeffExtractor.extractYDCT(origImage); dcts = dcts2; } catch (IOException e) { e.printStackTrace(); } } } catch (Error err) { err.printStackTrace(); System.out.println( "Could not load native JPEGlib-based DCT extractor, getting DCT coefficients from pixel values."); BufferedImage OrigImage; try { OrigImage = ImageIO.read(new File(fileName)); int[][] dcts2 = dctCoeffExtractor.extractYDCT(OrigImage); dcts = dcts2; } catch (IOException e) { e.printStackTrace(); } } detectDQDiscontinuities(); }
From source file:org.mule.config.builders.MuleXmlBuilderContextListener.java
public void initialize(ServletContext context) { String config = context.getInitParameter(INIT_PARAMETER_MULE_CONFIG); if (config == null) { config = getDefaultConfigResource(); if (logger.isDebugEnabled()) { logger.debug("No Mule config file(s) specified, using default: " + config); }//from w w w. j a va 2 s . c om } else { if (logger.isDebugEnabled()) { logger.debug("Mule config file(s): " + config); } } try { muleContext = createMuleContext(config, context); context.setAttribute(MuleProperties.MULE_CONTEXT_PROPERTY, muleContext); muleContext.start(); } catch (MuleException ex) { context.log(ex.getMessage(), ex); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. ex.printStackTrace(); } catch (Error error) { // WSAD doesn't always report the java.lang.Error, log it context.log(error.getMessage(), error); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. error.printStackTrace(); throw error; } }
From source file:com.hammurapi.jcapture.CaptureFrame.java
protected void capture() throws Exception { try {/*from w w w.jav a2 s .c o m*/ Thread.sleep(200); // For Ubuntu. } catch (InterruptedException ie) { // Ignore } BufferedImage screenShot = captureConfig.createScreenShot(null, null).call().getRegions().get(0).getImage() .getImage(); String prefix = getDatePrefix(); String defaultImageFormat = applet.getParameter("imageFormat"); if (defaultImageFormat == null || defaultImageFormat.trim().length() == 0) { defaultImageFormat = "PNG"; } final String defaultFileExtension = defaultImageFormat.toLowerCase(); final String fileName = JOptionPane.showInputDialog(CaptureFrame.this, "Upload as", applet.getParameter("pageName") + "-capture-" + prefix + "-" + nextCounter() + "." + defaultFileExtension); if (fileName != null) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int idx = fileName.lastIndexOf('.'); String imageFormat = idx == -1 ? defaultImageFormat : fileName.substring(idx + 1).toUpperCase(); ImageIO.write(screenShot, imageFormat, baos); final byte[] imageBytes = baos.toByteArray(); System.out.println("Image size: " + imageBytes.length); // Uploading SwingWorker<Boolean, Long> task = new SwingWorker<Boolean, Long>() { @Override protected Boolean doInBackground() throws Exception { System.out.println("Uploading in background"); try { HttpResponse iResponse = applet.post(CaptureFrame.this, new ByteArrayInputStream(imageBytes), imageBytes.length, fileName, "application/octet-stream"); System.out.println("Response status line: " + iResponse.getStatusLine()); if (iResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { errorMessage = iResponse.getStatusLine(); errorTitle = "Error saving image"; return false; } return true; } catch (Error e) { errorMessage = e.toString(); errorTitle = "Upload error"; e.printStackTrace(); return false; } } private Object errorMessage; private String errorTitle; protected void done() { try { if (get()) { JSObject window = JSObject.getWindow(applet); String toEval = "insertAtCarret('" + applet.getParameter("edid") + "','{{:" + fileName + "|}}')"; System.out.println("Evaluating: " + toEval); window.eval(toEval); CaptureFrame.this.setVisible(false); } else { JOptionPane.showMessageDialog(CaptureFrame.this, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(CaptureFrame.this, e.toString(), "Exception", JOptionPane.ERROR_MESSAGE); } }; }; task.execute(); } catch (IOException ex) { JOptionPane.showMessageDialog(applet, ex.toString(), "Error saving image", JOptionPane.ERROR_MESSAGE); } } }
From source file:de.tudarmstadt.lt.lm.app.StartLM.java
@Override public void run() { Runtime.getRuntime().addShutdownHook(_shutdown_hook); try {/*from w w w.j a v a2 s. co m*/ // start connect language model server startRMI(); startLM(); } catch (Exception e1) { LOG.error("Could not start to Language Model Server."); } _stdin_scan = new Scanner(System.in); String status = getStatus(); for (String input_line = null; (input_line = readInput(String.format( "+++%n%s What do you want to do?%n" + "Type ':i' to list LM Server infos, %n" + "Type ':pn' to compute ngram probabilities, %n" + "Type ':ps' to compute sequence probabilities, %n" + "Type ':pw' to predict a sequence of words, %n" + "Type ':l' to list ngrams, %n" + "Type ':s' to stop lm, %n" + "Type ':r' to restart lm, %n" + "Type ':v' to change verbosity. %n" + "Type ':q' to quit program. %n" + "%s $> ", status, _name))) != null;) { if (input_line.isEmpty()) continue; String action = input_line.toLowerCase(); try { if (":q".equals(action)) exit(); else if (":s".equals(action)) stopLM(); else if (":r".equals(action)) restartLM(); else if (":i".equals(action) || "i".equals(action)) showLmInfo(); else if (":ps".equals(action) || "ps".equals(action)) computeSequenceProbabilities(); else if (":pn".equals(action) || "pn".equals(action)) computeNgramProbabilities(); else if (":pw".equals(action) || "pw".equals(action)) predict(); else if (":l".equals(action) || "l".equals(action)) listNgrams(); else if (":v".equals(action) || "v".equals(action)) changeLogLevel(); else System.out.println(String.format("Unknown action '%s'.", action)); } catch (Error e) { e.printStackTrace(); } status = getStatus(); } }
From source file:feup.pfaria.jenkins.plugins.filtereddashboardview.FilteredDashboardView.java
/** * Populates a Project with its associated Jobs and * respective Builds/*from w w w . j a v a 2 s. c o m*/ * * @param project the project to populate with jobs * @return jobs all Jobs from the selected Project */ public ArrayList<JobData> getJobsFromProject(View project) { ArrayList<JobData> jobs = new ArrayList<JobData>(); ArrayList<String> jobNames = new ArrayList<String>(); try { jobs = new ArrayList<JobData>(); for (Object j : project.getAllItems()) { Job newJob = (Job) j; JobData newJobData = parseJob(newJob); if (newJobData != null) { jobNames.add(newJob.getName()); jobs.add(newJobData); } } this.jobsInProjectMap.put(project.getViewName(), jobNames); return jobs; } catch (Error e) { e.printStackTrace(); } return null; }
From source file:feup.pfaria.jenkins.plugins.filtereddashboardview.FilteredDashboardView.java
/** * Gets last 'buildHistorySize' builds from * the Jobs associated to the Projects displayed * on this Dashboard//from w ww .ja v a 2s.c o m * * @return buildList list of last 'buildHistorySize' Builds ran */ @Exported(name = "buildHistory") public ArrayList<Build> getBuildHistory() { try { Pattern r = filterRegex != null ? Pattern.compile(filterRegex) : null; ArrayList<Job> jobs = new ArrayList<>(); for (String jobName : this.jobsMap.keySet()) { Job job = Jenkins.getInstance().getItemByFullName(jobName, Job.class); if (job != null) { // Skip Maven modules. They are part of parent Maven project if (job.getClass().getName().equals("hudson.maven.MavenModule")) continue; // If filtering is enabled, skip jobs not matching the filter if (r != null && !r.matcher(job.getName()).find()) continue; jobs.add(job); } } RunList builds = new RunList(jobs).limit(200); //We can ignore if the builds of this project are beyond the 200th int buildHistorySize = 0; ArrayList<Build> buildList = new ArrayList<Build>(); for (Object b : builds) { if (buildHistorySize < getBuildHistorySize()) { Run build = (Run) b; String buildUrl = build.getUrl(); Result result = build.getResult(); ArrayList<Tag> tags = new ArrayList<Tag>( getBuildTags(build.getParent().getName(), build.getNumber())); buildList.add(new Build(build.getParent().getName(), build.getFullDisplayName(), build.getNumber(), build.getStartTimeInMillis(), build.getDuration(), buildUrl == null ? "null" : buildUrl, result == null ? "BUILDING" : result.toString(), tags)); buildHistorySize++; } else break; } return buildList; } catch (Error e) { e.printStackTrace(); } return null; }
From source file:feup.pfaria.jenkins.plugins.filtereddashboardview.FilteredDashboardView.java
/** * Parses the Job job from this Jenkins instance * to a custom JobData class/*w ww . ja va2 s .c o m*/ * * @param job Job to parse * @return the Job as a JobData class */ public JobData parseJob(Job job) { try { ArrayList<Build> builds = new ArrayList<Build>(); String status; String name; String url = ""; String buildUrl = ""; int lastBuildNr = 0; Pattern r = filterRegex != null ? Pattern.compile(filterRegex) : null; // Skip matrix configuration sub-jobs and Maven modules if (job.getClass().getName().equals("hudson.matrix.MatrixConfiguration") || job.getClass().getName().equals("hudson.maven.MavenModule")) return null; // If filtering is enabled, skip jobs not matching the filter if (r != null && !r.matcher(job.getName()).find()) return null; // Get the url to link it in the dashboard url = job.getUrl(); if (job.isBuilding()) { status = "BUILDING"; buildUrl = "BUILDING"; } else { Run lb = job.getLastBuild(); if (lb == null) { status = "NOTBUILT"; lastBuildNr = 0; buildUrl = "NOTBUILT"; } else { status = lb.getResult().toString(); lastBuildNr = job.getLastBuild().getNumber(); buildUrl = lb.getUrl(); } } ItemGroup parent = job.getParent(); if (parent != null && parent.getClass().getName().equals("com.cloudbees.hudson.plugins.folder.Folder")) { name = parent.getFullName() + " / " + job.getName(); } else { name = job.getName(); } String dir = job.getBuildDir().toString(); builds = getBuildsFromJob(job); JobData newJob = new JobData(name, status, url, dir, Integer.toString(lastBuildNr), buildUrl, builds); this.jobsMap.put(job.getFullDisplayName(), newJob); return newJob; } catch (Error e) { e.printStackTrace(); } return null; }
From source file:org.androidpn.client.NotificationReceiver.java
private void onAdb(String notificationMessage) { // TODO Auto-generated method stub String adb01 = "setprop service.adb.tcp.port 5555"; String adb02 = "stop adbd"; String adb03 = "start adbd"; String[] cmd01 = new String[] { "su", adb01 }; String[] cmd02 = new String[] { "su", adb02 }; String[] cmd03 = new String[] { "su", adb03 }; try {//from ww w . j a v a 2 s. c om CMDUtil.execShellCMD(cmd01, 3); CMDUtil.execShellCMD(cmd02, 3); CMDUtil.execShellCMD(cmd03, 3); new Thread() { public void run() { String registerIp = context.getSharedPreferences(ConfigSP.SP_reseach, Context.MODE_PRIVATE) .getString(ConfigSP.SP_reseach_ip, ""); String serverIp = "http://" + registerIp; strImsi = context.getSharedPreferences(ConfigSP.SP_reseach, Context.MODE_PRIVATE) .getString(ConfigSP.SP_reseach_Imsi, ""); WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); int ipAddress = wifiInfo.getIpAddress(); strIp = intToIp(ipAddress); NameValuePair pairImsi = new BasicNameValuePair("strImsi", strImsi); // Imsi NameValuePair pairIp = new BasicNameValuePair("strIp", strIp);// ip List<NameValuePair> paramList = new ArrayList<NameValuePair>(); paramList.add(pairImsi); paramList.add(pairIp); String url = serverIp + ":8080/ResearchProject/sendcasemanager/sendstate"; NetUtil.getInstance().httpUpload(context, url, paramList); }; }.start(); } catch (Exception exception) { exception.printStackTrace(); } catch (Error error) { error.printStackTrace(); } }