本文整理了Java中java.util.NoSuchElementException.initCause()
方法的一些代码示例,展示了NoSuchElementException.initCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchElementException.initCause()
方法的具体详情如下:
包路径:java.util.NoSuchElementException
类名称:NoSuchElementException
方法名:initCause
暂无
代码示例来源:origin: linkedin/parseq
@Override
public T get() {
throw (NoSuchElementException) new NoSuchElementException().initCause(_error);
}
代码示例来源:origin: neo4j/neo4j
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 );
}
}
代码示例来源:origin: requery/requery
@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;
}
}
代码示例来源:origin: apache/activemq
@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()));
}
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
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);
}
}
代码示例来源:origin: geotools/geotools
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;
}
代码示例来源:origin: geotools/geotools
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;
}
}
代码示例来源:origin: geotools/geotools
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;
}
}
代码示例来源:origin: haraldk/TwelveMonkeys
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;
}
}
代码示例来源:origin: haraldk/TwelveMonkeys
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;
}
}
代码示例来源:origin: geotools/geotools
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;
}
}
代码示例来源:origin: geotools/geotools
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 */
代码示例来源:origin: geotools/geotools
nse.initCause(e);
throw nse;
代码示例来源:origin: geotools/geotools
+ "'";
NoSuchElementException nse = new NoSuchElementException(msg);
nse.initCause(e);
throw nse;
代码示例来源:origin: org.apache.commons/commons-pool2
final NoSuchElementException nsee = new NoSuchElementException(
"Unable to activate object");
nsee.initCause(e);
throw nsee;
final NoSuchElementException nsee = new NoSuchElementException(
"Unable to validate object");
nsee.initCause(validationThrowable);
throw nsee;
代码示例来源:origin: org.apache.commons/commons-pool2
final NoSuchElementException nsee = new NoSuchElementException(
"Unable to activate object");
nsee.initCause(e);
throw nsee;
final NoSuchElementException nsee = new NoSuchElementException(
"Unable to validate object");
nsee.initCause(validationThrowable);
throw nsee;
代码示例来源:origin: org.geotools/gt-main
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;
}
代码示例来源:origin: NationalSecurityAgency/datawave
@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);
}
代码示例来源:origin: apache/jackrabbit
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;
}
}
};
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
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;
}
}
};
内容来源于网络,如有侵权,请联系作者删除!