1 17 18 package org.netbeans.server.uihandler; 19 20 import java.awt.EventQueue ; 21 import java.util.Collections ; 22 import java.util.HashMap ; 23 import java.util.Map ; 24 import java.util.logging.Level ; 25 import java.util.logging.LogRecord ; 26 import java.util.logging.Logger ; 27 28 35 public class Exceptions extends Statistics<Map <Integer ,LogRecord >> { 36 private static final Logger LOG = Logger.getLogger(Exceptions.class.getName()); 37 public static final String USER_CONFIGURATION = "UI_USER_CONFIGURATION"; 39 40 41 public Exceptions() { 42 super("Exceptions"); 43 } 44 45 protected Map <Integer , LogRecord > newData() { 46 return Collections.emptyMap(); 47 } 48 49 protected Map <Integer , LogRecord > process(LogRecord rec) { 50 Map <Integer , LogRecord > coll = new HashMap <Integer , LogRecord >(); 51 if (USER_CONFIGURATION.equals(rec.getMessage())){ 52 coll.put(0, rec); 53 } 54 if (rec.getThrown()!= null){ 55 coll.put(1, rec); 56 57 } 58 return coll; 59 } 60 61 protected Map <Integer , LogRecord > join(Map <Integer , LogRecord > one, 62 Map <Integer , LogRecord > two) { 63 Map <Integer , LogRecord > result = new HashMap <Integer , LogRecord >(); 64 if (one.get(0) != null) result.put(0, one.get(0)); 66 else if (two.get(0) != null) result.put(0, two.get(0)); 67 if (two.get(1)!=null) result.put(1, two.get(1)); 69 else if (one.get(1) != null) result.put(1, one.get(1)); 70 return result; 71 } 72 73 76 protected Map <Integer , LogRecord > finishSessionUpload(String userId, 77 int sessionNumber, 78 boolean initialParse, 79 Map <Integer , LogRecord > data) { 80 int issueId = -2; 81 if (initialParse){ 82 LogRecord metaData = data.get(0); 83 if (metaData==null) LOG.info("METADATA = NULL"); else if (metaData.getParameters()==null) LOG.info("PARAMETERS = NULL"); else{ 86 int length = metaData.getParameters().length; 87 if (length==6){ Throwable thrown = null; 89 if (data.get(1) != null) thrown = data.get(1).getThrown(); 90 if (thrown != null){ 91 EventQueue.invokeLater(new DbInsertion(metaData, thrown, 92 userId + "." + Integer.toString(sessionNumber))); issueId = Utils.checkIssue(thrown); 94 }else{ 95 LOG.info("THROWN = NULL"); } 97 } 98 } 99 } 100 LogRecord log = new LogRecord (Level.CONFIG, Integer.toString(issueId)); 101 Map <Integer , LogRecord > d = new HashMap <Integer , LogRecord >(); 102 d.put(2, log); 103 LOG.finest("EXCEPTIONS UPLOAD FINISHED"); return d; 105 } 106 107 } 108 | Popular Tags |