List of usage examples for java.lang RuntimeException printStackTrace
public void printStackTrace()
From source file:opennlp.tools.textsimilarity.TextProcessor.java
public static String trimPunctuationFromStart(String text) { try {/*from ww w. ja va 2s . com*/ int start = 0; int end = text.length() - 1; // trim from the start for (int i = 0; i < text.length(); i++) { if (!isPunctuation(text.charAt(i))) break; start++; } if (start == text.length()) { return ""; } return text.substring(start, end + 1); } catch (RuntimeException e) { LOG.severe("RuntimeException " + e); e.printStackTrace(); return ""; } }
From source file:com.ey.dao.cmd.DefaultCommand.java
public <T> T execute(Command<T> command) { try {/*from w w w . j a v a 2 s . com*/ return command.execute(this.getSessionFactory().getCurrentSession()); } catch (RuntimeException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
public static <S1 extends Shape, S2 extends Shape> int SpatialJoin_planeSweep(final S1[] R, final S2[] S, ResultCollector2<S1, S2> output, Reporter reporter) { int count = 0; final Comparator<Shape> comparator = new Comparator<Shape>() { @Override//from w w w .j av a 2 s. c o m public int compare(Shape o1, Shape o2) { if (o1.getMBR().x1 == o2.getMBR().x1) return 0; return o1.getMBR().x1 < o2.getMBR().x1 ? -1 : 1; } }; long t1 = System.currentTimeMillis(); LOG.info("Joining arrays " + R.length + " with " + S.length); Arrays.sort(R, comparator); Arrays.sort(S, comparator); int i = 0, j = 0; try { while (i < R.length && j < S.length) { S1 r; S2 s; if (comparator.compare(R[i], S[j]) < 0) { r = R[i]; int jj = j; while ((jj < S.length) && ((s = S[jj]).getMBR().x1 <= r.getMBR().x2)) { if (r.isIntersected(s)) { if (output != null) output.collect(r, s); count++; } jj++; if (reporter != null) reporter.progress(); } i++; } else { s = S[j]; int ii = i; while ((ii < R.length) && ((r = R[ii]).getMBR().x1 <= s.getMBR().x2)) { if (r.isIntersected(s)) { if (output != null) output.collect(r, s); count++; } ii++; if (reporter != null) reporter.progress(); } j++; } if (reporter != null) reporter.progress(); } } catch (RuntimeException e) { e.printStackTrace(); } long t2 = System.currentTimeMillis(); LOG.info("Finished plane sweep in " + (t2 - t1) + " millis and found " + count + " pairs"); return count; }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
public static <S1 extends Shape, S2 extends Shape> int SpatialJoin_planeSweepFilterOnly(final S1[] R, final S2[] S, ResultCollector2<S1, S2> output, Reporter reporter) { int count = 0; final Comparator<Shape> comparator = new Comparator<Shape>() { @Override/*from w w w. j av a 2s . c o m*/ public int compare(Shape o1, Shape o2) { if (o1.getMBR().x1 == o2.getMBR().x1) return 0; return o1.getMBR().x1 < o2.getMBR().x1 ? -1 : 1; } }; long t1 = System.currentTimeMillis(); LOG.info("Joining arrays " + R.length + " with " + S.length); Arrays.sort(R, comparator); Arrays.sort(S, comparator); int i = 0, j = 0; try { while (i < R.length && j < S.length) { S1 r; S2 s; if (comparator.compare(R[i], S[j]) < 0) { r = R[i]; int jj = j; while ((jj < S.length) && ((s = S[jj]).getMBR().x1 <= r.getMBR().x2)) { if (r.getMBR().isIntersected(s.getMBR())) { if (output != null) output.collect(r, s); count++; } jj++; if (reporter != null) reporter.progress(); } i++; } else { s = S[j]; int ii = i; while ((ii < R.length) && ((r = R[ii]).getMBR().x1 <= s.getMBR().x2)) { if (r.getMBR().isIntersected(s.getMBR())) { if (output != null) output.collect(r, s); count++; } ii++; } j++; if (reporter != null) reporter.progress(); } if (reporter != null) reporter.progress(); } } catch (RuntimeException e) { e.printStackTrace(); } long t2 = System.currentTimeMillis(); LOG.info("Finished plane sweep filter only in " + (t2 - t1) + " millis and found " + count + " pairs"); return count; }
From source file:net.itransformers.topologyviewer.edgetooltip.DefaultEdgeTooltipTransformer.java
public String transform(String edge) { try {/*from w w w . j av a 2 s . c om*/ StringBuilder sb = new StringBuilder(); GraphMLMetadata<String> stringGraphMLMetadata = edgeMetadatas.get(tooltipType.getDataKey()); Transformer<String, String> transformer = stringGraphMLMetadata.transformer; final String value = transformer.transform(edge); if (value != null) { sb.append(value); } return sb.toString(); } catch (RuntimeException rte) { rte.printStackTrace(); throw rte; } }
From source file:com.sonar.sslr.test.minic.integration.MiniCOwnExamplesTest.java
@Test public void test() throws Exception { Collection<File> files = FileUtils.listFiles(new File("src/test/resources/MiniCIntegration"), null, true); assertThat(files).isNotEmpty();//w w w.java 2s . co m for (File file : files) { try { parser.parse(file); } catch (RuntimeException e) { e.printStackTrace(); throw e; } } }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
/** * @param R//from w w w .j a v a 2 s.c om * @param S * @param output * @return * @throws IOException */ public static <S1 extends Shape, S2 extends Shape> int SpatialJoin_planeSweep(List<S1> R, List<S2> S, ResultCollector2<S1, S2> output, Reporter reporter) throws IOException { int count = 0; Comparator<Shape> comparator = new Comparator<Shape>() { @Override public int compare(Shape o1, Shape o2) { if (o1.getMBR().x1 == o2.getMBR().x1) return 0; return o1.getMBR().x1 < o2.getMBR().x1 ? -1 : 1; } }; long t1 = System.currentTimeMillis(); LOG.info("Joining lists " + R.size() + " with " + S.size()); Collections.sort(R, comparator); Collections.sort(S, comparator); int i = 0, j = 0; try { while (i < R.size() && j < S.size()) { S1 r; S2 s; if (comparator.compare(R.get(i), S.get(j)) < 0) { r = R.get(i); int jj = j; while ((jj < S.size()) && ((s = S.get(jj)).getMBR().x1 <= r.getMBR().x2)) { // Check if r and s are overlapping but not the same object // for self join if (r.isIntersected(s) && !r.equals(s)) { if (output != null) output.collect(r, s); count++; } jj++; if (reporter != null) reporter.progress(); } i++; } else { s = S.get(j); int ii = i; while ((ii < R.size()) && ((r = R.get(ii)).getMBR().x1 <= s.getMBR().x2)) { if (r.isIntersected(s) && !r.equals(s)) { if (output != null) output.collect(r, s); count++; } ii++; if (reporter != null) reporter.progress(); } j++; } if (reporter != null) reporter.progress(); } } catch (RuntimeException e) { e.printStackTrace(); } long t2 = System.currentTimeMillis(); LOG.info("Finished plane sweep in " + (t2 - t1) + " millis and found " + count + " pairs"); return count; }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
/** * Self join of rectangles. This method runs faster than the general version * because it just performs the filter step based on the rectangles. * @param output/*from w w w. j a va2 s. c o m*/ * @return * @throws IOException */ public static <S1 extends Rectangle, S2 extends Rectangle> int SpatialJoin_rectangles(final S1[] R, final S2[] S, OutputCollector<S1, S2> output, Reporter reporter) throws IOException { int count = 0; final Comparator<Rectangle> comparator = new Comparator<Rectangle>() { @Override public int compare(Rectangle o1, Rectangle o2) { if (o1.x1 == o2.x1) return 0; return o1.x1 < o2.x1 ? -1 : 1; } }; long t1 = System.currentTimeMillis(); LOG.info("Spatial Join of " + R.length + " X " + S.length + "shapes"); Arrays.sort(R, comparator); Arrays.sort(S, comparator); int i = 0, j = 0; try { while (i < R.length && j < S.length) { S1 r; S2 s; if (comparator.compare(R[i], S[j]) < 0) { r = R[i]; int jj = j; while ((jj < S.length) && ((s = S[jj]).getMBR().x1 <= r.getMBR().x2)) { if (r.isIntersected(s)) { if (output != null) output.collect(r, s); count++; } jj++; } i++; if (reporter != null) reporter.progress(); } else { s = S[j]; int ii = i; while ((ii < R.length) && ((r = R[ii]).getMBR().x1 <= s.getMBR().x2)) { if (r.isIntersected(s)) { if (output != null) output.collect(r, s); count++; } ii++; if (reporter != null) reporter.progress(); } j++; } if (reporter != null) reporter.progress(); } } catch (RuntimeException e) { e.printStackTrace(); } long t2 = System.currentTimeMillis(); LOG.info("Finished spatial join plane sweep in " + (t2 - t1) + " millis and found " + count + " pairs"); return count; }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
/** * Self join of rectangles. This method runs faster than the general version * because it just performs the filter step based on the rectangles. * @param rs// w w w . j av a 2s .c o m * @param output * @return * @throws IOException */ public static <S extends Rectangle> int SelfJoin_rectangles(final S[] rs, OutputCollector<S, S> output, Progressable reporter) throws IOException { int count = 0; final Comparator<Rectangle> comparator = new Comparator<Rectangle>() { @Override public int compare(Rectangle o1, Rectangle o2) { if (o1.x1 == o2.x1) return 0; return o1.x1 < o2.x1 ? -1 : 1; } }; long t1 = System.currentTimeMillis(); LOG.info("Self Join of " + rs.length + " shapes"); Arrays.sort(rs, comparator); int i = 0, j = 0; try { while (i < rs.length && j < rs.length) { S r; S s; if (rs[i].x1 < rs[j].x1) { r = rs[i]; int jj = j; while ((jj < rs.length) && ((s = rs[jj]).x1 <= r.x2)) { if (r != s && r.isIntersected(s)) { if (output != null) { output.collect(r, s); } count++; } jj++; if (reporter != null) reporter.progress(); } i++; } else { s = rs[j]; int ii = i; while ((ii < rs.length) && ((r = rs[ii]).x1 <= s.x2)) { if (r != s && r.isIntersected(s)) { if (output != null) { output.collect(r, s); } count++; } ii++; if (reporter != null) reporter.progress(); } j++; } if (reporter != null) reporter.progress(); } } catch (RuntimeException e) { e.printStackTrace(); } long t2 = System.currentTimeMillis(); LOG.info("Finished self plane sweep in " + (t2 - t1) + " millis and found " + count + " pairs"); return count; }
From source file:net.itransformers.topologyviewer.edgetooltip.CSVEdgeTooltipTransformer.java
public String transform(String edge) { try {/*from www. j av a 2 s. co m*/ StringBuilder sb = new StringBuilder(); Set<String> valueSet = new HashSet<String>(); GraphMLMetadata<String> stringGraphMLMetadata = edgeMetadatas.get(tooltipType.getDataKey()); if (stringGraphMLMetadata != null) { Transformer<String, String> transformer = stringGraphMLMetadata.transformer; final String value = transformer.transform(edge); if (value != null) { valueSet.addAll(Arrays.asList(value.split(","))); } } sb.append(valueSet); return sb.toString(); } catch (RuntimeException rte) { rte.printStackTrace(); throw rte; } }