private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = in.readFields(); if (!fields.defaulted("blargh")) { throw new Error(); } try { fields.defaulted("nonexistant"); throw new Error(); } catch (IllegalArgumentException ex) { } if ((fields.get("z", false) != true) || (fields.get("b", (byte) 0) != 5) || (fields.get("c", '0') != '5') || (fields.get("s", (short) 0) != 5) || (fields.get("i", 0) != 5) || (fields.get("j", 0l) != 5) || (fields.get("f", 0.0f) != 5.0f) || (fields.get("d", 0.0) != 5.0) || (!fields.get("str", null).equals("5"))) { throw new Error(); } } }
@Override public boolean defaulted(String name) throws IOException { return classFields.get(CONTEXT.caller()).defaulted(name); }
if (fields.defaulted("_parseAllStyles")) { throw new InvalidObjectException("Missing field: parseAllStyles");
if (fields.defaulted("signum")) message = "BigInteger: Signum not present in stream"; throw new java.io.StreamCorruptedException(message); if ((mag.length == 0) != (sign == 0)) { String message = "BigInteger: signum-magnitude mismatch"; if (fields.defaulted("magnitude")) message = "BigInteger: Magnitude not present in stream"; throw new java.io.StreamCorruptedException(message);
/** * Ensure that previously-serialized instances don't fail due to the member name change. */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { GetField fields = is.readFields(); if (fields.defaulted("first")) { // This is a pre-V3.3 this.first = (F) fields.get("fFirst", null); this.second = (S) fields.get("fSecond", null); } else { this.first = (F) fields.get("first", null); this.second = (S) fields.get("second", null); } } }
/** * Ensure that previously-serialized instances don't fail due to the member name change. */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { GetField fields = is.readFields(); if (fields.defaulted("first")) { // This is a pre-V3.3 this.first = (F) fields.get("fFirst", null); this.second = (S) fields.get("fSecond", null); } else { this.first = (F) fields.get("first", null); this.second = (S) fields.get("second", null); } } }
/** * Ensure that previously-serialized instances don't fail due to the member name change. */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { GetField fields = is.readFields(); if (fields.defaulted("first")) { // This is a pre-V3.3 this.first = (F) fields.get("fFirst", null); this.second = (S) fields.get("fSecond", null); } else { this.first = (F) fields.get("first", null); this.second = (S) fields.get("second", null); } } }