grouper-users - [grouper-users] json in REST input disallows whitespace at end
Subject: Grouper Users - Open Discussion List
List archive
- From: "Hyzer, Chris" <>
- To: " Mailing List" <>
- Cc: "Redman, Chad Eric" <>
- Subject: [grouper-users] json in REST input disallows whitespace at end
- Date: Mon, 5 Dec 2016 21:43:50 +0000
- Accept-language: en-US
- Authentication-results: spf=none (sender IP is ) ;
- Ironport-phdr: 9a23:nEPDRhxlqt820vLXCy+O+j09IxM/srCxBDY+r6Qd0uoXKfad9pjvdHbS+e9qxAeQG96KsLQY26GI6ejJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fdbghMijexe7x/IRa5oQjQqMUdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LpwRRT2lCkIKSI28GDPisxxkq1bpg6hpwdiyILQeY2ZKeZycr/Ycd4cWGFPXNteVzZZD428cYUBEvYBM+hboYn8u1QAohSxCBKwBOz01jNEmmP60bE43uknDArI3BYgH9ULsHnMotn7NqcTUOGrw6nS1TnIcu1b2Tfn6IjJaRAtr+yHULV1ccXNyUkuFwLEgUuKqYH+PjOVzfgCv3KG7+p4S+2vjWgnpxtvrTey28chk4/EjZ8bxFDD8CV22oc1JdugRU56Z96kDIVftzucN4RoXsMuXXtktzgnxb0boZK7czIKyJM6xx7HdfOHaZKE4xz4VOuXPDx2h2pldaqhixmo7USs1+jxWtSp3FpXqydFnNbBumwR2xHW6MWIVPRw8lmk1DuKyQzf9uFJLVgpmafVN5It2Lo9mocJvUjdAyP7nF/6gLKUe0gl/OWj9v7pba/8ppCGMo95kgH+Pboqmsy4Gek2KhQDUW+H9eihzbHu4E/2TKtTgv0xiabWrorWJcMGpq6lGABV1Zsj6xCiADu8yNQYh34HLE5bdx2bk4jpOlbOIPbiAfe4nlSsjDNrx/fBPr3iGJnCMn/DkLL5cbZ87U5T1hYzwMhB651OFr0NPff+VlLsuNDFCxI5PQO5z/r7BNh41I4RR22CDrGcPa7Xr1OE+uIiL/GJZIAPuTb9L/Yl5+TpjX88gVIdeLWm3ZsXaXG5APtmOV6UYXv3gtgdC2sKoxI+Q/LsiF2ESzJceWu9X78k6jEhFI2mFZvDRpyqgLGZ0ye7BJpWZn1eCl+SC3fkbpiEW+wSZyKIOc9siTgEVbm6S489zhGiqhX2y7thLurI5CIYr5Tj28Zp5+HNjx096yF7D9nOm12KGit7hGQVXzIsmb1krFZm4laFzaVihfFET5pe6+4Bdw47MZ/awKReCsvuEEqVcc2OVU6rWJC7GjwrVfowxcMDeUBwB4/kgxzeiXmEGbgQwvarFY456OaU9HjrJt03gyLD36kwnVQ8aspUPiu7nqN58U7eC5OfwBbRrLqjaalJhH2Fz2yE12fb+RgACAM=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Chad, this is fixed in 2.3.0 patch 36. Can you take a look or try it please?
Thanks for identifying the problem and providing the code for a fix.
https://bugs.internet2.edu/jira/browse/GRP-1433
Chris
-----Original Message-----
From: Chad Redman (JIRA)
[mailto:]
Sent: Monday, December 05, 2016 10:44 AM
To: Hyzer, Chris
<>
Subject: [JIRA] (GRP-1433) json in REST input disallows whitespace at end
Chad Redman created GRP-1433:
--------------------------------
Summary: json in REST input disallows whitespace at end
Key: GRP-1433
URL: https://bugs.internet2.edu/jira/browse/GRP-1433
Project: Grouper
Issue Type: Improvement
Components: WS
Affects Versions: 2.3.0, 2.2.0, 2.1.0
Reporter: Chad Redman
Assignee: Chris Hyzer
When setting the POST json string for a REST request, the json format checker
allows whitespace anywhere except at the end of the string. If the last
character is not a closing brace, it throws error "Error unparsing string
with converter:
edu.internet2.middleware.grouper.ws.rest.json.DefaultJsonConverter...".
This sounds like a trivial issue, but it actually does make for confusing
behavior when using something like SoapUI to develop. The stacktrace includes
the input string, but with no quotes around it there is no indication whether
or not final whitespace is even there. One must be careful when setting up
the SoapUI request, making sure to delete any carriage return that might be
there after the closing brace.
Fix:
{code:java}
diff --git
a/grouper/src/grouper/edu/internet2/middleware/grouper/util/GrouperUtil.java
b/grouper/src/grouper/edu/internet2/middleware/grouper/util/GrouperUtil.java
index eb8d254..c2e4a48 100644
---
a/grouper/src/grouper/edu/internet2/middleware/grouper/util/GrouperUtil.java
+++
b/grouper/src/grouper/edu/internet2/middleware/grouper/util/GrouperUtil.java
@@ -1715,12 +1715,12 @@ public class GrouperUtil {
* \{\s* open bracket and optional space
* \"([^"]+)\" quote, simple name of class, quote
* \s*:\s* optional space, colon, optional space
- * \{(.*)}$ open bracket, the class info, close bracket, end of string
+ * \{(.*)}\s*$ open bracket, the class info, close bracket, optional
space, end of string
*
*
* </pre>
*/
- private static Pattern jsonPattern =
Pattern.compile("^\\s*\\{\\s*\\\"([^\"]+)\\\"\\s*:\\s*(.*)}$",
Pattern.DOTALL);
+ private static Pattern jsonPattern =
Pattern.compile("^\\s*\\{\\s*\\\"([^\"]+)\\\"\\s*:\\s*(.*)}\\s*$",
Pattern.DOTALL);
/**
* convert an object from json. note this works well if there are no
collections, just real types, arrays, etc.
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
- [grouper-users] json in REST input disallows whitespace at end, Hyzer, Chris, 12/05/2016
Archive powered by MHonArc 2.6.19.