本文整理了Java中java.util.NoSuchElementException.toString()
方法的一些代码示例,展示了NoSuchElementException.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchElementException.toString()
方法的具体详情如下:
包路径:java.util.NoSuchElementException
类名称:NoSuchElementException
方法名:toString
暂无
代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core
public boolean getBoolean(String key) {
try {
return configuration.getBoolean(key);
} catch (NoSuchElementException e) {
log.info("Return 'false' for '{}' because of '{}'", key , e.toString());
return false;
}
}
代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core
public int getInt(String key) {
try {
return configuration.getInt(key);
} catch (NoSuchElementException e) {
log.info("Return '0' for '{}' because of '{}'", key , e.toString());
return 0;
}
}
代码示例来源:origin: org.jmx4perl/j4p14
private static CompositeData getRow(int idx, Iterator it) {
try {
for (int i = 0; i < idx; i++) {
it.next();
}
} catch (NoSuchElementException ex) {
throw new IllegalArgumentException(
"Index " + idx + " out of range. Ex: " + ex.toString());
}
return (CompositeData) it.next();
}
代码示例来源:origin: org.jmx4perl/j4p
private static CompositeData getRow(int idx, Iterator it) {
try {
for (int i = 0; i < idx; i++) {
it.next();
}
} catch (NoSuchElementException ex) {
throw new IllegalArgumentException(
"Index " + idx + " out of range. Ex: " + ex.toString(),ex);
}
return (CompositeData) it.next();
}
代码示例来源:origin: org.wildfly.core/wildfly-controller
@Override
public String toString() {
return super.toString() + " [ " + getFailureDescription() + " ]";
}
}
代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core
public double getDouble(String key) {
try {
return configuration.getDouble(key);
} catch (NoSuchElementException e) {
log.info("Return '0D' for '{}' because of '{}'", key , e.toString());
return 0D;
}
}
代码示例来源:origin: wildfly/wildfly-core
@Override
public String toString() {
return super.toString() + " [ " + getFailureDescription() + " ]";
}
}
代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core
public float getFloat(String key) {
try {
return configuration.getFloat(key);
} catch (NoSuchElementException e) {
log.info("Return '0F' for '{}' because of '{}'", key , e.toString());
return 0F;
}
}
代码示例来源:origin: org.terracotta.modules/tim-tree-map-cache
/** Returns the root {@Link Fqn} of the this tree
*
* @return
* @throws CacheException
*/
public Fqn getFqn() throws CacheException {
Fqn fqn;
try {
fqn = cacheTree.firstKey();
} catch (NoSuchElementException e) {
throw new CacheException(e.toString());
}
return fqn;
}
代码示例来源:origin: com.synaptix/processmanager-core
public SyncMsg(String src) throws MalformedSyncMsgException {
try {
if (src.startsWith("?"))
type = T_REQ;
else if (src.startsWith(">"))
type = T_REG;
else if (src.startsWith("<"))
type = T_UREG;
else if (src.startsWith("O"))
type = T_OVERLOAD;
else if (src.startsWith("U"))
type = T_UNDERLOAD;
else
type = T_UNKNOWN;
StringTokenizer st = new StringTokenizer(src.substring(1), "|",
true);
registryUID = st.nextToken();
st.nextToken();
serviceID = st.nextToken();
st.nextToken();
providerURI = st.nextToken();
} catch (NoSuchElementException ex) {
throw new MalformedSyncMsgException("message " + src
+ " mal formé : " + ex.toString());
}
}
代码示例来源:origin: com.synaptix/SynaptixProcessManagerCore
public SyncMsg(String src) throws MalformedSyncMsgException {
try {
if (src.startsWith("?")) {
type = T_REQ;
} else if (src.startsWith(">")) {
type = T_REG;
} else if (src.startsWith("<")) {
type = T_UREG;
} else if (src.startsWith("O")) {
type = T_OVERLOAD;
} else if (src.startsWith("U")) {
type = T_UNDERLOAD;
} else {
type = T_UNKNOWN;
}
StringTokenizer st = new StringTokenizer(src.substring(1), "|", true);
registryUID = st.nextToken();
st.nextToken();
serviceID = st.nextToken();
st.nextToken();
providerURI = st.nextToken();
} catch (NoSuchElementException ex) {
throw new MalformedSyncMsgException("message " + src + " mal formé : " + ex.toString());
}
}
代码示例来源:origin: com.cloudera.oryx/oryx-als-serving
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException {
CharSequence pathInfo = request.getPathInfo();
if (pathInfo == null) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No path");
return;
}
Iterator<String> pathComponents = SLASH.split(pathInfo).iterator();
String userID;
String itemID;
try {
userID = pathComponents.next();
itemID = pathComponents.next();
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
}
OryxRecommender recommender = getRecommender();
recommender.removePreference(userID, itemID);
}
代码示例来源:origin: org.terracotta.modules/tim-tree-map-cache
/** Returns the root {@Link Fqn} of the this tree
*
* @return
* @throws CacheException
*/
public Fqn getFqn() throws CacheException {
Fqn fqn;
try {
fqn = cacheTree.firstKey();
} catch (NoSuchElementException e) {
throw new CacheException(e.toString());
}
touch(fqn);
return fqn;
}
代码示例来源:origin: org.libreoffice/jurt
/**
* Returns the next element of the enumeration.
*
* <p>If no further elements available a com.sun.star.container.NoSuchElementException
* exception will be thrown.</p>
*
* @return the next element.
* @see com.sun.star.container.XEnumeration
*/
public Object nextElement()
throws com.sun.star.container.NoSuchElementException,
com.sun.star.lang.WrappedTargetException,
com.sun.star.uno.RuntimeException
{
if (enumeration == null)
throw new com.sun.star.container.NoSuchElementException();
try {
return enumeration.next();
} catch (java.util.NoSuchElementException e) {
throw new com.sun.star.container.NoSuchElementException(e, e.toString());
}
}
}
代码示例来源:origin: com.cloudera.oryx/oryx-als-serving
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
CharSequence pathInfo = request.getPathInfo();
if (pathInfo == null) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No path");
return;
}
Iterator<String> pathComponents = SLASH.split(pathInfo).iterator();
String userID;
try {
userID = pathComponents.next();
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
}
OryxRecommender recommender = getRecommender();
try {
output(request, response, recommender.getKnownItemsForUser(userID));
} catch (NotReadyException nre) {
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
}
}
代码示例来源:origin: myrrix/myrrix-recommender
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException {
CharSequence pathInfo = request.getPathInfo();
if (pathInfo == null) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No path");
return;
}
Iterator<String> pathComponents = SLASH.split(pathInfo).iterator();
long userID;
long itemID;
try {
userID = Long.parseLong(pathComponents.next());
itemID = Long.parseLong(pathComponents.next());
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
} catch (NumberFormatException nfe) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nfe.toString());
return;
}
MyrrixRecommender recommender = getRecommender();
try {
recommender.removePreference(userID, itemID);
} catch (TasteException te) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, te.toString());
getServletContext().log("Unexpected error in " + getClass().getSimpleName(), te);
}
}
代码示例来源:origin: com.cloudera.oryx/oryx-als-serving
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
CharSequence pathInfo = request.getPathInfo();
if (pathInfo == null) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No path");
return;
}
Iterator<String> pathComponents = SLASH.split(pathInfo).iterator();
String userID;
List<String> itemIDsList;
try {
userID = pathComponents.next();
itemIDsList = new ArrayList<>();
while (pathComponents.hasNext()) {
itemIDsList.add(pathComponents.next());
}
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
}
String[] itemIDs = itemIDsList.toArray(new String[itemIDsList.size()]);
unescapeSlashHack(itemIDs);
OryxRecommender recommender = getRecommender();
try {
float[] estimates = recommender.estimatePreferences(userID, itemIDs);
output(request, response, estimates);
} catch (NotReadyException nre) {
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
}
}
代码示例来源:origin: com.cloudera.oryx/oryx-als-serving
userID = pathComponents.next();
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
代码示例来源:origin: com.cloudera.oryx/oryx-als-serving
itemIDsAndValue = RecommendToAnonymousServlet.parseItemValuePairs(pathComponents);
} catch (NoSuchElementException nsee) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, nsee.toString());
return;
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds
@Test(groups={"Live", "Live-sanity"})
public void testJcloudsCreateWithHardwareIdShortFormWithNoRegion() throws Exception {
replaceJcloudsLocation(GCE_PROVIDER);
try {
obtainMachine(ImmutableMap.of(JcloudsLocation.HARDWARE_ID, N1_STANDARD_1_HARDWARE_ID));
Asserts.shouldHaveFailedPreviously();
} catch (Exception e) {
NoSuchElementException nsee = Exceptions.getFirstThrowableOfType(e, NoSuchElementException.class);
if (nsee == null || !nsee.toString().contains("hardwareId("+N1_STANDARD_1_HARDWARE_ID+") not found")) {
throw e;
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!