List of usage examples for org.apache.commons.lang SerializationException SerializationException
public SerializationException(Throwable cause)
Constructs a new SerializationException
with specified nested Throwable
.
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
@Override public float floatValue() { try {//from ww w . j av a 2 s .co m return parser.getFloatValue(); } catch (IOException ex) { throw new SerializationException(ex); } }
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
@Override public double doubleValue() { try {// w w w . j a va2s . c o m return parser.getDoubleValue(); } catch (IOException ex) { throw new SerializationException(ex); } }
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
@Override public boolean booleanValue() { try {// www . jav a2s . co m return parser.getBooleanValue(); } catch (IOException ex) { throw new SerializationException(ex); } }
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
@Override public byte[] binaryValue() { try {/*from w w w. j a v a2s . c om*/ return parser.getBinaryValue(); } catch (IOException ex) { throw new SerializationException(ex); } }
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
@Override public void close() { try {// w ww. j ava 2s . co m parser.close(); } catch (IOException ex) { throw new SerializationException(ex); } }
From source file:org.elasticsearch.hadoop.serialization.json.JacksonJsonParser.java
private NumberType convertNumberType(JsonParser.NumberType numberType) { switch (numberType) { case INT://from w ww. j ava2s . c o m return NumberType.INT; case LONG: return NumberType.LONG; case FLOAT: return NumberType.FLOAT; case DOUBLE: return NumberType.DOUBLE; case BIG_INTEGER: return NumberType.DOUBLE; case BIG_DECIMAL: return NumberType.DOUBLE; } throw new SerializationException("No matching token for number_type [" + numberType + "]"); }
From source file:org.mule.util.SerializationUtils.java
/** * <p>Deserializes an <code>Object</code> from the specified stream.</p> * <p/>/*from ww w .j a va2s .c om*/ * <p>The stream will be closed once the object is written. This * avoids the need for a finally clause, and maybe also exception * handling, in the application code.</p> * <p/> * <p>The stream passed in is not buffered internally within this method. * This is the responsibility of your application if desired.</p> * * @param inputStream the serialized object input stream, must not be null * @param cl classloader which can load custom classes from the stream * @return the deserialized object * @throws IllegalArgumentException if <code>inputStream</code> is <code>null</code> * @throws org.apache.commons.lang.SerializationException * (runtime) if the serialization fails */ private static Object deserialize(InputStream inputStream, ClassLoader cl, MuleContext muleContext) { if (inputStream == null) { throw new IllegalArgumentException("The InputStream must not be null"); } if (cl == null) { throw new IllegalArgumentException("The ClassLoader must not be null"); } ObjectInputStream in = null; try { // stream closed in the finally in = new ClassLoaderObjectInputStream(cl, inputStream); Object obj = in.readObject(); if (obj instanceof DeserializationPostInitialisable) { DeserializationPostInitialisable.Implementation.init(obj, muleContext); } return obj; } catch (ClassNotFoundException ex) { throw new SerializationException(ex); } catch (IOException ex) { throw new SerializationException(ex); } catch (Exception ex) { throw new SerializationException(ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { // ignore close exception } } }
From source file:org.netbeans.jcode.util.PreferenceUtils.java
private static void serialize(Serializable obj, OutputStream outputStream) { if (outputStream == null) { throw new IllegalArgumentException("The OutputStream must not be null"); }/*from w w w. java 2s .com*/ ObjectOutputStream out = null; try { // stream closed in the finally out = new ObjectOutputStream(outputStream); out.writeObject(obj); } catch (IOException ex) { throw new SerializationException(ex); } finally { try { if (out != null) { out.close(); } } catch (IOException ex) { // ignore close exception } } }
From source file:org.netbeans.jcode.util.PreferenceUtils.java
private static Object deserialize(InputStream inputStream, ClassLoader classLoader) throws InvalidClassException { if (inputStream == null) { throw new IllegalArgumentException("The InputStream must not be null"); }//w w w. ja v a2s . co m ObjectInputStream in = null; try { // stream closed in the finally in = new ClassLoaderObjectInputStream(classLoader, inputStream); return in.readObject(); } catch (ClassNotFoundException ex) { throw new SerializationException(ex); } catch (InvalidClassException ex) { throw ex; } catch (IOException ex) { throw new SerializationException(ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { // ignore close exception } } }