You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2007/01/11 11:51:27 UTC
[jira] Updated: (HARMONY-2464) [classlib][nio] Compatibility:
reset() method called on Buffer without mark() previously called should
cause InvalidMarkException
[ https://issues.apache.org/jira/browse/HARMONY-2464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison updated HARMONY-2464:
---------------------------------
Component/s: (was: Classlib)
Non-bug differences from RI
> [classlib][nio] Compatibility: reset() method called on Buffer without mark() previously called should cause InvalidMarkException
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2464
> URL: https://issues.apache.org/jira/browse/HARMONY-2464
> Project: Harmony
> Issue Type: Bug
> Components: Non-bug differences from RI
> Reporter: Anton Ivanov
> Assigned To: Tim Ellison
> Priority: Minor
>
> There are some obscure things about reset(), duplicate(), asReadOnly() methods in specification.
> When we obtain a duplicate of this Buffer (for example IntBuffer) by calling to its duplicate() method
> this duplicate Buffer has identical to original Buffer mark, position, limit and capacity values (according to specification).
> But the question is: If mark is defined (set) for original Buffer after mark() method was called on it can we believe
> that mark is defined (set) for the duplicate Buffer?
> If we believe so, we can call reset() method on duplicate Buffer according to specification.
> But RI throws InvalidMarkException here. Is this a RI bug or Harmony bug?
> The same problem arises when we use asReadOnly() method instead of duplicate() method.
> Test to reproduce the problem:
> import junit.framework.TestCase;
> import java.nio.CharBuffer;
> import java.nio.InvalidMarkException;
> public class Test extends TestCase {
> public void test1() {
> char[] cc = {'b', 'u', 'f', 'f', 'e', 'r'};
> CharBuffer cb = CharBuffer.wrap(cc);
> try {
> cb.mark();
> CharBuffer roBuf = cb.asReadOnlyBuffer();
> roBuf.reset();
> fail("InvalidMarkException should be thrown");
> } catch (InvalidMarkException e) {
> //passed
> }
> }
> public void test2() {
> char[] cc = {'b', 'u', 'f', 'f', 'e', 'r'};
> CharBuffer cb = CharBuffer.wrap(cc);
> try {
> cb.mark();
> CharBuffer dupBuf = cb.duplicate();
> dupBuf.reset();
> fail("InvalidMarkException should be thrown");
> } catch (InvalidMarkException e) {
> //passed
> }
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira