http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java File google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java (right): http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#newcode338 google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java:338: "The content logging limit must be non negative."); non-negative ...
12 years, 5 months ago
(2011-11-16 16:01:14 UTC)
#2
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java File google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java (right): http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#newcode338 google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java:338: "The content logging limit must be non negative."); On ...
12 years, 5 months ago
(2011-11-16 20:38:14 UTC)
#3
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
File
google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
(right):
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java:338:
"The content logging limit must be non negative.");
On 2011/11/16 16:01:14, yanivi wrote:
> non-negative
Done.
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java:680:
if (contentLength <= contentLoggingLimit && contentLoggingLimit != 0) {
On 2011/11/16 16:01:14, yanivi wrote:
> What about the case of contentLength == -1, i.e. unknown content length?
> Usually it is not -1, but we should try to fully support the case where it is
> -1.
>
> I recommend we try to be more robust in LogContent. We should pass
> contentLoggingLimit to LogContent. In its writeTo() method, we should check
> debugContent.length before logging.
Done. Let me know if this is what you had in mind.
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java:683:
logbuf.append("Content will not be logged because the content length " +
contentLength
On 2011/11/16 16:01:14, yanivi wrote:
> design question: should we instead show the first contentLoggingLimit bytes?
>
> similarly for HttpResponse
I think it might be confusing for users if we show the first contentLoggingLimit
bytes, they may see it and think that is it for their content, not showing
anything because we went over the limit might be better.
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
File
google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java
(right):
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java:280:
"The content logging limit must be non negative.");
On 2011/11/16 16:01:14, yanivi wrote:
> "non-negative"
Done.
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java:406:
if (debugContentByteArray.length <= contentLoggingLimit && contentLoggingLimit
!= 0) {
On 2011/11/16 16:01:14, yanivi wrote:
> don't need contentLoggingLimit since we already know
> debugContentByteArray.length != 0
Done.
http://codereview.appspot.com/5373102/diff/1/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java:406:
if (debugContentByteArray.length <= contentLoggingLimit && contentLoggingLimit
!= 0) {
On 2011/11/16 16:01:14, yanivi wrote:
> missing unit test
Yes I could not figure out a good way to test this. But after looking at
LogContentTest I now know. Done.
only one important issue left http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/java/com/google/api/client/http/LogContent.java File google-http-client/src/main/java/com/google/api/client/http/LogContent.java (right): http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/java/com/google/api/client/http/LogContent.java#newcode63 google-http-client/src/main/java/com/google/api/client/http/LogContent.java:63: if (contentLength != -1 ...
12 years, 5 months ago
(2011-11-16 22:12:28 UTC)
#4
only one important issue left
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
File google-http-client/src/main/java/com/google/api/client/http/LogContent.java
(right):
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
google-http-client/src/main/java/com/google/api/client/http/LogContent.java:63:
if (contentLength != -1 && contentLoggingLimit != 0 && contentLength <=
contentLoggingLimit) {
it would be a shame to not log content if contentLength == -1
for a long time we didn't even compute content length for any of our HttpContent
implementations. I suggest instead checking debugContent.length if
contentLength == -1. the downside is the risk of OutOfMemoryError, but it feels
like that's the right trade-off.
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
google-http-client/src/main/java/com/google/api/client/http/LogContent.java:84:
public int getContentLoggingLimit() {
package-private
FYI, I will wait for this CL to be LGTM'ed and submitted before doing the ...
12 years, 5 months ago
(2011-11-16 23:41:06 UTC)
#5
FYI, I will wait for this CL to be LGTM'ed and submitted before doing the sync.
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
File google-http-client/src/main/java/com/google/api/client/http/LogContent.java
(right):
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
google-http-client/src/main/java/com/google/api/client/http/LogContent.java:63:
if (contentLength != -1 && contentLoggingLimit != 0 && contentLength <=
contentLoggingLimit) {
On 2011/11/16 22:12:28, yanivi wrote:
> it would be a shame to not log content if contentLength == -1
>
> for a long time we didn't even compute content length for any of our
HttpContent
> implementations. I suggest instead checking debugContent.length if
> contentLength == -1. the downside is the risk of OutOfMemoryError, but it
feels
> like that's the right trade-off.
Ok. Thank you for the context. Done.
http://codereview.appspot.com/5373102/diff/3002/google-http-client/src/main/j...
google-http-client/src/main/java/com/google/api/client/http/LogContent.java:84:
public int getContentLoggingLimit() {
On 2011/11/16 22:12:28, yanivi wrote:
> package-private
Done.
Issue 5373102: Should have a limit to the amount of content to log
(Closed)
Created 12 years, 5 months ago by rmistry
Modified 12 years, 5 months ago
Reviewers: yanivi
Base URL: https://google-http-java-client.googlecode.com/hg/
Comments: 24