Examples of AnalysisException


Examples of com.taobao.top.analysis.exception.AnalysisException

       
        if (subKeys.size() > 0)
          entry.setSubKeys(subKeys);
      }
      else
        throw new AnalysisException("entry key should not be null! entry name :" + entry.getName() + ", report:" + report.getFile());
    }
   

    if (start.getAttributeByName(new QName("", "value")) != null) {
      String content = start.getAttributeByName(new QName("", "value"))
View Full Code Here

Examples of com.taobao.top.analysis.exception.AnalysisException

      job.getJobTasks().clear();
   
    JobConfig jobConfig = job.getJobConfig();
   
    if (jobConfig == null)
      throw new AnalysisException("generateJobTasks error, jobConfig is null.");
   
    //允许定义多个job通过逗号分割
    if (jobConfig.getInputParams() == null && jobConfig.getInput().indexOf(",") <= 0)
    {
      JobTask jobTask = new JobTask(jobConfig);
      jobTask.setStatisticsRule(job.getStatisticsRule());
      jobTask.setJobName(job.getJobName());
      jobTask.setUrl(jobTask.getInput());
      jobTask.setJobSourceTimeStamp(job.getJobSourceTimeStamp());
     
      jobTask.setInput(generateJobInputAddition(jobTask.getInput(),job));
      jobTask.setTaskId(getTaskIdFromUrl(job.getJobName(), jobTask.getUrl(), job.getTaskCount()));
     
      /**
       * 目前使用master游标管理方式的只有hub
       */
      Long begin = jobConfig.getBegin();
      if(begin == null)
          begin = 0L;
      if(jobTask.getUrl().startsWith("hub://")) {
          String key = jobTask.getUrl().substring(0, jobTask.getUrl().indexOf('?'));
          job.getCursorMap().putIfAbsent(key, begin);
          job.getTimestampMap().putIfAbsent(key, -1L);
          jobTask.setJobSourceTimeStamp(job.getTimestampMap().get(key));
      }
      job.addTaskCount();
      jobTask.getTailCursor().set(jobConfig.getInit());
      job.getJobTasks().add(jobTask);
    }
    else
    {
      if (jobConfig.getInputParams() != null)
      {
        String[] p = StringUtils.split(jobConfig.getInputParams(),":");
        String key = new StringBuilder("$").append(p[0]).append("$").toString();
       
        if (p.length != 2 || jobConfig.getInput().indexOf(key) < 0)
          throw new AnalysisException("inputParams invalidate : " + jobConfig.getInputParams());
       
        String[] params = StringUtils.split(p[1],",");
       
        for(String ps : params)
        {
View Full Code Here

Examples of com.taobao.top.analysis.exception.AnalysisException

   
    if(operation.startsWith(AnalysisConstants.CONDITION_LIKE_STR)) {
        return AnalysisConstants.CONDITION_LIKE;
    }

    throw new AnalysisException("Entry Operation not support!");

  }
View Full Code Here

Examples of com.taobao.top.analysis.exception.AnalysisException

    }
    if (operation == AnalysisConstants.OPERATE_RIDE_CHAR) {
      return AnalysisConstants.OPERATE_RIDE;
    }

    throw new AnalysisException("Entry Operation not support!");

  }
View Full Code Here

Examples of org.jf.dexlib2.analysis.AnalysisException

    private void addAnalyzedInstructionMethodItems(List<MethodItem> methodItems) {
        MethodAnalyzer methodAnalyzer = new MethodAnalyzer(classDef.options.classPath, method,
                classDef.options.inlineResolver);

        AnalysisException analysisException = methodAnalyzer.getAnalysisException();
        if (analysisException != null) {
            // TODO: need to keep track of whether any errors occurred, so we can exit with a non-zero result
            methodItems.add(new CommentMethodItem(
                    String.format("AnalysisException: %s", analysisException.getMessage()),
                    analysisException.codeAddress, Integer.MIN_VALUE));
            analysisException.printStackTrace(System.err);
        }

        List<AnalyzedInstruction> instructions = methodAnalyzer.getAnalyzedInstructions();

        int currentCodeAddress = 0;
View Full Code Here

Examples of org.mitre.sim.analysis.instrument.AnalysisException

      String qualifiedName = getQualifiedName(className);
      String aspectName = nameForCombining + "_instrument";
      File aspectFile = new File(directoryPath, aspectName + ".aj");
      if (aspectFile.exists()) aspectFile.delete();
      if (!aspectFile.createNewFile())
        throw new AnalysisException("aspect file " + aspectFile
            + " already exists");
      ps = new PrintStream(new FileOutputStream(aspectFile));
      ps.println("package " + aspectPathInfo.getPackageName() + ";");
      ps.println("import java.util.List;");
      ps.println("import java.util.HashSet;");
      ps.println("import java.util.ArrayList;");
      ps.println("import java.lang.reflect.Field;");
      ps.println("import java.lang.reflect.Method;");
      ps.println("import org.mitre.sim.analysis.instrument.InstrumentedTrigger;");
      //aspect is privileged to allow it access to Triggers' private fields
      ps.println("\nprivileged aspect " + aspectName + " {");
     
      ps.println("\n  declare parents : " + unqualifiedName
          + " implements InstrumentedTrigger;");
      ps.println("  private ArrayList " + unqualifiedName + ".earlyBoundNotifiers"
          + " = new ArrayList();");
     
      AspectData.TriggerRecord tr = (AspectData.TriggerRecord)aspectData
        .getTriggerRecord(className);
      String enclosingClassName = null, unqualifiedEnclosingClassName = null;
      String enclosingNameForCombining = null;
      if (tr.enclosingClassName != null) {
        enclosingClassName = getQualifiedName(tr.enclosingClassName);
        unqualifiedEnclosingClassName = getUnqualifiedName(tr.enclosingClassName);
        enclosingNameForCombining = unqualifiedEnclosingClassName.replace('.', '_');
      }
      if (tr.enclosingClassName != null && tr.enclosingCollections.size() > 0)
        addTheAddNotifierMethod(ps, unqualifiedName);
     
      ps.println("\n  public List " + unqualifiedName
          + ".getNotifiers(InstrumentedTrigger it) {");
      ps.println("    ArrayList allNotifiers = new ArrayList();");
      //for each Collection class field in Trigger
      for (Iterator cc = tr.collectionFields.keySet().iterator(); cc.hasNext(); ) {
        String fieldName = (String)cc.next();
        ps.println("    allNotifiers.add(((" + unqualifiedName + ")it)."
            + fieldName + ");" );
      }
      //for each Collection class field in enclosing class
      if (enclosingClassName != null) {
        for (Iterator ecc = tr.enclosingCollections.keySet().iterator();
          ecc.hasNext(); ) {
          String fieldName = (String)ecc.next();
          AspectData.EnclosingClassCollectionRecord eccr = (AspectData.EnclosingClassCollectionRecord)
            tr.enclosingCollections.get(fieldName);
          ps.println("    addTortugaNotifier(it,");
          ps.println("      allNotifiers,");
          ps.println("      " + unqualifiedName + ".class,");
          ps.println("      " + unqualifiedEnclosingClassName + ".class,");
          ps.println("      \"" + eccr.accessMethodName + "\",");
          ps.println("      \"" + tr.referenceToEnclosingName + "\");");
        }
      }
      ps.println("    allNotifiers.addAll(earlyBoundNotifiers);" );
      ps.println("    return allNotifiers;" );
      ps.println("  } //getNotifiers");
     
      ps.println("\n  public void " + unqualifiedName + ".addNotifier(Object n)" );
      ps.println("    { earlyBoundNotifiers.add(n); }" );

      //add enclosing class as notifier, if it has primitive fields
      if (enclosingClassName != null && !tr.enclosingPrimitives.isEmpty()) {
        String pointcutName = nameForCombining + "_add_" + enclosingNameForCombining;
        ps.println("\n  pointcut " + pointcutName + "(InstrumentedTrigger trigger)");
        ps.println("    : initialization(public " + unqualifiedName
            + ".new(..)) && target(trigger);" );
        ps.println("\n  after (InstrumentedTrigger trigger) : "
            + pointcutName + "(trigger) {");
        ps.println("    try {");
        ps.println("      Field enclosingThisField = trigger.getClass().getDeclaredField(\""
            + tr.referenceToEnclosingName + "\");");
        ps.println("      enclosingThisField.setAccessible(true);");
        ps.println("      trigger.addNotifier(enclosingThisField.get(trigger));");
        ps.println("    }");
        ps.println("    catch (Exception e) {");
        ps.println("      throw new IllegalStateException(\"See Tortuga Support. "
            + "(\" + e + \" in trigger instrument aspect for field "
            + tr.referenceToEnclosingName + " trigger " + qualifiedName
            + ")\");");
        ps.println("    } //catch");
        ps.println("  } //after" );
      }
      //add trigger class itself as notifier, if it has primitive fields
      if (!tr.primitiveFields.isEmpty()) {
        String pointcutName = nameForCombining + "_add_" + nameForCombining;
        ps.println("\n  pointcut " + pointcutName + "(InstrumentedTrigger trigger)");
        ps.println("    : initialization(public " + unqualifiedName
            + ".new(..)) && target(trigger);" );
        ps.println("\n  after (InstrumentedTrigger trigger) : "
            + pointcutName + "(trigger) {");
        ps.println("    trigger.addNotifier(trigger);" );
        ps.println("  } //after" );
      }
      ps.println("} //aspect");
    }    
    catch (IOException ex) {
      throw new AnalysisException(ex);
    }
    finally {
      if (ps != null) ps.close();
    }
  }
View Full Code Here

Examples of org.mitre.sim.analysis.instrument.AnalysisException

      String qualifiedName = getQualifiedName(className);
      String aspectName = nameForCombining + "_notifier";
      File aspectFile = new File(directoryPath, aspectName + ".aj");
      if (aspectFile.exists()) aspectFile.delete();
      if (!aspectFile.createNewFile())
        throw new AnalysisException("aspect file " + aspectFile
            + " already exists");
      ps = new PrintStream(new FileOutputStream(aspectFile));
      ps.println("package " + aspectPathInfo.getPackageName() + ";");
      ps.println("import org.mitre.sim.exec.Executive;");
      ps.println("import org.mitre.sim.analysis.instrument.Notifier;");
//      ps.println("\npublic aspect " + aspectName + " {");
      ps.println("\nprivileged aspect " + aspectName + " {");
      ps.println("\n  declare parents : " + unqualifiedName
          + " implements Notifier;");
      ps.println("  private Executive " + unqualifiedName + ".exec = null;" );
      ps.println("\n  public void " + unqualifiedName
          + ".setTortugaNotifierExecutive(Executive exec)");
      ps.println("    { this.exec = exec; }" );
      ps.println("  public Executive " + unqualifiedName + ".getTortugaNotifierExecutive()"
          + "\n    { return this.exec; }" );
      //for each primitive field in the Trigger
      for (Iterator pf = primitiveFields.keySet().iterator();
        pf.hasNext(); ) {
        String fieldName = (String)pf.next();
        String signature = (String)primitiveFields.get(fieldName);
        String pointcutName = nameForCombining + "_" + fieldName + "_cut";
        ps.println("\n  pointcut " + pointcutName + "(Notifier notifier)");
        ps.println("    : set(" + signature + " " + unqualifiedName
            + "." + fieldName + ") && target(notifier);" );
        ps.println("\n  after(Notifier notifier) : " + pointcutName
            + "(notifier) {");
        ps.println("    Executive exec = notifier.getTortugaNotifierExecutive();" );
        ps.println("    if (exec != null) exec.conditionMayHaveChanged(notifier);" );
        ps.println("  } //after");
      }
      ps.println("} //aspect");
    }    
    catch (IOException ex) {
      throw new AnalysisException(ex);
    }
    finally {
      if (ps != null) ps.close();
    }
  }
View Full Code Here

Examples of org.mitre.sim.analysis.instrument.AnalysisException

   */
  private static boolean isAnonymous(String className)
  throws AnalysisException
  {
    String[] pathElements = className.split("\\.");
    if (pathElements.length < 1) throw new AnalysisException(
        "Class name " + className + " is invalid");
    String lastElement = pathElements[pathElements.length - 1];
    String[] nameElements = lastElement.split("\\$");
    //anon class name has form <identifier>$<int> or <iden1>$<int>$<iden2>
    boolean isAnonymous = false;
View Full Code Here

Examples of org.mitre.sim.analysis.instrument.AnalysisException

   */
  private static String getUnqualifiedName(String className)
  throws AnalysisException
  {
    String[] pathElements = className.split("\\.");
    if (pathElements.length < 1) throw new AnalysisException(
        "Class name " + className + " is invalid");
    String lastElement = pathElements[pathElements.length - 1];
    String[] nameElements = lastElement.split("\\$");
    //anon class name has form <identifier>$<int> or <iden1>$<int>$<iden2>
    boolean isAnonymous = false;
View Full Code Here

Examples of org.mitre.sim.analysis.instrument.AnalysisException

  throws AnalysisException
  {
    this.className = className;
    this.aspectsRoot = aspectsRoot;
    String[] pathElements = className.split("\\.");
    if (pathElements.length < 1) throw new AnalysisException(
        "Class name " + className + " is invalid");
    unqualifiedClassName = pathElements[pathElements.length - 1];
    StringBuffer path = new StringBuffer();
    for (int i = 0; i < pathElements.length - 1; ++i ) {
      path.append(pathElements[i]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.