List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException(String s)
From source file:fi.hsl.parkandride.itest.AbstractReportingITest.java
protected List<String> findRowWithColumn(Sheet sheet, int columnNumber, String content) { for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) { final Row row = sheet.getRow(i); final List<String> dataFromRow = getDataFromRow(row); if (dataFromRow.contains(content)) { return dataFromRow; }/* ww w.j a v a 2 s . co m*/ } throw new NoSuchElementException( String.format("Row with column at %d: <%s> not found", columnNumber, content)); }
From source file:com.opengamma.util.timeseries.fast.integer.FastArrayIntDoubleTimeSeries.java
@Override public int getEarliestTimeFast() { if (_times.length > 0) { return _times[0]; } else {/* ww w. j av a2s .c o m*/ throw new NoSuchElementException("Series is empty"); } }
From source file:com.oracle2hsqldb.dialect.GenericDialect.java
public Iterator getSequences(DataSource dataSource, String schemaName) throws SQLException { return new Iterator() { public boolean hasNext() { return false; }// w w w .j av a2 s . c om public Object next() { throw new NoSuchElementException("No elements at all"); } public void remove() { throw new UnsupportedOperationException(); } }; }
From source file:net.opentsdb.core.Aggregators.java
/** * Returns the aggregator corresponding to the given name. * @param name The name of the aggregator to get. * @throws NoSuchElementException if the given name doesn't exist. * @see #set//from w w w .j av a 2 s.c o m */ public static Aggregator get(final String name) { final Aggregator agg = aggregators.get(name); if (agg != null) { return agg; } throw new NoSuchElementException("No such aggregator: " + name); }
From source file:com.opengamma.util.timeseries.fast.integer.FastArrayIntDoubleTimeSeries.java
@Override public double getEarliestValueFast() { if (_values.length > 0) { return _values[0]; } else {/*w ww .j a v a 2 s. co m*/ throw new NoSuchElementException("Series is empty"); } }
From source file:com.opengamma.util.timeseries.fast.integer.object.FastArrayIntObjectTimeSeries.java
@Override public T getEarliestValueFast() { if (_values.length > 0) { return _values[0]; } else {//from w w w . j ava 2 s. c o m throw new NoSuchElementException("Series is empty"); } }
From source file:com.opengamma.util.timeseries.fast.longint.FastArrayLongDoubleTimeSeries.java
@Override public long getEarliestTimeFast() { if (_times.length > 0) { return _times[0]; } else {/*from ww w.j a v a2 s.c o m*/ throw new NoSuchElementException("Series is empty"); } }
From source file:io.horizondb.model.schema.DefaultRecordSetDefinition.java
/** * {@inheritDoc}/*w w w.j av a 2 s . co m*/ */ @Override public int getFieldIndex(int type, String name) { if (type >= this.recordTypes.size()) { throw new NoSuchElementException( "No records have not been defined with the index " + type + " within this record set."); } RecordTypeDefinition recordType = this.recordTypes.get(type); return recordType.getFieldIndex(name); }
From source file:com.asakusafw.lang.inspection.cli.Cli.java
private static InspectionNode find(InspectionNode node, String path) { InspectionNode current = node;//from ww w. j a v a 2s . co m StringBuilder history = new StringBuilder(); for (String segment : path.split(PATH_SEPARATOR)) { if (segment.isEmpty()) { continue; } if (history.length() >= 1) { history.append(PATH_SEPARATOR); } history.append(segment); InspectionNode next = current.getElements().get(segment); if (next == null) { throw new NoSuchElementException(history.toString()); } current = next; } return current; }
From source file:com.hybris.mobile.lib.http.converter.JsonDataConverter.java
/** * @param data String of character to be parsed * @param property Attributes to be parse * @param element JSON element to get data from * @return List of String/*w w w.java 2s. c o m*/ */ protected List<String> getValuesFromPropertyElement(String data, String property, String element, boolean recursive) { List<String> listToReturn = new ArrayList<>(); if (data == null) { throw new IllegalArgumentException(); } JsonParser parser = new JsonParser(); JsonArray jsonArray; JsonElement jsonElement; try { if (StringUtils.isNotBlank(property)) { jsonElement = parser.parse(data).getAsJsonObject().get(property); } else { jsonElement = parser.parse(data); } if (jsonElement != null) { if (jsonElement.isJsonArray()) { jsonArray = jsonElement.getAsJsonArray(); } else { jsonArray = new JsonArray(); jsonArray.add(jsonElement); } if (jsonArray != null) { for (JsonElement currentJsonElement : jsonArray) { if (StringUtils.isNotBlank(element)) { if (recursive) { try { listToReturn.addAll(getValuesFromPropertyElement(currentJsonElement.toString(), property, element, recursive)); } catch (NoSuchElementException e) { Log.d(TAG, "End of getting the recursive property " + property + "."); } } currentJsonElement = currentJsonElement.getAsJsonObject().get(element); } if (currentJsonElement != null) { if (currentJsonElement.isJsonPrimitive()) { listToReturn.add(currentJsonElement.getAsString()); } else { listToReturn.add(currentJsonElement.toString()); } } else { Log.d(TAG, "No data found for element " + element + "."); } } } } else { Log.d(TAG, "No data found on " + data + " for property " + property + "."); } } catch (Exception e) { Log.e(TAG, "Error parsing the data " + data + " for property " + property + " and element " + element + "."); throw new NoSuchElementException("Error parsing the data " + data + " for property " + property + " and element " + element + "."); } return listToReturn; }