@Override public ItemStack next() { direction = 1; try { return inventory.getItem(nextIndex++); } catch (IndexOutOfBoundsException e) { throw new NoSuchElementException(e.getLocalizedMessage()); } }
throw new IOException( String.format("The string is not long enough to extract 1 character for name \"%s\" - %s.", fieldName, ex.getLocalizedMessage()), ex);
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; }
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; }
/** * 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 + ")."); } }
/** * 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 + ")."); } }
/** * 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 + ")."); } }
/** * 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 + ")."); } }
/** * 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 + ")."); } }
/** * 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 + ")."); } }
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; }
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; }
/** * 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; } }
/** * 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; } }
/** * 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; } }
} catch (IndexOutOfBoundsException iobe) { request.setAttribute("fatalError", "Error: offset or offset + limit is out of bound, " + iobe.getLocalizedMessage()); getServletContext().getRequestDispatcher(mBrowseJsp).forward(request, response); return;
} 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;
} 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;
} 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;
replaceText= replaceTextMatcher.replaceFirst(replaceText); } catch (IndexOutOfBoundsException ex) { throw new PatternSyntaxException(ex.getLocalizedMessage(), replaceText, -1);