rmannibucau commented on PR #84:
URL: https://github.com/apache/johnzon/pull/84#issuecomment-1102151436

   @dblevins guess we can passthrough the input (stream or reader or string) 
and if in memory we could just use it but I was more thinking about just giving 
some context iterating over the object and not serializing it as JSON but more 
a simple toString for a subpart, something in the spirit of `var buffer = new 
StringBuilder(50); var it = object.entrySet().iterator(); while 
(buffer.length() < 50 && iterator.hasNext()) { if (buffer.length() > 0) { 
buffer.append(", "); }  var e = iterator.next(); 
buffer.append(e.getKey()).append(": ").append(e.getValue()); }`
   
   It has the avantage to 1. not go through a real JSON serialization, 2. not 
serialize the full object when you only need one field (take the example of a 
json object of 1m with an url, here the url is sufficient to fill the 50 chars) 
so it will give some context to the error but also enables to keep performances 
fine when error are repeated (including attack cases ;)).
   
   Hope it makes sense.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@johnzon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to