Re: [jira] Commented: (HARMONY-27) The network related channels in java.nio.channels are not implemented
Sorry for the confusion I caused, I DID write it in txt, about the "red", I didn't mean the color of text, but the color of classes in the class diagram I attached:). I thought I should add the attachment link to this JIRA comments. Sorry for that. 2006/1/19, Geir Magnusson Jr <[EMAIL PROTECTED]>: > > > > Paulex Yang (JIRA) wrote: > > [ > http://issues.apache.org/jira/browse/HARMONY-27?page=comments#action_12363230] > > > > Paulex Yang commented on HARMONY-27: > > > > > > my proposed solution: > > > > 1. Refactor the java.net > > > > Currently, the Harmony's socket structur is as below(red means API > classes, others are package private). I will attach the diagram to Jira. > > > > "red"? I assume that you did this in HTML? > > Please, no HTML - it's hard for people to read who don't use > HTML-enabled mail readers I for example, can't see it... > > geir > > > I proposed to refactor to three packages like this: > > > > java.net: for sure includes All API classes, and includes them only > > public class Socket > > public class ServerSocket > > public abstract class SocketImpl > > public class DatagramSocket > > public class MulticastSocket extends DatagramSocket > > public abstract class DatagramSocketImpl > > > > org.apache.harmony.net: all implementation classes with a factory > > public class SocketImplProvider > > class PlainSocketImpl extends SocketImpl > > class PlainSocketImpl2 extends PlainSocketImpl > > class PlainServerSocketImpl extends PlainSocketImpl > > class PlainDatagramSocketImpl extends DatagramSocketImpl > > class PlainMulticastSocketImpl extends PlainDatagramSocketImpl > > some relevant small classes(Socks4Message, GenericIPMreq) > > > > org.apache.platform: currently, this package includes native file system > and memory management interface, so it is a good place to include the native > network interface, the INetworkSystem will encapsulate all JNI interfaces. > > public interface INetworkSystem > > public class OSNetworkSystem implements INetworkSystem > > > > 2. Implement java.nio > > Now it is ready to implement NIO network channels based on it: > > java.nio: > > public abstract class SocketChannel > > public abstract class ServerSocketChannel > > public abstract class DatagramSocketChannel > > class SocketChannelImpl > > class ServerSocketImpl > > class DatagramSocketChannelImpl > > class SocketAdapter > > class ServerSocketAdapter > > class DatagramSocketAdapter > > > > I will attach the result diagram into JIRA, too > > > > 3. Modulize them > > According to the current Harmony modulization, propose to modify the > modulization as follows: > > luni exports: java.net, org.apache.harmony.net, > org.apache.harmony.platform(move from nio to luni, and export it) > > nio exports: java.nio > > > > > > > > > >> The network related channels in java.nio.channels are not implemented > >> - > >> > >> Key: HARMONY-27 > >> URL: http://issues.apache.org/jira/browse/HARMONY-27 > >> Project: Harmony > >> Type: Bug > >> Components: Classlib > >> Reporter: Paulex Yang > >> Assignee: Geir Magnusson Jr > > > >> The following classes defined by Java Spec 5.0 in java.nio.channels are > not included in the class library code > >> public abstarct class java.nio.channels.DatagramChannel > >> public abstract class java.nio.channels.ServerSocketChannel > >> public abstract class java.nio.channels.SocketChannel > > > -- Paulex Yang China Software Development Labotary IBM
Re: [classlib-security2] Move to org.apache.harmony namespace complete
Some if them are in comments or in the doc file. Thanks, Mikhail On 1/20/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > I was able to test in Ubuntu 5.1 on a VMWare partition all tests > pass > > Geir Magnusson Jr wrote: > > Right - I need to put that back in... > > > > put junit and bcprov on your classpath... .or wait a few min until I > > redo the build again to do it automatically. evil classpath > > > > > > > > Tim Ellison wrote: > >> Anything special required for the environment? > >> What classpath do you have set-up? > >> > >> Regards, > >> Tim > >> > >> [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ ant tests.run > >> Buildfile: build.xml > >> > >> .. > >> > >> tests.compile: > >> [echo] Compiling Security tests from > >> /home/tellison/Harmony/modules/security2/test/common/unit, > >> /home/tellison/Harmony/modules/security2/test/linux/unit > >> > >> tests: > >> > >> run: > >> [junit] Running java.security.AccessControlExceptionTest > >> [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.012 sec > >> [junit] Running java.security.AlgorithmParameterGeneratorSpiTests > >> [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.085 sec > >> [junit] Running java.security.AlgorithmParameterGeneratorTest1 > >> [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.016 sec > >> > >> BUILD FAILED > >> /home/tellison/Harmony/modules/security2/make/build.xml:396: Test > >> java.security.AlgorithmParameterGeneratorTest1 failed > >> > >> Total time: 7 seconds > >> [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ > >> > >> > >> > >> Geir Magnusson Jr wrote: > >>> That took longer than I thought, but I thought it generally productive > >>> for me as I understand it a lot more, and in general because we got some > >>> good discussion and broader awareness. > >>> > >>> All tests pass on WindowsXP - someone needs to test on linux to make > >>> sure I didn't break anything. > >>> > >>> For next steps, I'd like to modify the local security2 component build > >>> to product artifacts that drop in with the rest, so we can get rid of > >>> security/ > >>> > >>> Once we have that done, we could re-structure to be like the others. But > >>> first, it would be good to have it be a "first-class citizen" in the > >>> classlibrary. > >>> > >>> What's the easiest way to do this? > >>> > >>> geir > >>> > >> > > > > >
Re: [jira] Commented: (HARMONY-31) Move peformance timing of unit tests into a decorator class.
To summarize, we have 3 options: 1. Keep PerformanceTest as a super class. Set printAllowed to false by default. 2. Remove PerformnceTest. Introduce a simple Logger that does not print by default. 3. Move performance functionality to Decorator. #1 is the most unliked. #3 as I wrote before does not work. So I can submit a script that goes through the tests replacing "extends PerformanceTest" with "extends TestCase" "import PerformanceTest" with "import Logger" and putting "Logger." before logln() and other log functions Thanks, Mikhail On 1/19/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > > > Mikhail Loenko wrote: > > On 1/19/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > >> > >> Mikhail Loenko wrote: > >>> The problem is unstable execution time of java programs: > >>> > >>> If you consequently run the same java program on the same computer > >>> in the same conditions, execution time may vary by 20% or even more > >> Why? Given that computers are pretty determinstic, I'd argue that you > >> don't have the same conditions from run to run. > > > > Did you make experiments or it's your theoretical conclusion :) ? > > Have done experiments. I never claim that it's the same conditions > every run. That's the issue, I think. > > geir > > > Try to create an application that runs 20 seconds and run it several times. > > > > Frankly, I do not exactly know why. But I know a lot of reasons that could > > affect this dispersion. For example, there is a number of serving > > threads and GC that impact on execution time. > > > > > Thanks, > > Mikhail > > > > > >> geir > >> > > > > >
Re: [classlib-security2] Move to org.apache.harmony namespace complete
I was able to test in Ubuntu 5.1 on a VMWare partition all tests pass Geir Magnusson Jr wrote: Right - I need to put that back in... put junit and bcprov on your classpath... .or wait a few min until I redo the build again to do it automatically. evil classpath Tim Ellison wrote: Anything special required for the environment? What classpath do you have set-up? Regards, Tim [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ ant tests.run Buildfile: build.xml .. tests.compile: [echo] Compiling Security tests from /home/tellison/Harmony/modules/security2/test/common/unit, /home/tellison/Harmony/modules/security2/test/linux/unit tests: run: [junit] Running java.security.AccessControlExceptionTest [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.012 sec [junit] Running java.security.AlgorithmParameterGeneratorSpiTests [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.085 sec [junit] Running java.security.AlgorithmParameterGeneratorTest1 [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.016 sec BUILD FAILED /home/tellison/Harmony/modules/security2/make/build.xml:396: Test java.security.AlgorithmParameterGeneratorTest1 failed Total time: 7 seconds [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ Geir Magnusson Jr wrote: That took longer than I thought, but I thought it generally productive for me as I understand it a lot more, and in general because we got some good discussion and broader awareness. All tests pass on WindowsXP - someone needs to test on linux to make sure I didn't break anything. For next steps, I'd like to modify the local security2 component build to product artifacts that drop in with the rest, so we can get rid of security/ Once we have that done, we could re-structure to be like the others. But first, it would be good to have it be a "first-class citizen" in the classlibrary. What's the easiest way to do this? geir
Re: [jira] Updated: (HARMONY-35) Harmony ignores java.security.policy property
Hi George, > >The reason for this buggy behaviour is the incomplete implementation of >com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() >method needs work to actually fulfill its contract as laid out in the >Javadoc comments. > com.ibm.oti.util.DefaultPolicy extends java.security.Policy class that is from the security component. BTW, we do have another implementation of java.security.Policy that is org.apache.harmony.security.fortress.DefaultPolicy and I've verified that in this particular case implementation from 'security2' works correctly. Thanks, Stepan Mishura Intel Middleware Products Division On 1/20/06, George Harley (JIRA) <[EMAIL PROTECTED]> wrote: > > [ http://issues.apache.org/jira/browse/HARMONY-35?page=all ] > > George Harley updated HARMONY-35: > - > >Attachment: HARMONY-35-patch.txt > > The attached patch seems to fix it for me on Win XP. Not tested on Linux. > > Best regards, > George > > > Harmony ignores java.security.policy property > > - > > > > Key: HARMONY-35 > > URL: http://issues.apache.org/jira/browse/HARMONY-35 > > Project: Harmony > > Type: Bug > > Components: Classlib > > Environment: Win32 and Linux > > Reporter: George Harley > > Attachments: HARMONY-35-patch.txt > > > > Here is the complete contents of a Java security policy file called " > mysecurity.policy" that can be used to specify additional permissions to a > JRE... > > -snip-- > > grant { > > // so we can remove the security manager > > permission java.lang.RuntimePermission "setSecurityManager"; > > }; > > -snip-- > > If its location is passed in the Java launch arguments with the > java.security.policy property as below then the permissions are added to > the default set of permissions that the JRE runs with ... > > -Djava.security.policy=c:\path\to\mysecurity.policy > > If the following unit test is run against a sandbox build of the > classlibs under SVN trunk on the IBM Apache Harmony VME with the > java.security.policy set (as above) so that the "setSecurityManager" > runtime permission is added, then a pass should result. It doesn't. > > ---snip-- > > package foo; > > import java.security.AccessControlException; > > import junit.framework.TestCase; > > public class SecurityPolicyTest extends TestCase { > > public void testPermissions() { > > try { > > System.out > > .println("Trying to set the security manager the > first time..."); > > System.setSecurityManager(new SecurityManager()); > > System.out.println("Trying to set the security manager to > null..."); > > System.setSecurityManager(null); > > assertEquals(null, System.getSecurityManager()); > > } catch (AccessControlException e) { > > fail("Caught AccessControlException : " + e.getMessage()); > > } > > } > > } > > ---snip-- > > The failure occurs because an AccessControlException is thrown on the > second call to System.setSecurityManager() when the test tries to pass a > null argument. > > The problem is that after the first call to System.setSecurityManager() > has installed a security manager, there is no runtime permission to enable > the security manager to be set again. This is despite the fact that when > running the test we set the java.security.policy property to point to a > file that grants this very permission ! > > The reason for this buggy behaviour is the incomplete implementation of > com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() > method needs work to actually fulfill its contract as laid out in the > Javadoc comments. > > George > > -- > This message is automatically generated by JIRA. > - > If you think it was sent incorrectly contact one of the administrators: > http://issues.apache.org/jira/secure/Administrators.jspa > - > For more information on JIRA, see: > http://www.atlassian.com/software/jira > >
Re: [classlib-security2] Move to org.apache.harmony namespace complete
These files still contain 'openintel' security2/doc/ASN1Framework.htm security2/make/build.xml security2/src/windows/other/jaaswin/jaaswin.cpp security2/test/common/unit/javax/security/cert/X509CertificateTest.java security2/test/common/unit/org/apache/harmony/security/provider/cert/CertFactoryTestData.java security2/test/common/unit/org/apache/harmony/security/provider/cert/X509CertFactoryPerfTest.java They need to be updated Thanks, Mikhail On 1/20/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > Right - I need to put that back in... > > put junit and bcprov on your classpath... .or wait a few min until I > redo the build again to do it automatically. evil classpath > > > > Tim Ellison wrote: > > Anything special required for the environment? > > What classpath do you have set-up? > > > > Regards, > > Tim > > > > [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ ant tests.run > > Buildfile: build.xml > > > > .. > > > > tests.compile: > > [echo] Compiling Security tests from > > /home/tellison/Harmony/modules/security2/test/common/unit, > > /home/tellison/Harmony/modules/security2/test/linux/unit > > > > tests: > > > > run: > > [junit] Running java.security.AccessControlExceptionTest > > [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.012 sec > > [junit] Running java.security.AlgorithmParameterGeneratorSpiTests > > [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.085 sec > > [junit] Running java.security.AlgorithmParameterGeneratorTest1 > > [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.016 sec > > > > BUILD FAILED > > /home/tellison/Harmony/modules/security2/make/build.xml:396: Test > > java.security.AlgorithmParameterGeneratorTest1 failed > > > > Total time: 7 seconds > > [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ > > > > > > > > Geir Magnusson Jr wrote: > >> That took longer than I thought, but I thought it generally productive > >> for me as I understand it a lot more, and in general because we got some > >> good discussion and broader awareness. > >> > >> All tests pass on WindowsXP - someone needs to test on linux to make > >> sure I didn't break anything. > >> > >> For next steps, I'd like to modify the local security2 component build > >> to product artifacts that drop in with the rest, so we can get rid of > >> security/ > >> > >> Once we have that done, we could re-structure to be like the others. But > >> first, it would be good to have it be a "first-class citizen" in the > >> classlibrary. > >> > >> What's the easiest way to do this? > >> > >> geir > >> > > >
Re: [classlib-security2] Move to org.apache.harmony namespace complete
Right - I need to put that back in... put junit and bcprov on your classpath... .or wait a few min until I redo the build again to do it automatically. evil classpath Tim Ellison wrote: Anything special required for the environment? What classpath do you have set-up? Regards, Tim [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ ant tests.run Buildfile: build.xml .. tests.compile: [echo] Compiling Security tests from /home/tellison/Harmony/modules/security2/test/common/unit, /home/tellison/Harmony/modules/security2/test/linux/unit tests: run: [junit] Running java.security.AccessControlExceptionTest [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.012 sec [junit] Running java.security.AlgorithmParameterGeneratorSpiTests [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.085 sec [junit] Running java.security.AlgorithmParameterGeneratorTest1 [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.016 sec BUILD FAILED /home/tellison/Harmony/modules/security2/make/build.xml:396: Test java.security.AlgorithmParameterGeneratorTest1 failed Total time: 7 seconds [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ Geir Magnusson Jr wrote: That took longer than I thought, but I thought it generally productive for me as I understand it a lot more, and in general because we got some good discussion and broader awareness. All tests pass on WindowsXP - someone needs to test on linux to make sure I didn't break anything. For next steps, I'd like to modify the local security2 component build to product artifacts that drop in with the rest, so we can get rid of security/ Once we have that done, we could re-structure to be like the others. But first, it would be good to have it be a "first-class citizen" in the classlibrary. What's the easiest way to do this? geir
[jira] Assigned: (HARMONY-35) Harmony ignores java.security.policy property
[ http://issues.apache.org/jira/browse/HARMONY-35?page=all ] Tim Ellison reassigned HARMONY-35: -- Assign To: Tim Ellison > Harmony ignores java.security.policy property > - > > Key: HARMONY-35 > URL: http://issues.apache.org/jira/browse/HARMONY-35 > Project: Harmony > Type: Bug > Components: Classlib > Environment: Win32 and Linux > Reporter: George Harley > Assignee: Tim Ellison > Attachments: HARMONY-35-patch.txt > > Here is the complete contents of a Java security policy file called > "mysecurity.policy" that can be used to specify additional permissions to a > JRE... > -snip-- > grant { > // so we can remove the security manager > permission java.lang.RuntimePermission "setSecurityManager"; > }; > -snip-- > If its location is passed in the Java launch arguments with the > java.security.policy property as below then the permissions are added to the > default set of permissions that the JRE runs with ... > -Djava.security.policy=c:\path\to\mysecurity.policy > If the following unit test is run against a sandbox build of the classlibs > under SVN trunk on the IBM Apache Harmony VME with the java.security.policy > set (as above) so that the "setSecurityManager" runtime permission is added, > then a pass should result. It doesn't. > ---snip-- > package foo; > import java.security.AccessControlException; > import junit.framework.TestCase; > public class SecurityPolicyTest extends TestCase { > public void testPermissions() { > try { > System.out > .println("Trying to set the security manager the first > time..."); > System.setSecurityManager(new SecurityManager()); > System.out.println("Trying to set the security manager to > null..."); > System.setSecurityManager(null); > assertEquals(null, System.getSecurityManager()); > } catch (AccessControlException e) { > fail("Caught AccessControlException : " + e.getMessage()); > } > } > } > ---snip-- > The failure occurs because an AccessControlException is thrown on the second > call to System.setSecurityManager() when the test tries to pass a null > argument. > The problem is that after the first call to System.setSecurityManager() has > installed a security manager, there is no runtime permission to enable the > security manager to be set again. This is despite the fact that when running > the test we set the java.security.policy property to point to a file that > grants this very permission ! > The reason for this buggy behaviour is the incomplete implementation of > com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method > needs work to actually fulfill its contract as laid out in the Javadoc > comments. > George -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [classlib-security2] Move to org.apache.harmony namespace complete
Anything special required for the environment? What classpath do you have set-up? Regards, Tim [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ ant tests.run Buildfile: build.xml .. tests.compile: [echo] Compiling Security tests from /home/tellison/Harmony/modules/security2/test/common/unit, /home/tellison/Harmony/modules/security2/test/linux/unit tests: run: [junit] Running java.security.AccessControlExceptionTest [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.012 sec [junit] Running java.security.AlgorithmParameterGeneratorSpiTests [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.085 sec [junit] Running java.security.AlgorithmParameterGeneratorTest1 [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.016 sec BUILD FAILED /home/tellison/Harmony/modules/security2/make/build.xml:396: Test java.security.AlgorithmParameterGeneratorTest1 failed Total time: 7 seconds [EMAIL PROTECTED]:~/Harmony/modules/security2/make$ Geir Magnusson Jr wrote: > That took longer than I thought, but I thought it generally productive > for me as I understand it a lot more, and in general because we got some > good discussion and broader awareness. > > All tests pass on WindowsXP - someone needs to test on linux to make > sure I didn't break anything. > > For next steps, I'd like to modify the local security2 component build > to product artifacts that drop in with the rest, so we can get rid of > security/ > > Once we have that done, we could re-structure to be like the others. But > first, it would be good to have it be a "first-class citizen" in the > classlibrary. > > What's the easiest way to do this? > > geir > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
Re: [jira] Created: (HARMONY-35) Harmony ignores java.security.policy property
I suspected :) George Harley1 wrote: Hi, Yep. On its way Best regards, George George C. Harley Geir Magnusson Jr <[EMAIL PROTECTED]> 19/01/2006 21:56 Please respond to harmony-dev@incubator.apache.org To harmony-dev@incubator.apache.org cc Subject Re: [jira] Created: (HARMONY-35) Harmony ignores java.security.policy property have a patch, maybe? George Harley (JIRA) wrote: Harmony ignores java.security.policy property - Key: HARMONY-35 URL: http://issues.apache.org/jira/browse/HARMONY-35 Project: Harmony Type: Bug Components: Classlib Environment: Win32 and Linux Reporter: George Harley Here is the complete contents of a Java security policy file called "mysecurity.policy" that can be used to specify additional permissions to a JRE... -snip-- grant { // so we can remove the security manager permission java.lang.RuntimePermission "setSecurityManager"; }; -snip-- If its location is passed in the Java launch arguments with the java.security.policy property as below then the permissions are added to the default set of permissions that the JRE runs with ... -Djava.security.policy=c:\path\to\mysecurity.policy If the following unit test is run against a sandbox build of the classlibs under SVN trunk on the IBM Apache Harmony VME with the java.security.policy set (as above) so that the "setSecurityManager" runtime permission is added, then a pass should result. It doesn't. ---snip-- package foo; import java.security.AccessControlException; import junit.framework.TestCase; public class SecurityPolicyTest extends TestCase { public void testPermissions() { try { System.out .println("Trying to set the security manager the first time..."); System.setSecurityManager(new SecurityManager()); System.out.println("Trying to set the security manager to null..."); System.setSecurityManager(null); assertEquals(null, System.getSecurityManager()); } catch (AccessControlException e) { fail("Caught AccessControlException : " + e.getMessage()); } } } ---snip-- The failure occurs because an AccessControlException is thrown on the second call to System.setSecurityManager() when the test tries to pass a null argument. The problem is that after the first call to System.setSecurityManager() has installed a security manager, there is no runtime permission to enable the security manager to be set again. This is despite the fact that when running the test we set the java.security.policy property to point to a file that grants this very permission ! The reason for this buggy behaviour is the incomplete implementation of com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method needs work to actually fulfill its contract as laid out in the Javadoc comments. George
[jira] Updated: (HARMONY-35) Harmony ignores java.security.policy property
[ http://issues.apache.org/jira/browse/HARMONY-35?page=all ] George Harley updated HARMONY-35: - Attachment: HARMONY-35-patch.txt The attached patch seems to fix it for me on Win XP. Not tested on Linux. Best regards, George > Harmony ignores java.security.policy property > - > > Key: HARMONY-35 > URL: http://issues.apache.org/jira/browse/HARMONY-35 > Project: Harmony > Type: Bug > Components: Classlib > Environment: Win32 and Linux > Reporter: George Harley > Attachments: HARMONY-35-patch.txt > > Here is the complete contents of a Java security policy file called > "mysecurity.policy" that can be used to specify additional permissions to a > JRE... > -snip-- > grant { > // so we can remove the security manager > permission java.lang.RuntimePermission "setSecurityManager"; > }; > -snip-- > If its location is passed in the Java launch arguments with the > java.security.policy property as below then the permissions are added to the > default set of permissions that the JRE runs with ... > -Djava.security.policy=c:\path\to\mysecurity.policy > If the following unit test is run against a sandbox build of the classlibs > under SVN trunk on the IBM Apache Harmony VME with the java.security.policy > set (as above) so that the "setSecurityManager" runtime permission is added, > then a pass should result. It doesn't. > ---snip-- > package foo; > import java.security.AccessControlException; > import junit.framework.TestCase; > public class SecurityPolicyTest extends TestCase { > public void testPermissions() { > try { > System.out > .println("Trying to set the security manager the first > time..."); > System.setSecurityManager(new SecurityManager()); > System.out.println("Trying to set the security manager to > null..."); > System.setSecurityManager(null); > assertEquals(null, System.getSecurityManager()); > } catch (AccessControlException e) { > fail("Caught AccessControlException : " + e.getMessage()); > } > } > } > ---snip-- > The failure occurs because an AccessControlException is thrown on the second > call to System.setSecurityManager() when the test tries to pass a null > argument. > The problem is that after the first call to System.setSecurityManager() has > installed a security manager, there is no runtime permission to enable the > security manager to be set again. This is despite the fact that when running > the test we set the java.security.policy property to point to a file that > grants this very permission ! > The reason for this buggy behaviour is the incomplete implementation of > com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method > needs work to actually fulfill its contract as laid out in the Javadoc > comments. > George -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] Created: (HARMONY-35) Harmony ignores java.security.policy property
Hi, Yep. On its way Best regards, George George C. Harley Geir Magnusson Jr <[EMAIL PROTECTED]> 19/01/2006 21:56 Please respond to harmony-dev@incubator.apache.org To harmony-dev@incubator.apache.org cc Subject Re: [jira] Created: (HARMONY-35) Harmony ignores java.security.policy property have a patch, maybe? George Harley (JIRA) wrote: > Harmony ignores java.security.policy property > - > > Key: HARMONY-35 > URL: http://issues.apache.org/jira/browse/HARMONY-35 > Project: Harmony > Type: Bug > Components: Classlib > Environment: Win32 and Linux > Reporter: George Harley > > > Here is the complete contents of a Java security policy file called "mysecurity.policy" that can be used to specify additional permissions to a JRE... > > -snip-- > > grant { > // so we can remove the security manager > permission java.lang.RuntimePermission "setSecurityManager"; > }; > > -snip-- > > If its location is passed in the Java launch arguments with the java.security.policy property as below then the permissions are added to the default set of permissions that the JRE runs with ... > > -Djava.security.policy=c:\path\to\mysecurity.policy > > > If the following unit test is run against a sandbox build of the classlibs under SVN trunk on the IBM Apache Harmony VME with the java.security.policy set (as above) so that the "setSecurityManager" runtime permission is added, then a pass should result. It doesn't. > > ---snip-- > > package foo; > > import java.security.AccessControlException; > > import junit.framework.TestCase; > > public class SecurityPolicyTest extends TestCase { > > public void testPermissions() { > try { > System.out > .println("Trying to set the security manager the first time..."); > System.setSecurityManager(new SecurityManager()); > > System.out.println("Trying to set the security manager to null..."); > System.setSecurityManager(null); > assertEquals(null, System.getSecurityManager()); > } catch (AccessControlException e) { > fail("Caught AccessControlException : " + e.getMessage()); > } > } > } > > ---snip-- > > The failure occurs because an AccessControlException is thrown on the second call to System.setSecurityManager() when the test tries to pass a null argument. > > The problem is that after the first call to System.setSecurityManager() has installed a security manager, there is no runtime permission to enable the security manager to be set again. This is despite the fact that when running the test we set the java.security.policy property to point to a file that grants this very permission ! > > The reason for this buggy behaviour is the incomplete implementation of com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method needs work to actually fulfill its contract as laid out in the Javadoc comments. > > George > >
Re: [jira] Created: (HARMONY-35) Harmony ignores java.security.policy property
have a patch, maybe? George Harley (JIRA) wrote: Harmony ignores java.security.policy property - Key: HARMONY-35 URL: http://issues.apache.org/jira/browse/HARMONY-35 Project: Harmony Type: Bug Components: Classlib Environment: Win32 and Linux Reporter: George Harley Here is the complete contents of a Java security policy file called "mysecurity.policy" that can be used to specify additional permissions to a JRE... -snip-- grant { // so we can remove the security manager permission java.lang.RuntimePermission "setSecurityManager"; }; -snip-- If its location is passed in the Java launch arguments with the java.security.policy property as below then the permissions are added to the default set of permissions that the JRE runs with ... -Djava.security.policy=c:\path\to\mysecurity.policy If the following unit test is run against a sandbox build of the classlibs under SVN trunk on the IBM Apache Harmony VME with the java.security.policy set (as above) so that the "setSecurityManager" runtime permission is added, then a pass should result. It doesn't. ---snip-- package foo; import java.security.AccessControlException; import junit.framework.TestCase; public class SecurityPolicyTest extends TestCase { public void testPermissions() { try { System.out .println("Trying to set the security manager the first time..."); System.setSecurityManager(new SecurityManager()); System.out.println("Trying to set the security manager to null..."); System.setSecurityManager(null); assertEquals(null, System.getSecurityManager()); } catch (AccessControlException e) { fail("Caught AccessControlException : " + e.getMessage()); } } } ---snip-- The failure occurs because an AccessControlException is thrown on the second call to System.setSecurityManager() when the test tries to pass a null argument. The problem is that after the first call to System.setSecurityManager() has installed a security manager, there is no runtime permission to enable the security manager to be set again. This is despite the fact that when running the test we set the java.security.policy property to point to a file that grants this very permission ! The reason for this buggy behaviour is the incomplete implementation of com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method needs work to actually fulfill its contract as laid out in the Javadoc comments. George
[jira] Created: (HARMONY-35) Harmony ignores java.security.policy property
Harmony ignores java.security.policy property - Key: HARMONY-35 URL: http://issues.apache.org/jira/browse/HARMONY-35 Project: Harmony Type: Bug Components: Classlib Environment: Win32 and Linux Reporter: George Harley Here is the complete contents of a Java security policy file called "mysecurity.policy" that can be used to specify additional permissions to a JRE... -snip-- grant { // so we can remove the security manager permission java.lang.RuntimePermission "setSecurityManager"; }; -snip-- If its location is passed in the Java launch arguments with the java.security.policy property as below then the permissions are added to the default set of permissions that the JRE runs with ... -Djava.security.policy=c:\path\to\mysecurity.policy If the following unit test is run against a sandbox build of the classlibs under SVN trunk on the IBM Apache Harmony VME with the java.security.policy set (as above) so that the "setSecurityManager" runtime permission is added, then a pass should result. It doesn't. ---snip-- package foo; import java.security.AccessControlException; import junit.framework.TestCase; public class SecurityPolicyTest extends TestCase { public void testPermissions() { try { System.out .println("Trying to set the security manager the first time..."); System.setSecurityManager(new SecurityManager()); System.out.println("Trying to set the security manager to null..."); System.setSecurityManager(null); assertEquals(null, System.getSecurityManager()); } catch (AccessControlException e) { fail("Caught AccessControlException : " + e.getMessage()); } } } ---snip-- The failure occurs because an AccessControlException is thrown on the second call to System.setSecurityManager() when the test tries to pass a null argument. The problem is that after the first call to System.setSecurityManager() has installed a security manager, there is no runtime permission to enable the security manager to be set again. This is despite the fact that when running the test we set the java.security.policy property to point to a file that grants this very permission ! The reason for this buggy behaviour is the incomplete implementation of com.ibm.oti.util.DefaultPolicy in the luni component. The readPolicy() method needs work to actually fulfill its contract as laid out in the Javadoc comments. George -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[classlib-security2] Move to org.apache.harmony namespace complete
That took longer than I thought, but I thought it generally productive for me as I understand it a lot more, and in general because we got some good discussion and broader awareness. All tests pass on WindowsXP - someone needs to test on linux to make sure I didn't break anything. For next steps, I'd like to modify the local security2 component build to product artifacts that drop in with the rest, so we can get rid of security/ Once we have that done, we could re-structure to be like the others. But first, it would be good to have it be a "first-class citizen" in the classlibrary. What's the easiest way to do this? geir
Re: IBM Development Package for Apache Harmony
Touché :) On 1/19/06, Tim Ellison <[EMAIL PROTECTED]> wrote: > Davanum Srinivas wrote: > > Folks, > > > > I was trying to download the JVM from [1] as per instructions on our > > site [2]why is it asking me for all kinds of personal information? > > The JVM is being made available under a license that (AIUI) means it > cannot be redistributed from the Apache site. Developerworks has this > policy of requesting info before a download, though most of it is > optional and you can indicate that it is not to be used for any other > purpose IIRC. > > > Is there a way to avoid this? > > Contribute to JCHEVM ;-) > > Regards, > Tim > > > thanks, > > dims > > > > [1] : http://www-128.ibm.com/developerworks/java/jdk/harmony/index.html > > [2] : http://incubator.apache.org/harmony/downloads.html > > -- > > Davanum Srinivas : http://wso2.com/blogs/ > > > > -- > > Tim Ellison ([EMAIL PROTECTED]) > IBM Java technology centre, UK. > -- Davanum Srinivas : http://wso2.com/blogs/
Re: Proposal to relocate jchevm
+1 On 1/19/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > Go! :) > > +1 > > geir > > (catching up after a day of power outage... ) > > Archie Cobbs wrote: > > Hi all. I'm planning to move jchevm from: > > > > enhanced/trunk/sandbox/contribs/jchevm/jchevm > > > > to: > > > > enhanced/jchevm > > > > i.e., to move it out of the "sandbox". Let me know if anyone has > > any issues. > > > > Thanks, > > -Archie > > > > __ > > Archie Cobbs *CTO, Awarix* http://www.awarix.com > > > > > -- Davanum Srinivas : http://wso2.com/blogs/
Re: compiling JCHEVM with GCC/Cygwin
Hi Archie, Enrico Migliore wrote: P.S. During the compilation phase, that is, before stopping on the mentioned error, the compiler issues the following warning: gcc: unrecognized option '-pthread' I've removed this configure hack, which is no longer needed. ok! P.S. I put the ucontext.h file in the dirs: /include and /include/sys at the moment they are empty That's a bad sign.. :-) -Archie I don't know whether the Cygwin guys has ported the functions included in the ucontext.h header file, to Win32. I'll check it tonight. Enrico
[jira] Commented: (HARMONY-26) The API of buffer classes in java.nio are not compliant with the specification of Java 5.0
[ http://issues.apache.org/jira/browse/HARMONY-26?page=comments#action_12363270 ] Tim Ellison commented on HARMONY-26: Richard, I have taken your tests (with slight refactoring of pcakage names), and they pass with the latest version of the NIO code. The tests are in NIO module, src/test/java/** at repository revision 370544. > The API of buffer classes in java.nio are not compliant with the > specification of Java 5.0 > -- > > Key: HARMONY-26 > URL: http://issues.apache.org/jira/browse/HARMONY-26 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Richard Liang > Assignee: Tim Ellison > Attachments: DirectBuffer.java, nio-tests.jar > > 1. java.nio.CharBuffer > 1.1) java.nio.CharBuffer needs to implement two new interface > java.lang.Appendable and java.lang.Readable > 1.2) The following methods should NOT be "protected": > protected CharBuffer(int capacity) > protected abstract char[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > > 1.3) The following method should be "final": > public CharBuffer put(char[] src) > > 2. java.nio.Buffer > 2.1) The following fields should NOT be "protected": > int UNSET_MARK > int capacity > int limit > int mark should > int position > 2.3) The following method should NOT be "protected": > protected Buffer(int capacity) > 3. java.nio.ByteBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, > ShortBuffer > 3.1) The following field should NOT be "protected": > com.ibm.platform.Endianness order > 3.2) The following methods should NOT be "protected": > protected ByteBuffer(int capacity) > protected abstract byte[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > 3.3) The following method should be "final": > public ByteBuffer order(ByteOrder byteOrder) > > 4. The implementation of bulk put/get methods of all the buffer classes are > low-efficiency > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-24) java.net.URLEncoder.encode(String s, String enc) doesn't throw UnsupportedEncodingException
[ http://issues.apache.org/jira/browse/HARMONY-24?page=comments#action_12363269 ] Vladimir Strigun commented on HARMONY-24: - Current implementation of encode(String, String) method use getBytes(encoding) method for encoding "special" characters. My testcase haven't some "special" characters, thatswhy we can't see exception. To fix it, we can add check that charset is supported: 19a20 > import java.nio.charset.Charset; 93a95,96 > if(!Charset.isSupported(enc)) > throw new UnsupportedEncodingException(enc); > java.net.URLEncoder.encode(String s, String enc) doesn't throw > UnsupportedEncodingException > --- > > Key: HARMONY-24 > URL: http://issues.apache.org/jira/browse/HARMONY-24 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Geir Magnusson Jr > > Corresponding to API specification method encode(String, String) of > java.net.URLEncoder should throw "UnsupportedEncodingException - If the named > encoding is not supported". But the test shows that Harmony implementation > doesn't throw an exception. > import java.io.UnsupportedEncodingException; > import java.net.URLEncoder; > public class Test { > public static void main(String[] args) { > try { > > System.out.println("URLEncoder.encode="+URLEncoder.encode("str","unknown_enc")); > > } catch (UnsupportedEncodingException e) { > e.printStackTrace(); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: compiling JCHEVM with GCC/Cygwin
Enrico Migliore wrote: P.S. During the compilation phase, that is, before stopping on the mentioned error, the compiler issues the following warning: gcc: unrecognized option '-pthread' I've removed this configure hack, which is no longer needed. P.S. I put the ucontext.h file in the dirs: /include and /include/sys at the moment they are empty That's a bad sign.. :-) -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
[jira] Commented: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
[ http://issues.apache.org/jira/browse/HARMONY-23?page=comments#action_12363266 ] Vladimir Strigun commented on HARMONY-23: - it's ok. > java.net.URI(String s) for invalid escaped characters throw > IllegalArgumentException > > > Key: HARMONY-23 > URL: http://issues.apache.org/jira/browse/HARMONY-23 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Minor > > When I use URI(String) constructor with invalid escaped characters I get > IllegalArgumentException instead of URISyntaxException. > Small testcase for reproducing this issue: > import java.net.*; > public class URIBug{ >public static void main(String[] args) { > try { > new URI("%3"); > } catch (URISyntaxException e) { >System.out.println("PASSED"); > } catch (Exception e) { >System.out.println("FAILED: illegal exception occured: "+e); > } >} > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-21) File constructor produces wrong path to absolute path specified relative to root
[ http://issues.apache.org/jira/browse/HARMONY-21?page=comments#action_12363265 ] Vladimir Strigun commented on HARMONY-21: - Sorry, of course it's ok . > File constructor produces wrong path to absolute path specified relative to > root > > > Key: HARMONY-21 > URL: http://issues.apache.org/jira/browse/HARMONY-21 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Tim Ellison > Assignee: Tim Ellison > > Specifying an absolute path relative to the root directory produces the wrong > final pathname. > Here's a simple test illustrating the problem: > public void test_File_Constructor() { > File path = new File("/dir/file"); > File root = new File("/"); > File file = new File(root, "/dir/file"); > assertEquals("wrong path result ", path.getPath(), > file.getPath()); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] Commented: (HARMONY-31) Move peformance timing of unit tests into a decorator class.
Mikhail Loenko wrote: On 1/19/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: Mikhail Loenko wrote: The problem is unstable execution time of java programs: If you consequently run the same java program on the same computer in the same conditions, execution time may vary by 20% or even more Why? Given that computers are pretty determinstic, I'd argue that you don't have the same conditions from run to run. Did you make experiments or it's your theoretical conclusion :) ? Have done experiments. I never claim that it's the same conditions every run. That's the issue, I think. geir Try to create an application that runs 20 seconds and run it several times. Frankly, I do not exactly know why. But I know a lot of reasons that could affect this dispersion. For example, there is a number of serving threads and GC that impact on execution time. Thanks, Mikhail geir
Re: compiling JCHEVM with GCC/Cygwin
Enrico Migliore wrote: After compiling some C source files, thoug, it stopped saying: jcjavah: can't load class 'gnu/classpath/VMStackWalker': java/io/IOException: error reading entry 'gnu/classpath/VMStackWalker.class' in ZIP file 'usr/local/classpath/share/classpath/glibj.zip': No error make[2]: *** [gnu_classpath_VMStackWalker.h] Error 1 (Note that VMStackWalker.class is present in my zip file: /usr/local/classpath/share/classpath/glibj.zip) Looks like the pread(3) function is not working properly under Cygwin. This error occurs on line 373 of zip.c if you want to try to debug it (sorry, I'm Windows illiterate). -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
[jira] Closed: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
[ http://issues.apache.org/jira/browse/HARMONY-23?page=all ] Tim Ellison closed HARMONY-23: -- No response from Vladimir. Assuming it is ok -- closing. > java.net.URI(String s) for invalid escaped characters throw > IllegalArgumentException > > > Key: HARMONY-23 > URL: http://issues.apache.org/jira/browse/HARMONY-23 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Minor > > When I use URI(String) constructor with invalid escaped characters I get > IllegalArgumentException instead of URISyntaxException. > Small testcase for reproducing this issue: > import java.net.*; > public class URIBug{ >public static void main(String[] args) { > try { > new URI("%3"); > } catch (URISyntaxException e) { >System.out.println("PASSED"); > } catch (Exception e) { >System.out.println("FAILED: illegal exception occured: "+e); > } >} > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (HARMONY-21) File constructor produces wrong path to absolute path specified relative to root
[ http://issues.apache.org/jira/browse/HARMONY-21?page=all ] Tim Ellison closed HARMONY-21: -- No response from Vladimir. Assuming that this is ok -- closing. > File constructor produces wrong path to absolute path specified relative to > root > > > Key: HARMONY-21 > URL: http://issues.apache.org/jira/browse/HARMONY-21 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Tim Ellison > Assignee: Tim Ellison > > Specifying an absolute path relative to the root directory produces the wrong > final pathname. > Here's a simple test illustrating the problem: > public void test_File_Constructor() { > File path = new File("/dir/file"); > File root = new File("/"); > File file = new File(root, "/dir/file"); > assertEquals("wrong path result ", path.getPath(), > file.getPath()); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (HARMONY-22) Double NaN should compare greater than positive infinity
[ http://issues.apache.org/jira/browse/HARMONY-22?page=all ] Tim Ellison closed HARMONY-22: -- > Double NaN should compare greater than positive infinity > > > Key: HARMONY-22 > URL: http://issues.apache.org/jira/browse/HARMONY-22 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Tim Ellison > Assignee: Tim Ellison > > java.lang.Double.compareTo(java.lang.Double) should answer that Double.NaN > is greater than Double.POSITIVE_INFINITY. > Here's a test case that demonstrates the problem: > public void testDoubleCompare() { > Double nonNumber = new Double(Double.NaN); > Double infinity = new Double(Double.POSITIVE_INFINITY); > int indicator = nonNumber.compareTo(infinity); > assertEquals("Incorrect comparison result", 1, indicator); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] Commented: (HARMONY-31) Move peformance timing of unit tests into a decorator class.
On 1/19/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > > > Mikhail Loenko wrote: > > The problem is unstable execution time of java programs: > > > > If you consequently run the same java program on the same computer > > in the same conditions, execution time may vary by 20% or even more > > Why? Given that computers are pretty determinstic, I'd argue that you > don't have the same conditions from run to run. Did you make experiments or it's your theoretical conclusion :) ? Try to create an application that runs 20 seconds and run it several times. Frankly, I do not exactly know why. But I know a lot of reasons that could affect this dispersion. For example, there is a number of serving threads and GC that impact on execution time. Thanks, Mikhail > > geir >
[jira] Closed: (HARMONY-25) Out of spec port value in URI string should result in registry-based URI
[ http://issues.apache.org/jira/browse/HARMONY-25?page=all ] Tim Ellison closed HARMONY-25: -- > Out of spec port value in URI string should result in registry-based URI > > > Key: HARMONY-25 > URL: http://issues.apache.org/jira/browse/HARMONY-25 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Tim Ellison > Assignee: Tim Ellison > > Since negative port numbers are outside the specified range (int) for port > values, the URI class should consider the authority to be registry-based if > (what would be) the port is apparently negative. > Therefore, given > URI uri = new URI("http://host:-8096/path/index.html";); > uri.getPort() should return -1 (= undefined) > uri.getHost() should return null > uri.parseServerAuthority() should throw a URISyntaxException -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (HARMONY-19) Divide by zero exception when rotating an empty List
[ http://issues.apache.org/jira/browse/HARMONY-19?page=all ] Tim Ellison resolved HARMONY-19: Resolution: Fixed George, your patch and test case look good. Fixed in luni module, java/util/Collections.java at repo revision 370506. Please verify that it fully resolves your problem. > Divide by zero exception when rotating an empty List > > > Key: HARMONY-19 > URL: http://issues.apache.org/jira/browse/HARMONY-19 > Project: Harmony > Type: Bug > Components: Classlib > Environment: All > Reporter: George Harley > Assignee: Tim Ellison > Priority: Minor > Attachments: HARMONY-19-patch-20051202.txt > > The implementation of method rotate(List, int) in java.util.Collections is not > checking the size of the input list prior to attempting the rotation. As a > result, when called with an empty List argument a > java.lang.ArithmeticException > will occur because of the the subsequent divide by zero operation. > The problem can be demonstrated in the below unit test case ... > public void testRotateEmptyList() { > // Create an *empty* list > List list = new ArrayList(); > try { > Collections.rotate(list, 25); > } catch (Exception e) { > fail("Unexpected exception rotating empty List : " + e); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [classlib] What can it do?
Tim Ellison wrote: Sure -- I was using "passing the application's examples and test suites" as a reasonable definition of 'it works'. The wiki is good for this topic since it allows any number of people to edit the website with the results of their experiments (rather than relying on a poor, overworked committer to update the website). Feh. It teaches people to send a patch, which I'd argue is faster than working w/ the wiki :) However, I agree that putting 'notable milestones achieved' on the website site would be appropriate, and the failures can be on the wiki as a tempting feast for people looking to contribute. Regards, Tim Geir Magnusson Jr wrote: Tim Ellison wrote: At the risk of incurring the wrath of GM Jr. I've tweaked the class library wiki page to include the results of some basic experiments using the recent Harmony class library snapshot. http://wiki.apache.org/harmony/ClassLibrary (I'll go back and fill in something for Ant and the Eclipse compiler soon, but we use them for self-host so seems to work quite well.) If you try and run something, please record your success/failure for us all to see. It will help us form a missing code "Most Wanted" list and a record of our abilities. I was going to do this as part of our website - doing a "how are we doing?" page. I suspect that there's a lot more things we can put there, and little things that people are familiar with. Like, it's really cool that it runs velocity. It's pleasantly surprising. it's not surprising that it won't run Tomcat (yet). Lets try to keep finding small things that work. Maybe we need little programs that show functionality - i.e. we can't just say "log4j works" as I'm not sure what that means w/o context. However, having a little proggie that shows log4j working might be good. The point would be to support your subject line "What can we do?"... Once I dig out of my pile, I'll try to put something on the website for us and come up w/ more examples... geir
Re: IBM Development Package for Apache Harmony
This will just help ensure we get our own stuff working sooner :) That said, thanks to IBM for making this available to us for testing and evaluation. I think that even after we are up and self-running, this will be a valuable testing/sanity-check tool. geir Tim Ellison wrote: Davanum Srinivas wrote: Folks, I was trying to download the JVM from [1] as per instructions on our site [2]why is it asking me for all kinds of personal information? The JVM is being made available under a license that (AIUI) means it cannot be redistributed from the Apache site. Developerworks has this policy of requesting info before a download, though most of it is optional and you can indicate that it is not to be used for any other purpose IIRC. Is there a way to avoid this? Contribute to JCHEVM ;-) Regards, Tim thanks, dims [1] : http://www-128.ibm.com/developerworks/java/jdk/harmony/index.html [2] : http://incubator.apache.org/harmony/downloads.html -- Davanum Srinivas : http://wso2.com/blogs/
Re: [classlib] What can it do?
Sure -- I was using "passing the application's examples and test suites" as a reasonable definition of 'it works'. The wiki is good for this topic since it allows any number of people to edit the website with the results of their experiments (rather than relying on a poor, overworked committer to update the website). However, I agree that putting 'notable milestones achieved' on the website site would be appropriate, and the failures can be on the wiki as a tempting feast for people looking to contribute. Regards, Tim Geir Magnusson Jr wrote: > > > Tim Ellison wrote: >> At the risk of incurring the wrath of GM Jr. > > > > I've tweaked the class >> library wiki page to include the results of some basic experiments using >> the recent Harmony class library snapshot. >> >> http://wiki.apache.org/harmony/ClassLibrary >> >> (I'll go back and fill in something for Ant and the Eclipse compiler >> soon, but we use them for self-host so seems to work quite well.) >> >> If you try and run something, please record your success/failure for us >> all to see. It will help us form a missing code "Most Wanted" list >> and a record of our abilities. > > I was going to do this as part of our website - doing a "how are we > doing?" page. > > I suspect that there's a lot more things we can put there, and little > things that people are familiar with. Like, it's really cool that it > runs velocity. It's pleasantly surprising. it's not surprising that it > won't run Tomcat (yet). > > Lets try to keep finding small things that work. Maybe we need little > programs that show functionality - i.e. we can't just say "log4j works" > as I'm not sure what that means w/o context. However, having a little > proggie that shows log4j working might be good. > > The point would be to support your subject line "What can we do?"... > > Once I dig out of my pile, I'll try to put something on the website for > us and come up w/ more examples... > > > geir > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
Re: IBM Development Package for Apache Harmony
Davanum Srinivas wrote: > Folks, > > I was trying to download the JVM from [1] as per instructions on our > site [2]why is it asking me for all kinds of personal information? The JVM is being made available under a license that (AIUI) means it cannot be redistributed from the Apache site. Developerworks has this policy of requesting info before a download, though most of it is optional and you can indicate that it is not to be used for any other purpose IIRC. > Is there a way to avoid this? Contribute to JCHEVM ;-) Regards, Tim > thanks, > dims > > [1] : http://www-128.ibm.com/developerworks/java/jdk/harmony/index.html > [2] : http://incubator.apache.org/harmony/downloads.html > -- > Davanum Srinivas : http://wso2.com/blogs/ > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
[jira] Assigned: (HARMONY-19) Divide by zero exception when rotating an empty List
[ http://issues.apache.org/jira/browse/HARMONY-19?page=all ] Tim Ellison reassigned HARMONY-19: -- Assign To: Tim Ellison (was: Geir Magnusson Jr) > Divide by zero exception when rotating an empty List > > > Key: HARMONY-19 > URL: http://issues.apache.org/jira/browse/HARMONY-19 > Project: Harmony > Type: Bug > Components: Classlib > Environment: All > Reporter: George Harley > Assignee: Tim Ellison > Priority: Minor > Attachments: HARMONY-19-patch-20051202.txt > > The implementation of method rotate(List, int) in java.util.Collections is not > checking the size of the input list prior to attempting the rotation. As a > result, when called with an empty List argument a > java.lang.ArithmeticException > will occur because of the the subsequent divide by zero operation. > The problem can be demonstrated in the below unit test case ... > public void testRotateEmptyList() { > // Create an *empty* list > List list = new ArrayList(); > try { > Collections.rotate(list, 25); > } catch (Exception e) { > fail("Unexpected exception rotating empty List : " + e); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-30) java.text.BreakIterator.next () returns incorrect value
[ http://issues.apache.org/jira/browse/HARMONY-30?page=all ] Tim Ellison reassigned HARMONY-30: -- Assign To: Tim Ellison (was: Geir Magnusson Jr) > java.text.BreakIterator.next () returns incorrect value > > > Key: HARMONY-30 > URL: http://issues.apache.org/jira/browse/HARMONY-30 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: tatyana doubtsova > Assignee: Tim Ellison > > java.text.BreakIterator.next () returns incorrect value > Code for reproducing Test.java: > import java.text.BreakIterator; > import java.util.Locale; > public class Test { > public static void main (String[] args) { > BreakIterator bi = BreakIterator.getWordInstance(Locale.US); > bi.setText("This is the test, WordInstance"); > int n = bi.first(); > System.out.println("bi.first() = " + n); > n = bi.next(); > System.out.println("bi.next() = " + n); > } > } > Steps to Reproduce: > 1. Build Harmony-14 j2se subset as described in README.txt. > 2. Compile Test.java using BEA 1.4 javac > > javac -d . Test.java > 2. Run java using compatible VM (J9) > > java -showversion Test > Output: > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > bi.first() = 0 > bi.next() = 30 > Output on BEA 1.4.2 to compare with: > bi.first() = 0 > bi.next() = 4 > Suggested junit test case: > package org.apache.harmony.tests.java.text; > import java.text.BreakIterator; > import java.util.Locale; > import junit.framework.TestCase; > public class BreakIteratorTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(BreakIteratorTest.class); >} > > public void test_next() { > BreakIterator bi = BreakIterator.getWordInstance(Locale.US); > bi.setText("This is the test, WordInstance"); > int n = bi.first(); > n = bi.next(); > assertTrue("Assert 0: next() returns incorrect value " + n, n > == 4 ); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (HARMONY-34) test of Estimated complexity
[ http://issues.apache.org/jira/browse/HARMONY-34?page=all ] Geir Magnusson Jr closed HARMONY-34: Resolution: Fixed just testing > test of Estimated complexity > > > Key: HARMONY-34 > URL: http://issues.apache.org/jira/browse/HARMONY-34 > Project: Harmony > Type: Bug > Components: Classlib > Environment: my pc > Reporter: Geir Magnusson Jr > > woogie woogie -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] Commented: (HARMONY-27) The network related channels in java.nio.channels are not implemented
Paulex Yang (JIRA) wrote: [ http://issues.apache.org/jira/browse/HARMONY-27?page=comments#action_12363230 ] Paulex Yang commented on HARMONY-27: my proposed solution: 1. Refactor the java.net Currently, the Harmony's socket structur is as below(red means API classes, others are package private). I will attach the diagram to Jira. "red"? I assume that you did this in HTML? Please, no HTML - it's hard for people to read who don't use HTML-enabled mail readers I for example, can't see it... geir I proposed to refactor to three packages like this: java.net: for sure includes All API classes, and includes them only public class Socket public class ServerSocket public abstract class SocketImpl public class DatagramSocket public class MulticastSocket extends DatagramSocket public abstract class DatagramSocketImpl org.apache.harmony.net: all implementation classes with a factory public class SocketImplProvider class PlainSocketImpl extends SocketImpl class PlainSocketImpl2 extends PlainSocketImpl class PlainServerSocketImpl extends PlainSocketImpl class PlainDatagramSocketImpl extends DatagramSocketImpl class PlainMulticastSocketImpl extends PlainDatagramSocketImpl some relevant small classes(Socks4Message, GenericIPMreq) org.apache.platform: currently, this package includes native file system and memory management interface, so it is a good place to include the native network interface, the INetworkSystem will encapsulate all JNI interfaces. public interface INetworkSystem public class OSNetworkSystem implements INetworkSystem 2. Implement java.nio Now it is ready to implement NIO network channels based on it: java.nio: public abstract class SocketChannel public abstract class ServerSocketChannel public abstract class DatagramSocketChannel class SocketChannelImpl class ServerSocketImpl class DatagramSocketChannelImpl class SocketAdapter class ServerSocketAdapter class DatagramSocketAdapter I will attach the result diagram into JIRA, too 3. Modulize them According to the current Harmony modulization, propose to modify the modulization as follows: luni exports: java.net, org.apache.harmony.net, org.apache.harmony.platform(move from nio to luni, and export it) nio exports: java.nio The network related channels in java.nio.channels are not implemented - Key: HARMONY-27 URL: http://issues.apache.org/jira/browse/HARMONY-27 Project: Harmony Type: Bug Components: Classlib Reporter: Paulex Yang Assignee: Geir Magnusson Jr The following classes defined by Java Spec 5.0 in java.nio.channels are not included in the class library code public abstarct class java.nio.channels.DatagramChannel public abstract class java.nio.channels.ServerSocketChannel public abstract class java.nio.channels.SocketChannel
Re: problems with security2
Ok - I'll try this... thanks Stepan Mishura wrote: The possible fix is to change class name to be loaded, so the following update may be applied to the test: --- modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java (revision 370462) +++ modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java (working copy) @@ -843,7 +843,7 @@ }; Thread.currentThread().setContextClassLoader(testClassLoader); String klassName = TestConfig -.addInstalledRequired("no such class here."); +.addInstalledRequired("NoSuchClassHere"); try { LoginContext lc = new LoginContext(CONFIG_NAME); lc.login(); Thanks, Stepan On 1/19/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: Can you give me some clue about what to look for? I found out that the test is implementation specific. I used BEA JRockit 1.4.2_04 to run tests and after I switched to Sun's JDK 1.4.2_04 the test failed. The test verifies that implementation of LoginContext class uses a thread's context class loader to load a LoginModule class. To check that the test sets a custom class loader as a context class loader for the current thread, creates LoginContext object and invokes its login() method. The custom class loader has overridden loadClass() method that stores all class names to be loaded. So the difference is BEA JRockit invokes loadClass() method and Sun's JDK doesn't. I've minimized test case to demonstrate the difference: public void testThreadContextClassLoader(){ // custom class loader ClassLoader testClassLoader = new ClassLoader() { protected synchronized Class loadClass(String klassName, boolean resolve) throws ClassNotFoundException { System.out.println("ClassLoader.loadClass: " + klassName); return super.loadClass(klassName, resolve); } }; ClassLoader saveCCL = Thread.currentThread ().getContextClassLoader(); Thread.currentThread().setContextClassLoader(testClassLoader); try { Class.forName("no such class here.", false, testClassLoader); fail("No expected ClassNotFoundException"); } catch (ClassNotFoundException ex){ } finally { Thread.currentThread().setContextClassLoader(saveCCL); } } Thanks, Stepan On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: Can you give me some clue about what to look for? geir Stepan Mishura wrote: 5) Now I run the tests ant tests.run and get after a while... [junit] Running javax.security.auth.login.LoginContextTest_1 [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec I can not reproduce this failure. (I just did sync. with repository to verify that nothing has change since my last checkout) Thanks, Stepan On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: Mikhail Loenko wrote: I've just updated from SVN, all unit tests from security2 passed (including serialization ones). I don't see how. Could you please provide more details? Sure! 1) I did a fresh checkout : svn co https://svn.apache.org/repos/asf/incubator/ harmony/enhanced/classlib/trunk/modules/security2 2) cd security2/make 3) ant (all built fine) 4) Now, I keep a mostly empty classpath because I fear and loathe anything that depends on local developer classpath (I did fix this for security2 but backed it out because I wanted to ensure that the tests ran in "stock" form) So adding to the classpath C:\Documents and Settings\gmagnuss>echo %CLASSPATH% C:\Program Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip C:\Documents and Settings\gmagnuss>set CLASSPATH=%CLASSPATH%;c:\junit.jar;c:\bcprov-jdk14-131.jar C:\Documents and Settings\gmagnuss>echo %CLASSPATH% C:\Program Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip;c:\junit.jar;c:\bcprov- jdk14-131.jar 5) Now I run the tests ant tests.run and get after a while... [junit] Running javax.security.auth.login.LoginContextTest_1 [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec BUILD FAILED C:\TEMP\geir\security2\make\build.xml:393: Test javax.security.auth.login.LoginContextTest_1 failed Total time: 4 minutes 22 seconds C:\TEMP\geir\security2\make> and find in the test report : Testsuite: javax.security.auth.login.LoginContextTest_1 Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016 sec Testcase: testLoginContextString took 0 sec Testcase: testLoginContextStringCallbackHandler took 0.016 sec Testcase: testLoginContextStringSubject took 0 sec Testcase: testLoginContextStringSubjectCallbackHandler took 0 sec Testcase: testLoginContextStringSubjectCallbackHandlerConfiguration took 0 sec Testcase: testLogin_minus1 took 0 sec FAILED null junit.framework.AssertionFailedError at javax.security.auth.login.
Re: [jira] Commented: (HARMONY-31) Move peformance timing of unit tests into a decorator class.
Mikhail Loenko wrote: The problem is unstable execution time of java programs: If you consequently run the same java program on the same computer in the same conditions, execution time may vary by 20% or even more Why? Given that computers are pretty determinstic, I'd argue that you don't have the same conditions from run to run. geir
Re: [classlib] What can it do?
Tim Ellison wrote: At the risk of incurring the wrath of GM Jr. I've tweaked the class library wiki page to include the results of some basic experiments using the recent Harmony class library snapshot. http://wiki.apache.org/harmony/ClassLibrary (I'll go back and fill in something for Ant and the Eclipse compiler soon, but we use them for self-host so seems to work quite well.) If you try and run something, please record your success/failure for us all to see. It will help us form a missing code "Most Wanted" list and a record of our abilities. I was going to do this as part of our website - doing a "how are we doing?" page. I suspect that there's a lot more things we can put there, and little things that people are familiar with. Like, it's really cool that it runs velocity. It's pleasantly surprising. it's not surprising that it won't run Tomcat (yet). Lets try to keep finding small things that work. Maybe we need little programs that show functionality - i.e. we can't just say "log4j works" as I'm not sure what that means w/o context. However, having a little proggie that shows log4j working might be good. The point would be to support your subject line "What can we do?"... Once I dig out of my pile, I'll try to put something on the website for us and come up w/ more examples... geir
Re: Develop using classlib+J9 with Eclipse?
On 1/19/06, Steven Gong <[EMAIL PROTECTED]> wrote: > > Hi all, > Is there a way to make classlib+J9 as a JRE configuration of Eclipse? I > found that Eclipse could only support the standard classlib directory layout > while classlib uses different modulized jars. It seems more comfortable to > develop and test something in an IDE. Do you think so? Solved it with a dirty hack -- Just copy any jar as xxx/jre/rt.jar and xxx/jre/ext/tools.jar Then uncheck "Use default system libraries" and add jars from xxx/jre/lib/boot/ -- > Best Regards > Steven Gong -- Best Regards Steven Gong
[jira] Created: (HARMONY-34) test of Estimated complexity
test of Estimated complexity Key: HARMONY-34 URL: http://issues.apache.org/jira/browse/HARMONY-34 Project: Harmony Type: Bug Components: Classlib Environment: my pc Reporter: Geir Magnusson Jr woogie woogie -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: New JIRA 'component'?
done Leo Simons wrote: On Wed, Jan 18, 2006 at 04:48:29PM +, Tim Ellison wrote: (Geez, that component word is overloaded...) No kidding! What do you think about having a new JIRA component called "Classlib - Newcomer" where we can put bugs that are good candidates for people to start with? Suboptimal. Jira can do so much more! I experimented with modifying the issue summary to have a structured keyword ( #easy# or something ), but it's a bit of a hack, and I don't see any way to produce a URL for a filter that will find them easily. This is part of the wider goal to make it easy for people to contribute to Harmony. Other suggestions welcome of course. Another option is to have a custom field. Eg we could have something like an "Estimated Complexity" field, and then make the select list of values something such as Unknown Novice Moderate Advanced Guru Needs James Gosling with "Uknown" as the default value. Having a plain text field is also possible, as well as several others (multiple selection list, textarea, checkboxes). Hmm. Checkbox might be what you described above, eg you have a checkbox like [ ] Easy to fix when you create or edit an issue. Yet another option is to (ab)use one of the other fields, such as "priority", "status" or "resolution". I've also seen the "version" dimension abused for this (eg create an "easy" version). Me being the semantic web enthusiast I am, I like having a specific field. (Really what we want here is not clear to me yet. I also just don't know what we should call this thing. Its possible to create a "summary view" that includes this stuff and define searches/filters for them. I can set that up (as can about a 100 other people with jira admin privileges, probably at least Geir too, I suspect Dims too), just need to know what we want. LSD
Re: NIO Component improvement
On 1/19/06, Anthony Green <[EMAIL PROTECTED]> wrote: > On Wed, 2006-01-18 at 21:51 +0300, Vladimir Strigun wrote: > > Attached document contains a proposal describing an approach which is > > trying to enforce portability of nio socket channels implementation by > > moving supporting functions up to java layer and by sharing the code > > between java.net's socket implementations and socket channels in > > java.nio package thus reducing the amount of java code and number of > > native methods in both packages. > > If I understand your document properly, this is similar to how we handle > things in GNU Classpath (see gnu.java.net.PlainSocketImpl). ok, I'll have a look to classpath implementation. > One difference is that we throw exceptions in the JNI code. As you > mention in your document, this has the disadvantage of resulting in a > JNI class lookup -- but in your example, don't you have to do a second > JNI call to get the error string? (BSDSocketErrors.getMessage(res)). No, we don't - BSDSocketErrors contains all the error messages on the Java layer, one more advantage of this is that since all error messages are kept within one class they could be easily localized. Thanks, Vladimir Strigun, Intel Middleware Products Division. > (For GCJ, we implement this code in CNI - not JNI. It's simpler and > there's zero overhead between the Java and C++ code - so we can throw > exceptions in C++ code with no JNI name lookups.) > > AG > > >
Re: Proposal to relocate jchevm
Go! :) +1 geir (catching up after a day of power outage... ) Archie Cobbs wrote: Hi all. I'm planning to move jchevm from: enhanced/trunk/sandbox/contribs/jchevm/jchevm to: enhanced/jchevm i.e., to move it out of the "sandbox". Let me know if anyone has any issues. Thanks, -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
IBM Development Package for Apache Harmony
Folks, I was trying to download the JVM from [1] as per instructions on our site [2]why is it asking me for all kinds of personal information? Is there a way to avoid this? thanks, dims [1] : http://www-128.ibm.com/developerworks/java/jdk/harmony/index.html [2] : http://incubator.apache.org/harmony/downloads.html -- Davanum Srinivas : http://wso2.com/blogs/
[jira] Updated: (HARMONY-26) The API of buffer classes in java.nio are not compliant with the specification of Java 5.0
[ http://issues.apache.org/jira/browse/HARMONY-26?page=all ] Richard Liang updated HARMONY-26: - Attachment: nio-tests.jar > The API of buffer classes in java.nio are not compliant with the > specification of Java 5.0 > -- > > Key: HARMONY-26 > URL: http://issues.apache.org/jira/browse/HARMONY-26 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Richard Liang > Assignee: Tim Ellison > Attachments: DirectBuffer.java, nio-tests.jar > > 1. java.nio.CharBuffer > 1.1) java.nio.CharBuffer needs to implement two new interface > java.lang.Appendable and java.lang.Readable > 1.2) The following methods should NOT be "protected": > protected CharBuffer(int capacity) > protected abstract char[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > > 1.3) The following method should be "final": > public CharBuffer put(char[] src) > > 2. java.nio.Buffer > 2.1) The following fields should NOT be "protected": > int UNSET_MARK > int capacity > int limit > int mark should > int position > 2.3) The following method should NOT be "protected": > protected Buffer(int capacity) > 3. java.nio.ByteBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, > ShortBuffer > 3.1) The following field should NOT be "protected": > com.ibm.platform.Endianness order > 3.2) The following methods should NOT be "protected": > protected ByteBuffer(int capacity) > protected abstract byte[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > 3.3) The following method should be "final": > public ByteBuffer order(ByteOrder byteOrder) > > 4. The implementation of bulk put/get methods of all the buffer classes are > low-efficiency > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Develop using classlib+J9 with Eclipse?
Hi all, Is there a way to make classlib+J9 as a JRE configuration of Eclipse? I found that Eclipse could only support the standard classlib directory layout while classlib uses different modulized jars. It seems more comfortable to develop and test something in an IDE. Do you think so? -- Best Regards Steven Gong
[jira] Commented: (HARMONY-26) The API of buffer classes in java.nio are not compliant with the specification of Java 5.0
[ http://issues.apache.org/jira/browse/HARMONY-26?page=comments#action_12363247 ] Richard Liang commented on HARMONY-26: -- Yes, Tim. The fix has been properly applied :-) Thanks a lot. And I have attached my unit test cases to JIRA. > The API of buffer classes in java.nio are not compliant with the > specification of Java 5.0 > -- > > Key: HARMONY-26 > URL: http://issues.apache.org/jira/browse/HARMONY-26 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Richard Liang > Assignee: Tim Ellison > Attachments: DirectBuffer.java > > 1. java.nio.CharBuffer > 1.1) java.nio.CharBuffer needs to implement two new interface > java.lang.Appendable and java.lang.Readable > 1.2) The following methods should NOT be "protected": > protected CharBuffer(int capacity) > protected abstract char[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > > 1.3) The following method should be "final": > public CharBuffer put(char[] src) > > 2. java.nio.Buffer > 2.1) The following fields should NOT be "protected": > int UNSET_MARK > int capacity > int limit > int mark should > int position > 2.3) The following method should NOT be "protected": > protected Buffer(int capacity) > 3. java.nio.ByteBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, > ShortBuffer > 3.1) The following field should NOT be "protected": > com.ibm.platform.Endianness order > 3.2) The following methods should NOT be "protected": > protected ByteBuffer(int capacity) > protected abstract byte[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > 3.3) The following method should be "final": > public ByteBuffer order(ByteOrder byteOrder) > > 4. The implementation of bulk put/get methods of all the buffer classes are > low-efficiency > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: problems with security2
The possible fix is to change class name to be loaded, so the following update may be applied to the test: --- modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java (revision 370462) +++ modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java (working copy) @@ -843,7 +843,7 @@ }; Thread.currentThread().setContextClassLoader(testClassLoader); String klassName = TestConfig -.addInstalledRequired("no such class here."); +.addInstalledRequired("NoSuchClassHere"); try { LoginContext lc = new LoginContext(CONFIG_NAME); lc.login(); Thanks, Stepan On 1/19/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: > > > > >Can you give me some clue about what to look for? > > > > I found out that the test is implementation specific. I used BEA JRockit > 1.4.2_04 to run tests and after I switched to Sun's JDK 1.4.2_04 the test > failed. > > The test verifies that implementation of LoginContext class uses a > thread's context class loader to load a LoginModule class. To check that the > test sets a custom class loader as a context class loader for the current > thread, creates LoginContext object and invokes its login() method. The > custom class loader has overridden loadClass() method that stores all class > names to be loaded. > > So the difference is BEA JRockit invokes loadClass() method and Sun's JDK > doesn't. > I've minimized test case to demonstrate the difference: > > public void testThreadContextClassLoader(){ > > // custom class loader > ClassLoader testClassLoader = new ClassLoader() { > protected synchronized Class loadClass(String klassName, > boolean resolve) throws ClassNotFoundException { > > System.out.println("ClassLoader.loadClass: " + klassName); > > return super.loadClass(klassName, resolve); > } > }; > > ClassLoader saveCCL = Thread.currentThread > ().getContextClassLoader(); > > Thread.currentThread().setContextClassLoader(testClassLoader); > > try { > Class.forName("no such class here.", false, testClassLoader); > fail("No expected ClassNotFoundException"); > } catch (ClassNotFoundException ex){ > } finally { > Thread.currentThread().setContextClassLoader(saveCCL); > } > } > > > Thanks, > Stepan > > > On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > > > > Can you give me some clue about what to look for? > > > > geir > > > > Stepan Mishura wrote: > > >> 5) Now I run the tests > > >> > > >>ant tests.run > > >> > > >> and get after a while... > > >> > > >> > > >> > > >> [junit] Running javax.security.auth.login.LoginContextTest_1 > > >> [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec > > >> > > > > > > I can not reproduce this failure. (I just did sync. with repository to > > > verify that nothing has change since my last checkout) > > > > > > Thanks, > > > Stepan > > > > > > > > > On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > > >> > > >> > > >> Mikhail Loenko wrote: > > >>> I've just updated from SVN, all unit tests from security2 passed > > >>> (including serialization ones). > > >> I don't see how. > > >> > > >>> Could you please provide more details? > > >> Sure! > > >> > > >> 1) I did a fresh checkout : > > >> > > >>svn co https://svn.apache.org/repos/asf/incubator/ > > >> harmony/enhanced/classlib/trunk/modules/security2 > > >> > > >> 2) cd security2/make > > >> > > >> 3) ant > > >> > > >> (all built fine) > > >> > > >> 4) Now, I keep a mostly empty classpath because I fear and loathe > > >> anything that depends on local developer classpath (I did fix this > > for > > >> security2 but backed it out because I wanted to ensure that the tests > > >> ran in "stock" form) So adding to the classpath > > >> > > >> C:\Documents and Settings\gmagnuss>echo %CLASSPATH% > > >> C:\Program Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip > > >> > > >> C:\Documents and Settings\gmagnuss>set > > >> CLASSPATH=%CLASSPATH%;c:\junit.jar;c:\bcprov-jdk14-131.jar > > >> > > >> C:\Documents and Settings\gmagnuss>echo %CLASSPATH% > > >> C:\Program > > >> Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip;c:\junit.jar;c:\bcprov- > > >> jdk14-131.jar > > >> > > >> 5) Now I run the tests > > >> > > >>ant tests.run > > >> > > >> and get after a while... > > >> > > >> > > >> > > >> [junit] Running javax.security.auth.login.LoginContextTest_1 > > >> [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec > > >> > > >> BUILD FAILED > > >> C:\TEMP\geir\security2\make\build.xml:393: Test > > >> javax.security.auth.login.LoginContextTest_1 failed > > >> > > >> Total time: 4 minutes 22 seconds > > >> C:\TEMP\geir\security2\make> > > >> > > >> and find in the test report
Re: [classlib] serialVersionUIDs for Serializable classes
Mikhail Loenko wrote: > Hello, > > Do we need to have serialVersionUIDs for all Serializable classes even if > those > fields are missing in API Spec or we might omit them? > > According to Java Object Serialization Specification, 4.6 > http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html#4100 > > "It is strongly recommended that all serializable classes explicitly declare > serialVersionUID values, since the default serialVersionUID > computation is highly > sensitive to class details that may vary depending on compiler > implementations, > and can thus result in unexpected serialVersionUID conflicts during > deserialization, > causing deserialization to fail" > > I suggest to have these fields for all serialized classes, unless > there is a particular > reason for those classes not to have serialVersionUID > > (And I'm not saying that we need them instead of serialization tests :) > > Opinions? I agree. (I suppose I should get used to just saying "+1", to fit in round here). Regards, Tim > Thanks, > Mikhail Loenko > Intel Middleware Products Division > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
[jira] Resolved: (HARMONY-26) The API of buffer classes in java.nio are not compliant with the specification of Java 5.0
[ http://issues.apache.org/jira/browse/HARMONY-26?page=all ] Tim Ellison resolved HARMONY-26: Resolution: Fixed Actually, that wasn't as bad as it looks at first sight. It is mostly refactoring to be spec compliant, no functional change. Richard please can you review and verify. > The API of buffer classes in java.nio are not compliant with the > specification of Java 5.0 > -- > > Key: HARMONY-26 > URL: http://issues.apache.org/jira/browse/HARMONY-26 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Richard Liang > Assignee: Tim Ellison > Attachments: DirectBuffer.java > > 1. java.nio.CharBuffer > 1.1) java.nio.CharBuffer needs to implement two new interface > java.lang.Appendable and java.lang.Readable > 1.2) The following methods should NOT be "protected": > protected CharBuffer(int capacity) > protected abstract char[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > > 1.3) The following method should be "final": > public CharBuffer put(char[] src) > > 2. java.nio.Buffer > 2.1) The following fields should NOT be "protected": > int UNSET_MARK > int capacity > int limit > int mark should > int position > 2.3) The following method should NOT be "protected": > protected Buffer(int capacity) > 3. java.nio.ByteBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, > ShortBuffer > 3.1) The following field should NOT be "protected": > com.ibm.platform.Endianness order > 3.2) The following methods should NOT be "protected": > protected ByteBuffer(int capacity) > protected abstract byte[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > 3.3) The following method should be "final": > public ByteBuffer order(ByteOrder byteOrder) > > 4. The implementation of bulk put/get methods of all the buffer classes are > low-efficiency > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
compiling JCHEVM with GCC/Cygwin
Hi Archie In order to build JCHEVM with Cygwin I took the following steps: 1. Built Classpath 0.20 with Cygwin, with the following options: $./configure --with-jikes gtk-peer-enable 2. Downloaded JCHEVM and read Apache.README and INSTALL 3. Ran successfully the following script: $sh autogen.sh 4. Ran the following command: $make After compiling some C source files, thoug, it stopped saying: jcjavah: can't load class 'gnu/classpath/VMStackWalker': java/io/IOException: error reading entry 'gnu/classpath/VMStackWalker.class' in ZIP file 'usr/local/classpath/share/classpath/glibj.zip': No error make[2]: *** [gnu_classpath_VMStackWalker.h] Error 1 (Note that VMStackWalker.class is present in my zip file: /usr/local/classpath/share/classpath/glibj.zip) Can anybody help me out? ciao, Enrico P.S. During the compilation phase, that is, before stopping on the mentioned error, the compiler issues the following warning: gcc: unrecognized option '-pthread' P.S. I put the ucontext.h file in the dirs: /include and /include/sys at the moment they are empty
Re: NIO Component improvement
Agree with you that the relation with java.net package is also one of our main concern about SocketChannel, etc. And basically we took similiar approach to implement it. I've put the details into JIRA. Pls. refer to https://issues.apache.org/jira/browse/HARMONY-27 Some implementation difference with your solution is as below: 1. Use a factory class to access Socket implementation classes, so that the PlainXXXSocketImpl can be hide by package private access. 2. Refactored the current Harmony java.net implementations, and implement network channels based on them. Another comment about the error code is: Harmony has a port library already, which has covered most functions nio needed, and has defined platform independent error codes. I think this is easier to use, and will make our library codes can be ported more easily, so I suggest we leverage Harmony port library as much as possible. I've tested the solution, and it works fine. I will post step by step details later, or I can just upload my modifications:). 2006/1/19, Vladimir Strigun <[EMAIL PROTECTED]>: > > We also have been thinking about implementation of socket channels > from java.nio package. One of the concerns we had is related to the > fact that java.nio.channels API provides methods to access regular > java.net socket classes via corresponding methods of socket channels. > Since socket implementations are typically located in java.net package > and have package private visibility one has to create the new socket > implementations for the java.nio package. Having in mind that the > functionality for them has many things in common it could make sense > to share socket implementations between the java.net and java.nio > packages. > > Attached document contains a proposal describing an approach which is > trying to enforce portability of nio socket channels implementation by > moving supporting functions up to java layer and by sharing the code > between java.net's socket implementations and socket channels in > java.nio package thus reducing the amount of java code and number of > native methods in both packages. > > Thanks, > Vladimir Strigun, Intel Middleware Products Division. > > > On 1/12/06, Paulex Yang <[EMAIL PROTECTED]> wrote: > > Hi, everybody > > > > I'm Paulex of China Software Development Lab, IBM, and I'm working with > > Richard on the nio improvement. I found that the network related > > channels in java.nio.channels are not implemented in the class library > > code, so I will raise a JIRA request on this today. and we will start to > > contribute an implementation of these classes. Hopefully they can be > > accepted and helpful:). > > > > P.S. As a declaration, I confirm that: > > I have read Apache Harmony Contribution Policy and already have a > > completed questionnaire on file. :-) > > > > Richard Liang wrote: > > > > > Geir Magnusson Jr wrote: > > > > > >> Defects? In software? Can't be :) > > >> > > >> Thanks, and welcome. > > >> > > >> Please read our comntribution policy : > > >> > > >> http://incubator.apache.org/harmony/contribution_policy.html > > >> > > >> Please ensure that you will be able to satisfactorily contribute to > > >> the NIO area > > >> > > >> geir > > >> > > >> Richard Liang wrote: > > >> > > >>> Hi there: > > >>> > > >>> Recently, My colleague Paulex and I are looking at the code > > >>> contributed by IBM (Tim). We spend most of our time on NIO, and find > > >>> there are some defects in this component. We will submit the defects > > >>> in Harmony JIRA, and hopefully we can contribute patches to fix > > >>> these defects. > > >>> > > >>> Thanks a lot. > > >>> > > >> > > > Hello Geir, > > > > > > Thanks for your reminder. > > > > > > Yes, I have read Apache Harmony Contribution Policy and already have a > > > completed questionnaire on file. > > > > > > > > > -- > > Paulex Yang > > China Software Development Lab > > IBM > > > > > > > > > -- Paulex Yang China Software Development Labotary IBM
[jira] Updated: (HARMONY-27) The network related channels in java.nio.channels are not implemented
[ http://issues.apache.org/jira/browse/HARMONY-27?page=all ] Paulex Yang updated HARMONY-27: --- Attachment: Nio-net Refactoring.jpg the proposed net/nio refactory result diagram > The network related channels in java.nio.channels are not implemented > - > > Key: HARMONY-27 > URL: http://issues.apache.org/jira/browse/HARMONY-27 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Paulex Yang > Assignee: Geir Magnusson Jr > Attachments: Nio-net Refactoring.jpg, java.net.JPG > > The following classes defined by Java Spec 5.0 in java.nio.channels are not > included in the class library code > public abstarct class java.nio.channels.DatagramChannel > public abstract class java.nio.channels.ServerSocketChannel > public abstract class java.nio.channels.SocketChannel -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-27) The network related channels in java.nio.channels are not implemented
[ http://issues.apache.org/jira/browse/HARMONY-27?page=all ] Paulex Yang updated HARMONY-27: --- Attachment: java.net.JPG the current java.net class diagram > The network related channels in java.nio.channels are not implemented > - > > Key: HARMONY-27 > URL: http://issues.apache.org/jira/browse/HARMONY-27 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Paulex Yang > Assignee: Geir Magnusson Jr > Attachments: Nio-net Refactoring.jpg, java.net.JPG > > The following classes defined by Java Spec 5.0 in java.nio.channels are not > included in the class library code > public abstarct class java.nio.channels.DatagramChannel > public abstract class java.nio.channels.ServerSocketChannel > public abstract class java.nio.channels.SocketChannel -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-27) The network related channels in java.nio.channels are not implemented
[ http://issues.apache.org/jira/browse/HARMONY-27?page=comments#action_12363230 ] Paulex Yang commented on HARMONY-27: my proposed solution: 1. Refactor the java.net Currently, the Harmony's socket structur is as below(red means API classes, others are package private). I will attach the diagram to Jira. I proposed to refactor to three packages like this: java.net: for sure includes All API classes, and includes them only public class Socket public class ServerSocket public abstract class SocketImpl public class DatagramSocket public class MulticastSocket extends DatagramSocket public abstract class DatagramSocketImpl org.apache.harmony.net: all implementation classes with a factory public class SocketImplProvider class PlainSocketImpl extends SocketImpl class PlainSocketImpl2 extends PlainSocketImpl class PlainServerSocketImpl extends PlainSocketImpl class PlainDatagramSocketImpl extends DatagramSocketImpl class PlainMulticastSocketImpl extends PlainDatagramSocketImpl some relevant small classes(Socks4Message, GenericIPMreq) org.apache.platform: currently, this package includes native file system and memory management interface, so it is a good place to include the native network interface, the INetworkSystem will encapsulate all JNI interfaces. public interface INetworkSystem public class OSNetworkSystem implements INetworkSystem 2. Implement java.nio Now it is ready to implement NIO network channels based on it: java.nio: public abstract class SocketChannel public abstract class ServerSocketChannel public abstract class DatagramSocketChannel class SocketChannelImpl class ServerSocketImpl class DatagramSocketChannelImpl class SocketAdapter class ServerSocketAdapter class DatagramSocketAdapter I will attach the result diagram into JIRA, too 3. Modulize them According to the current Harmony modulization, propose to modify the modulization as follows: luni exports: java.net, org.apache.harmony.net, org.apache.harmony.platform(move from nio to luni, and export it) nio exports: java.nio > The network related channels in java.nio.channels are not implemented > - > > Key: HARMONY-27 > URL: http://issues.apache.org/jira/browse/HARMONY-27 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Paulex Yang > Assignee: Geir Magnusson Jr > > The following classes defined by Java Spec 5.0 in java.nio.channels are not > included in the class library code > public abstarct class java.nio.channels.DatagramChannel > public abstract class java.nio.channels.ServerSocketChannel > public abstract class java.nio.channels.SocketChannel -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-26) The API of buffer classes in java.nio are not compliant with the specification of Java 5.0
[ http://issues.apache.org/jira/browse/HARMONY-26?page=comments#action_12363229 ] Tim Ellison commented on HARMONY-26: Gulp -- ok I'll start looking through this laundry list and fixing the NIO buffer code. Do you have accompanying JUnit tests to go along with these defects? Since you have contributor paperwork on file I suggest you simply attach them to this issue (ensuring you mark them as granting ASF license). > The API of buffer classes in java.nio are not compliant with the > specification of Java 5.0 > -- > > Key: HARMONY-26 > URL: http://issues.apache.org/jira/browse/HARMONY-26 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Richard Liang > Assignee: Tim Ellison > Attachments: DirectBuffer.java > > 1. java.nio.CharBuffer > 1.1) java.nio.CharBuffer needs to implement two new interface > java.lang.Appendable and java.lang.Readable > 1.2) The following methods should NOT be "protected": > protected CharBuffer(int capacity) > protected abstract char[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > > 1.3) The following method should be "final": > public CharBuffer put(char[] src) > > 2. java.nio.Buffer > 2.1) The following fields should NOT be "protected": > int UNSET_MARK > int capacity > int limit > int mark should > int position > 2.3) The following method should NOT be "protected": > protected Buffer(int capacity) > 3. java.nio.ByteBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, > ShortBuffer > 3.1) The following field should NOT be "protected": > com.ibm.platform.Endianness order > 3.2) The following methods should NOT be "protected": > protected ByteBuffer(int capacity) > protected abstract byte[] protectedArray(); > protected abstract int protectedArrayOffset(); > protected abstract boolean protectedHasArray(); > 3.3) The following method should be "final": > public ByteBuffer order(ByteOrder byteOrder) > > 4. The implementation of bulk put/get methods of all the buffer classes are > low-efficiency > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[classlib] serialVersionUIDs for Serializable classes
Hello, Do we need to have serialVersionUIDs for all Serializable classes even if those fields are missing in API Spec or we might omit them? According to Java Object Serialization Specification, 4.6 http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html#4100 "It is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected serialVersionUID conflicts during deserialization, causing deserialization to fail" I suggest to have these fields for all serialized classes, unless there is a particular reason for those classes not to have serialVersionUID (And I'm not saying that we need them instead of serialization tests :) Opinions? Thanks, Mikhail Loenko Intel Middleware Products Division
[jira] Commented: (HARMONY-30) java.text.BreakIterator.next () returns incorrect value
[ http://issues.apache.org/jira/browse/HARMONY-30?page=comments#action_12363211 ] Richard Liang commented on HARMONY-30: -- Proposed fix: Change the method public static BreakIterator getWordInstance(Locale where) { return new RuleBasedBreakIterator(com.ibm.icu.text.BreakIterator .getSentenceInstance(where)); } to public static BreakIterator getWordInstance(Locale where) { return new RuleBasedBreakIterator(com.ibm.icu.text.BreakIterator .getWordInstance(where)); } > java.text.BreakIterator.next () returns incorrect value > > > Key: HARMONY-30 > URL: http://issues.apache.org/jira/browse/HARMONY-30 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: tatyana doubtsova > Assignee: Geir Magnusson Jr > > java.text.BreakIterator.next () returns incorrect value > Code for reproducing Test.java: > import java.text.BreakIterator; > import java.util.Locale; > public class Test { > public static void main (String[] args) { > BreakIterator bi = BreakIterator.getWordInstance(Locale.US); > bi.setText("This is the test, WordInstance"); > int n = bi.first(); > System.out.println("bi.first() = " + n); > n = bi.next(); > System.out.println("bi.next() = " + n); > } > } > Steps to Reproduce: > 1. Build Harmony-14 j2se subset as described in README.txt. > 2. Compile Test.java using BEA 1.4 javac > > javac -d . Test.java > 2. Run java using compatible VM (J9) > > java -showversion Test > Output: > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > bi.first() = 0 > bi.next() = 30 > Output on BEA 1.4.2 to compare with: > bi.first() = 0 > bi.next() = 4 > Suggested junit test case: > package org.apache.harmony.tests.java.text; > import java.text.BreakIterator; > import java.util.Locale; > import junit.framework.TestCase; > public class BreakIteratorTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(BreakIteratorTest.class); >} > > public void test_next() { > BreakIterator bi = BreakIterator.getWordInstance(Locale.US); > bi.setText("This is the test, WordInstance"); > int n = bi.first(); > n = bi.next(); > assertTrue("Assert 0: next() returns incorrect value " + n, n > == 4 ); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: problems with security2
> >Can you give me some clue about what to look for? > I found out that the test is implementation specific. I used BEA JRockit 1.4.2_04 to run tests and after I switched to Sun's JDK 1.4.2_04 the test failed. The test verifies that implementation of LoginContext class uses a thread's context class loader to load a LoginModule class. To check that the test sets a custom class loader as a context class loader for the current thread, creates LoginContext object and invokes its login() method. The custom class loader has overridden loadClass() method that stores all class names to be loaded. So the difference is BEA JRockit invokes loadClass() method and Sun's JDK doesn't. I've minimized test case to demonstrate the difference: public void testThreadContextClassLoader(){ // custom class loader ClassLoader testClassLoader = new ClassLoader() { protected synchronized Class loadClass(String klassName, boolean resolve) throws ClassNotFoundException { System.out.println("ClassLoader.loadClass: " + klassName); return super.loadClass(klassName, resolve); } }; ClassLoader saveCCL = Thread.currentThread ().getContextClassLoader(); Thread.currentThread().setContextClassLoader(testClassLoader); try { Class.forName("no such class here.", false, testClassLoader); fail("No expected ClassNotFoundException"); } catch (ClassNotFoundException ex){ } finally { Thread.currentThread().setContextClassLoader(saveCCL); } } Thanks, Stepan On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > > Can you give me some clue about what to look for? > > geir > > Stepan Mishura wrote: > >> 5) Now I run the tests > >> > >>ant tests.run > >> > >> and get after a while... > >> > >> > >> > >> [junit] Running javax.security.auth.login.LoginContextTest_1 > >> [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec > >> > > > > I can not reproduce this failure. (I just did sync. with repository to > > verify that nothing has change since my last checkout) > > > > Thanks, > > Stepan > > > > > > On 1/18/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: > >> > >> > >> Mikhail Loenko wrote: > >>> I've just updated from SVN, all unit tests from security2 passed > >>> (including serialization ones). > >> I don't see how. > >> > >>> Could you please provide more details? > >> Sure! > >> > >> 1) I did a fresh checkout : > >> > >>svn co https://svn.apache.org/repos/asf/incubator/ > >> harmony/enhanced/classlib/trunk/modules/security2 > >> > >> 2) cd security2/make > >> > >> 3) ant > >> > >> (all built fine) > >> > >> 4) Now, I keep a mostly empty classpath because I fear and loathe > >> anything that depends on local developer classpath (I did fix this for > >> security2 but backed it out because I wanted to ensure that the tests > >> ran in "stock" form) So adding to the classpath > >> > >> C:\Documents and Settings\gmagnuss>echo %CLASSPATH% > >> C:\Program Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip > >> > >> C:\Documents and Settings\gmagnuss>set > >> CLASSPATH=%CLASSPATH%;c:\junit.jar;c:\bcprov-jdk14-131.jar > >> > >> C:\Documents and Settings\gmagnuss>echo %CLASSPATH% > >> C:\Program > >> Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip;c:\junit.jar;c:\bcprov- > >> jdk14-131.jar > >> > >> 5) Now I run the tests > >> > >>ant tests.run > >> > >> and get after a while... > >> > >> > >> > >> [junit] Running javax.security.auth.login.LoginContextTest_1 > >> [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec > >> > >> BUILD FAILED > >> C:\TEMP\geir\security2\make\build.xml:393: Test > >> javax.security.auth.login.LoginContextTest_1 failed > >> > >> Total time: 4 minutes 22 seconds > >> C:\TEMP\geir\security2\make> > >> > >> and find in the test report : > >> > >> Testsuite: javax.security.auth.login.LoginContextTest_1 > >> Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016 sec > >> > >> Testcase: testLoginContextString took 0 sec > >> Testcase: testLoginContextStringCallbackHandler took 0.016 sec > >> Testcase: testLoginContextStringSubject took 0 sec > >> Testcase: testLoginContextStringSubjectCallbackHandler took 0 sec > >> Testcase: testLoginContextStringSubjectCallbackHandlerConfiguration > took > >> 0 sec > >> Testcase: testLogin_minus1 took 0 sec > >>FAILED > >> null > >> junit.framework.AssertionFailedError > >>at > >> javax.security.auth.login.LoginContextTest_1.testLogin_minus1 > >> (LoginContextTest_1.java:858) > >>at > >> com.openintel.drl.security.test.PerformanceTest.runBare( > >> PerformanceTest.java:157) > >> > >> > >> > >> (aside - can we adopt the convention that all tests end in "Test" and > >> not anything after? That way we can by pattern have "Data", "Config" > >> etc - any stuff that tests might n