-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from sykesd/31-delegated-properties-can-cause-NPE
Reproduction test case and fix
- Loading branch information
Showing
3 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.dt.japper.testmodel; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Map; | ||
|
||
public class DelegatedPartModel { | ||
private String delegatedId; | ||
|
||
private PartModel part = new PartModel(); | ||
|
||
public String getDelegatedId() { | ||
return delegatedId; | ||
} | ||
|
||
public void setDelegatedId(String delegatedId) { | ||
this.delegatedId = delegatedId; | ||
} | ||
|
||
public String getPartno() { | ||
return part.getPartno(); | ||
} | ||
|
||
public void setPartno(String partno) { | ||
part.setPartno(partno); | ||
} | ||
|
||
public String getDescription() { | ||
return part.getDescription(); | ||
} | ||
|
||
public void setDescription(String description) { | ||
part.setDescription(description); | ||
} | ||
|
||
// NOTE: We deliberately leave off the partType property to ensure | ||
// that an incomplete delegation does not cause an NPE | ||
// See https://github.com/sykesd/japper/issues/31 | ||
|
||
public Map<String, BigDecimal> getFlexFields() { | ||
return part.getFlexFields(); | ||
} | ||
|
||
public void setFlexFields(Map<String, BigDecimal> flexFields) { | ||
part.setFlexFields(flexFields); | ||
} | ||
|
||
public PartModel getPart() { | ||
return part; | ||
} | ||
} |