List of usage examples for java.util NoSuchElementException NoSuchElementException
public NoSuchElementException(String s)
From source file:net.sf.morph.reflect.support.ResultSetIterator.java
/** * {@inheritDoc}/*w w w . j a v a 2 s. c o m*/ */ public Object next() { if (hasNext()) { hasReturnedRow = true; return resultSet; } throw new NoSuchElementException(NO_MORE); }
From source file:com.mongodb.hadoop.util.BSONLoader.java
public BSONObject next() { try {//from w w w . j a v a2 s . co m byte[] data = new byte[nextLen + 4]; System.arraycopy(nextHdr, 0, data, 0, 4); _input.readFully(data, 4, nextLen - 4); decoder.decode(data, callback); return (BSONObject) callback.get(); } catch (IOException e) { /* If we can't read another length it's not an error, just return quietly. */ log.info("No Length Header available." + e); hasMore.set(false); try { _input.close(); } catch (IOException e1) { } throw new NoSuchElementException("Iteration completed."); } }
From source file:com.esri.gpt.control.webharvest.client.waf.FtpFileIterator.java
@Override public Resource next() { if (nextResource == null) { throw new NoSuchElementException("No more elements."); }/*from w w w. j ava 2 s. com*/ Resource r = nextResource; nextResource = null; if (r instanceof FtpFile) { try { FtpFile f = (FtpFile) r; f.getContent(); } catch (Exception ex) { iterationContext.onIterationException(ex); } } return r; }
From source file:org.obiba.mica.core.service.DocumentSetService.java
/** * Find document with ID./* ww w. ja va 2 s. com*/ * * @param id * @return */ public DocumentSet findOne(String id) { DocumentSet documentSet = documentSetRepository.findOne(id); if (documentSet == null) throw new NoSuchElementException("No '" + getType() + "' set with id: " + id); return documentSet; }
From source file:com.schedjoules.eventdiscovery.framework.serialization.commons.OptionalArgument.java
@Override public T value() throws NoSuchElementException { Box<T> box = mBundle.getParcelable(mKey.name()); if (box == null) { throw new NoSuchElementException( String.format("Argument with key `%s` not found in Bundle", mKey.name())); }/*from w ww. ja v a 2 s . com*/ return box.content(); }
From source file:com.eviware.soapui.utils.ContainerWalker.java
public <T> JComboBox findComboBoxWithValue(T value) { for (Component component : containedComponents) { if (component instanceof JComboBox) { JComboBox comboBox = (JComboBox) component; for (int i = 0; i < comboBox.getItemCount(); i++) { if (comboBox.getItemAt(i).equals(value)) { return comboBox; }/* w ww .j a v a 2 s. c o m*/ } } } throw new NoSuchElementException("No combo box found with item " + value); }
From source file:com.telefonica.euro_iaas.sdc.puppetwrapper.data.Node.java
public Software getSoftware(String softName) { Software result = null;/*from w w w.j av a2 s . c om*/ for (Software soft : softwareList) { if (soft.getName().equals(softName)) { result = soft; break; } } if (result == null) { throw new NoSuchElementException(format("The software {0} could not be found", softName)); } return result; }
From source file:ArrayIterator.java
/** * Returns the next element of this Iterator if this Iterator * object has at least one more element to provide. * * @return the next element of this Iterator. * @throws NoSuchElementException if no more elements exist. * * @since ostermillerutils 1.03.00//from w ww .j a va2 s .com */ public ElementType next() throws NoSuchElementException { if (index >= array.length) throw new NoSuchElementException("Array index: " + index); ElementType object = array[index]; index++; lastRemoved = false; return object; }
From source file:it.unibo.alchemist.language.protelis.datatype.FieldTroveMapImpl.java
@Override public Object getSample(final DeviceUID n) { Objects.requireNonNull(n);//from w ww. j a va2 s . co m final Pair<DeviceUID, Object> res = fld.get(n.getId()); if (res == null) { throw new NoSuchElementException(n.toString()); } return res.getSecond(); }
From source file:de.codesourcery.eve.skills.db.dao.FactionDAO.java
@Override public Faction getFactionByName(String factionName) throws NoSuchElementException { if (StringUtils.isBlank(factionName)) { throw new IllegalArgumentException("factionName cannot be blank."); }/*from w w w. java2 s. co m*/ if (!initialized) { // thread-safe because of volatile semantics load(); } final Faction result = this.byNameCache.get(factionName); if (result == null) { throw new NoSuchElementException("Found no faction with name '" + factionName + "'"); } return result; }