List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException(String s)
From source file:AvailablePortFinder.java
/** * Gets the next available port starting at a port. * * @param fromPort the port to scan for availability * @throws NoSuchElementException if there are no ports available *//* w w w .j av a2s. c o m*/ public static int getNextAvailable(int fromPort) { if (fromPort < MIN_PORT_NUMBER || fromPort > MAX_PORT_NUMBER) { throw new IllegalArgumentException("Invalid start port: " + fromPort); } for (int i = fromPort; i <= MAX_PORT_NUMBER; i++) { if (available(i)) { return i; } } throw new NoSuchElementException("Could not find an available port " + "above " + fromPort); }
From source file:ar.com.zauber.commons.repository.ScrollableResultsIterator.java
/** @see Iterator#next() */ public final T next() { if (buffer == null) { throw new NoSuchElementException("no more rows"); }// w w w . ja v a2 s . c o m T ret = buffer; readNextFromScrollable(); return ret; }
From source file:io.knotx.dataobjects.Fragment.java
private Fragment(List<String> knots, String data) { if (knots == null || knots.isEmpty() || StringUtils.isEmpty(data)) { throw new NoSuchElementException("Fragment is not valid [" + knots + "], [" + data + "]."); }/*from w w w .ja v a 2 s . c o m*/ this.knots = knots; this.content = data; this.context = new JsonObject(); }
From source file:de.tud.inf.db.sparqlytics.repository.AbstractRepository.java
@Override public Dimension findDimension(final String name) { for (Dimension dimension : getDimensions()) { if (dimension.getName().equals(name)) { return dimension; }/* w w w.j a va 2 s . c om*/ } throw new NoSuchElementException(name); }
From source file:net.longfalcon.newsj.nntp.client.ReplyIterator.java
public boolean hasNext() { if (savedException != null) { throw new NoSuchElementException(savedException.toString()); }/*from www. j av a2 s. c om*/ return line != null; }
From source file:de.unioninvestment.eai.portal.portlet.crud.domain.model.FormFields.java
/** * Holt ein FormField anhand des Namen./*from ww w.ja v a 2 s . c o m*/ * * @param fieldName * Feldname * @return FormField */ public FormField get(String fieldName) { FormField field = fields.get(fieldName); if (field == null) { throw new NoSuchElementException("No such field: '" + fieldName + "'"); } return field; }
From source file:com.uber.hoodie.hadoop.RecordReaderValueIterator.java
@Override public V next() { if (!hasNext()) { throw new NoSuchElementException("Make sure you are following iterator contract."); }/* w ww.j a v a 2 s . com*/ V retVal = this.nextVal; this.nextVal = null; return retVal; }
From source file:ListOfFiles.java
public FileInputStream nextElement() { FileInputStream in = null;//from www. j a v a 2 s . c o m if (!hasMoreElements()) throw new NoSuchElementException("No more files."); else { String nextElement = listOfFiles[current]; current++; try { in = new FileInputStream(nextElement); } catch (FileNotFoundException e) { System.err.println("ListOfFiles: Can't open " + nextElement); } } return in; }
From source file:net.longfalcon.newsj.nntp.client.ReplyIterator.java
public String next() throws NoSuchElementException { if (savedException != null) { throw new NoSuchElementException(savedException.toString()); }// w ww .jav a 2 s .c o m String prev = line; if (prev == null) { throw new NoSuchElementException(); } try { line = reader.readLine(); // save next line if (line == null) { Util.closeQuietly(reader); } } catch (IOException ex) { savedException = ex; // if it fails, save the exception, as it does not apply to this call Util.closeQuietly(reader); } return prev; }
From source file:de.tud.inf.db.sparqlytics.repository.AbstractRepository.java
@Override public Measure findMeasure(final String name) { for (Measure measure : getMeasures()) { if (measure.getName().equals(name)) { return measure; }/*from ww w . jav a2 s. co m*/ } throw new NoSuchElementException(name); }