Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
Fix #61
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 17, 2016
1 parent 104b4cb commit 7a77991
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/module/jaxb</packageVersion.dir>
<packageVersion.package>${project.groupId}.jaxb</packageVersion.package>
<version.jackson.core>2.8.2</version.jackson.core>
<version.jackson.core>2.8.3-SNAPSHOT</version.jackson.core>

<!-- 29-Apr-2016, tatu: 2.8 requires JDK7, so no overrides needed (parent has them) -->
</properties>
Expand Down
6 changes: 6 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Project: jackson-module-jaxb-annotations
=== Releases ===
------------------------------------------------------------------------

2.8.3 (not yet released)

#61: Transient fields serialized when @XmlAccessorType(XmlAccessType.FIELD)
is present
(reported by dsharp1@github)

2.8.2 (30-Aug-2016)
2.8.1 (20-Jul-2016)
2.8.0 (04-Jul-2016)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ public Object findSerializationContentConverter(AnnotatedMember a)
@Override
public PropertyName findNameForSerialization(Annotated a)
{
// [jaxb-annotations#69], need bit of delegation (note: copy of super-class functionality)
// need bit of delegation (note: copy of super-class functionality)
if (a instanceof AnnotatedMethod) {
AnnotatedMethod am = (AnnotatedMethod) a;
if (!isVisible(am)) {
Expand All @@ -948,6 +948,15 @@ public PropertyName findNameForSerialization(Annotated a)
if (!isVisible(af)) {
return null;
}
// Hmmh. As per [jaxb-annotations#61], looks like we must do one more thing to
// avoid accidentally exposing transient fields: this is necessary because later on
// our returning of "" suggests explicit annotation, which is NOT true, but may be
// necessary to indicate that visibility level is satisfied. That works ok except
// for specific case of transient fields that we must suppress now
if (af.isTransient()) {
return null;
}

PropertyName name = findJaxbPropertyName(af, af.getRawType(), null);
/* This may seem wrong, but since JAXB field auto-detection
* needs to find even non-public fields (if enabled by
Expand Down Expand Up @@ -1183,7 +1192,7 @@ public JavaType refineDeserializationType(final MapperConfig<?> config,
@Override
public PropertyName findNameForDeserialization(Annotated a)
{
// [jaxb-annotations#69], need bit of delegation -- note: copy from super-class
// need bit of delegation -- note: copy from super-class
// TODO: should simplify, messy.
if (a instanceof AnnotatedMethod) {
AnnotatedMethod am = (AnnotatedMethod) a;
Expand All @@ -1199,13 +1208,19 @@ public PropertyName findNameForDeserialization(Annotated a)
if (!isVisible(af)) {
return null;
}
// As per [jaxb-annotations#61] need to do explicit suppress (see
// `findNameForSerialization` for details)
if (af.isTransient()) {
return null;
}

PropertyName name = findJaxbPropertyName(af, af.getRawType(), null);

/* This may seem wrong, but since JAXB field auto-detection
* needs to find even non-public fields (if enabled by
* JAXB access type), we need to return name like so:
*/
// 31-Oct-2014, tatu: As per [Issue#31], need to be careful to indicate "use default"
// 31-Oct-2014, tatu: As per [jaxb-annotations#31], need to be careful to indicate "use default"
// and NOT to force use of specific name; latter would establish explicit name
// and what we want is implicit (unless there is real explicitly annotated name)
if (name == null) {
Expand Down

0 comments on commit 7a77991

Please sign in to comment.