java.lang.IndexOutOfBoundsException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中java.lang.IndexOutOfBoundsException.getLocalizedMessage()方法的一些代码示例,展示了IndexOutOfBoundsException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndexOutOfBoundsException.getLocalizedMessage()方法的具体详情如下:
包路径:java.lang.IndexOutOfBoundsException
类名称:IndexOutOfBoundsException
方法名:getLocalizedMessage

IndexOutOfBoundsException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
public ItemStack next() {
  direction = 1;
  try {
    return inventory.getItem(nextIndex++);
  } catch (IndexOutOfBoundsException e) {
    throw new NoSuchElementException(e.getLocalizedMessage());
  }
}

代码示例来源:origin: oracle/opengrok

throw new IOException(
    String.format("The string is not long enough to extract 1 character for name \"%s\" - %s.",
        fieldName, ex.getLocalizedMessage()), ex);

代码示例来源:origin: org.eclipse/org.eclipse.search

private String computeReplacementString(Pattern pattern, String originalText, String replacementText) {
  if (pattern != null) {
    try {
      return pattern.matcher(originalText).replaceFirst(replacementText);
    } catch (IndexOutOfBoundsException ex) {
      throw new PatternSyntaxException(ex.getLocalizedMessage(), replacementText, -1);
    }
  }
  return replacementText;
}

代码示例来源:origin: senbox-org/s1tbx

public ArrayList queryKey(String key, int groupToReturn) throws IndexOutOfBoundsException {
  ArrayList<String> valuesList = new ArrayList<String>();
  Matcher match = createMatcher(buffer.substring(startIdx, endIdx), createPattern(key));
  while (match.find()) {
    try {
      valuesList.add(match.group(groupToReturn));
    } catch (IndexOutOfBoundsException e) {
      logger.severe("queryKey(key,group) : Exception handling regex : " + e.getLocalizedMessage());
    }
  }
  return valuesList;
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Returns whether a given cell is blocked or not. Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-Coordinate of grid cell to be tested
 * @param y
 *            Y-Coordinate of grid cell to be tested
 * @return true: cell is filled; false: otherwise
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
public boolean isBlockedCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    return isBlocked(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Blocks the cell at position (x,y). Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-coordinate of cell to fill
 * @param y
 *            Y-coordinate of cell to fill
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
void setBlockedCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    setBlocked(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Empties the cell at position (x,y). Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-coordinate of cell to empty
 * @param y
 *            Y-coordinate of cell to empty
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
void setEmptyCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    setEmpty(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Fills the cell at position (x,y). Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-coordinate of cell to weakly block
 * @param y
 *            Y-coordinate of cell to weakly block
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
void setWeaklyBlockedCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    setWeaklyBlocked(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Returns whether a given cell is blocked or not. Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-Coordinate of grid cell to be tested
 * @param y
 *            Y-Coordinate of grid cell to be tested
 * @return true: cell is filled; false: otherwise
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
public boolean isEmptyCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    return isEmpty(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.elk/org.eclipse.elk.alg.common.compaction

/**
 * Returns whether a given cell is weakly blocked or not. Coordinates are given relative to the center of the grid.
 * 
 * @param x
 *            X-Coordinate of grid cell to be tested
 * @param y
 *            Y-Coordinate of grid cell to be tested
 * @return true: cell is weakly blocked; false: otherwise
 * @throws IndexOutOfBoundsException
 *             Coordinates are outside of the grid.
 */
public boolean isWeaklyBlockedCenterBased(final int x, final int y) throws IndexOutOfBoundsException {
  try {
    return isWeaklyBlocked(x + xCenter, y + yCenter);
  } catch (IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(
        e.getLocalizedMessage() + " Given center based coordinates were (" + x + ", " + y + ").");
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.search

private String computeReplacementString(Pattern pattern, String originalText, String replacementText, String lineDelimiter) throws PatternSyntaxException {
  if (pattern != null) {
    try {
      replacementText= PatternConstructor.interpretReplaceEscapes(replacementText, originalText, lineDelimiter);
      Matcher matcher= pattern.matcher(originalText);
      StringBuffer sb = new StringBuffer();
      matcher.reset();
      if (matcher.find()) {
        matcher.appendReplacement(sb, replacementText);
      } else {
        return null;
      }
      matcher.appendTail(sb);
      return sb.toString();
    } catch (IndexOutOfBoundsException ex) {
      throw new PatternSyntaxException(ex.getLocalizedMessage(), replacementText, -1);
    }
  }
  return replacementText;
}

代码示例来源:origin: senbox-org/s1tbx

public double[][] parseOrbit() throws Exception {
  // get number of state vectors
  final String numStateVectorsKey = "NUMBER_OF_DATAPOINTS";
  final int numberOfStateVectors = parseIntegerValue(numStateVectorsKey);
  final double[][] stateVectors = new double[numberOfStateVectors][4];
  String stateVectorsPattern = "\\s*?(\\d+\\.\\d+)\\s*?(\\d+\\.\\d+)\\s*?(\\d+\\.\\d+)\\s*?(\\d+\\.\\d+)";
  Matcher match = createMatcher(buffer.substring(startIdx, endIdx), stateVectorsPattern);
  int i = 0;
  while (match.find()) {
    try {
      stateVectors[i][0] = Double.parseDouble(match.group(1).trim());
      stateVectors[i][1] = Double.parseDouble(match.group(2).trim());
      stateVectors[i][2] = Double.parseDouble(match.group(3).trim());
      stateVectors[i][3] = Double.parseDouble(match.group(4).trim());
      i++;
    } catch (IndexOutOfBoundsException e) {
      logger.severe("parseOrbit() : Exception handling regex : " + e.getLocalizedMessage());
    }
  }
  if (i != numberOfStateVectors) {
    logger.severe("parseOrbit() : inconsistency in number of defined and parsed state vectors");
    throw new IllegalArgumentException("Cannot parse orbit : number of defined and parsed state vectors not the same");
  }
  return stateVectors;
}

代码示例来源:origin: org.opencms/opencms-solr

/**
 * Returns the localized name of the currently active tab.<p>
 * 
 * @return the localized name of the currently active tab or null if no tab name was found
 */
public String getActiveTabName() {
  if (m_activeTab < 0) {
    getActiveTab();
  }
  List tabNames = getTabs();
  try {
    return (String)tabNames.get(m_activeTab - 1);
  } catch (IndexOutOfBoundsException e) {
    // should usually never happen
    if (LOG.isInfoEnabled()) {
      LOG.info(e.getLocalizedMessage());
    }
    return null;
  }
}

代码示例来源:origin: org.opencms/org.opencms.workplace

/**
 * Returns the localized name of the currently active tab.<p>
 *
 * @return the localized name of the currently active tab or null if no tab name was found
 */
public String getActiveTabName() {
  if (m_activeTab < 0) {
    getActiveTab();
  }
  List<String> tabNames = getTabs();
  try {
    return tabNames.get(m_activeTab - 1);
  } catch (IndexOutOfBoundsException e) {
    // should usually never happen
    if (LOG.isInfoEnabled()) {
      LOG.info(e.getLocalizedMessage());
    }
    return null;
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
   * Tries to rewrite a given path, and either returns the rewrite result or null if no
   * rewrite alias matched the path.<p>
   *
   * @param path the path to match
   * @return the rewrite result or null if no rewrite alias matched
   */
  public RewriteResult match(String path) {

    for (CmsRewriteAlias alias : m_aliases) {
      try {
        Pattern pattern = Pattern.compile(alias.getPatternString());
        Matcher matcher = pattern.matcher(path);
        if (matcher.matches()) {
          String newPath = matcher.replaceFirst(alias.getReplacementString());
          return new RewriteResult(newPath, alias);
        }
      } catch (PatternSyntaxException e) {
        LOG.warn(e.getLocalizedMessage(), e);
      } catch (IndexOutOfBoundsException e) {
        LOG.warn(e.getLocalizedMessage(), e);
      }
    }
    return null;
  }
}

代码示例来源:origin: org.tachyonproject/tachyon-servers

} catch (IndexOutOfBoundsException iobe) {
 request.setAttribute("fatalError",
     "Error: offset or offset + limit is out of bound, " + iobe.getLocalizedMessage());
 getServletContext().getRequestDispatcher(mBrowseJsp).forward(request, response);
 return;

代码示例来源:origin: org.tachyonproject/tachyon-servers

} catch (IndexOutOfBoundsException iobe) {
 request.setAttribute("fatalError",
   "Error: offset or offset + limit is out of bound, " + iobe.getLocalizedMessage());
 getServletContext().getRequestDispatcher("/memory.jsp").forward(request, response);
 return;

代码示例来源:origin: org.alluxio/alluxio-core-server-master

} catch (IndexOutOfBoundsException e) {
 request.setAttribute("fatalError",
   "Error: offset or offset + limit is out of bound, " + e.getLocalizedMessage());
 getServletContext().getRequestDispatcher("/memory.jsp").forward(request, response);
 return;

代码示例来源:origin: org.tachyonproject/tachyon-servers

} catch (IndexOutOfBoundsException iobe) {
 request.setAttribute("fatalError",
   "Error: offset or offset + limit is out of bound, " + iobe.getLocalizedMessage());
 getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
 return;

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

replaceText= replaceTextMatcher.replaceFirst(replaceText);
} catch (IndexOutOfBoundsException ex) {
  throw new PatternSyntaxException(ex.getLocalizedMessage(), replaceText, -1);

相关文章