You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/07/08 20:35:46 UTC

[juneau] branch master updated: Make Parser fields private.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 218c263  Make Parser fields private.
218c263 is described below

commit 218c26353b56a87ded94a0a9f67c122dbd7577dd
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sun Jul 8 16:35:28 2018 -0400

    Make Parser fields private.
---
 .../java/org/apache/juneau/ComboRoundTripTest.java |  4 +-
 .../java/org/apache/juneau/jena/RdfCommon.java     |  2 +
 .../java/org/apache/juneau/jena/RdfParser.java     | 80 ++++++++++++++++++++--
 .../org/apache/juneau/jena/RdfParserSession.java   | 44 ++++--------
 .../java/org/apache/juneau/json/JsonParser.java    | 20 +++++-
 .../org/apache/juneau/json/JsonParserSession.java  |  6 +-
 .../apache/juneau/parser/InputStreamParser.java    | 20 +++++-
 .../juneau/parser/InputStreamParserSession.java    |  7 +-
 .../org/apache/juneau/parser/ReaderParser.java     | 30 +++++++-
 .../apache/juneau/parser/ReaderParserSession.java  |  7 +-
 .../serializer/OutputStreamSerializerSession.java  |  2 +-
 11 files changed, 163 insertions(+), 59 deletions(-)

diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
index 1d4fccb..11a7d4f 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
@@ -595,8 +595,8 @@ public abstract class ComboRoundTripTest {
 	//--------------------------------------------------------------------------------
 	// MsgPack
 	//--------------------------------------------------------------------------------
-	OutputStreamSerializer sMsgPack = MsgPackSerializer.DEFAULT_SPACED_HEX.builder().addBeanTypes().addRootType().build();
-	InputStreamParser pMsgPack = MsgPackParser.DEFAULT_SPACED_HEX;
+	OutputStreamSerializer sMsgPack = MsgPackSerializer.create().addBeanTypes().addRootType().build();
+	InputStreamParser pMsgPack = MsgPackParser.DEFAULT;
 
 	@Test
 	public void f11_serializeMsgPack() throws Exception {
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
index 28705b7..2925cb8 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
@@ -68,6 +68,8 @@ public interface RdfCommon {
 	 *
 	 * <h5 class='section'>Description:</h5>
 	 * <p>
+	 * 	The RDF language to use.
+	 * <p>
 	 * Can be any of the following:
 	 * <ul class='spaced-list'>
 	 * 	<li>
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
index ea4ff09..221bfe9 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
@@ -191,10 +191,11 @@ public class RdfParser extends ReaderParser implements RdfCommon {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final boolean trimWhitespace, looseCollections;
-	final String rdfLanguage;
-	final Namespace juneauNs, juneauBpNs;
-	final RdfCollectionFormat collectionFormat;
+	private final boolean trimWhitespace, looseCollections;
+	private final String rdfLanguage;
+	private final Namespace juneauNs, juneauBpNs;
+	private final RdfCollectionFormat collectionFormat;
+
 	final Map<String,Object> jenaSettings = new HashMap<>();
 
 	/**
@@ -248,6 +249,77 @@ public class RdfParser extends ReaderParser implements RdfCommon {
 		return new RdfParserSession(this, args);
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Trim whitespace from text elements.
+	 *
+	 * @see #RDF_trimWhitespace
+	 * @return
+	 * 	<jk>true</jk> if whitespace in text elements will be automatically trimmed.
+	 */
+	public final boolean isTrimWhitespace() {
+		return trimWhitespace;
+	}
+
+	/**
+	 * Configuration property:  Collections should be serialized and parsed as loose collections.
+	 *
+	 * @see #RDF_looseCollections
+	 * @return
+	 * 	<jk>true</jk> if collections of resources are handled as loose collections of resources in RDF instead of
+	 * 	resources that are children of an RDF collection (e.g. Sequence, Bag).
+	 */
+	public final boolean isLooseCollections() {
+		return looseCollections;
+	}
+
+	/**
+	 * Configuration property:  RDF language.
+	 *
+	 * @see #RDF_language
+	 * @return
+	 * 	The RDF language to use.
+	 */
+	public final String getRdfLanguage() {
+		return rdfLanguage;
+	}
+
+	/**
+	 * Configuration property:  XML namespace for Juneau properties.
+	 *
+	 * @see #RDF_juneauNs
+	 * @return
+	 * 	XML namespace for Juneau properties.
+	 */
+	public final Namespace getJuneauNs() {
+		return juneauNs;
+	}
+
+	/**
+	 * Configuration property:  Default XML namespace for bean properties.
+	 *
+	 * @see #RDF_juneauBpNs
+	 * @return
+	 * 	Default XML namespace for bean properties.
+	 */
+	public final Namespace getJuneauBpNs() {
+		return juneauBpNs;
+	}
+
+	/**
+	 * Configuration property:  RDF format for representing collections and arrays.
+	 *
+	 * @see #RDF_collectionFormat
+	 * @return
+	 * 	RDF format for representing collections and arrays.
+	 */
+	public final RdfCollectionFormat getCollectionFormat() {
+		return collectionFormat;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
index 4b65c6e..b845f84 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
@@ -14,8 +14,6 @@ package org.apache.juneau.jena;
 
 import static org.apache.juneau.internal.StringUtils.*;
 import static org.apache.juneau.jena.Constants.*;
-import static org.apache.juneau.jena.RdfCommon.*;
-import static org.apache.juneau.jena.RdfParser.*;
 
 import java.util.*;
 
@@ -37,14 +35,11 @@ import com.hp.hpl.jena.util.iterator.*;
 @SuppressWarnings({"unchecked", "rawtypes"})
 public class RdfParserSession extends ReaderParserSession {
 
-	private final String rdfLanguage;
-	private final Namespace juneauNs, juneauBpNs;
+	private final RdfParser ctx;
 	private final Property pRoot, pValue, pType, pRdfType;
 	private final Model model;
-	private final boolean trimWhitespace, looseCollections;
 	private final RDFReader rdfReader;
 	private final Set<Resource> urisVisited = new HashSet<>();
-	private final RdfCollectionFormat collectionFormat;
 
 	/**
 	 * Create a new session using properties specified in the context.
@@ -57,23 +52,18 @@ public class RdfParserSession extends ReaderParserSession {
 	 */
 	protected RdfParserSession(RdfParser ctx, ParserSessionArgs args) {
 		super(ctx, args);
-		rdfLanguage = getProperty(RDF_language, String.class, ctx.rdfLanguage);
-		juneauNs = getInstanceProperty(RDF_juneauNs, Namespace.class, ctx.juneauNs);
-		juneauBpNs = getInstanceProperty(RDF_juneauBpNs, Namespace.class, ctx.juneauBpNs);
-		trimWhitespace = getProperty(RDF_trimWhitespace, boolean.class, ctx.trimWhitespace);
-		collectionFormat = getProperty(RDF_collectionFormat, RdfCollectionFormat.class, ctx.collectionFormat);
-		looseCollections = getProperty(RDF_looseCollections, boolean.class, ctx.looseCollections);
+		this.ctx = ctx;
 		model = ModelFactory.createDefaultModel();
-		addModelPrefix(juneauNs);
-		addModelPrefix(juneauBpNs);
-		pRoot = model.createProperty(juneauNs.getUri(), RDF_juneauNs_ROOT);
-		pValue = model.createProperty(juneauNs.getUri(), RDF_juneauNs_VALUE);
-		pType = model.createProperty(juneauBpNs.getUri(), RDF_juneauNs_TYPE);
+		addModelPrefix(ctx.getJuneauNs());
+		addModelPrefix(ctx.getJuneauBpNs());
+		pRoot = model.createProperty(ctx.getJuneauNs().getUri(), RDF_juneauNs_ROOT);
+		pValue = model.createProperty(ctx.getJuneauNs().getUri(), RDF_juneauNs_VALUE);
+		pType = model.createProperty(ctx.getJuneauBpNs().getUri(), RDF_juneauNs_TYPE);
 		pRdfType = model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-		rdfReader = model.getReader(rdfLanguage);
+		rdfReader = model.getReader(ctx.getRdfLanguage());
 
 		// Note: NTripleReader throws an exception if you try to set any properties on it.
-		if (! rdfLanguage.equals(LANG_NTRIPLE)) {
+		if (! ctx.getRdfLanguage().equals(LANG_NTRIPLE)) {
 			for (Map.Entry<String,Object> e : ctx.jenaSettings.entrySet())
 				rdfReader.setProperty(e.getKey(), e.getValue());
 		}
@@ -83,12 +73,6 @@ public class RdfParserSession extends ReaderParserSession {
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("RdfParser", new ObjectMap()
-				.append("collectionFormat", collectionFormat)
-				.append("looseCollections", looseCollections)
-				.append("juneauNs", juneauNs)
-				.append("juneauBpNs", juneauBpNs)
-				.append("rdfLanguage", rdfLanguage)
-				.append("trimWhitespace", trimWhitespace)
 			);
 	}
 
@@ -101,7 +85,7 @@ public class RdfParserSession extends ReaderParserSession {
 		List<Resource> roots = getRoots(model);
 
 		// Special case where we're parsing a loose collection of resources.
-		if (looseCollections && type.isCollectionOrArray()) {
+		if (ctx.isLooseCollections() && type.isCollectionOrArray()) {
 			Collection c = null;
 			if (type.isArray() || type.isArgs())
 				c = new ArrayList();
@@ -146,7 +130,7 @@ public class RdfParserSession extends ReaderParserSession {
 		String s = o.toString();
 		if (s.isEmpty())
 			return s;
-		if (trimWhitespace)
+		if (ctx.isTrimWhitespace())
 			s = s.trim();
 		s = XmlUtils.decode(s, null);
 		if (isTrimStrings())
@@ -162,7 +146,7 @@ public class RdfParserSession extends ReaderParserSession {
 		List<Resource> l = new LinkedList<>();
 
 		// First try to find the root using the "http://www.apache.org/juneau/root" property.
-		Property root = m.createProperty(juneauNs.getUri(), RDF_juneauNs_ROOT);
+		Property root = m.createProperty(ctx.getJuneauNs().getUri(), RDF_juneauNs_ROOT);
 		for (ResIterator i  = m.listResourcesWithProperty(root); i.hasNext();)
 			l.add(i.next());
 
@@ -226,7 +210,7 @@ public class RdfParserSession extends ReaderParserSession {
 		if (bpRdf.getCollectionFormat() != RdfCollectionFormat.DEFAULT)
 			return bpRdf.getCollectionFormat() == RdfCollectionFormat.MULTI_VALUED;
 
-		return collectionFormat == RdfCollectionFormat.MULTI_VALUED;
+		return ctx.getCollectionFormat() == RdfCollectionFormat.MULTI_VALUED;
 	}
 
 	private <T> T parseAnything(ClassMeta<?> eType, RDFNode n, Object outer, BeanPropertyMeta pMeta) throws Exception {
@@ -413,7 +397,7 @@ public class RdfParserSession extends ReaderParserSession {
 			Statement st = i.next();
 			Property p = st.getPredicate();
 			String key = p.getLocalName();
-			if (! (key.equals("root") && p.getURI().equals(juneauNs.getUri()))) {
+			if (! (key.equals("root") && p.getURI().equals(ctx.getJuneauNs().getUri()))) {
 				key = decodeString(key);
 				RDFNode o = st.getObject();
 				K key2 = convertAttrToType(m, key, keyType);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
index 320cf93..067cb9b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
@@ -114,7 +114,7 @@ public class JsonParser extends ReaderParser {
 	 * 	<li><b>Name:</b>  <js>"JsonParser.validateEnd.b"</js>
 	 * 	<li><b>Data type:</b>  <code>Boolean</code>
 	 * 	<li><b>Default:</b>  <jk>false</jk>
-	 * 	<li><b>Session-overridable:</b>  <jk>true</jk>
+	 * 	<li><b>Session-overridable:</b>  <jk>false</jk>
 	 * 	<li><b>Methods:</b>
 	 * 		<ul>
 	 * 			<li class='jm'>{@link JsonParserBuilder#validateEnd(boolean)}
@@ -193,7 +193,7 @@ public class JsonParser extends ReaderParser {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final boolean validateEnd;
+	private final boolean validateEnd;
 
 	/**
 	 * Constructor.
@@ -241,6 +241,22 @@ public class JsonParser extends ReaderParser {
 		return new JsonParserSession(this, args);
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Validate end.
+	 *
+	 * @see #JSON_validateEnd
+	 * @return
+	 * 	<jk>true</jk> if after parsing a POJO from the input, verifies that the remaining input in
+	 * 	the stream consists of only comments or whitespace.
+	 */
+	public final boolean isValidateEnd() {
+		return validateEnd;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index e9890e2..626d170 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -36,7 +36,7 @@ public final class JsonParserSession extends ReaderParserSession {
 
 	private static final AsciiSet decChars = AsciiSet.create().ranges("0-9").build();
 
-	private final boolean validateEnd;
+	private final JsonParser ctx;
 
 	/**
 	 * Create a new session using properties specified in the context.
@@ -49,7 +49,7 @@ public final class JsonParserSession extends ReaderParserSession {
 	 */
 	protected JsonParserSession(JsonParser ctx, ParserSessionArgs args) {
 		super(ctx, args);
-		validateEnd = getProperty(JSON_validateEnd, boolean.class, ctx.validateEnd);
+		this.ctx = ctx;
 	}
 
 	/**
@@ -775,7 +775,7 @@ public final class JsonParserSession extends ReaderParserSession {
 	 * remainder in the input, that it consists only of whitespace and comments.
 	 */
 	private void validateEnd(ParserReader r) throws Exception {
-		if (! validateEnd)
+		if (! ctx.isValidateEnd())
 			return;
 		skipCommentsAndSpace(r);
 		int c = r.read();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
index 28a5686..23bd2f4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
@@ -42,7 +42,7 @@ public abstract class InputStreamParser extends Parser {
 	 * 	<li><b>Name:</b>  <js>"InputStreamParser.binaryFormat.s"</js>
 	 * 	<li><b>Data type:</b>  {@link BinaryFormat}
 	 * 	<li><b>Default:</b>  {@link BinaryFormat#HEX}
-	 * 	<li><b>Session-overridable:</b>  <jk>true</jk>
+	 * 	<li><b>Session-overridable:</b>  <jk>false</jk>
 	 * 	<li><b>Methods:</b>
 	 * 		<ul>
 	 * 			<li class='jm'>{@link InputStreamParserBuilder#binaryFormat(BinaryFormat)}
@@ -83,7 +83,7 @@ public abstract class InputStreamParser extends Parser {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final BinaryFormat binaryFormat;
+	private final BinaryFormat binaryFormat;
 
 	/**
 	 * Constructor.
@@ -93,7 +93,6 @@ public abstract class InputStreamParser extends Parser {
 	 */
 	protected InputStreamParser(PropertyStore ps, String...consumes) {
 		super(ps, consumes);
-
 		binaryFormat = getProperty(ISPARSER_binaryFormat, BinaryFormat.class, BinaryFormat.HEX);
 	}
 
@@ -102,6 +101,21 @@ public abstract class InputStreamParser extends Parser {
 		return false;
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Binary input format.
+	 *
+	 * @see #ISPARSER_binaryFormat
+	 * @return
+	 * 	The format to use when converting strings to byte arrays.
+	 */
+	public final BinaryFormat getBinaryFormat() {
+		return binaryFormat;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
index d83fc31..922a120 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
@@ -12,8 +12,6 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.parser;
 
-import static org.apache.juneau.parser.InputStreamParser.*;
-
 import java.io.*;
 
 import org.apache.juneau.*;
@@ -27,7 +25,6 @@ import org.apache.juneau.*;
 public abstract class InputStreamParserSession extends ParserSession {
 
 	private final InputStreamParser ctx;
-	private final BinaryFormat binaryFormat;
 
 	/**
 	 * Create a new session using properties specified in the context.
@@ -41,7 +38,6 @@ public abstract class InputStreamParserSession extends ParserSession {
 	protected InputStreamParserSession(InputStreamParser ctx, ParserSessionArgs args) {
 		super(ctx, args);
 		this.ctx = ctx;
-		binaryFormat = getProperty(ISPARSER_binaryFormat, BinaryFormat.class, BinaryFormat.HEX);
 	}
 
 	/**
@@ -80,14 +76,13 @@ public abstract class InputStreamParserSession extends ParserSession {
 	@SuppressWarnings("resource")
 	@Override /* ParserSession */
 	public final ParserPipe createPipe(Object input) {
-		return setPipe(new ParserPipe(input, isDebug(), ctx.isAutoCloseStreams(), ctx.isUnbuffered(), binaryFormat));
+		return setPipe(new ParserPipe(input, isDebug(), ctx.isAutoCloseStreams(), ctx.isUnbuffered(), ctx.getBinaryFormat()));
 	}
 
 	@Override /* Session */
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("InputStreamParserSession", new ObjectMap()
-				.append("binaryFormat", binaryFormat)
 			);
 	}
 }
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
index cec0d10..46ba236 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
@@ -89,7 +89,7 @@ public abstract class ReaderParser extends Parser {
 	 * 	<li><b>Name:</b>  <js>"ReaderParser.inputStreamCharset.s"</js>
 	 * 	<li><b>Data type:</b>  <code>String</code>
 	 * 	<li><b>Default:</b>  <js>"UTF-8"</js>
-	 * 	<li><b>Session-overridable:</b>  <jk>true</jk>
+	 * 	<li><b>Session-overridable:</b>  <jk>false</jk>
 	 * 	<li><b>Methods:</b>
 	 * 		<ul>
 	 * 			<li class='jm'>{@link ReaderParserBuilder#inputStreamCharset(String)}
@@ -135,7 +135,7 @@ public abstract class ReaderParser extends Parser {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final String inputStreamCharset, fileCharset;
+	private final String inputStreamCharset, fileCharset;
 
 	/**
 	 * Constructor.
@@ -155,6 +155,32 @@ public abstract class ReaderParser extends Parser {
 		return true;
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Input stream charset.
+	 *
+	 * @see #RPARSER_inputStreamCharset
+	 * @return
+	 * 	The character set to use for converting <code>InputStreams</code> and byte arrays to readers.
+	 */
+	public final String getInputStreamCharset() {
+		return inputStreamCharset;
+	}
+
+	/**
+	 * Configuration property:  File charset.
+	 *
+	 * @see #RPARSER_fileCharset
+	 * @return
+	 * 	The character set to use for reading <code>Files</code> from the file system.
+	 */
+	public final String getFileCharset() {
+		return fileCharset;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
index 626eb10..8bf2529 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
@@ -27,7 +27,6 @@ import org.apache.juneau.*;
 public abstract class ReaderParserSession extends ParserSession {
 
 	private final ReaderParser ctx;
-	private final String inputStreamCharset, fileCharset;
 
 	/**
 	 * Create a new session using properties specified in the context.
@@ -41,8 +40,6 @@ public abstract class ReaderParserSession extends ParserSession {
 	protected ReaderParserSession(ReaderParser ctx, ParserSessionArgs args) {
 		super(ctx, args);
 		this.ctx = ctx;
-		inputStreamCharset = getProperty(RPARSER_inputStreamCharset, String.class, ctx.inputStreamCharset);
-		fileCharset = getProperty(RPARSER_fileCharset, String.class, ctx.fileCharset);
 	}
 
 	/**
@@ -85,15 +82,13 @@ public abstract class ReaderParserSession extends ParserSession {
 	@SuppressWarnings("resource")
 	@Override /* ParserSesson */
 	public final ParserPipe createPipe(Object input) {
-		return setPipe(new ParserPipe(input, isDebug(), ctx.isStrict(), ctx.isAutoCloseStreams(), ctx.isUnbuffered(), fileCharset, inputStreamCharset));
+		return setPipe(new ParserPipe(input, isDebug(), ctx.isStrict(), ctx.isAutoCloseStreams(), ctx.isUnbuffered(), ctx.getFileCharset(), ctx.getInputStreamCharset()));
 	}
 
 	@Override /* Session */
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("ReaderParserSession", new ObjectMap()
-				.append("fileCharset", fileCharset)
-				.append("inputStreamCharset", inputStreamCharset)
 			);
 	}
 }
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
index 1136c70..8e77697 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
@@ -49,7 +49,7 @@ public abstract class OutputStreamSerializerSession extends SerializerSession {
 	protected OutputStreamSerializerSession(OutputStreamSerializer ctx, SerializerSessionArgs args) {
 		super(ctx, args);
 
-		binaryFormat = getProperty(OSSERIALIZER_binaryFormat, BinaryFormat.class, BinaryFormat.HEX);
+		binaryFormat = getProperty(OSSERIALIZER_binaryFormat, BinaryFormat.class, ctx.binaryFormat);
 	}
 
 	/**