Package org.netbeans.modules.exceptions.entity

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


        innocents = PersistenceUtils.getInstance().getAll(InnocentClass.class);
        mappings = PersistenceUtils.getInstance().getAll(SourcejarMapping.class);
    }

    private Component getComponentFromSourceJar(EntityManager em, StackTraceElement stackTraceElement) {
        SourcejarMapping bestMapping = null;
        String methodName = Method.getMethodNameFromSTE(stackTraceElement);
        Method method = (Method) PersistenceUtils.getExist(em, "Method.findByName", methodName);
        if ((method != null) && (method.getSourcejar() != null)){
            for (SourcejarMapping mapping: mappings){
                if (!mapping.matches(method.getSourcejar())){
                    continue;
                }
                if ((bestMapping == null) || (mapping.getSourcejar().length() > bestMapping.getSourcejar().length())){
                    bestMapping = mapping;
                }
            }
        }
        if (bestMapping != null){
          return new Component(bestMapping.getComponent().toLowerCase(), bestMapping.getSubcomponent());
        }
        return null;
    }
View Full Code Here


            Component comp = getComponentFromSourceJar(em, stes[i]);
            if (comp == null){
                comp = fromJar(stes[i].getFileName());
                if (comp != null){
                    String jarName = comp.getSubComponent();
                    SourcejarMapping bestMapping = null;
                    for (SourcejarMapping mapping: mappings){
                        if (!mapping.matches(jarName)){
                            continue;
                        }
                        if ((bestMapping == null) || (mapping.getSourcejar().length() > bestMapping.getSourcejar().length())){
                            bestMapping = mapping;
                        }
                    }
                    if (bestMapping != null){
                      comp = new Component(bestMapping.getComponent(), bestMapping.getSubcomponent());
                    }
                }
            }
            if (comp != null){
                return comp;
View Full Code Here

                    new StackTraceElement("org.openide.util.Mutex", "doEvent", "file", 45)
                });
        assertNotNull(comp);// mapping

        em.getTransaction().begin();
        SourcejarMapping mapping = em.find(SourcejarMapping.class, "org-openide-util.jar");
        mapping.setComponent("comp1");
        mapping.setSubcomponent("subcomp1");
        em.merge(mapping);
        em.getTransaction().commit();
        matcher.reload();

        comp = match(matcher, new StackTraceElement[]{
                    new StackTraceElement("org.openide.util.Mutex", "doEvent", "file", 45)
                });

        assertEquals("comp1", comp.getComponent());
        assertEquals("subcomp1", comp.getSubComponent());

        comp = match(matcher, new StackTraceElement[]{
                    new StackTraceElement("org.netbeans.visualweb.insync.models.FacesModel", "syncImpl", "file", 45)
                });
        assertNull(comp);
        //----------------------//

        mapping = new SourcejarMapping("testingfile");
        mapping.setComponent("comp2");
        mapping.setSubcomponent("subcomp2");
        perUtils.persist(mapping);
        matcher.reload();


        comp = match(matcher, new StackTraceElement[]{
                    new StackTraceElement("org.openide.util.Mutex", "doEvent", "file", 45)
                });

        assertEquals("comp1", comp.getComponent());
        assertEquals("subcomp1", comp.getSubComponent());

        comp = match(matcher, new StackTraceElement[]{
                    new StackTraceElement("org.netbeans.modules.visualweb.insync.models.FacesModel", "syncImpl", "file", 45)
                });

        assertEquals("comp2", comp.getComponent());
        assertEquals("subcomp2", comp.getSubComponent());

        mapping = new SourcejarMapping("testingfile.jar");
        mapping.setComponent("comp3");
        mapping.setSubcomponent("subcomp3");
        perUtils.persist(mapping);
        matcher.reload();

        comp = match(matcher, new StackTraceElement[]{
                    new StackTraceElement("org.netbeans.modules.visualweb.insync.models.FacesModel", "syncImpl", "file", 45)
View Full Code Here

            throws Exception {
        LOG.log(Level.FINE, "{0}.execute()", SourceJarMappingAction.class.getName());
        EntityManager em = getEntityManager(request);
        final String drop = request.getParameter("drop");
        if (drop != null) {
            SourcejarMapping removed = (SourcejarMapping) PersistenceUtils.getExist(em, "SourcejarMapping.findBySourcejar", drop);
            em.getTransaction().begin();
            em.remove(removed);
            em.getTransaction().commit();
        } else {
            SourcejarMappingBean smb = (SourcejarMappingBean) form;
            if (smb == null || smb.isClean()){
                return mapping.getInputForward();
            }
            SourcejarMapping mapp = new SourcejarMapping(smb.getSourcejar().toLowerCase());
            mapp.setComponent(smb.getComponent().toLowerCase());
            mapp.setSubcomponent(smb.getSubcomponent());
            em.getTransaction().begin();
            em.persist(mapp);
            em.getTransaction().commit();
            smb.reset();
        }
View Full Code Here

TOP

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

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.