/** * Abuse {@code replaceObject()} as a hook to * maintain our stack. */ @Override protected Object replaceObject(Object o) { // ObjectOutputStream writes serialization // exceptions to the stream. Ignore // everything after that so we don't lose // the path to a non-serializable object. So // long as the user doesn't write an // IOException as the root object, we're OK. int currentDepth = currentDepth(); if (o instanceof IOException && currentDepth == 0) { broken = true; } if (!broken) { truncate(currentDepth); stack.add(o); } return o; }
public DebugObjectOutputStream( OutputStream out) throws IOException { super(out); enableReplaceObject(true); }
private void truncate(int depth) { while (stack.size() > depth) { pop(); } }
private static void assertSerializability(StringBuilder builder, Object toPrint) { DebugObjectOutputStream doos = null; try { OutputStream base = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(base); doos = new DebugObjectOutputStream(oos); doos.writeObject(toPrint); } catch (IOException ioe) { List pathToBadObject = doos.getStack(); builder.append("Path to non-Serializable Object: \n"); for (Object cur : pathToBadObject) { builder.append(cur.toString()).append("\n"); } } }
private static void assertSerializability(StringBuilder builder, Object toPrint) { DebugObjectOutputStream doos = null; try { OutputStream base = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(base); doos = new DebugObjectOutputStream(oos); doos.writeObject(toPrint); } catch (IOException ioe) { List pathToBadObject = doos.getStack(); builder.append("Path to non-Serializable Object: \n"); for (Object cur : pathToBadObject) { builder.append(cur.toString()).append("\n"); } } }
private static void assertSerializability(StringBuilder builder, Object toPrint) { DebugObjectOutputStream doos = null; try { OutputStream base = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(base); doos = new DebugObjectOutputStream(oos); doos.writeObject(toPrint); } catch (IOException ioe) { List pathToBadObject = doos.getStack(); builder.append("Path to non-Serializable Object: \n"); for (Object cur : pathToBadObject) { builder.append(cur.toString()).append("\n"); } } }
/** * Abuse {@code replaceObject()} as a hook to * maintain our stack. */ protected Object replaceObject(Object o) { // ObjectOutputStream writes serialization // exceptions to the stream. Ignore // everything after that so we don't lose // the path to a non-serializable object. So // long as the user doesn't write an // IOException as the root object, we're OK. int currentDepth = currentDepth(); if (o instanceof IOException && currentDepth == 0) { broken = true; } if (!broken) { truncate(currentDepth); stack.add(o); } return o; }
public DebugObjectOutputStream( OutputStream out) throws IOException { super(out); enableReplaceObject(true); }
private void truncate(int depth) { while (stack.size() > depth) { pop(); } }
private static void assertSerializability(StringBuilder builder, Object toPrint) { DebugObjectOutputStream doos = null; try { OutputStream base = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(base); doos = new DebugObjectOutputStream(oos); doos.writeObject(toPrint); } catch (IOException ioe) { List pathToBadObject = doos.getStack(); builder.append("Path to non-Serializable Object: \n"); for (Object cur : pathToBadObject) { builder.append(cur.toString()).append("\n"); } } }
/** * Abuse {@code replaceObject()} as a hook to * maintain our stack. */ @Override protected Object replaceObject(Object o) { // ObjectOutputStream writes serialization // exceptions to the stream. Ignore // everything after that so we don't lose // the path to a non-serializable object. So // long as the user doesn't write an // IOException as the root object, we're OK. int currentDepth = currentDepth(); if (o instanceof IOException && currentDepth == 0) { broken = true; } if (!broken) { truncate(currentDepth); stack.add(o); } return o; }
public DebugObjectOutputStream( OutputStream out) throws IOException { super(out); enableReplaceObject(true); }
private void truncate(int depth) { while (stack.size() > depth) { pop(); } }
ByteArrayOutputStream discard = new ByteArrayOutputStream(); DebugObjectOutputStream out = new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[0]); } catch (Exception e) { throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e); new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[1]); } catch (Exception e) { DebugUtil.printState((Map)stateToWrite[1], LOGGER); throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e);
/** * Abuse {@code replaceObject()} as a hook to * maintain our stack. */ @Override protected Object replaceObject(Object o) { // ObjectOutputStream writes serialization // exceptions to the stream. Ignore // everything after that so we don't lose // the path to a non-serializable object. So // long as the user doesn't write an // IOException as the root object, we're OK. int currentDepth = currentDepth(); if (o instanceof IOException && currentDepth == 0) { broken = true; } if (!broken) { truncate(currentDepth); stack.add(o); } return o; }
public DebugObjectOutputStream( OutputStream out) throws IOException { super(out); enableReplaceObject(true); }
private void truncate(int depth) { while (stack.size() > depth) { pop(); } }
ByteArrayOutputStream discard = new ByteArrayOutputStream(); DebugObjectOutputStream out = new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[0]); } catch (Exception e) { throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e); new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[1]); } catch (Exception e) { DebugUtil.printState((Map)stateToWrite[1], LOGGER); throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e);
ByteArrayOutputStream discard = new ByteArrayOutputStream(); DebugObjectOutputStream out = new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[0]); } catch (Exception e) { throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e); new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[1]); } catch (Exception e) { DebugUtil.printState((Map)stateToWrite[1], LOGGER); throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e);
ByteArrayOutputStream discard = new ByteArrayOutputStream(); DebugObjectOutputStream out = new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[0]); } catch (Exception e) { throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e); new DebugObjectOutputStream(discard); try { out.writeObject(stateToWrite[1]); } catch (Exception e) { DebugUtil.printState((Map)stateToWrite[1], LOGGER); throw new FacesException( "Serialization error. Path to offending instance: " + out.getStack(), e);