@Override public T get() { throw (NoSuchElementException) new NoSuchElementException().initCause(_error); }
private <T> T get( String key, Class<T> type ) { Object value = map.get( key ); if ( value == null ) { if ( !map.containsKey( key ) ) { throw new NoSuchElementException( "No such entry: " + key ); } } try { return type.cast( value ); } catch ( ClassCastException e ) { throw (NoSuchElementException) new NoSuchElementException( "Element '" + key + "' is not a " + type.getSimpleName() ).initCause( e ); } }
@Override public E next() { if (closed) { throw new IllegalStateException(); } try { if (!advanced) { // move forward if (!results.next()) { advanced = false; close(); throw new NoSuchElementException(); } } // else already ready to read E value = reader.read(results, selection); position++; advanced = false; return value; } catch (SQLException e) { NoSuchElementException exception = new NoSuchElementException(); exception.initCause(e); throw exception; } }
@Override public PListEntry next() { Map.Entry<String, Location> entry = iterator.next(); ByteSequence bs = null; try { bs = store.getPayload(entry.getValue()); } catch (IOException unexpected) { NoSuchElementException e = new NoSuchElementException(unexpected.getLocalizedMessage()); e.initCause(unexpected); throw e; } return new PListEntry(entry.getKey(), bs, new Locator(entry.getKey())); }
public synchronized String previous() { if (index == 0) { throw new NoSuchElementException(); } try { int pos = index - 1; initReader(); String last = null; while (index <= pos) { last = next(); } index--; return last; } catch (IOException ex) { throw (NoSuchElementException)new NoSuchElementException().initCause(ex); } }
public SimpleFeature next() { if (origionalProblem == null) { // you only get the real error on the first offense // (after that you are just silly) // throw new NoSuchElementException(); } NoSuchElementException cantFind = new NoSuchElementException("Could not aquire feature:" + origionalProblem); cantFind.initCause(origionalProblem); origionalProblem = null; throw cantFind; }
public SimpleFeature next() { if (writer == null) { throw new NoSuchElementException("Iterator has been closed"); } try { return writer.next(); } catch (IOException io) { NoSuchElementException problem = new NoSuchElementException("Could not obtain the next feature:" + io); problem.initCause(io); throw problem; } }
public SimpleFeature next() { if (writer == null) { throw new NoSuchElementException("Iterator has been closed"); } try { return writer.next(); } catch (IOException io) { NoSuchElementException problem = new NoSuchElementException("Could not obtain the next feature:" + io); problem.initCause(io); throw problem; } }
public E next() { if (!hasNext()) { throw new NoSuchElementException(); } try { return array[next++]; } catch (ArrayIndexOutOfBoundsException e) { NoSuchElementException nse = new NoSuchElementException(e.getMessage()); nse.initCause(e); throw nse; } }
public E previous() { if (!hasPrevious()) { throw new NoSuchElementException(); } try { return array[--next]; } catch (ArrayIndexOutOfBoundsException e) { NoSuchElementException nse = new NoSuchElementException(e.getMessage()); nse.initCause(e); throw nse; } }
public F next() { if (reader == null) { throw new NoSuchElementException("Iterator has been closed"); } try { return reader.next(); } catch (IOException io) { close(); NoSuchElementException problem = new NoSuchElementException("Could not obtain the next feature:" + io); problem.initCause(io); throw problem; } catch (org.opengis.feature.IllegalAttributeException create) { close(); NoSuchElementException problem = new NoSuchElementException("Could not create the next feature:" + create); problem.initCause(create); throw problem; } }
public SimpleFeature next() { if (reader == null) { throw new NoSuchElementException("Iterator has been closed"); } try { return reader.next(); } catch (IOException io) { close(); NoSuchElementException problem = new NoSuchElementException("Could not obtain the next feature:" + io); problem.initCause(io); throw problem; } catch (IllegalAttributeException create) { close(); NoSuchElementException problem = new NoSuchElementException("Could not create the next feature:" + create); problem.initCause(create); throw problem; } } /** If this is a problem, a different iterator can be made based on FeatureWriter */
nse.initCause(e); throw nse;
+ "'"; NoSuchElementException nse = new NoSuchElementException(msg); nse.initCause(e); throw nse;
public SimpleFeature next() { if( origionalProblem == null ){ // you only get the real error on the first offense // (after that you are just silly) // throw new NoSuchElementException(); } NoSuchElementException cantFind = new NoSuchElementException( "Could not aquire feature:" + origionalProblem ); cantFind.initCause( origionalProblem ); origionalProblem = null; throw cantFind; }
@Override public byte[] last() { if (size == 0) { QueryException qe = new QueryException(DatawaveErrorCode.FETCH_LAST_ELEMENT_ERROR); throw (NoSuchElementException) (new NoSuchElementException().initCause(qe)); } return get(size - 1); }
public Object next() { ChildNodeEntry cne = (ChildNodeEntry) super.next(); try { return ism.getItemState(cne.getId()); } catch (ItemStateException e) { NoSuchElementException nsee = new NoSuchElementException("No node with id " + cne.getId() + " found in child axis"); nsee.initCause(e); throw nsee; } } };
public Object next() { ChildNodeEntry cne = (ChildNodeEntry) super.next(); try { return ism.getItemState(cne.getId()); } catch (ItemStateException e) { NoSuchElementException nsee = new NoSuchElementException("No node with id " + cne.getId() + " found in child axis"); nsee.initCause(e); throw nsee; } } };