You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/10/03 14:49:00 UTC
[jira] [Commented] (TAP5-2640) tapestry-json improvements
(implement Collection/Map, better exceptions)
[ https://issues.apache.org/jira/browse/TAP5-2640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206720#comment-17206720 ]
ASF subversion and git services commented on TAP5-2640:
-------------------------------------------------------
Commit 2dab8e0ad16c1ad690e08f9eb76fe2a42b187b3d in tapestry-5's branch refs/heads/master from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=2dab8e0 ]
TAP5-2640: tapestry-json improvements
(implement Collection/Map, better exceptions)
tapestry-json: added JSONTypeMismatchException
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
tapestry-json: JSONTokener constructors exceptions improved
tapestry-json: improve JSONSpec tests
tapestry-json: better exception building
tapestry-json: added JSONSyntaxException
tapesty-json: javadoc updated
tapestry-json: JSONArray non-finite/nan check fixed
The constructor wasn't using checkedPut, even though the javadoc states that doubles are checked.
tapestry-json: javadoc typo
tapestry-json: added JSONArrayIndexOutOfBoundsException
tapestry-json: code style
tapestrsy-json: fix lossy conversion
tapestry-json: source formatting
tapestry-json: throw IllegalArgumentException on invalid doubles
tapestry-json: JSONObject implements Map<String, Object>
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
- putAll -> now returns void (breaking change)
- Arguments for key are Object -> shouldn't be a problem
tapestry-json: added get{type}OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc
> tapestry-json improvements (implement Collection/Map, better exceptions)
> ------------------------------------------------------------------------
>
> Key: TAP5-2640
> URL: https://issues.apache.org/jira/browse/TAP5-2640
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-json
> Reporter: Benjamin Weidig
> Priority: Minor
> Attachments: 0001-tapestry-json-adding-JSONInvalidTypeException.patch, 0002-travis-disabled-mail-notification.patch, 0003-tapestry-json-added-JSONTypeMismatchException.patch, 0004-tapestry-json-JSONArray-get-now-throws-IndexOutOfBou.patch, 0005-tapestry-json-JSONTokener-constructors-exceptions-im.patch, 0006-tapestry-json-improve-JSONSpec-tests.patch, 0007-tapestry-json-better-exception-building.patch, 0008-tapestry-json-added-JSONSyntaxException.patch, 0009-tapesty-json-javadoc-updated.patch, 0010-tapestry-json-JSONArray-non-finite-nan-check-fixed.patch, 0011-tapestry-json-javadoc-typo.patch, 0012-tapestry-json-added-JSONArrayIndexOutOfBoundsExcepti.patch, 0013-tapestry-json-code-style.patch, 0014-tapestrsy-json-fix-lossy-conversion.patch, 0015-tapestry-json-source-formatting.patch, 0016-tapestry-json-throw-IllegalArgumentException-on-inva.patch, 0017-tapestry-json-JSONObject-implements-Map-String-Objec.patch, 0018-tapestry-json-added-get-type-OrDefault-methods-to-JS.patch, 0019-tapestry-json-make-JSONArray-a-real-Collection-wip.patch, 0020-tapestry-json-JSONArray-improve-javadoc.patch, 0021-tapestry-json-JSONObject-improve-javadoc.patch
>
>
> As laid out in [http://mail-archives.apache.org/mod_mbox/tapestry-dev/202007.mbox/browser] these patches aim to improve tapestry-json.
> Core features:
> * JSONArray/JSONObject implements Collection/Map
> * Better exceptions
> Unit-tests were added if appropiate. "Passthrough"-methods to the underlying storage weren't tested if there are no additional edge-cases.
> Javadoc was added, trying to mimic Collection/Map, but reduced to the actual exception cases.
> Minar/breaking changes occur as discussed on the mailing list:
> * Signature change: JSONObject get(Object name) instead of JSONObject get(String name)
> * Return type / Signature change: void putAll(Map<? extends String, ? extends Object> newProperties) instead of JSONObject putAll(Map<String, ?> newProperties)
> I've attached 21 patch files. Maybe I should've squashed it, but if anyone is interested in the evolution/idea behind the code, this way it would be easier to grasp it.
> The code is also available on Github https://github.com/apache/tapestry-5/compare/master...benweidig:feature/tapestry-json-exceptions
--
This message was sent by Atlassian Jira
(v8.3.4#803005)