Map IO-Exceptions accordingly
437333
private J4pException mapException(Exception pException) throws J4pException {
        if (pException instanceof ConnectException) {
            return new J4pConnectException(
                    "Cannot connect to " + requestHandler.getJ4pServerUrl() + ": " + pException.getMessage(),
                    (ConnectException) pException);
        } else if (pException instanceof ConnectTimeoutException) {
            return new J4pTimeoutException(
                    "Read timeout while request " + requestHandler.getJ4pServerUrl() + ": " + pException.getMessage(),
                    (ConnectTimeoutException) pException);
        } else if (pException instanceof IOException) {
            return new J4pException("IO-Error while contacting the server: " + pException,pException);
        } else if (pException instanceof URISyntaxException) {
            URISyntaxException sExp = (URISyntaxException) pException;
            return new J4pException("Invalid URI " + sExp.getInput() + ": " + sExp.getReason(),pException);
        } else {
            return new J4pException("Exception " + pException,pException);
        }
    }
936579
private <T> void storeInMap(MultiValueMap<T> map, T key, String[] values) {
        try {
            map.set(key, values);
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }
    }
55347
@Beta
    public <R, E extends Exception, E2 extends Exception> List<R> filterThenFlatMap(final Try.Predicate<? super T, E> filter,
            final Try.Function<? super T, ? extends Collection<? extends R>, E2> mapper) throws E, E2 {
        N.checkArgNotNull(filter);
        N.checkArgNotNull(mapper);

        final List<R> result = new ArrayList<>();

        Collection<? extends R> c = null;

        for (T e : coll) {
            if (filter.test(e)) {
                c = mapper.apply(e);

                if (N.notNullOrEmpty(c)) {
                    result.addAll(c);
                }
            }
        }

        return result;
    }
595222
public void map(K key, V value,
                  OutputCollector<V, K> output, Reporter reporter)
    throws IOException {
    output.collect(value, key);
  }
413696
public <T, E extends Exception> T map(Try.Function<? super String, T, E> mapper) throws E {
        return mapper.apply(toString());
    }
1055949
@GwtIncompatible("Unnecessary")
  private void outputNameMaps() throws IOException {

    String propertyMapOutputPath = null;
    String variableMapOutputPath = null;

    // Check the create_name_map_files FLAG.
    if (config.createNameMapFiles) {
      String basePath = getMapPath(config.jsOutputFile);

      propertyMapOutputPath = basePath + "_props_map.out";
      variableMapOutputPath = basePath + "_vars_map.out";
    }

    // Check the individual FLAGS.
    if (!config.variableMapOutputFile.isEmpty()) {
      if (variableMapOutputPath != null) {
        throw new FlagUsageException("The flags variable_map_output_file and "
            + "create_name_map_files cannot both be used simultaneously.");
      }

      variableMapOutputPath = config.variableMapOutputFile;
    }

    if (!config.propertyMapOutputFile.isEmpty()) {
      if (propertyMapOutputPath != null) {
        throw new FlagUsageException("The flags property_map_output_file and "
            + "create_name_map_files cannot both be used simultaneously.");
      }

      propertyMapOutputPath = config.propertyMapOutputFile;
    }

    // Output the maps.
    if (variableMapOutputPath != null && compiler.getVariableMap() != null) {
      compiler.getVariableMap().save(variableMapOutputPath);
    }

    if (propertyMapOutputPath != null && compiler.getPropertyMap() != null) {
      compiler.getPropertyMap().save(propertyMapOutputPath);
    }
  }
607161
public static <T, E extends Exception> ByteList mapToByte(final T[] a, final int fromIndex, final int toIndex, final Try.ToByteFunction<? super T, E> func)
            throws E {
        checkFromToIndex(fromIndex, toIndex, len(a));
        N.checkArgNotNull(func);

        if (N.isNullOrEmpty(a)) {
            return new ByteList();
        }

        final ByteList result = new ByteList(toIndex - fromIndex);

        for (int i = fromIndex; i < toIndex; i++) {
            result.add(func.applyAsByte(a[i]));
        }

        return result;
    }
86163
protected void remapData(int[][] mapping) throws IOException {
    if (!closed) {
      // remap and merge keys
      String[] newKeyList = new String[mapping.length];
      // process mapping for functions?
      HashMap<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map = new HashMap<>();
      int[] newSourceNumberList = new int[mapping.length];
      int[] newErrorNumber = new int[mapping.length];
      @SuppressWarnings("unchecked")
      HashMap<String, Integer>[] newErrorList = (HashMap<String, Integer>[]) new HashMap<?, ?>[mapping.length];
      for (int i = 0; i < mapping.length; i++) {
        newKeyList[i] = keyList[mapping[i][0]];
        newSourceNumberList[i] = sourceNumberList[mapping[i][0]];
        for (int j = 0; j < mapping[i].length; j++) {
          if (j == 0) {
            newErrorNumber[i] = errorNumber[mapping[i][j]];
            newErrorList[i] = errorList[mapping[i][j]];
          } else {
            newErrorNumber[i] += errorNumber[mapping[i][j]];
            for (Entry<String, Integer> entry : errorList[mapping[i][j]]
                .entrySet()) {
              if (newErrorList[i].containsKey(entry.getKey())) {
                newErrorList[i].put(entry.getKey(),
                    newErrorList[i].get(entry.getKey()) + entry.getValue());
              } else {
                newErrorList[i].put(entry.getKey(), entry.getValue());
              }
            }
          }
        }
      }
      if (hasSub) {
        newSubCollectorListNextLevel = new MtasDataCollector<?, ?>[mapping.length];
        for (int i = 0; i < mapping.length; i++) {
          for (int j = 0; j < mapping[i].length; j++) {
            if (j == 0 || newSubCollectorListNextLevel[i] == null) {
              newSubCollectorListNextLevel[i] = subCollectorListNextLevel[mapping[i][j]];
            } else {
              newSubCollectorListNextLevel[i]
                  .merge(subCollectorListNextLevel[mapping[i][j]], map, false);
            }
          }
        }
        subCollectorListNextLevel = newSubCollectorListNextLevel;
      }
      keyList = newKeyList;
      sourceNumberList = newSourceNumberList;
      errorNumber = newErrorNumber;
      errorList = newErrorList;
      size = keyList.length;
      position = 0;
    } else {
      throw new IOException("already closed");
    }
  }
877738
public static void error(Throwable e) throws JMapperException{
		logger.error("{}: {}",e.getClass().getSimpleName(),e.getMessage());
		throw new JMapperException(e);
	}
330212
def map_boto_exceptions(key=None, exc_pass=()):
    """"""
    from boto.exception import BotoClientError, BotoServerError, \
        StorageResponseError
    try:
        yield
    except StorageResponseError as e:
        if e.code == 'NoSuchKey':
            raise KeyError(key)
        raise IOError(str(e))
    except (BotoClientError, BotoServerError) as e:
        if e.__class__.__name__ not in exc_pass:
            raise IOError(str(e))
871422
def map_exception_codes():
    ''''''
    werkex = inspect.getmembers(exceptions, lambda x: getattr(x, 'code', None))
    return {e.code: e for _, e in werkex}
1035550
public static void readMapFile (BufferedReader bin, HashMap<String, Integer> map)
        throws IOException
    {
        String line;
        while ((line = bin.readLine()) != null) {
            int eidx = line.indexOf(SEP_STR);
            if (eidx == -1) {
                throw new IOException("Malformed line, no '" + SEP_STR +
                                      "': '" + line + "'");
            }
            try {
                String code = line.substring(eidx+SEP_STR.length());
                map.put(line.substring(0, eidx), Integer.valueOf(code));
            } catch (NumberFormatException nfe) {
                String errmsg = "Malformed line, invalid code: '" + line + "'";
                throw new IOException(errmsg);
            }
        }
    }
411342
@Override
  public void map(K key, V value, Context context
                  ) throws IOException, InterruptedException {
    context.write(value, key);
  }
417245
def wrmap(func, iterable, *args):
    ''
    for it in iterable:
        try:
            yield func(it, *args)
        except Exception as e:
            pass
1304242
@Beta
    public <R, E extends Exception, E2 extends Exception> void flatMapThenForEach(final Try.Function<? super T, ? extends Collection<? extends R>, E> mapper,
            final Try.Consumer<? super R, E2> action) throws E, E2 {
        N.checkArgNotNull(mapper);
        N.checkArgNotNull(action);

        Collection<? extends R> c = null;

        for (T e : coll) {
            c = mapper.apply(e);

            if (N.notNullOrEmpty(c)) {
                for (R r : c) {
                    action.accept(r);
                }
            }
        }
    }
699222
public static <T, E extends Exception> IntList mapToInt(final T[] a, final int fromIndex, final int toIndex, final Try.ToIntFunction<? super T, E> func)
            throws E {
        checkFromToIndex(fromIndex, toIndex, len(a));
        N.checkArgNotNull(func);

        if (N.isNullOrEmpty(a)) {
            return new IntList();
        }

        final IntList result = new IntList(toIndex - fromIndex);

        for (int i = fromIndex; i < toIndex; i++) {
            result.add(func.applyAsInt(a[i]));
        }

        return result;
    }
1256871
function simpleMap(map, lvls, opts, type, ext, callback) {
    opts = utils.clone(opts);
    lvls--;
    if(lvls < 1) {
        opts.simple = false;
        opts.recursive = true;
        opts.type = type;
        opts.ext = ext;
    }
    var folders = map.__filter({type:'directory'}, true);
    var count = folders.length;
    var errs = [];

    function end(err) {
        if(err) {
            errs.push(err);
        }
        if(--count !== 0) {
            return;
        }
        if(errs.length) {
            callback(errs);
            return;
        }
        callback(null, map);
    }
    folders.forEach(function (folder) {
        folder.__map(opts, function (err, fMap) {
            if(err) {
                end(err);
                return;
            }
            if(lvls < 1) {
                end();
            } else {
                simpleMap(fMap, lvls, opts, type, ext, end);
            }
        });
    });
}