Пример #1
0
  /** Initialise le header du fichier temporaire */
  private void initHeaderTmpFile() {
    try {
      FileOutputStream writer_tmp = new FileOutputStream(this);
      FileChannel writer = writer_tmp.getChannel();

      int offset = 0;

      // Taille de la clef
      Tools.write(writer, offset, _key.length());
      offset += 4;
      // Clef
      Tools.write(writer, offset, _key);
      offset += _key.length();
      // Size
      Tools.write(writer, offset, _size);
      offset += 4;
      // piecesize
      Tools.write(writer, offset, _piecesize);
      offset += 4;
      // Buffermap
      int i;
      for (i = 0; i < this.nbPieces(); i++) {
        Tools.write(writer, offset, -1);
        offset += 4;
      }

      writer.force(true);
      writer_tmp.close();
    } catch (Exception e) {
      System.out.println("Unable to create a new tmp file");
      e.printStackTrace();
    }
  }
  protected HighlightSeverity getSeverity(@NotNull RefElement element) {
    final PsiElement psiElement = element.getPointer().getContainingFile();
    if (psiElement != null) {
      final GlobalInspectionContextImpl context = getContext();
      final String shortName = getSeverityDelegateName();
      final Tools tools = context.getTools().get(shortName);
      if (tools != null) {
        for (ScopeToolState state : tools.getTools()) {
          InspectionToolWrapper toolWrapper = state.getTool();
          if (toolWrapper == getToolWrapper()) {
            return context
                .getCurrentProfile()
                .getErrorLevel(HighlightDisplayKey.find(shortName), psiElement)
                .getSeverity();
          }
        }
      }

      final InspectionProfile profile =
          InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
      final HighlightDisplayLevel level =
          profile.getErrorLevel(HighlightDisplayKey.find(shortName), psiElement);
      return level.getSeverity();
    }
    return null;
  }
Пример #3
0
  /**
   * Ecrit la piece donnée dans le fichier temporaire sur le disque
   *
   * @param piece : pièce à écrire
   * @param num : numéros de la pièce
   */
  private synchronized void writePieceTmpFile(byte[] piece, int num) {
    if (num < 0 || num >= this.nbPieces()) {
      throw new IllegalArgumentException();
    }
    if (piece.length > _piecesize) {
      throw new IllegalArgumentException();
    }

    try {
      RandomAccessFile writer_tmp = new RandomAccessFile(this, "rw");
      FileChannel writer = writer_tmp.getChannel();

      int index_piece = ((int) this.length() - this.headerSize()) / _piecesize;

      if (piece.length < _piecesize) {
        piece = Arrays.copyOf(piece, _piecesize);
      }
      Tools.write(writer, 4 + _key.length() + 4 + 4 + 4 * num, index_piece);
      Tools.write(writer, this.headerSize() + _piecesize * index_piece, piece);

      writer.force(true);
      writer_tmp.close();
    } catch (Exception e) {
      System.out.println("Unable to write tmp file piece");
      e.printStackTrace();
    }
  }
 public boolean isToolEnabled(HighlightDisplayKey key, PsiElement element) {
   if (key == null) {
     return false;
   }
   final Tools toolState = getTools(key.toString());
   return toolState != null && toolState.isEnabled(element);
 }
Пример #5
0
  /**
   * Lis et retourne une piece depuis le fichier temporaire sur le disque (la piece doit exister)
   *
   * @param num : numéros de la piece
   */
  private synchronized byte[] readPieceTmpFile(int num) {
    if (num < 0 || num >= this.nbPieces()) {
      throw new IllegalArgumentException();
    }

    try {
      FileInputStream reader_tmp = new FileInputStream(this);
      FileChannel reader = reader_tmp.getChannel();

      int index_piece = Tools.readInt(reader, 4 + _key.length() + 4 + 4 + 4 * num);
      if (index_piece < 0) {
        throw new IllegalArgumentException();
      }

      int size = _piecesize;
      if (num == this.nbPieces() - 1) {
        size = _size - _piecesize * (this.nbPieces() - 1);
      }

      byte[] piece = Tools.readBytes(reader, this.headerSize() + _piecesize * index_piece, size);
      reader_tmp.close();

      return piece;
    } catch (Exception e) {
      System.out.println("Unable to read tmp file piece");
      e.printStackTrace();
    }
    return new byte[0];
  }
 public List<ScopeToolState> getDefaultStates() {
   initInspectionTools();
   final List<ScopeToolState> result = new ArrayList<ScopeToolState>();
   for (Tools tools : myTools.values()) {
     result.add(tools.getDefaultState());
   }
   return result;
 }
 @NotNull
 public InspectionProfileEntry[] getInspectionTools(PsiElement element) {
   initInspectionTools();
   List<InspectionTool> result = new ArrayList<InspectionTool>();
   for (Tools toolList : myTools.values()) {
     result.add((InspectionTool) toolList.getInspectionTool(element));
   }
   return result.toArray(new InspectionTool[result.size()]);
 }
 public void lockProfile(boolean isLocked) {
   for (Tools toolList : myTools.values()) {
     final String key = toolList.getShortName();
     if (isLocked) {
       myDisplayLevelMap.put(key, Boolean.FALSE);
     }
   }
   myLockedProfile = isLocked;
 }
Пример #9
0
 public int getSliceNumber(String label) {
   int slice = 0;
   if (label.length() >= 14 && label.charAt(4) == '-' && label.charAt(9) == '-')
     slice = (int) Tools.parseDouble(label.substring(0, 4), -1);
   else if (label.length() >= 17 && label.charAt(5) == '-' && label.charAt(11) == '-')
     slice = (int) Tools.parseDouble(label.substring(0, 5), -1);
   else if (label.length() >= 20 && label.charAt(6) == '-' && label.charAt(13) == '-')
     slice = (int) Tools.parseDouble(label.substring(0, 6), -1);
   return slice;
 }
 public InspectionProfileEntry getToolById(String id, PsiElement element) {
   initInspectionTools();
   for (Tools toolList : myTools.values()) {
     final InspectionProfileEntry tool = toolList.getInspectionTool(element);
     String toolId =
         tool instanceof LocalInspectionToolWrapper
             ? ((LocalInspectionToolWrapper) tool).getID()
             : tool.getShortName();
     if (id.equals(toolId)) return tool;
   }
   return null;
 }
Пример #11
0
 /**
  * @param expected the expected value
  * @param typeAdapter the body adapter for the cell
  * @param formatter the formatter
  * @param minLenForToggle the value determining whether the content should be rendered as a
  *     collapseable section.
  * @return the formatted content for a cell with a wrong expectation
  */
 public static String makeContentForWrongCell(
     String expected,
     RestDataTypeAdapter typeAdapter,
     CellFormatter<?> formatter,
     int minLenForToggle) {
   StringBuffer sb = new StringBuffer();
   sb.append(Tools.toHtml(expected));
   if (formatter.isDisplayActual()) {
     sb.append(toHtml("\n"));
     sb.append(formatter.label("expected"));
     String actual = typeAdapter.toString();
     sb.append(toHtml("-----"));
     sb.append(toHtml("\n"));
     if (minLenForToggle >= 0 && actual.length() > minLenForToggle) {
       sb.append(makeToggleCollapseable("toggle actual", toHtml(actual)));
     } else {
       sb.append(toHtml(actual));
     }
     sb.append(toHtml("\n"));
     sb.append(formatter.label("actual"));
   }
   List<String> errors = typeAdapter.getErrors();
   if (errors.size() > 0) {
     sb.append(toHtml("-----"));
     sb.append(toHtml("\n"));
     for (String e : errors) {
       sb.append(toHtml(e + "\n"));
     }
     sb.append(toHtml("\n"));
     sb.append(formatter.label("errors"));
   }
   return sb.toString();
 }
Пример #12
0
  /**
   * Créer le fichier complet correspondant Copie et réassemble les données Supprime le fichier
   * temporaire et renvoi le nouveau fichier
   */
  public synchronized FileShared tmpToComplete() {
    String name = this.getName();
    name = name.substring(0, name.length() - ((String) App.config.get("tmpExtension")).length());

    File complete = new File(App.config.get("downloadDir") + File.separator + name);
    if (complete.exists()) {
      throw new IllegalArgumentException();
    }

    try {
      FileOutputStream writer_tmp = new FileOutputStream(complete, true);
      FileChannel writer = writer_tmp.getChannel();

      int i;
      for (i = 0; i < this.nbPieces(); i++) {
        byte[] piece = this.readPieceTmpFile(i);
        Tools.write(writer, 0, piece);
      }

      writer.force(true);
      writer_tmp.close();
    } catch (Exception e) {
      System.out.println("Unable to write complete file");
      e.printStackTrace();
    }

    this.delete();

    return new FileShared(name);
  }
Пример #13
0
  public void transformProcedure(Procedure proc) {
    // For each variable and field, look for that variable-field access
    //  combination, and replace it with the correct representation.
    for (Dim3Var var : implicitvars) {
      for (int entry = 0; entry < var.getNumEntries(); entry++) {
        AccessExpression old =
            // *cetus-1.1*  new AccessExpression(new Identifier(var.getString()),
            new AccessExpression(
                new NameID(var.getString()),
                AccessOperator.MEMBER_ACCESS,
                // *cetus-1.1*  new Identifier(var.getDimEntry(entry)));
                new NameID(var.getDimEntry(entry)));

        Expression replacement = var.getId(entry);

        if (Driver.getOptionValue("CEAN") != null && var == MCUDAUtils.Tidx)
          if (Driver.getOptionValue("CEANv2") != null)
            for (Expression e : MCUDAUtils.getBdim())
              replacement = new ArrayAccess(replacement, new ArraySlice());
          else replacement = new ArrayAccess(replacement, new ArraySlice());

        Tools.replaceAll(proc, old, replacement);
      }
    }
  }
Пример #14
0
  // Normalizes a comparison operation
  private SimpleExpression normalizeCompare() {
    SimpleExpression lhs = getChild(0), rhs = getChild(1);

    // Before normalization ( lhs <op> rhs )
    if (lhs.sop == LIT && rhs.sop == LIT) {
      double diff = lhs.getValue().doubleValue() - rhs.getValue().doubleValue();
      switch (sop) {
        case EQ:
          return (diff == 0) ? sone : szero;
        case NE:
          return (diff != 0) ? sone : szero;
        case LE:
          return (diff <= 0) ? sone : szero;
        case LT:
          return (diff < 0) ? sone : szero;
        case GE:
          return (diff >= 0) ? sone : szero;
        case GT:
          return (diff > 0) ? sone : szero;
        default:
          Tools.exit("[SimpleExpression] unknown comparison expression");
      }
    } else if (lhs.equals(rhs)) return (sop == EQ || sop == LE || sop == GE) ? sone : szero;

    // Normalization ( lhs-rhs <op> 0 )
    SimpleExpression ret = new SimpleExpression(sop);
    if (compare(lhs, rhs) < 0) {
      ret.add(subtract(rhs, lhs));
      ret.sop = exchangeOp(sop);
    } else ret.add(subtract(lhs, rhs));
    ret.add(szero);

    return ret;
  }
Пример #15
0
 // Returns se1<op>se2 with constant evaluation.
 private static SimpleExpression compute(SimpleExpression se1, int op, SimpleExpression se2) {
   SimpleExpression ret = null;
   if (se1.sop == LIT && se2.sop == LIT) {
     Double result = null, v1 = se1.getValue(), v2 = se2.getValue();
     switch (op) {
       case ADD:
         result = v1 + v2;
         break;
       case MUL:
         result = v1 * v2;
         break;
       case DIV:
         result = v1 / v2;
         break;
       case MOD:
         result = v1 % v2;
         break;
       default:
         Tools.exit("[SimpleExpression] unknown operation in normalization");
     }
     if (se1.expr instanceof IntegerLiteral && se2.expr instanceof IntegerLiteral)
       ret = getInt(result.intValue());
     else ret = getDouble(result.doubleValue());
   } else {
     ret = new SimpleExpression(se1, op, se2);
     ret = ret.normalize();
   }
   // Tools.printlnStatus("[COM] "+se1+" "+cop.get(op)+" "+se2+" --> "+ret, 1);
   return ret;
 }
  /**
   * Prints a linkage specification block to a stream.
   *
   * @param spec The block to print.
   * @param stream The stream on which to print the block.
   */
  public static void defaultPrint(LinkageSpecification spec, OutputStream stream) {
    PrintStream p = new PrintStream(stream);

    p.print("extern \"");
    p.print(spec.calling_convention);
    p.print("\"\n{\n");
    Tools.printlnList(spec.children, stream);
    p.print("}");
  }
Пример #17
0
 /**
  * Returns a string representation of the simple expression.
  *
  * @return the string representation.
  */
 public String toString() {
   if (children.isEmpty()) return expr.toString();
   StringBuilder str = new StringBuilder(80);
   str.append("(");
   str.append(cop.get(sop).toString());
   str.append(", ");
   str.append(Tools.listToString(children, ", "));
   str.append(")");
   return str.toString();
 }
  public String toString() {
    StringBuilder str = new StringBuilder(80);

    str.append("extern \"");
    str.append(calling_convention);
    str.append("\"\n{\n");
    str.append(Tools.listToString(children, "\n") + "\n");
    str.append("}");

    return str.toString();
  }
Пример #19
0
  /**
   * Prints a __builtin_offsetof expression to a stream.
   *
   * @param expr The expression to print.
   * @param stream The stream on which to print the expression.
   */
  public static void defaultPrint(OffsetofExpression expr, OutputStream stream) {
    PrintStream p = new PrintStream(stream);

    p.print("__builtin_offsetof");

    p.print("(");
    Tools.printListWithSeparator(expr.specs, stream, " ");
    p.print(",");
    expr.getExpression().print(stream);
    p.print(")");
  }
Пример #20
0
  public String toString() {
    StringBuilder str = new StringBuilder(80);

    str.append("__builtin_offsetof");
    str.append("(");
    str.append(Tools.listToString(specs, " "));
    str.append(",");
    str.append(getExpression().toString());
    str.append(")");

    return str.toString();
  }
Пример #21
0
  /** Lis le header du fichier temporaire et charge ses informations */
  private void readHeaderTmpFile() {
    try {
      FileInputStream reader_tmp = new FileInputStream(this);
      FileChannel reader = reader_tmp.getChannel();

      int key_size = 0;
      int offset = 0;

      // Taile de le clef
      key_size = Tools.readInt(reader, offset);
      offset += 4;
      // Clef
      _key = Tools.readString(reader, offset, key_size);
      offset += key_size;
      // Size
      _size = Tools.readInt(reader, offset);
      offset += 4;
      // piecesize
      _piecesize = Tools.readInt(reader, offset);
      offset += 4;
      // Buffermap
      _buffermap = new Buffermap(this.nbPieces(), false);
      int i;
      for (i = 0; i < this.nbPieces(); i++) {
        int index = Tools.readInt(reader, offset);
        if (index >= 0) {
          _buffermap.setBit(i, true);
        } else {
          _buffermap.setBit(i, false);
        }
        offset += 4;
      }

      reader_tmp.close();
    } catch (Exception e) {
      System.out.println("Unable to read tmp file header");
      e.printStackTrace();
    }
  }
Пример #22
0
 /**
  * MU_FAVORITE
  *
  * @throws Exception cyl
  * @param request
  * @return elements are Table or WebAction and menu list
  * @paqram includeAction if true?not now
  */
 public List getSubSystemsOfmufavorite(HttpServletRequest request) throws Exception {
   ArrayList mufavorite = new ArrayList();
   TableManager manager = TableManager.getInstance();
   // Table table;
   try {
     UserWebImpl userWeb =
         ((UserWebImpl)
             WebUtils.getSessionContextManager(request.getSession())
                 .getActor(nds.util.WebKeys.USER));
     int userid = userWeb.getUserId();
     List al =
         QueryEngine.getInstance()
             .doQueryList(
                 "select t.ad_table_id,t.fa_menu,t.menu_re,t.IS_REPORT from MU_FAVORITE t where t.ownerid="
                     + String.valueOf(userid)
                     + " group by t.ad_table_id,t.menu_no,t.fa_menu,t.menu_re,t.IS_REPORT,t.creationdate order by t.menu_no,t.creationdate asc");
     logger.debug("MU_FAVORITE size is " + String.valueOf(al.size()));
     if (al.size() > 0) {
       for (int i = 0; i < al.size(); i++) {
         // ArrayList catschild= new ArrayList();
         List als = (List) al.get(i);
         String fa_menu = (String) als.get(1);
         String menu_re = (String) als.get(2);
         String isreport = (String) als.get(3);
         int table_id = Tools.getInt(als.get(0), -1);
         Table table = manager.getTable(table_id);
         logger.debug(table.getName());
         /*
         if(!table.isMenuObject()){
                     	continue;
                     	//because many table is webaction not ismenuobject
                     }*/
         try {
           WebUtils.checkTableQueryPermission(table.getName(), request);
         } catch (NDSSecurityException e) {
           continue;
         }
         logger.debug("add_table    ->" + table.getName());
         ArrayList row = new ArrayList();
         row.add(fa_menu);
         row.add(menu_re);
         row.add(isreport);
         row.add(table);
         mufavorite.add(row);
       }
     }
   } catch (Throwable t) {
     logger.error("Fail to load mufavorite", t);
   }
   return mufavorite;
 }
 private boolean buildTree() {
   InspectionProfile profile = myInspectionProfile;
   boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY;
   myGroups.clear();
   final Map<String, Tools> tools = myGlobalInspectionContext.getTools();
   boolean resultsFound = false;
   for (Tools currentTools : tools.values()) {
     InspectionToolWrapper defaultToolWrapper = currentTools.getDefaultState().getTool();
     final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName());
     for (ScopeToolState state : myProvider.getTools(currentTools)) {
       InspectionToolWrapper toolWrapper = state.getTool();
       if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
         addTool(
             toolWrapper,
             ((InspectionProfileImpl) profile)
                 .getErrorLevel(key, state.getScope(myProject), myProject),
             isGroupedBySeverity);
         resultsFound = true;
       }
     }
   }
   return resultsFound;
 }
Пример #24
0
 /**
  * Find report with input, throw exception if could not found. When there's more than one, use id
  * small one
  *
  * @param clientDomain
  * @param tableName
  * @param reportType
  * @return
  * @throws Exception
  */
 private int getReportId(String clientDomain, String tableName, String reportType)
     throws Exception {
   reportType = reportType.toUpperCase();
   Table table = nds.schema.TableManager.getInstance().findTable(tableName);
   if (table == null) throw new NDSException("table " + tableName + " not found.");
   String sql =
       "select r.id from ad_report r, ad_client c where c.domain='"
           + clientDomain
           + "' and r.ad_table_id="
           + table.getId()
           + " and r.reporttype='"
           + reportType
           + "' and c.id=r.ad_client_id order by id asc";
   return Tools.getInt(QueryEngine.getInstance().doQueryOne(sql), -1);
 }
 @RequestMapping(value = "/save")
 public ModelAndView save() throws Exception {
   logBefore(logger, "新增Textmsg");
   if (!PermissionHandler.buttonJurisdiction(menuUrl, "add")) {
     return null;
   }
   ModelAndView mv = this.getModelAndView();
   PageData pd = new PageData();
   pd = this.getPageData();
   pd.put("TEXTMSG_ID", this.get32UUID()); // 主键
   pd.put("CREATETIME", Tools.date2Str(new Date())); // 创建时间
   weixinTextMsgService.save(pd);
   mv.addObject("msg", "success");
   mv.setViewName("save_result");
   return mv;
 }
Пример #26
0
  /**
   * Returns a reconstructed Cetus expression from the simple expression.
   *
   * @return the Cetus expression.
   */
  protected Expression getExpression() {
    Expression ret = null;

    if (children.isEmpty()) ret = (Expression) expr.clone();
    else if (sop == TREE) {
      ret = (Expression) expr.clone();
      for (int i = 0; i < children.size(); ++i) ret.setChild(i, getChild(i).getExpression());
    } else if (cop.get(sop) instanceof UnaryOperator) {
      UnaryOperator uop = (UnaryOperator) cop.get(sop);
      ret = new UnaryExpression(uop, getChild(0).getExpression());
    } else if (cop.get(sop) instanceof BinaryOperator) {
      BinaryOperator bop = (BinaryOperator) cop.get(sop);
      Iterator<SimpleExpression> iter = children.iterator();
      if (iter.hasNext()) ret = iter.next().getExpression();
      while (iter.hasNext()) ret = new BinaryExpression(ret, bop, iter.next().getExpression());
    } else Tools.exit("[SimpleExpression] unknown simple expression");

    return ret;
  }
Пример #27
0
  /**
   * return OutputStream of JasperReport object, this page could only be viewed from localhost for
   * security concern. parameter can be (id), or (table and type)
   *
   * @param id - report id, or
   * @param table - table name
   * @param type - reporttype "s","l","o", case insensitive
   * @param client(*) - client domain
   * @param version - version number, default to -1
   */
  public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String clientName = request.getParameter("client");
    int objectId = ParamUtils.getIntAttributeOrParameter(request, "id", -1);
    if (objectId == -1) {
      // try using table and type
      objectId =
          getReportId(clientName, request.getParameter("table"), request.getParameter("type"));
    }
    if (objectId == -1) {
      logger.error("report not found, request is:" + Tools.toString(request));
      throw new NDSException("report not found");
    }
    int version = ParamUtils.getIntAttributeOrParameter(request, "version", -1);
    File reportXMLFile = new File(ReportTools.getReportFile(objectId, clientName));
    if (reportXMLFile.exists()) {
      // generate jasperreport if file not exists or not newer
      String reportName =
          reportXMLFile.getName().substring(0, reportXMLFile.getName().lastIndexOf("."));
      File reportJasperFile = new File(reportXMLFile.getParent(), reportName + ".jasper");
      if (!reportJasperFile.exists()
          || reportJasperFile.lastModified() < reportXMLFile.lastModified()) {
        JasperCompileManager.compileReportToFile(
            reportXMLFile.getAbsolutePath(), reportJasperFile.getAbsolutePath());
      }
      InputStream is = new FileInputStream(reportJasperFile);
      response.setContentType("application/octetstream;");
      response.setContentLength((int) reportJasperFile.length());

      // response.setHeader("Content-Disposition","inline;filename=\""+reportJasperFile.getName()+"\"");
      ServletOutputStream os = response.getOutputStream();

      byte[] b = new byte[8192];
      int bInt;
      while ((bInt = is.read(b, 0, b.length)) != -1) {
        os.write(b, 0, bInt);
      }
      is.close();
      os.flush();
      os.close();
    } else {
      throw new NDSException("Not found report template");
    }
  }
Пример #28
0
  // Parses a generic expression and returns true if it contains side effect.
  private void parseTree(Expression e) {
    if (e instanceof MinMaxExpression) {
      MinMaxExpression mme = (MinMaxExpression) e;
      sop = (mme.isMin()) ? MIN : MAX;
    } else {
      sop = TREE;
      expr = e;
      order = TREE_ORDER;
      if (e instanceof FunctionCall || e instanceof VaArgExpression) contains_side_effect = true;
    }

    if (e instanceof StatementExpression) // parsing stops here.
    return;

    for (Object o : e.getChildren()) {
      if (o instanceof Expression) {
        SimpleExpression child = new SimpleExpression((Expression) o);
        contains_side_effect |= child.contains_side_effect;
        add(child);
      } else Tools.exit("[SimpleExpression] unable to parse a generic expression");
    }
  }
Пример #29
0
  // Normalizes a BIT operation
  private SimpleExpression normalizeBitOperation() {
    if (!(getChild(0).expr instanceof IntegerLiteral && getChild(1).expr instanceof IntegerLiteral))
      return this;

    int lhs = getChild(0).getValue().intValue();
    int rhs = getChild(1).getValue().intValue();

    switch (sop) {
      case SFTL:
        return getInt(lhs << rhs);
      case SFTR:
        return getInt(lhs >> rhs);
      case BAND:
        return getInt(lhs & rhs);
      case BOR:
        return getInt(lhs | rhs);
      case BXOR:
        return getInt(lhs ^ rhs);
      default:
        Tools.exit("[SimpleExpression] unknown bit operation");
        return null;
    }
  }
Пример #30
0
  private List<String> createCommand() {
    ArrayList<String> command = new ArrayList<String>();

    command.add("java");
    command.add("-Xmx1024M");
    File jar = Tools.getCurrentJar();
    command.add("-jar");
    String jarName = jar.getName();
    if (jarName.contains(" ")) command.add("\"" + jar.getName() + "\"");
    else command.add(jarName);

    command.add("-u");
    command.add(username);

    if (password != null) {
      command.add("-p");
      command.add(password);
    }
    if (sessionID != null) {
      command.add("-s");
      command.add(sessionID);
    }
    return command;
  }