java.io.OptionalDataException Java Examples
The following examples show how to use
java.io.OptionalDataException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: jdk1.8-source-analysis Author: raysonfang File: IIOPInputStream.java License: Apache License 2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #2
Source Project: TencentKona-8 Author: Tencent File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #3
Source Project: jdk8u60 Author: chenghanpeng File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #4
Source Project: JDKSourceCode1.8 Author: wupeixuan File: IIOPInputStream.java License: MIT License | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #5
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #6
Source Project: openjdk-jdk8u-backup Author: AdoptOpenJDK File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #7
Source Project: hottub Author: dsrg-uoft File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #8
Source Project: openjdk-8-source Author: keerath File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #9
Source Project: openjdk-8 Author: bpupadhyaya File: IIOPInputStream.java License: GNU General Public License v2.0 | 6 votes |
private OptionalDataException createOptionalDataException() { try { OptionalDataException result = (OptionalDataException) OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] { Boolean.TRUE }); if (result == null) // XXX I18N, logging needed. throw new Error("Created null OptionalDataException"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new Error("Couldn't create OptionalDataException", ex); } }
Example #10
Source Project: cuba Author: cuba-platform File: EntitySerializationExceptionHandler.java License: Apache License 2.0 | 6 votes |
@Override protected boolean canHandle(String className, String message, @Nullable Throwable throwable) { Throwable cause = throwable != null ? throwable.getCause() : null; if (cause == null) { return false; } if (cause instanceof ClassCastException && checkClassCastExceptionStack(cause.getStackTrace())) { return true; } if (cause instanceof OptionalDataException && checkOptionalDataExceptionStack(cause.getStackTrace())) { return true; } return false; }
Example #11
Source Project: jdk1.8-source-analysis Author: raysonfang File: DataFlavor.java License: Apache License 2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #12
Source Project: jdk1.8-source-analysis Author: raysonfang File: IIOPInputStream.java License: Apache License 2.0 | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }
Example #13
Source Project: dragonwell8_jdk Author: alibaba File: DataFlavor.java License: GNU General Public License v2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #14
Source Project: dragonwell8_jdk Author: alibaba File: ReflectionFactory.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a new OptionalDataException with {@code eof} set to {@code true} * or {@code false}. * @param bool the value of {@code eof} in the created OptionalDataException * @return a new OptionalDataException */ public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) { try { Constructor<OptionalDataException> boolCtor = OptionalDataException.class.getDeclaredConstructor(Boolean.TYPE); boolCtor.setAccessible(true); return boolCtor.newInstance(bool); } catch (NoSuchMethodException | InstantiationException| IllegalAccessException|InvocationTargetException ex) { throw new InternalError("unable to create OptionalDataException", ex); } }
Example #15
Source Project: jdk8u-dev-jdk Author: frohoff File: DataFlavor.java License: GNU General Public License v2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #16
Source Project: TencentKona-8 Author: Tencent File: IIOPInputStream.java License: GNU General Public License v2.0 | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }
Example #17
Source Project: TencentKona-8 Author: Tencent File: DataFlavor.java License: GNU General Public License v2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #18
Source Project: TencentKona-8 Author: Tencent File: ReflectionFactory.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a new OptionalDataException with {@code eof} set to {@code true} * or {@code false}. * @param bool the value of {@code eof} in the created OptionalDataException * @return a new OptionalDataException */ public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) { try { Constructor<OptionalDataException> boolCtor = OptionalDataException.class.getDeclaredConstructor(Boolean.TYPE); boolCtor.setAccessible(true); return boolCtor.newInstance(bool); } catch (NoSuchMethodException | InstantiationException| IllegalAccessException|InvocationTargetException ex) { throw new InternalError("unable to create OptionalDataException", ex); } }
Example #19
Source Project: TencentKona-8 Author: Tencent File: ReflectionFactoryTest.java License: GNU General Public License v2.0 | 5 votes |
/** * Test the constructor of OptionalDataExceptions. */ @Test static void newOptionalDataException() { OptionalDataException ode = factory.newOptionalDataExceptionForSerialization(true); Assert.assertTrue(ode.eof, "eof wrong"); ode = factory.newOptionalDataExceptionForSerialization(false); Assert.assertFalse(ode.eof, "eof wrong"); }
Example #20
Source Project: kogito-runtimes Author: kiegroup File: MarshallingIssuesTest.java License: Apache License 2.0 | 5 votes |
@Test public void testJBRULES_1946() { KieBase kbase = loadKnowledgeBase("../Sample.drl" ); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); oos.writeObject( kbase ); oos.flush(); oos.close(); baos.flush(); baos.close(); byte[] serializedKb = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream( serializedKb ); ObjectInputStream ois = new ObjectInputStream( bais ); KieBase kb2 = (KieBase) ois.readObject(); } catch ( OptionalDataException ode ) { ode.printStackTrace(); fail( "EOF? " + ode.eof ); } catch ( Exception e ) { e.printStackTrace(); fail( "Unexpected exception: " + e.getMessage() ); } }
Example #21
Source Project: kogito-runtimes Author: kiegroup File: MarshallingIssuesTest.java License: Apache License 2.0 | 5 votes |
@Test public void testJBRULES_1946_2() { KieBase kbase = loadKnowledgeBase("../Sample.drl" ); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DroolsObjectOutputStream oos = new DroolsObjectOutputStream( baos ); oos.writeObject( kbase ); oos.flush(); oos.close(); baos.flush(); baos.close(); byte[] serializedKb = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream( serializedKb ); DroolsObjectInputStream ois = new DroolsObjectInputStream( bais ); KieBase kb2 = (KieBase) ois.readObject(); } catch ( OptionalDataException ode ) { ode.printStackTrace(); fail( "EOF? " + ode.eof ); } catch ( Exception e ) { e.printStackTrace(); fail( "Unexpected exception: " + e.getMessage() ); } }
Example #22
Source Project: jdk8u60 Author: chenghanpeng File: IIOPInputStream.java License: GNU General Public License v2.0 | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }
Example #23
Source Project: jdk8u60 Author: chenghanpeng File: DataFlavor.java License: GNU General Public License v2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #24
Source Project: JDKSourceCode1.8 Author: wupeixuan File: DataFlavor.java License: MIT License | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #25
Source Project: JDKSourceCode1.8 Author: wupeixuan File: IIOPInputStream.java License: MIT License | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }
Example #26
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: IIOPInputStream.java License: GNU General Public License v2.0 | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }
Example #27
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: DataFlavor.java License: GNU General Public License v2.0 | 5 votes |
/** * Restores this <code>DataFlavor</code> from a Serialized state. */ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException { String rcn = null; mimeType = (MimeType)is.readObject(); if (mimeType != null) { humanPresentableName = mimeType.getParameter("humanPresentableName"); mimeType.removeParameter("humanPresentableName"); rcn = mimeType.getParameter("class"); if (rcn == null) { throw new IOException("no class parameter specified in: " + mimeType); } } try { representationClass = (Class)is.readObject(); } catch (OptionalDataException ode) { if (!ode.eof || ode.length != 0) { throw ode; } // Ensure backward compatibility. // Old versions didn't write the representation class to the stream. if (rcn != null) { representationClass = DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader()); } } }
Example #28
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: ReflectionFactory.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a new OptionalDataException with {@code eof} set to {@code true} * or {@code false}. * @param bool the value of {@code eof} in the created OptionalDataException * @return a new OptionalDataException */ public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) { try { Constructor<OptionalDataException> boolCtor = OptionalDataException.class.getDeclaredConstructor(Boolean.TYPE); boolCtor.setAccessible(true); return boolCtor.newInstance(bool); } catch (NoSuchMethodException | InstantiationException| IllegalAccessException|InvocationTargetException ex) { throw new InternalError("unable to create OptionalDataException", ex); } }
Example #29
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: ReflectionFactoryTest.java License: GNU General Public License v2.0 | 5 votes |
/** * Test the constructor of OptionalDataExceptions. */ @Test static void newOptionalDataException() { OptionalDataException ode = factory.newOptionalDataExceptionForSerialization(true); Assert.assertTrue(ode.eof, "eof wrong"); ode = factory.newOptionalDataExceptionForSerialization(false); Assert.assertFalse(ode.eof, "eof wrong"); }
Example #30
Source Project: openjdk-jdk8u-backup Author: AdoptOpenJDK File: IIOPInputStream.java License: GNU General Public License v2.0 | 5 votes |
private static Constructor getOptDataExceptionCtor() { try { Constructor result = (Constructor) AccessController.doPrivileged( new PrivilegedExceptionAction() { public java.lang.Object run() throws NoSuchMethodException, SecurityException { Constructor boolCtor = OptionalDataException.class.getDeclaredConstructor( new Class[] { Boolean.TYPE }); boolCtor.setAccessible(true); return boolCtor; }}); if (result == null) // XXX I18N, logging needed. throw new Error("Unable to find OptionalDataException constructor"); return result; } catch (Exception ex) { // XXX I18N, logging needed. throw new ExceptionInInitializerError(ex); } }