Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Stacktrace


     */
    private static List<Stacktrace> reduceCandidates(EntityManager em, List<Stacktrace> candidates, Throwable innerThrowable) {
        List<Stacktrace> accepted = new LinkedList<Stacktrace>();
        List<Stacktrace> acceptedParents = new LinkedList<Stacktrace>();
        for (Stacktrace stack : candidates) {
            Stacktrace parent = stack.getStacktrace();
            if (parent == null){
                accepted.add(stack);
            }else if (FilteringUtils.verifyTheSameStacktraces(em, innerThrowable, parent, 5)){
                acceptedParents.add(parent);
            }
View Full Code Here


        }

        private void removeClosed(Set<Stacktrace> stackTraceIds) {
            Iterator<Stacktrace> it = stackTraceIds.iterator();
            while (it.hasNext()){
                Stacktrace next = it.next();
                Exceptions exc = FilteringUtils.getRootExceptions(next);
                if (exc == null){
                    Logger.getLogger(CheckingFilter.class.getName()).log(Level.SEVERE, "stacktrace {0} has null exception", next.getId());
                }
                if (!PersistenceUtils.exceptionIsOpen(exc)){
                    it.remove();
                }
            }
View Full Code Here

        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        Exceptions exc = new Exceptions(exceptionId);
        Report report = new Report(exceptionId);
        exc.setReportId(report);
        Stacktrace stack = new Stacktrace(Utils.getNextId(Stacktrace.class));
        Logfile logfile = new Logfile(userId, 0);
        ProductVersion pVersion = new ProductVersion(Utils.getNextId(ProductVersion.class));
        pVersion.setProductVersion("pVersion");
        Nbversion version = new Nbversion(Utils.getNextId(Nbversion.class));
        version.setVersion("version");
View Full Code Here

    }

    @Test
    public void testGetStacktraceLinesSimple(){
        Exceptions exc = new Exceptions(1);
        Stacktrace st = new Stacktrace(1);
        Stacktrace st2 = new Stacktrace(2);
        exc.setStacktrace(st);
        st.setAnnotation(st2);
        st.setMessage("st");
        st.setLineCollection(Collections.<Line>emptyList());
        Method m1 = new Method(1);
        m1.setName("test1");
        Method m2 = new Method(2);
        m2.setName("test2");
        Line l1 = new Line(1,1,3,1);
        Line l2 = new Line(1,1,3,2);
        Line l3 = new Line(1,1,3,3);
        Line l4 = new Line(1,1,3,4);
        l1.setMethod(m1);
        l2.setMethod(m2);
        l3.setMethod(m1);
        l4.setMethod(m2);
        List<Line> lines = new ArrayList<Line>();
        lines.add(l1);
        lines.add(l2);
        lines.add(l3);
        lines.add(l4);
        st2.setMessage("st2");
        st2.setLineCollection(lines);
        String result = Utils.getStacktraceLines(exc, 5,"");
        assertTrue(result.contains("test1("));
        assertTrue(result.contains("test2("));
    }
View Full Code Here

        Set<Exceptions> result = new HashSet<Exceptions>();
        // get stacktraces by id -- temporary solution
        for (Iterator<Integer> stackId = list.iterator(); stackId.hasNext();) {
            Integer key = stackId.next();
            Stacktrace st = em.find(Stacktrace.class, key);
            if ((st == null) || (st.getExceptions() == null)) {
                continue;
            }
            result.add(st.getExceptions());
        }
       
        if (result.isEmpty()){
            return mapping.findForward(STACKTRACE);
        }
View Full Code Here

            Slowness slowness = new Slowness(i);
            slowness.setActionTime(Long.valueOf(i));
            slowness.setSuspiciousMethod(m);
            sbm = slowness;
        } else {
            Stacktrace stack = new Stacktrace(i);
            stack.setMessage("Something is wrong");
            em.persist(stack);
            Exceptions exc = new Exceptions(i);
            exc.setStacktrace(stack);
            sbm = exc;
        }
View Full Code Here

        addLog(log, "NB2040811605");
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        Exceptions exc = em.find(Exceptions.class, 1);
        assertNotNull(exc);
        Stacktrace stack = exc.getStacktrace();
        String result = new String(Utils.format(stack));
        em.getTransaction().commit();
        em.close();

        assertTrue(result.contains("NullPointerException"));
View Full Code Here

     * Test of sameMessages method, of class FilteringUtils.
     */
    @Test
    public void testSameMessages() {
        Throwable thrown = new Throwable("java.util.MissingResourceException: Can't find resource for bundle org.openide.util.NbBundle$PBundle, key Actions/Window");
        Stacktrace stack = new Stacktrace();
        stack.setMessage("java.util.MissingResourceException: Can't find resource for bundle org.openide.util.NbBundle$PBundle, key Actions/View");
        assertFalse(FilteringUtils.sameMessages(thrown, stack));
    }
View Full Code Here

        TestLogFileTask task = new TestLogFileTask(em, log);
        Nbuser user = new Nbuser(1);
        user.setName("HALLO");
        org.netbeans.modules.exceptions.entity.Exceptions exc = new org.netbeans.modules.exceptions.entity.Exceptions(100);
        Report report = new Report(100);
        Stacktrace stacktrace = new Stacktrace(100);
        stacktrace.setLineCollection(Collections.<Line>emptyList());
        stacktrace.setClass1("NullPointerException");
        exc.setReportId(report);
        exc.setLogfileId(log);
        exc.setStacktrace(stacktrace);
        report.setComponent("user.dir");
        report.setSubcomponent("some.jar");
View Full Code Here

        doPrintStackTrace(new PrintStream(os), stacktrace);
        return os.toByteArray();
    }

    private static void doPrintStackTrace(PrintStream printStream, Stacktrace stacktrace) {
        Stacktrace lower = stacktrace.getAnnotation();
        if (lower != null) {
            doPrintStackTrace(printStream, lower);
            printStream.print("Caused: ");                  //NOI18N
        }
        String summary = stacktrace.getMessage();
        if (lower != null) {
            String suffix = ": " + lower;
            if (summary.endsWith(suffix)) {
                summary = summary.substring(0, summary.length() - suffix.length());
            }
        }
        printStream.println(summary);
        List<Line> lines = stacktrace.getSortedLines();
        int end = lines.size();
        Stacktrace higher = stacktrace.getStacktrace();
        if (higher != null) {
            List<Line> higherLines = higher.getSortedLines();
            while (end > 0) {
                int higherEnd = end + higherLines.size() - lines.size();
                if (higherEnd <= 0 || !linesAreEqual(higherLines.get(higherEnd - 1), lines.get(end - 1))) {
                    break;
                }
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Stacktrace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.