Examples of JadxException


Examples of jadx.core.utils.exceptions.JadxException

        RegisterArg nameArg = (RegisterArg) insn.getArg(0);
        // InsnArg pos = insn.getArg(1);
        // TODO add check: pos == j
        String name = (String) nameArg.getConstValue(cls.dex());
        if (name == null) {
          throw new JadxException("Unknown enum field name: " + cls);
        }
        EnumField field = new EnumField(name, insn.getArgsCount() - 2);
        attr.getFields().add(field);
        for (int i = 2; i < insn.getArgsCount(); i++) {
          InsnArg constrArg;
          InsnArg iArg = insn.getArg(i);
          if (iArg.isLiteral()) {
            constrArg = iArg;
          } else {
            constrArg = CodeShrinker.inlineArgument(staticMethod, (RegisterArg) iArg);
            if (constrArg == null) {
              throw new JadxException("Can't inline constructor arg in enum: " + cls);
            }
          }
          field.getArgs().add(constrArg);
        }
View Full Code Here

Examples of jadx.core.utils.exceptions.JadxException

    loadFiles(Collections.singletonList(file));
  }

  public void loadFiles(List<File> files) throws JadxException {
    if (files.isEmpty()) {
      throw new JadxException("Empty file list");
    }
    inputFiles.clear();
    for (File file : files) {
      try {
        inputFiles.add(new InputFile(file));
      } catch (IOException e) {
        throw new JadxException("Error load file: " + file, e);
      }
    }
    parse();
  }
View Full Code Here

Examples of jadx.core.utils.exceptions.JadxException

      LOG.info("output directory: " + outDirName);
      outputDir = new File(outDirName);
      jadxArgs.setOutputDir(outputDir);
    }
    if (outputDir.exists() && !outputDir.isDirectory()) {
      throw new JadxException("Output directory exists as file " + outputDir);
    }
    return true;
  }
View Full Code Here

Examples of jadx.core.utils.exceptions.JadxException

      printUsage();
      return false;
    }
    try {
      if (threadsCount <= 0) {
        throw new JadxException("Threads count must be positive");
      }
      if (files != null) {
        for (String fileName : files) {
          File file = new File(fileName);
          if (file.exists()) {
            input.add(file);
          } else {
            throw new JadxException("File not found: " + file);
          }
        }
      }
      if (input.size() > 1) {
        throw new JadxException("Only one input file is supported");
      }
      if (outDirName != null) {
        outputDir = new File(outDirName);
      }
      if (isVerbose()) {
View Full Code Here

Examples of jadx.core.utils.exceptions.JadxException

    try {
      LOG.info("converting to dex: {} ...", jarFile.getName());
      JavaToDex j2d = new JavaToDex();
      byte[] ba = j2d.convert(jarFile.getAbsolutePath());
      if (ba.length == 0) {
        throw new JadxException(j2d.isError() ? j2d.getDxErrors() : "Empty dx output");
      } else if (j2d.isError()) {
        LOG.warn("dx message: {}", j2d.getDxErrors());
      }
      return new Dex(ba);
    } catch (Throwable e) {
View Full Code Here

Examples of jadx.core.utils.exceptions.JadxException

  public byte[] convert(String javaFile) throws JadxException {
    ByteArrayOutputStream errOut = new ByteArrayOutputStream();
    try {
      DxConsole.err = new PrintStream(errOut, true, CHARSET_NAME);
    } catch (UnsupportedEncodingException e) {
      throw new JadxException(e.getMessage(), e);
    }
    PrintStream oldOut = System.out;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
      System.setOut(new PrintStream(baos, true, CHARSET_NAME));
      DxArgs args = new DxArgs("-", new String[]{javaFile});
      Main.run(args);
      baos.close();
    } catch (Throwable e) {
      throw new JadxException("dx exception: " + e.getMessage(), e);
    } finally {
      System.setOut(oldOut);
    }
    try {
      // errOut also contains warnings
      dxErrors = errOut.toString(CHARSET_NAME);
    } catch (UnsupportedEncodingException e) {
      throw new JadxException("Can't save error output", e);
    }
    return baos.toByteArray();
  }
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.