You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Ildar Safarov (JIRA)" <ji...@apache.org> on 2008/09/30 15:19:44 UTC

[jira] Created: (HTTPCLIENT-800) Position is incremented twice in skip(long) method of ContentLengthInputStream

Position is incremented twice in skip(long) method of ContentLengthInputStream
------------------------------------------------------------------------------

                 Key: HTTPCLIENT-800
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-800
             Project: HttpComponents HttpClient
          Issue Type: Bug
            Reporter: Ildar Safarov


Position is modificated in read method inside cycle and explicitly after cycle. I think patch should look like this:

Index: ContentLengthInputStream.java
===================================================================
--- ContentLengthInputStream.java	(revision 700438)
+++ ContentLengthInputStream.java	(working copy)
@@ -214,7 +214,6 @@
             count += l;
             remaining -= l;
         }
-        this.pos += count;
         return count;
     }
 }




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCORE-174) Position is incremented twice in skip(long) method of ContentLengthInputStream

Posted by "Ildar Safarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636385#action_12636385 ] 

Ildar Safarov commented on HTTPCORE-174:
----------------------------------------

I think this change in the test will expose the bug:

Index: module-main/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java
===================================================================
--- module-main/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java	(revision 701108)
+++ module-main/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java	(working copy)
@@ -114,6 +114,10 @@
         in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[2]), 4L);
         in.read();
         assertTrue(in.skip(2) == 1);
+        
+        in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 10L);
+        in.skip(5);
+        assertEquals(5, in.read(new byte[20]));
     }
 
     public void testClose() throws IOException {


> Position is incremented twice in skip(long) method of ContentLengthInputStream
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-174
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-174
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.0-beta2
>            Reporter: Ildar Safarov
>             Fix For: 4.0-beta3
>
>
> Position is modificated in read method inside cycle and explicitly after cycle. I think patch should look like this:
> Index: ContentLengthInputStream.java
> ===================================================================
> --- ContentLengthInputStream.java	(revision 700438)
> +++ ContentLengthInputStream.java	(working copy)
> @@ -214,7 +214,6 @@
>              count += l;
>              remaining -= l;
>          }
> -        this.pos += count;
>          return count;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCORE-174) Position is incremented twice in skip(long) method of ContentLengthInputStream

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-174:
---------------------------------------

          Component/s: HttpCore
    Affects Version/s: 4.0-beta2
        Fix Version/s: 4.0-beta3

Looks reasonable. Would you also be willing to submit a test case for this bug?

Oleg

> Position is incremented twice in skip(long) method of ContentLengthInputStream
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-174
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-174
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.0-beta2
>            Reporter: Ildar Safarov
>             Fix For: 4.0-beta3
>
>
> Position is modificated in read method inside cycle and explicitly after cycle. I think patch should look like this:
> Index: ContentLengthInputStream.java
> ===================================================================
> --- ContentLengthInputStream.java	(revision 700438)
> +++ ContentLengthInputStream.java	(working copy)
> @@ -214,7 +214,6 @@
>              count += l;
>              remaining -= l;
>          }
> -        this.pos += count;
>          return count;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCORE-174) Position is incremented twice in skip(long) method of ContentLengthInputStream

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-174.
----------------------------------------

    Resolution: Fixed

Patch checked in

Oleg

> Position is incremented twice in skip(long) method of ContentLengthInputStream
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-174
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-174
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.0-beta2
>            Reporter: Ildar Safarov
>             Fix For: 4.0-beta3
>
>
> Position is modificated in read method inside cycle and explicitly after cycle. I think patch should look like this:
> Index: ContentLengthInputStream.java
> ===================================================================
> --- ContentLengthInputStream.java	(revision 700438)
> +++ ContentLengthInputStream.java	(working copy)
> @@ -214,7 +214,6 @@
>              count += l;
>              remaining -= l;
>          }
> -        this.pos += count;
>          return count;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Moved: (HTTPCORE-174) Position is incremented twice in skip(long) method of ContentLengthInputStream

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski moved HTTPCLIENT-800 to HTTPCORE-174:
-------------------------------------------------------

        Key: HTTPCORE-174  (was: HTTPCLIENT-800)
    Project: HttpComponents HttpCore  (was: HttpComponents HttpClient)

> Position is incremented twice in skip(long) method of ContentLengthInputStream
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-174
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-174
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>            Reporter: Ildar Safarov
>
> Position is modificated in read method inside cycle and explicitly after cycle. I think patch should look like this:
> Index: ContentLengthInputStream.java
> ===================================================================
> --- ContentLengthInputStream.java	(revision 700438)
> +++ ContentLengthInputStream.java	(working copy)
> @@ -214,7 +214,6 @@
>              count += l;
>              remaining -= l;
>          }
> -        this.pos += count;
>          return count;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org