예제 #1
2
 /** {@inheritDoc} */
 public void putAll(Map<? extends Integer, ? extends Integer> map) {
   ensureCapacity(map.size());
   // could optimize this for cases when map instanceof THashMap
   for (Map.Entry<? extends Integer, ? extends Integer> entry : map.entrySet()) {
     this.put(entry.getKey().intValue(), entry.getValue().intValue());
   }
 }
예제 #2
1
 private Map<String, String> parseHeaders(HttpURLConnection conn) {
   Map<String, String> headers = new HashMap<String, String>();
   for (String key : conn.getHeaderFields().keySet()) {
     headers.put(key, conn.getHeaderFields().get(key).get(0));
   }
   return headers;
 }
예제 #3
1
  static void serTest(Map s, int size) throws Exception {
    if (!(s instanceof Serializable)) return;
    System.out.print("Serialize              : ");

    for (int i = 0; i < size; i++) {
      s.put(new Integer(i), Boolean.TRUE);
    }

    long startTime = System.currentTimeMillis();

    FileOutputStream fs = new FileOutputStream("MapCheck.dat");
    ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fs));
    out.writeObject(s);
    out.close();

    FileInputStream is = new FileInputStream("MapCheck.dat");
    ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(is));
    Map m = (Map) in.readObject();

    long endTime = System.currentTimeMillis();
    long time = endTime - startTime;

    System.out.print(time + "ms");

    if (s instanceof IdentityHashMap) return;
    reallyAssert(s.equals(m));
  }
  private Map promptForOverwrite(List plugins, List locales) {
    Map overwrites = new HashMap();

    if (overwriteWithoutAsking) return overwrites;

    for (Iterator iter = plugins.iterator(); iter.hasNext(); ) {
      IPluginModelBase plugin = (IPluginModelBase) iter.next();
      for (Iterator it = locales.iterator(); it.hasNext(); ) {
        Locale locale = (Locale) it.next();
        IProject project = getNLProject(plugin, locale);

        if (project.exists() && !overwrites.containsKey(project.getName())) {
          boolean overwrite =
              MessageDialog.openConfirm(
                  PDEPlugin.getActiveWorkbenchShell(),
                  PDEUIMessages.InternationalizeWizard_NLSFragmentGenerator_overwriteTitle,
                  NLS.bind(
                      PDEUIMessages.InternationalizeWizard_NLSFragmentGenerator_overwriteMessage,
                      pluginName(plugin, locale)));
          overwrites.put(project.getName(), overwrite ? OVERWRITE : null);
        }
      }
    }

    return overwrites;
  }
예제 #5
1
  /**
   * Handles the move put from a Client.
   *
   * @param params is a String array containing the blocks to place
   */
  public void doMovePut(String[] params) {
    Map<Point, Block> moves = new HashMap<>();

    for (String move : params) {
      String[] moveArg = move.split("@");
      int blockId = Integer.parseInt(moveArg[0]);
      int moveX = Integer.parseInt(moveArg[1].split(",")[0]);
      int moveY = Integer.parseInt(moveArg[1].split(",")[1]);

      moves.put(new Point(moveX, moveY), new Block(blockId));
    }

    try {
      game.doMovePut(moves);
      System.out.println("[Server] (ClientHandler) - Current game situation:");
      System.out.println(game.getBoard().toString());
    } catch (InvalidMoveException e) {
      sendError(IProtocol.Error.MOVE_INVALID.ordinal() + " Invalid move");
      game.sendPlayerTurn();
    } catch (TilesUnownedException e) {
      sendError(
          IProtocol.Error.MOVE_TILES_UNOWNED.ordinal() + " Player tried to place unowned tile");
      game.sendPlayerTurn();
    } catch (NullPointerException e) {
      System.out.println("[Server] ClientHandler - Game ended during turn.");
    }
  }
  /** {@inheritDoc} */
  @Override
  public Map<K, V> peekAll(
      @Nullable Collection<? extends K> keys,
      @Nullable GridPredicate<? super GridCacheEntry<K, V>>[] filter) {
    if (keys == null || keys.isEmpty()) return emptyMap();

    final Collection<K> skipped = new GridLeanSet<K>();

    final Map<K, V> map = peekAll0(keys, filter, skipped);

    if (map.size() + skipped.size() != keys.size()) {
      map.putAll(
          dht.peekAll(
              F.view(
                  keys,
                  new P1<K>() {
                    @Override
                    public boolean apply(K k) {
                      return !map.containsKey(k) && !skipped.contains(k);
                    }
                  }),
              filter));
    }

    return map;
  }
  /**
   * Creates a new Socket connected to the given IP address. The method uses connection settings
   * supplied in the constructor for connecting the socket.
   *
   * @param address the IP address to connect to
   * @return connected socket
   * @throws java.net.UnknownHostException if the hostname of the address or the proxy cannot be
   *     resolved
   * @throws java.io.IOException if an I/O error occured while connecting to the remote end or to
   *     the proxy
   */
  private Socket createSocket(InetSocketAddress address, int timeout) throws IOException {
    String socksProxyHost = System.getProperty("socksProxyHost");
    System.getProperties().remove("socksProxyHost");
    try {
      ConnectivitySettings cs = lastKnownSettings.get(address);
      if (cs != null) {
        try {
          return createSocket(cs, address, timeout);
        } catch (IOException e) {
          // not good anymore, try all proxies
          lastKnownSettings.remove(address);
        }
      }

      URI uri = addressToURI(address, "socket");
      try {
        return createSocket(uri, address, timeout);
      } catch (IOException e) {
        // we will also try https
      }

      uri = addressToURI(address, "https");
      return createSocket(uri, address, timeout);

    } finally {
      if (socksProxyHost != null) {
        System.setProperty("socksProxyHost", socksProxyHost);
      }
    }
  }
예제 #8
1
  // ---------------------------------------------------------------------------
  private void printDependencies() throws TablesawException {
    m_printedDependencies = new HashSet<String>();

    try {
      PrintWriter pw = new PrintWriter(new FileWriter("dependency.txt"));

      pw.println("Targets marked with a * have already been printed");
      // Create a reduced set of stuff to print
      Set<String> ruleNames = new HashSet<String>();

      for (String name : m_nameRuleMap.keySet()) ruleNames.add(name);

      for (String name : m_nameRuleMap.keySet()) {
        Rule rule = m_nameRuleMap.get(name);
        for (String dep : rule.getDependNames()) ruleNames.remove(dep);

        for (Rule dep : rule.getDependRules()) {
          if (dep.getName() != null) ruleNames.remove(dep.getName());
        }
      }

      for (String name : ruleNames) {
        if (!name.startsWith(NAMED_RULE_PREFIX)) printDependencies(name, pw, 0);
      }

      pw.close();
    } catch (IOException ioe) {
      throw new TablesawException("Cannot write to file dependency.txt", -1);
    }
  }
예제 #9
1
 private Map<String, Object> query(HttpServletRequest req) {
   final Map<String, Object> map = new HashMap<>();
   for (Map.Entry<String, String[]> entry : req.getParameterMap().entrySet()) {
     map.put(entry.getKey(), entry.getValue());
   }
   return map;
 }
예제 #10
0
  /** Metodo que escreve os clientes num ficheiro */
  public void escreveLocalidades(String fileLocalidades, String fileLigacoes, int nrlocalidades)
      throws FileNotFoundException, IOException {
    PrintWriter printloc = new PrintWriter(fileLocalidades);
    PrintWriter printlig = new PrintWriter(fileLigacoes);

    Collection<Localidade> coll = this.localidades.values();

    for (Localidade l : coll) {
      printloc.print(l.get_Codigopostal() + "|" + l.get_Nome());

      Map<String, Ligacao> ligacoes = l.get_Ligacoes();
      int nrligacoes = ligacoes.size();

      Collection<Ligacao> colllig = ligacoes.values();

      for (Ligacao lig : colllig) {
        printloc.print("|1");
        printlig.println(
            l.get_Codigopostal()
                + "|"
                + lig.get_Localidaded()
                + "|"
                + lig.get_Distancia()
                + "|"
                + lig.get_Taxas());
      }
      printloc.print("\n");

      nrlocalidades--;
      if (nrlocalidades == 0) break;
    }

    printloc.close();
    printlig.close();
  }
예제 #11
0
 /**
  * 验证项目是否ok
  *
  * @param contextPath 项目路径
  */
 public static boolean isdomainok(String contextPath, String securityKey, String domiankey) {
   try {
     if (contextPath.indexOf("127.0.") > -1 || contextPath.indexOf("192.168.") > -1) {
       return true;
     }
     String dedomaininfo = PurseSecurityUtils.decryption(domiankey, securityKey);
     Gson gson = new Gson();
     JsonParser jsonParser = new JsonParser();
     JsonObject jsonObject = jsonParser.parse(dedomaininfo).getAsJsonObject();
     Map<String, String> map =
         gson.fromJson(jsonObject, new TypeToken<Map<String, String>>() {}.getType());
     String domain = map.get("domain");
     if (contextPath.indexOf(domain) < 0) {
       System.exit(2);
       return false;
     }
     String dt = map.get("dt");
     if (com.yizhilu.os.core.util.StringUtils.isNotEmpty(dt)) {
       Date t = DateUtils.toDate(dt, "yyyy-MM-dd");
       if (t.compareTo(new Date()) < 0) {
         System.exit(3);
         return false;
       }
     }
     return true;
   } catch (Exception e) {
     return false;
   }
 }
예제 #12
0
 private static String getPath(Map<String, Object> map, String part) {
   Object obj = "/".equals(part) ? null : map.get(part);
   if (obj == null) {
     obj = map.get("/");
     if (obj != null) {
       return (String) obj;
     }
     obj = map.get("*");
     String path = (String) obj;
     if (path != null && path.endsWith("*")) {
       return path.substring(0, path.length() - 1) + part;
     } else {
       return path;
     }
   }
   if (obj instanceof String) {
     return (String) obj;
   }
   map = (Map<String, Object>) obj;
   obj = map.get("/");
   if (obj != null) {
     return (String) obj;
   }
   obj = map.get("*");
   return (String) obj;
 }
예제 #13
0
  // ---------------------------------------------------------------------------
  public CachedFile locateFileUsingRules(String fileName) {
    List<String> paths;
    CachedFile ret = null;
    CachedFile f;

    f = new CachedFile(fileName);
    if (f.exists()) ret = f;
    else if ((ret = m_locatedFiles.get(fileName)) == null) {
      paths = m_fileManager.getPossibleFiles(fileName);

      for (String path : paths) {
        f = new CachedFile(path);

        if (f.exists()) {
          ret = f;
          m_locatedFiles.put(fileName, ret);
          break;
        } else if (m_targetRuleMap.containsKey(path)) {
          ret = f;
          break;
        }
      }
    }

    return (ret);
  }
예제 #14
0
  // ---------------------------------------------------------------------------
  public Rule findTargetRule(String target) throws TablesawException {
    Rule rule = null;

    if (m_resolved) {
      ArrayList<String> posTargets;
      String posTarget = target;

      if (m_noRulesList.contains(target)) return (null);

      if ((rule = m_locatedRules.get(target)) != null) return (rule);

      // First look in name map
      rule = m_nameRuleMap.get(target);

      if (rule == null) { // Now look for targets
        rule = m_targetRuleMap.get(posTarget);
        if (rule == null) {
          posTargets = m_fileManager.getPossibleFiles(posTarget);
          for (String t : posTargets) {
            rule = m_targetRuleMap.get(t);
            if (rule != null) break;
          }
        }
      }

      Debug.print("Rule for " + target + " is " + rule);
      if (rule != null) {
        m_locatedRules.put(target, rule);
      } else m_noRulesList.add(target);
    }

    return (rule);
  }
예제 #15
0
  public static void setAZTracker(URL tracker_url, boolean az_tracker) {
    String key = tracker_url.getHost() + ":" + tracker_url.getPort();

    synchronized (az_trackers) {
      boolean changed = false;

      if (az_trackers.get(key) == null) {

        if (az_tracker) {

          az_trackers.put(key, new Long(SystemTime.getCurrentTime()));

          changed = true;
        }
      } else {

        if (!az_tracker) {

          if (az_trackers.remove(key) != null) {

            changed = true;
          }
        }
      }

      if (changed) {

        COConfigurationManager.setParameter("Tracker Client AZ Instances", az_trackers);
      }
    }
  }
 private void initVars(Map vm) {
   variable_PAGE_NUMBER = (JRFillVariable) vm.get("PAGE_NUMBER");
   variable_COLUMN_NUMBER = (JRFillVariable) vm.get("COLUMN_NUMBER");
   variable_REPORT_COUNT = (JRFillVariable) vm.get("REPORT_COUNT");
   variable_PAGE_COUNT = (JRFillVariable) vm.get("PAGE_COUNT");
   variable_COLUMN_COUNT = (JRFillVariable) vm.get("COLUMN_COUNT");
 }
예제 #17
0
  /*
   * Unit test to test [JACKSON-177]
   */
  public void testHibernateCglib() throws Exception {
    /* 03-Sep-2010, tatu: This often fails form Eclipse (on some platforms like Mac OS X),
     *   so let's only run it from Ant/CLI
     */
    if (!runsFromAnt()) {
      return;
    }

    Enhancer enh = new Enhancer();
    enh.setInterfaces(new Class[] {BeanInterfaceHib.class});
    enh.setCallback(
        new MethodInterceptor() {
          @Override
          public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
              throws Throwable {
            if ("getX".equals(method.getName())) {
              return Integer.valueOf(13);
            }
            return proxy.invokeSuper(obj, args);
          }
        });
    BeanInterfaceHib bean = (BeanInterfaceHib) enh.create();
    ObjectMapper mapper = new ObjectMapper();
    Map<String, Object> result = writeAndMap(mapper, bean);
    assertEquals(1, result.size());
    assertEquals(Integer.valueOf(13), result.get("x"));
  }
  private void parse(String filename) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
    StringBuffer sb = new StringBuffer();

    int j;
    while ((j = br.read()) != -1) {
      char next = (char) j;

      if (next >= 'A' && next <= 'z') {
        sb.append(next);
      }

      if (sb.length() == 4) {
        String qGram = sb.toString().toUpperCase();
        sb = new StringBuffer();

        int frequency = 0;

        if (map.containsKey(qGram)) {
          frequency = map.get(qGram);
        }

        frequency++;
        map.put(qGram, frequency);
      }
    }
    br.close();
  }
  public InputStream invokeClientInbound(HttpURLConnection httpConnection) throws IOException {
    // XXX fill this in...
    Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();

    Map<String, Object> httpProperties = new HashMap<String, Object>();
    httpProperties.put(HTTP_RESPONSE_CODE, Integer.valueOf(httpConnection.getResponseCode()));
    httpProperties.put(HTTP_RESPONSE_HEADERS, httpConnection.getHeaderFields());

    prepare(httpProperties, /*request=*/ false);

    if (!invokeInbound(httpConnection.getInputStream(), attachments)) {
      if (getProtocolException() != null) {
        reverseDirection();
        invokeInboundFaultHandlers();

        if (getRuntimeException() != null) throw getRuntimeException();
      } else if (getRuntimeException() != null) {
        closeClient();
        throw getRuntimeException();
      }
    }

    // XXX
    closeClient();
    return finish();
  }
  public void invokeServerOutbound(Source source, OutputStream os) {
    Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();

    Map<String, Object> httpProperties = new HashMap<String, Object>();
    httpProperties.put(HTTP_RESPONSE_CODE, Integer.valueOf(200));
    httpProperties.put(HTTP_RESPONSE_HEADERS, new HashMap<String, List<String>>());

    prepare(httpProperties, /*request=*/ false);

    if (!invokeOutbound(source, attachments)) {
      if (getProtocolException() != null) {
        reverseDirection();
        invokeOutboundFaultHandlers();
      }

      /*
      else if (getRuntimeException() != null) {
        closeServer();
        finish(response.getOutputStream());

        throw getRuntimeException();
      }*/
    }

    // XXX
    closeServer();
    finish(os);
  }
  private void outputEntry(TraceEntry te) {
    ThreadData td = te.getThread();
    if (td == null) return;

    // System.err.println("TRACE: " + te);

    BdynCallback cb = bdyn_factory.getCallback(te.getEntryLocation());
    if (cb == null) return;

    if (cb.getCallbackType() == CallbackType.CONSTRUCTOR) {
      OutputTask ot = td.getCurrentTransaction();
      if (ot == null) return;
      if (ot.isMainTask() && !BdynFactory.getOptions().useMainTask()) return;
      int i0 = te.getObject1();
      if (i0 != 0) {
        // System.err.println("ASSOC TASK " + i0 + " " + te.getObject2() + " " +
        // ot.getTaskRoot().getDisplayName());
        OutputTask ot1 = object_tasks.get(i0);
        if (ot1 == null) object_tasks.put(i0, ot);
        else if (ot1 != dummy_task && ot1 != ot) object_tasks.put(i0, dummy_task);
      }
      return;
    }

    td.beginTask(te);
    end_time = Math.max(end_time, te.getTime());
  }
예제 #22
0
파일: Graph.java 프로젝트: safdariqbal/frex
  private static void matchNodeSubgraph(Node node1, Node node2, Map<Node, Node> map) {

    if (map.containsKey(node1)) {
      assert (node2 == map.get(node1));
      return;
    }

    map.put(node1, node2);

    if (secondary_index[4]) {
      for (Field f : node1.outfields.keySet()) {
        FieldEdge fe1 = node1.outfields.get(f);
        assert (fe1.src.getRep() == node1);
        FieldEdge fe2 = node2.outfields.get(f);
        assert (fe2 != null);
        assert (fe2.src.getRep() == node2);
        matchNodeSubgraph(fe1.dst.getRep(), fe2.dst.getRep(), map);
      }
    } else {
      for (Field f : node1.graph.fedges.keySet())
        for (FieldEdge fe1 : node1.graph.fedges.get(f)) {
          if (fe1.src.getRep() != node1) continue;
          boolean found = false;
          assert (node2.graph.fedges.get(f) != null);
          for (FieldEdge fe2 : node2.graph.fedges.get(f)) {
            if (fe2.src.getRep() != node2) continue;
            if (!fe1.field.equals(fe2.field)) continue;
            matchNodeSubgraph(fe1.dst.getRep(), fe2.dst.getRep(), map);
            found = true;
            break;
          }
          assert (found);
        }
    }
  }
예제 #23
0
 /**
  * Copies the key/value mappings in <tt>map</tt> into this map. Note that this will be a
  * <b>deep</b> copy, as storage is by primitive value.
  *
  * @param map a <code>Map</code> value
  */
 public void putAll(Map<? extends Character, ? extends Double> map) {
   Iterator<? extends Entry<? extends Character, ? extends Double>> it = map.entrySet().iterator();
   for (int i = map.size(); i-- > 0; ) {
     Entry<? extends Character, ? extends Double> e = it.next();
     this.put(e.getKey(), e.getValue());
   }
 }
예제 #24
0
  /**
   * Reads the file that specifies method calls that should be replaced by other method calls. The
   * file is of the form:
   *
   * <p>[regex] [orig-method-def] [new-method-name]
   *
   * <p>where the orig_method-def is of the form:
   *
   * <p>fully-qualified-method-name (args)
   *
   * <p>Blank lines and // comments are ignored. The orig-method-def is replaced by a call to
   * new-method-name with the same arguments in any classfile that matches the regular expressions.
   * All method names and argument types should be fully qualified.
   */
  public void read_map_file(File map_file) throws IOException {

    LineNumberReader lr = new LineNumberReader(new FileReader(map_file));
    MapFileError mfe = new MapFileError(lr, map_file);
    Pattern current_regex = null;
    Map<MethodDef, MethodInfo> map = new LinkedHashMap<MethodDef, MethodInfo>();
    for (String line = lr.readLine(); line != null; line = lr.readLine()) {
      line = line.replaceFirst("//.*$", "");
      if (line.trim().length() == 0) continue;
      if (line.startsWith(" ")) {
        if (current_regex == null)
          throw new IOException("No current class regex on line " + lr.getLineNumber());
        StrTok st = new StrTok(line, mfe);
        st.stok.wordChars('.', '.');
        MethodDef md = parse_method(st);
        String new_method = st.need_word();
        map.put(md, new MethodInfo(new_method));
      } else {
        if (current_regex != null) {
          MethodMapInfo mmi = new MethodMapInfo(current_regex, map);
          map_list.add(mmi);
          map = new LinkedHashMap<MethodDef, MethodInfo>();
        }
        current_regex = Pattern.compile(line);
      }
    }
    if (current_regex != null) {
      MethodMapInfo mmi = new MethodMapInfo(current_regex, map);
      map_list.add(mmi);
    }

    dump_map_list();
  }
  /** {@inheritDoc} */
  @Override
  public Map<K, V> peekAll(
      @Nullable Collection<? extends K> keys, @Nullable Collection<GridCachePeekMode> modes)
      throws GridException {
    if (keys == null || keys.isEmpty()) return emptyMap();

    final Collection<K> skipped = new GridLeanSet<K>();

    final Map<K, V> map =
        !modes.contains(PARTITIONED_ONLY)
            ? peekAll0(keys, modes, ctx.tm().localTxx(), skipped)
            : new GridLeanMap<K, V>(0);

    if (map.size() != keys.size() && !modes.contains(NEAR_ONLY)) {
      map.putAll(
          dht.peekAll(
              F.view(
                  keys,
                  new P1<K>() {
                    @Override
                    public boolean apply(K k) {
                      return !map.containsKey(k) && !skipped.contains(k);
                    }
                  }),
              modes));
    }

    return map;
  }
예제 #26
0
  static void readConfig() {
    tracker_ip = COConfigurationManager.getStringParameter("Tracker IP", "");

    tracker_ip = UrlUtils.expandIPV6Host(tracker_ip);

    String override_ips = COConfigurationManager.getStringParameter("Override Ip", "");

    StringTokenizer tok = new StringTokenizer(override_ips, ";");

    Map new_override_map = new HashMap();

    while (tok.hasMoreTokens()) {

      String ip = tok.nextToken().trim();

      if (ip.length() > 0) {

        new_override_map.put(AENetworkClassifier.categoriseAddress(ip), ip);
      }
    }

    override_map = new_override_map;

    InetAddress bad = NetworkAdmin.getSingleton().getSingleHomedServiceBindAddress();

    if (bad == null || bad.isAnyLocalAddress()) {

      bind_ip = "";

    } else {

      bind_ip = bad.getHostAddress();
    }
  }
예제 #27
0
 static void clrTest(int n, Map s) {
   String nm = "Remove Present         ";
   timer.start(nm, n);
   s.clear();
   timer.finish();
   reallyAssert(s.isEmpty());
 }
  public static Map<String, String> readProperties(InputStream inputStream) {
    Map<String, String> propertiesMap = null;
    try {
      propertiesMap = new LinkedHashMap<String, String>();

      Properties properties = new Properties();
      properties.load(inputStream);

      Enumeration<?> enumeration = properties.propertyNames();
      while (enumeration.hasMoreElements()) {
        String key = (String) enumeration.nextElement();
        String value = (String) properties.get(key);
        propertiesMap.put(key, value);
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (inputStream != null) {
        try {
          inputStream.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
    return propertiesMap;
  }
예제 #29
0
  // ---------------------------------------------------------------------------
  private void writeCache() {
    try {
      Debug.print("Writing cache");
      FileOutputStream fos = new FileOutputStream(m_cacheFile);
      ObjectOutputStream oos = new ObjectOutputStream(fos);

      oos.writeObject(m_depCache);

      oos.writeInt(m_newModificationCache.size());

      Iterator<String> it = m_newModificationCache.keySet().iterator();

      while (it.hasNext()) {
        String key = it.next();

        oos.writeUTF(key);
        oos.writeLong(m_newModificationCache.get(key));
      }

      oos.close();
    } catch (Exception e) {
      Debug.print(e.getMessage());
      StringWriter sw = new StringWriter();
      e.printStackTrace(new PrintWriter(sw));
      Debug.print(sw.toString());
    }
  }
예제 #30
0
 private boolean workaroundBug356918(
     HttpServletRequest request, HttpServletResponse response, Exception e)
     throws ServletException, JSONException {
   if (e instanceof CheckoutConflictException) {
     JSONObject result = new JSONObject();
     result.put(GitConstants.KEY_RESULT, MergeStatus.FAILED.name());
     Map<String, MergeFailureReason> failingPaths = new HashMap<String, MergeFailureReason>();
     String[] files = e.getMessage().split("\n"); // $NON-NLS-1$
     for (int i = 1; i < files.length; i++) {
       // TODO: this is not always true, but it's a temporary workaround
       failingPaths.put(files[i], MergeFailureReason.DIRTY_WORKTREE);
     }
     result.put(GitConstants.KEY_FAILING_PATHS, failingPaths);
     try {
       OrionServlet.writeJSONResponse(
           request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
       return true;
     } catch (IOException e1) {
       e = e1;
     }
   }
   return statusHandler.handleRequest(
       request,
       response,
       new ServerStatus(
           IStatus.ERROR,
           HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
           "An error occured when merging.",
           e.getCause()));
 }