本文整理了Java中java.lang.ArrayStoreException.<init>()
方法的一些代码示例,展示了ArrayStoreException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayStoreException.<init>()
方法的具体详情如下:
包路径:java.lang.ArrayStoreException
类名称:ArrayStoreException
方法名:<init>
[英]Constructs a new ArrayStoreException that includes the current stack trace.
[中]构造包含当前堆栈跟踪的新ArrayStoreException。
代码示例来源:origin: plutext/docx4j
throw new ArrayStoreException
("Destination byte[] must have room for at least 16 bytes, " +
"but has a length of only " + dst.length + ".");
代码示例来源:origin: org.apache.poi/poi
throw new ArrayStoreException
("Destination byte[] must have room for at least 16 bytes, " +
"but has a length of only " + dst.length + ".");
代码示例来源:origin: robovm/robovm
private static void arraycopy(Object[] src, int srcPos, Object[] dst, int dstPos, int length) {
arraycopyCheckBounds(src.length, srcPos, dst.length, dstPos, length);
if (length > 0) {
// TODO: Use arraycopyFast() if src.class and dst.class have same dimensionality and (src instanceof dst)
int i = 0;
try {
// Check if this is a forward or backwards arraycopy
if (src != dst || srcPos > dstPos || srcPos + length <= dstPos) {
for (i = 0; i < length; ++i) {
dst[dstPos + i] = src[srcPos + i];
}
} else {
for (i = length - 1; i >= 0; --i) {
dst[dstPos + i] = src[srcPos + i];
}
}
} catch (ArrayStoreException e) {
// Throw a new one with a more descriptive message.
Class<?> srcElemClass = src[i + srcPos].getClass();
String srcElemTypeName = srcElemClass.isArray()
? srcElemClass.getCanonicalName() : srcElemClass.getName();
throw new ArrayStoreException(String.format(
"source[%d] of type %s cannot be stored in destination array of type %s",
i + srcPos, srcElemTypeName, dst.getClass().getCanonicalName()));
}
}
}
代码示例来源:origin: real-logic/agrona
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(final T[] into)
{
final Class<?> componentType = into.getClass().getComponentType();
if (!componentType.isAssignableFrom(Integer.class))
{
throw new ArrayStoreException("cannot store Integers in array of type " + componentType);
}
@DoNotSub final int size = size();
final T[] arrayCopy = into.length >= size ? into : (T[])Array.newInstance(componentType, size);
copyValues(arrayCopy);
return arrayCopy;
}
代码示例来源:origin: robovm/robovm
Class<?> type2 = dst.getClass();
if (!type1.isArray()) {
throw new ArrayStoreException("source of type " + type1.getName() + " is not an array");
throw new ArrayStoreException("destination of type " + type2.getName() + " is not an array");
if (!componentType1.isPrimitive()) {
if (componentType2.isPrimitive()) {
throw new ArrayStoreException(type1.getCanonicalName() + " and " + type2.getCanonicalName()
+ " are incompatible array types");
} else {
if (componentType2 != componentType1) {
throw new ArrayStoreException(type1.getCanonicalName() + " and " + type2.getCanonicalName()
+ " are incompatible array types");
代码示例来源:origin: robovm/robovm
} else if (value instanceof ArrayStoreException) {
ArrayStoreException ase = (ArrayStoreException)value;
throw new ArrayStoreException(ase.getMessage());
代码示例来源:origin: com.google.gwt/gwt-servlet
public static void checkCriticalArrayType(boolean expression) {
if (!expression) {
throw new ArrayStoreException();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public static void checkCriticalArrayType(boolean expression, Object errorMessage) {
if (!expression) {
throw new ArrayStoreException(String.valueOf(errorMessage));
}
}
代码示例来源:origin: robovm/robovm
} else if (value instanceof ArrayStoreException) {
ArrayStoreException e = (ArrayStoreException) value;
throw new ArrayStoreException(e.getMessage());
} else {
代码示例来源:origin: vsch/flexmark-java
@Override
public <T> T[] toArray(T[] array) {
Object[] objects = array;
int count = cardinality();
if (!array.getClass().getComponentType().isAssignableFrom(Integer.class)) {
throw new ArrayStoreException("Cannot store Integer in array of " + array.getClass().getName());
}
if (array.length < count) {
objects = array.getClass() == Object[].class ? new Object[count] : (Object[]) Array.newInstance(array.getClass().getComponentType(), count);
}
int i = 0;
for (Integer bitIndex : this) {
array[i++] = (T) bitIndex;
}
if (objects.length > ++i) {
objects[i] = null;
}
return (T[]) objects;
}
代码示例来源:origin: facebook/jcommon
@Override
public <T> T[] toArray(T[] a) {
if (!a.getClass().getComponentType().isAssignableFrom(Long.class)) {
throw new ArrayStoreException("array must be of type Long");
}
T[] result;
lock.readLock().lock();
try {
if (a.length >= size.get()) {
result = a;
} else {
result = (T[]) java.lang.reflect.Array
.newInstance(a.getClass().getComponentType(), size.get());
}
int i = 0;
for (Object value : this) {
result[i++] = (T) value;
}
} finally {
lock.readLock().unlock();
}
return result;
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
} catch (Exception e) {
String message = "Property's array value has type: " + values.toArray()[0].getClass().getName() + ", and your value to insert has type: " + value.getClass().getName();
throw new ArrayStoreException(message);
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Ensures the truth of an expression that verifies array type.
*/
public static void checkArrayType(boolean expression) {
if (!expression) {
throw new ArrayStoreException();
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Ensures the truth of an expression that verifies array type.
*/
public static void checkArrayType(boolean expression, Object errorMessage) {
if (!expression) {
throw new ArrayStoreException(String.valueOf(errorMessage));
}
}
代码示例来源:origin: com.oracle.substratevm/svm
/** Foreign call: {@link #CREATE_ARRAY_STORE_EXCEPTION}. */
@SubstrateForeignCallTarget
private static ArrayStoreException createArrayStoreException(Object value) {
assert value != null : "null can be stored into any array, so it cannot show up as a source of an ArrayStoreException";
return new ArrayStoreException(value.getClass().getTypeName());
}
代码示例来源:origin: com.oracle.substratevm/svm
/** Foreign call: {@link #THROW_NEW_ARRAY_STORE_EXCEPTION}. */
@SubstrateForeignCallTarget
private static void throwNewArrayStoreException() {
throw new ArrayStoreException();
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
protected E validate(int index, E object)
{
super.validate(index, object);
if (object != null && !isInstance(object))
{
throw new ArrayStoreException();
}
return object;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
protected E validate(int index, E object)
{
super.validate(index, object);
if (!hasInstanceClass() && object != null && !isInstance(object))
{
throw new ArrayStoreException();
}
return object;
}
代码示例来源:origin: org.objectweb.jonas/jonas-ejb-container
public Iterator iterator() {
try {
return gcIterator();
} catch (PException e) {
e.printStackTrace();
throw new ArrayStoreException(e.getMessage());
}
}
代码示例来源:origin: org.infinispan/infinispan-core
@CacheEntryCreated
public void entryCreated(CacheEntryEvent event) throws Exception {
if (event.isPre() && shouldFail(event)) {
if (throwError)
throw new NoClassDefFoundError("Simulated error...");
else
throw new ArrayStoreException("A failure...");
}
}
内容来源于网络,如有侵权,请联系作者删除!