You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Stefan Gmeiner (JIRA)" <ji...@apache.org> on 2008/09/18 14:39:44 UTC

[jira] Created: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

Initialise return ByteBuffer from PoolByteBufferAllokator with 0
----------------------------------------------------------------

                 Key: DIRMINA-622
                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
             Project: MINA
          Issue Type: Improvement
          Components: Core
    Affects Versions: 1.1.7
            Reporter: Stefan Gmeiner
            Priority: Trivial


A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.

The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
 

import org.apache.mina.common.ByteBuffer;

public class PooledByteBufferTest {

       public static void main(String[] args) {
               ByteBuffer.setAllocator(new PooledByteBufferAllocator());
               ByteBuffer buffer1 = ByteBuffer.allocate(100);
               System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
               buffer1.putInt(42);
               System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
               buffer1.release();

               ByteBuffer buffer2 = ByteBuffer.allocate(100);
               System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
       }
}



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


[jira] Updated: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

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

Emmanuel Lecharny updated DIRMINA-622:
--------------------------------------

    Fix Version/s:     (was: 3.0.0-M1)
                   1.1.8

Edouard is right ... If we fix that, we will have to fix it in 1.1.x branch.

> Initialise return ByteBuffer from PoolByteBufferAllokator with 0
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-622
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Stefan Gmeiner
>            Priority: Trivial
>             Fix For: 1.1.8
>
>
> A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.
> The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
>  
> import org.apache.mina.common.ByteBuffer;
> public class PooledByteBufferTest {
>        public static void main(String[] args) {
>                ByteBuffer.setAllocator(new PooledByteBufferAllocator());
>                ByteBuffer buffer1 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
>                buffer1.putInt(42);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
>                buffer1.release();
>                ByteBuffer buffer2 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
>        }
> }

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


[jira] Closed: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

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

Emmanuel Lecharny closed DIRMINA-622.
-------------------------------------


> Initialise return ByteBuffer from PoolByteBufferAllokator with 0
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-622
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Stefan Gmeiner
>            Assignee: Edouard De Oliveira
>            Priority: Trivial
>             Fix For: 1.1.8
>
>
> A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.
> The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
>  
> import org.apache.mina.common.ByteBuffer;
> public class PooledByteBufferTest {
>        public static void main(String[] args) {
>                ByteBuffer.setAllocator(new PooledByteBufferAllocator());
>                ByteBuffer buffer1 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
>                buffer1.putInt(42);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
>                buffer1.release();
>                ByteBuffer buffer2 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
>        }
> }

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


[jira] Commented: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650085#action_12650085 ] 

Edouard De Oliveira commented on DIRMINA-622:
---------------------------------------------

PooledByteBufferAllocator doesn't exist in the 2.0 codebase so can it be postponed to 3.0 ?

> Initialise return ByteBuffer from PoolByteBufferAllokator with 0
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-622
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Stefan Gmeiner
>            Priority: Trivial
>             Fix For: 3.0.0-M1
>
>
> A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.
> The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
>  
> import org.apache.mina.common.ByteBuffer;
> public class PooledByteBufferTest {
>        public static void main(String[] args) {
>                ByteBuffer.setAllocator(new PooledByteBufferAllocator());
>                ByteBuffer buffer1 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
>                buffer1.putInt(42);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
>                buffer1.release();
>                ByteBuffer buffer2 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
>        }
> }

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


[jira] Resolved: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira resolved DIRMINA-622.
-----------------------------------------

    Resolution: Fixed
      Assignee: Edouard De Oliveira

> Initialise return ByteBuffer from PoolByteBufferAllokator with 0
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-622
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Stefan Gmeiner
>            Assignee: Edouard De Oliveira
>            Priority: Trivial
>             Fix For: 1.1.8
>
>
> A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.
> The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
>  
> import org.apache.mina.common.ByteBuffer;
> public class PooledByteBufferTest {
>        public static void main(String[] args) {
>                ByteBuffer.setAllocator(new PooledByteBufferAllocator());
>                ByteBuffer buffer1 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
>                buffer1.putInt(42);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
>                buffer1.release();
>                ByteBuffer buffer2 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
>        }
> }

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


[jira] Updated: (DIRMINA-622) Initialise return ByteBuffer from PoolByteBufferAllokator with 0

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

Emmanuel Lecharny updated DIRMINA-622:
--------------------------------------

    Fix Version/s: 3.0.0-M1

Postponed

> Initialise return ByteBuffer from PoolByteBufferAllokator with 0
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-622
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-622
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.7
>            Reporter: Stefan Gmeiner
>            Priority: Trivial
>             Fix For: 3.0.0-M1
>
>
> A ByteBuffer returned by calling ByteBuffer.allocate() on a PooledByteBufferAllocator is not guarenteed to be initialised to 0 as it would be if a SimpleByteBufferAllocator was used.
> The java equivalent java.nio.ByteBuffers are always initialised with 0 hence the MINA variant should also follow this convention independent if PooledByteBufferAllocator was used or not.
>  
> import org.apache.mina.common.ByteBuffer;
> public class PooledByteBufferTest {
>        public static void main(String[] args) {
>                ByteBuffer.setAllocator(new PooledByteBufferAllocator());
>                ByteBuffer buffer1 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 0
>                buffer1.putInt(42);
>                System.out.println("buffer1[0]=" + buffer1.getInt(0)); // prints 42
>                buffer1.release();
>                ByteBuffer buffer2 = ByteBuffer.allocate(100);
>                System.out.println("buffer1[0]=" + buffer2.getInt(0)); // prints 42 instead of 0
>        }
> }

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