You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/06/21 05:21:16 UTC
svn commit: r549342 - in /harmony/enhanced/classlib/branches/java6/modules:
awt/src/main/native/fontlib/ beans/ beans/make/
beans/src/main/java/java/beans/beancontext/
beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/
jndi/src/...
Author: pyang
Date: Wed Jun 20 20:21:13 2007
New Revision: 549342
URL: http://svn.apache.org/viewvc?view=rev&rev=549342
Log:
Merge updates from classlib trunk@549309 since r548679
Added:
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/shared/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/shared/hycpu.c
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/shared/hycpu.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hycpu/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/shared/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/shared/hygp.c
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/shared/hygp.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hygp/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/shared/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/shared/hymem.c
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/shared/hymem.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/
- copied from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile
- copied unchanged from r549309, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hymem/windows/makefile
Modified:
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/ (props changed)
harmony/enhanced/classlib/branches/java6/modules/beans/build.xml
harmony/enhanced/classlib/branches/java6/modules/beans/make/exclude.common
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupport2Test.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java
harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java
harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/shared/hyerror.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/shared/hytime.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java
harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicButtonUI.java
harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicButtonUITest.java
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun 20 20:21:13 2007
@@ -1,4 +1,5 @@
*.dll
*.map
*.pdb
+*.manifest
libFL.so
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/build.xml?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/build.xml Wed Jun 20 20:21:13 2007
@@ -294,7 +294,10 @@
<fileset dir="${hy.beans.src.test.resources}">
<exclude name="**/*.java" />
</fileset>
- </copy>
+ <fileset dir="${hy.beans.src.test.support}">
+ <exclude name="**/*.java" />
+ </fileset>
+ </copy>
</target>
</project>
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/make/exclude.common?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/make/exclude.common Wed Jun 20 20:21:13 2007
@@ -3,9 +3,4 @@
org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java
org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java
org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
-org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
+
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java Wed Jun 20 20:21:13 2007
@@ -319,7 +319,9 @@
throw new NullPointerException();
}
synchronized (bcmListeners) {
- bcmListeners.add(listener);
+ if (!bcmListeners.contains(listener)) {
+ bcmListeners.add(listener);
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextChildSupportTest.java Wed Jun 20 20:21:13 2007
@@ -17,6 +17,7 @@
package org.apache.harmony.beans.tests.java.beans.beancontext;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
@@ -482,8 +483,7 @@
BeanContextChildSupport sup = new BeanContextChildSupport();
- assertFalse("Child is not supposed to be delegated",
- sup.isDelegated());
+ assertFalse("Child is not supposed to be delegated", sup.isDelegated());
}
public void testReleaseBeanContextResources() throws PropertyVetoException {
@@ -945,6 +945,55 @@
assertNotNull("BeanContext should not be null", sup.getBeanContext());
}
+
+ public void testSetBeanContextBeanContextWithPropertyVetoException()
+ throws Exception {
+ MyBeanContextChildSupport myBeanContextChildSupport = new MyBeanContextChildSupport();
+ VetoableChangeListener vcl = new MyVetoableChangeListener();
+ myBeanContextChildSupport.addVetoableChangeListener("beanContext", vcl);
+ BeanContext beanContext = new BeanContextSupport();
+ try {
+ myBeanContextChildSupport.setBeanContext(beanContext);
+ fail("should throw PropertyVetoException");
+ } catch (PropertyVetoException e) {
+ // expected
+ }
+ assertTrue(myBeanContextChildSupport.getRejectedSetBCOnce());
+ assertNull(myBeanContextChildSupport.getBeanContext());
+
+ myBeanContextChildSupport.setBeanContext(beanContext);
+ assertFalse(myBeanContextChildSupport.getRejectedSetBCOnce());
+ assertNotNull(myBeanContextChildSupport.getBeanContext());
+
+ try {
+ myBeanContextChildSupport.setBeanContext(new BeanContextSupport());
+ fail("should throw PropertyVetoException");
+ } catch (PropertyVetoException e) {
+ // expected
+ }
+
+ myBeanContextChildSupport
+ .removeVetoableChangeListener("beanContext", vcl);
+ myBeanContextChildSupport.setBeanContext(beanContext);
+ assertTrue(myBeanContextChildSupport.getRejectedSetBCOnce());
+ assertSame(beanContext, myBeanContextChildSupport.getBeanContext());
+ }
+
+
+ class MyVetoableChangeListener implements VetoableChangeListener
+ {
+
+ public void vetoableChange(PropertyChangeEvent arg0) throws PropertyVetoException {
+ throw new PropertyVetoException("TESTSTRING", null);
+ }
+ }
+
+ class MyBeanContextChildSupport extends BeanContextChildSupport {
+ public boolean getRejectedSetBCOnce() {
+ return rejectedSetBCOnce;
+ }
+ }
+
/** UTILITY METHODS * */
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java Wed Jun 20 20:21:13 2007
@@ -86,6 +86,17 @@
} catch (NullPointerException e) {
// expected
}
+
+ try {
+ event.isServiceClass(null);
+ fail("NPE expected");
+ } catch (NullPointerException e) {
+ // expected
+ }
+
+ event = new MockBeanContextServiceRevokedEvent(services, services
+ .getClass(), true);
+ assertFalse(event.isServiceClass(null));
}
public void testBeanContextServiceRevokedEvent() {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java Wed Jun 20 20:21:13 2007
@@ -1267,7 +1267,23 @@
}
public void testServiceRevoked() {
- // covered by testRemoveService
+ MockChildBeanContextServicesSupport mockChildBeanContextServicesSupport = new MockChildBeanContextServicesSupport();
+ BeanContextServicesSupport beanContextServicesSupport = new BeanContextServicesSupport();
+ beanContextServicesSupport.add(mockChildBeanContextServicesSupport);
+ BeanContextServiceRevokedEvent beanContextServiceRevokedEvent = new BeanContextServiceRevokedEvent(new BeanContextServicesSupport(), Collection.class,false);
+ beanContextServicesSupport.serviceRevoked(beanContextServiceRevokedEvent);
+ assertTrue(mockChildBeanContextServicesSupport.revokeCalled);
+ }
+
+ public static class MockChildBeanContextServicesSupport extends
+ BeanContextServicesSupport {
+ private static final long serialVersionUID = 1L;
+
+ public boolean revokeCalled = false;
+
+ public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) {
+ revokeCalled = true;
+ }
}
public void testSerialization() throws IOException, ClassNotFoundException {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupport2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupport2Test.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupport2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupport2Test.java Wed Jun 20 20:21:13 2007
@@ -20,6 +20,9 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.beancontext.BeanContextSupport;
+import java.beans.beancontext.BeanContextMembershipListener;
+import java.beans.beancontext.BeanContextMembershipEvent;
+import java.beans.beancontext.BeanContextChildSupport;
import java.util.Locale;
import junit.framework.TestCase;
@@ -37,6 +40,33 @@
beanContextSupport.setLocale(null);
assertEquals(Locale.FRANCE, beanContextSupport.getLocale());
assertFalse(myPropertyChangeListener.changed);
+ }
+
+ /**
+ * Regression test for HARMONY-4011
+ */
+ public void test4011() {
+ BeanContextSupport context = new BeanContextSupport();
+ final int[] k = { 0 };
+ BeanContextMembershipListener listener =
+ new BeanContextMembershipListener() {
+
+ public void childrenAdded(BeanContextMembershipEvent bcme) {
+ k[0]++;
+ }
+
+ public void childrenRemoved(BeanContextMembershipEvent bcme) {}
+ };
+
+ // add listener
+ context.addBeanContextMembershipListener(listener);
+ context.add(new BeanContextChildSupport());
+ assertEquals(1, k[0]);
+
+ // add the same listener onse again
+ context.addBeanContextMembershipListener(listener);
+ context.add(new BeanContextChildSupport());
+ assertEquals(2, k[0]);
}
private class MyPropertyChangeListener implements PropertyChangeListener {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java Wed Jun 20 20:21:13 2007
@@ -17,6 +17,8 @@
package org.apache.harmony.beans.tests.java.beans.beancontext;
+import java.awt.Button;
+import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
@@ -2035,7 +2037,6 @@
assertEqualsSerially(mock.support, serMock.support);
}
-
public void testSerialization_Compatibility() throws Exception {
MockBeanContextDelegateS mock = new MockBeanContextDelegateS("main id");
BeanContextSupport support = mock.support;
@@ -2082,7 +2083,7 @@
return result;
} catch (Exception e) {
e.printStackTrace();
- throw new RuntimeException();
+ throw new RuntimeException(e);
}
}
@@ -2179,6 +2180,42 @@
baos.toByteArray()));
Object obj = oin.readObject();
assertTrue(obj instanceof BeanContextSupport);
+ }
+
+ public void testAvoidGui() throws Exception
+ {
+ MockBeanContextSupport1 mockBeanContextSupport1 = new MockBeanContextSupport1();
+ mockBeanContextSupport1.setOkToUseGui(false);
+ assertFalse(mockBeanContextSupport1.avoidingGui());
+
+ mockBeanContextSupport1 = new MockBeanContextSupport1();
+ mockBeanContextSupport1.setOkToUseGui(true);
+ assertFalse(mockBeanContextSupport1.avoidingGui());
+
+ mockBeanContextSupport1 = new MockBeanContextSupport1();
+ Component component = new Button();
+ mockBeanContextSupport1.add(component);
+ mockBeanContextSupport1.setOkToUseGui(false);
+ assertTrue(mockBeanContextSupport1.needsGui());
+ assertTrue(mockBeanContextSupport1.avoidingGui());
+
+ mockBeanContextSupport1 = new MockBeanContextSupport1();
+ component = new Button();
+ mockBeanContextSupport1.add(component);
+ mockBeanContextSupport1.setOkToUseGui(true);
+ assertTrue(mockBeanContextSupport1.needsGui());
+ assertFalse(mockBeanContextSupport1.avoidingGui());
+ }
+
+
+ public class MockBeanContextSupport1 extends BeanContextSupport
+ {
+ private static final long serialVersionUID = 1L;
+
+ public void setOkToUseGui(boolean ok)
+ {
+ this.okToUseGui = ok;
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java Wed Jun 20 20:21:13 2007
@@ -42,6 +42,8 @@
private static final long serialVersionUID = -1595520034788997356L;
private transient List<Rdn> rdns;
+
+ private transient String rdnsStr;
/**
* @ar.org.fitc.spec_ref
@@ -59,7 +61,8 @@
* @ar.org.fitc.spec_ref
*/
public LdapName(String name) throws InvalidNameException {
- LdapNameParser parser = new LdapNameParser(name);
+ rdnsStr = name;
+ LdapNameParser parser = new LdapNameParser(rdnsStr);
this.rdns = parser.getList();
}
@@ -78,6 +81,7 @@
}
rdns.add(posn, comp);
+ rdnsStr = null;
return this;
}
@@ -116,6 +120,7 @@
}
rdns.addAll(posn, suffixRdns);
+ rdnsStr = null;
return this;
}
@@ -152,6 +157,12 @@
* @ar.org.fitc.spec_ref
*/
public Object clone() {
+ try {
+ if (rdnsStr != null) {
+ return new LdapName(rdnsStr);
+ }
+ } catch (InvalidNameException e) {
+ }
List<Rdn> lista = new ArrayList<Rdn>();
for (int i = 0; i < rdns.size(); i++) {
lista.add(rdns.get(i));
@@ -193,7 +204,7 @@
public boolean endsWith(List<Rdn> rdns) {
try {
Iterator<?> iter = rdns.iterator();
- Iterator<?> iter2 = ((LdapName) getSuffix(rdns.size()
+ Iterator<?> iter2 = ((LdapName) getSuffix(this.rdns.size()
- rdns.size())).rdns.iterator();
while (iter.hasNext()) {
@@ -324,6 +335,7 @@
* @ar.org.fitc.spec_ref
*/
public Object remove(int posn) throws InvalidNameException {
+ rdnsStr = null;
return rdns.remove(posn).toString();
}
@@ -370,6 +382,9 @@
* @ar.org.fitc.spec_ref
*/
public String toString() {
+ if (rdnsStr != null) {
+ return rdnsStr;
+ }
if (rdns.size() == 0) {
return "";
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java Wed Jun 20 20:21:13 2007
@@ -156,7 +156,27 @@
} else if (val.startsWith("#")) {
return getByteFromHexString(val);
} else {
- char[] chars = new String(val.trim()).toCharArray();
+ String tmpVal = val.trim();
+ if (tmpVal.length() > 0 && tmpVal.charAt(0) == '\"'
+ && tmpVal.charAt(tmpVal.length() - 1) == '\"') {
+ if (tmpVal.length() == 1) {
+ val = "";
+ } else {
+ val = tmpVal.substring(1, tmpVal.length() - 1);
+ }
+ }
+ char[] chars;
+ int pos = val.length() - 1;
+ boolean trailingSpace = false;
+ while (pos >= 0 && val.charAt(pos) == ' ') {
+ trailingSpace = true;
+ pos--;
+ }
+ if (pos >= 0 && val.charAt(pos) == '\\' && trailingSpace) {
+ chars = (new String(val.trim()) + " ").toCharArray();
+ } else {
+ chars = new String(val.trim()).toCharArray();
+ }
return getUnEscapedValues(chars);
}
@@ -188,6 +208,11 @@
if (chars[i + 1] == ' ') {
continue;
}
+ if (chars[i + 1] == '\\') {
+ sb.append('\\');
+ i = i + 1;
+ continue;
+ }
if (!isSpecialChar(chars, i + 1)
&& !isSpecialChar(chars, i + 2)) {
try {
@@ -203,6 +228,7 @@
}
}
} catch (ArrayIndexOutOfBoundsException e) {
+ sb.append(chars[i]);
}
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java Wed Jun 20 20:21:13 2007
@@ -28,11 +28,14 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+
import javax.naming.InvalidNameException;
+import javax.naming.directory.BasicAttributes;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
import junit.framework.TestCase;
+
import org.apache.harmony.testframework.serialization.SerializationTest;
/**
@@ -280,6 +283,21 @@
* <p>
* Test method for 'javax.naming.ldap.LdapName(String)'
* </p>
+ */
+ public void testLdapNameString002() throws Exception {
+ String str = "t=\\20\\ te\\ s\\20t\\20\\20 + t2 = test1\\20\\ ";
+ LdapName ln = new LdapName(str);
+ assertEquals(ln.toString(), str);
+ ln.get(0);
+ assertEquals(ln.toString(), str);
+ ln.add("t=test");
+ assertEquals(ln.toString(), "t=test,t=\\ \\ te s t\\ +t2=test1\\ \\ ");
+ }
+
+ /**
+ * <p>
+ * Test method for 'javax.naming.ldap.LdapName(String)'
+ * </p>
* <p>
* Here we are testing the constructor method, this method should recive a
* non-null String, this string must be a valid string like
@@ -760,6 +778,35 @@
/**
* <p>
+ * Test method for 'javax.naming.ldap.LdapName.LdapName(List<Rdn>)'
+ * </p>
+ * <p>
+ * Here we are testing the constructor method of LdapName reciving a list of
+ * valid names.
+ * </p>
+ * <p>
+ * The expected result is an instance of an object of LdapName, and also
+ * that the indexing is made like the other way around.
+ * </p>
+ */
+ public void testLdapNameListOfRdn006() throws Exception {
+ try {
+ BasicAttributes bas = new BasicAttributes();
+ bas.put("test2", "test2");
+ bas.put("test1", "test1");
+ bas.put("test3", "test3");
+ Rdn rdn1 = new Rdn(bas);
+ LinkedList<Rdn> rdns = new LinkedList<Rdn>();
+ rdns.add(rdn1);
+ LdapName ln = new LdapName(rdns);
+ assertEquals("test1=test1+test2=test2+test3=test3", ln.getAll().nextElement());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * <p>
* Test method for 'javax.naming.ldap.LdapName.hashCode()'
* </p>
* <p>
@@ -1030,7 +1077,7 @@
* </p>
*/
public void testToString004() throws Exception {
- LdapName ln = new LdapName("t=\\4c\\4c");
+ LdapName ln = new LdapName("t=ll");
assertEquals("T=LL", ln.toString().toUpperCase());
}
@@ -2217,6 +2264,24 @@
test.add(new Rdn("t2", "test"));
test.add(new Rdn("t3", "test"));
assertTrue(new LdapName("t3=test,t2=test,t=test").endsWith(test));
+ }
+
+ /**
+ * <p>
+ * Test method for 'javax.naming.ldap.LdapName.endsWith(List<Rdn>)'
+ * </p>
+ * <p>
+ * Here we are testing if this method determines whether the specified RDN
+ * sequence forms a suffix of this LDAP name.
+ * </p>
+ * <p>
+ * The expected result is if a non null list of Rdns is sended, is a true.
+ * </p>
+ */
+ public void testEndsWithListOfRdn007() throws Exception {
+ LinkedList<Rdn> test = new LinkedList<Rdn>();
+ test.add(new Rdn("t3=test3"));
+ assertTrue(new LdapName("t3=test3,t2=test2,t=test").endsWith(test));
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java Wed Jun 20 20:21:13 2007
@@ -2104,6 +2104,34 @@
} catch (IllegalArgumentException e) {}
}
+ /**
+ * <p>
+ * Test method for 'javax.naming.ldap.Rdn.unescapeValue(String)'
+ * </p>
+ * <p>
+ * Here we are testing if a given attribute value string formated, returns
+ * the unformated value. In this case we are testing the special character
+ * "#" in the form "#GOFJMOII".
+ * </p>
+ * <p>
+ * The expected result is an exception.
+ * </p>
+ */
+ public void testUnescapeValue011() {
+ try {
+ assertEquals("te st ", Rdn.unescapeValue("te st \\ "));
+ assertEquals("te\\st", Rdn.unescapeValue("te\\\\st"));
+ assertEquals("test", Rdn.unescapeValue("\"test\""));
+ assertEquals("\"test", Rdn.unescapeValue("\"test"));
+ assertEquals("\"te\"st", Rdn.unescapeValue("\"te\"st"));
+ assertEquals("te\"st", Rdn.unescapeValue("\"te\"st\""));
+ assertEquals("test", Rdn.unescapeValue(" \"test\" "));
+ assertEquals("\"test\" ", Rdn.unescapeValue(" \"test\" \\ "));
+ assertEquals("te1st\\", Rdn.unescapeValue(" \"te\\31st\\\" "));
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
public void testSerializationCompatibility() throws Exception{
Rdn object = new Rdn("t=\\20\\ te\\ s\\20t\\20\\20 + t2 = test1\\20\\ ");
SerializationTest.verifyGolden(this, object);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Wed Jun 20 20:21:13 2007
@@ -450,7 +450,7 @@
/*----------------the older form,nearly the same with below------------
//result = pollSelectRead (env, fileDescriptor, timeout, TRUE);
*/
- result = selectRead (env,hysocketP, timeout, FALSE);
+ result = selectRead (env, hysocketP, timeout * 1000, FALSE);
if (0 >= result)
return (jint) 0;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c Wed Jun 20 20:21:13 2007
@@ -402,7 +402,7 @@
if (!socketExConstructor) {
return;
}
- socketEx = (*env)->NewObject(env, socketExClass,errorCodeExConstructor,errorMessageString);
+ socketEx = (*env)->NewObject(env, socketExClass, socketExConstructor, errorMessageString);
socketExCauseMethod = (*env)->GetMethodID(env,socketExClass,"initCause","(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
(*env)->CallObjectMethod(env,socketEx,socketExCauseMethod,errorCodeEx);
(*env)->Throw(env,socketEx);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Wed Jun 20 20:21:13 2007
@@ -43,12 +43,14 @@
selectRead (JNIEnv * env,hysocket_t hysocketP, I_32 uSecTime, BOOLEAN accept){
PORT_ACCESS_FROM_ENV (env);
I_32 result = 0;
+ I_32 timeout;
struct pollfd my_pollfd;
+ timeout = uSecTime >= 0 ? TO_MILLIS(0, uSecTime) : -1;
my_pollfd.fd = hysocketP->sock;
my_pollfd.events = POLLIN | POLLPRI;
my_pollfd.revents = 0;
- result = poll (&my_pollfd, 1, TO_MILLIS(0, uSecTime));
+ result = poll (&my_pollfd, 1, timeout);
return result;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java Wed Jun 20 20:21:13 2007
@@ -933,7 +933,7 @@
boolean exception = false;
try {
- u = new URL("file://nonexistenttestdir/tstfile");
+ u = new URL("file:///nonexistenttestdir/tstfile");
u.openStream();
} catch (IOException e) {
// Correct behaviour
Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java Wed Jun 20 20:21:13 2007
@@ -26,6 +26,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
@@ -202,7 +203,7 @@
if (isBlocking == blockingMode) {
return this;
}
- if (blockingMode && isRegistered()) {
+ if (blockingMode && containsValidKeys()) {
throw new IllegalBlockingModeException();
}
implConfigureBlocking(blockingMode);
@@ -235,4 +236,17 @@
}
}
+ /**
+ * Returns true if the keyList contains at least 1 valid key and false otherwise.
+ */
+ private synchronized boolean containsValidKeys() {
+ for (Iterator<SelectionKey> iter = keyList.iterator(); iter.hasNext();) {
+ SelectionKey key = iter.next();
+
+ if (key != null && key.isValid()) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml Wed Jun 20 20:21:13 2007
@@ -179,37 +179,55 @@
</delete>
</target>
- <target name="-compile-native-tests" if="test.portlib" >
+ <target name="-compile-native-tests" >
<make dir="${hy.portlib.src.test.native}/init/${hy.os.family}" />
+ <make dir="${hy.portlib.src.test.native}/hycpu/${hy.os.family}" />
<make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}" />
- <make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}" />
<make dir="${hy.portlib.src.test.native}/hyfile/${hy.os.family}" />
+ <make dir="${hy.portlib.src.test.native}/hygp/${hy.os.family}" />
+ <make dir="${hy.portlib.src.test.native}/hymem/${hy.os.family}" />
+ <make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}" />
</target>
- <target name="-run-native-tests" if="test.portlib" >
+ <target name="-run-native-tests" >
<mkdir dir="${hy.tests.reports}" />
<property environment="env"/>
<condition property="hy.thr.libpath"
value="${path.separator}${hy.jdk}/jre/bin/default" else="">
<equals arg1="${hy.no.thr}" arg2="true" />
</condition>
- <exec-native test="init" />
+ <!-- <exec-native test="init" /> -->
+ <exec-native test="hycpu" />
<exec-native test="hyerror" />
+ <!-- <exec-native test="hyfile" /> -->
+ <exec-native test="hygp" />
+ <exec-native test="hymem" />
<exec-native test="hytime" />
- <exec-native test="hyfile" />
+
+ <move todir="${hy.tests.reports}">
+ <fileset dir="${hy.portlib}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ </move>
<antcall target="touch-errors-file" />
</target>
- <target name="-clean-native-tests" if="test.portlib" >
+ <target name="-clean-native-tests" >
<make dir="${hy.portlib.src.test.native}/init/${hy.os.family}"
target="clean" />
- <make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}"
+ <make dir="${hy.portlib.src.test.native}/hycpu/${hy.os.family}"
target="clean" />
- <make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}"
+ <make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}"
target="clean" />
<make dir="${hy.portlib.src.test.native}/hyfile/${hy.os.family}"
target="clean" />
+ <make dir="${hy.portlib.src.test.native}/hygp/${hy.os.family}"
+ target="clean" />
+ <make dir="${hy.portlib.src.test.native}/hymem/${hy.os.family}"
+ target="clean" />
+ <make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}"
+ target="clean" />
</target>
<target name="touch-errors-file" if="test.errors">
@@ -245,14 +263,14 @@
</not>
</condition>
<echo>@{test}: ${@{test}.result}${line.separator}</echo>
- <echo file="${hy.tests.reports}/TEST-${@{test}.name}.xml"
+<!-- <echo file="${hy.tests.reports}/TEST-${@{test}.name}.xml"
><?xml version='1.0' encoding='UTF-8' ?>
<testsuite tests="1" errors='${@{test}.errorcount}' failures='0'
name='${@{test}.name}' time='0'>
<testcase classname='${@{test}.name}' name='${@{test}.name}'
time='0.0' />
<system-out><![CDATA[${@{test}.output}]]></system-out>
-</testsuite>${line.separator}</echo>
+</testsuite>${line.separator}</echo> -->
</sequential>
</macrodef>
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/shared/hyerror.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/shared/hyerror.c?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/shared/hyerror.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/shared/hyerror.c Wed Jun 20 20:21:13 2007
@@ -16,18 +16,25 @@
*/
#include "hycomp.h"
#include "hyport.h"
+#include "hycunit.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define ERROR_STRING "Argh!"
+int test_hyerror_set_last_error(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_set_last_error_with_message(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_last_error_message(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_last_error_number(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_startup(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_shutdown(struct HyPortLibrary *hyportLibrary);
+
int main (int argc, char **argv, char **envp)
{
HyPortLibrary hyportLibrary;
HyPortLibraryVersion portLibraryVersion;
- I_32 num;
- const char *err;
+ int ret;
printf("hyerror:\n");
@@ -40,49 +47,128 @@
}
printf(" portlib initialized\n");
-
- err = hyportLibrary.error_last_error_message(&hyportLibrary);
- printf(" err = %s\n", err);
- if (strncmp(err, "", sizeof("")) != 0) {
- fprintf(stderr,
- "hyerror_last_error_message was not empty but \"%s\"\n", err);
+
+ Hytest_init(&hyportLibrary, "Portlib.Hyerror");
+ Hytest_func(&hyportLibrary, test_hyerror_last_error_message, "hyerror_last_error_message");
+ Hytest_func(&hyportLibrary, test_hyerror_last_error_number, "hyerror_last_error_number");
+ Hytest_func(&hyportLibrary, test_hyerror_set_last_error, "hyerror_set_last_error");
+ Hytest_func(&hyportLibrary, test_hyerror_set_last_error_with_message, "hyerror_set_last_error_with_message");
+ Hytest_func(&hyportLibrary, test_hyerror_startup, "hyerror_startup");
+ Hytest_func(&hyportLibrary, test_hyerror_shutdown, "hyerror_shutdown");
+ ret = Hytest_close_and_output(&hyportLibrary);
+
+ if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
+ fprintf(stderr, "portlib shutdown failed\n");
return 1;
}
+
+ printf(" portlib shutdown\n");
+ return ret;
+}
- hyportLibrary.error_set_last_error(&hyportLibrary,
+int test_hyerror_set_last_error(struct HyPortLibrary *hyportLibrary)
+{
+ I_32 num;
+ const char *err;
+ hyportLibrary->error_set_last_error(hyportLibrary,
2, HYPORT_ERROR_NOTFOUND);
- num = hyportLibrary.error_last_error_number(&hyportLibrary);
- err = hyportLibrary.error_last_error_message(&hyportLibrary);
+ num = hyportLibrary->error_last_error_number(hyportLibrary);
+ err = hyportLibrary->error_last_error_message(hyportLibrary);
printf(" num = %d, err = %s\n", num, err);
if (num != HYPORT_ERROR_NOTFOUND) {
- fprintf(stderr, "hyerror_last_error_number was %d not %d\n",
- num, HYPORT_ERROR_NOTFOUND);
- return 1;
+ Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_number Output should be [%d] not [%d] (%s)\n",
+ HYPORT_ERROR_NOTFOUND,num,HY_GET_CALLSITE());
+ return -1;
}
if (strncmp(err, "", sizeof("")) == 0) {
- fprintf(stderr, "hyerror_last_error_message was empty\n");
- return 1;
+ Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_message was empty(%s)\n",HY_GET_CALLSITE());
+ return -1;
}
+ return 0;
+}
- hyportLibrary.error_set_last_error_with_message(&hyportLibrary,
+int test_hyerror_set_last_error_with_message(struct HyPortLibrary *hyportLibrary)
+{
+ const char *err;
+ hyportLibrary->error_set_last_error_with_message(hyportLibrary,
HYPORT_ERROR_NOTFOUND,
ERROR_STRING);
- err = hyportLibrary.error_last_error_message(&hyportLibrary);
+ err = hyportLibrary->error_last_error_message(hyportLibrary);
printf(" err = %s\n", err);
if (strncmp(err, ERROR_STRING, sizeof(ERROR_STRING)) != 0) {
- fprintf(stderr, "hyerror_last_error_message was %s not %s\n", err,
- ERROR_STRING);
- return 1;
+ Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_message Output should be [%s] not [%s] (%s)\n", ERROR_STRING,
+ err,HY_GET_CALLSITE());
+ return -1;
}
-
- if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
- fprintf(stderr, "portlib shutdown failed\n");
- return 1;
+ return 0;
+}
+
+int test_hyerror_last_error_message(struct HyPortLibrary *hyportLibrary)
+{
+ const char *err;
+ err = hyportLibrary->error_last_error_message(hyportLibrary);
+ printf(" err = %s\n", err);
+ if (strncmp(err, "", sizeof("")) != 0) {
+ Hytest_setErrMsg(hyportLibrary,
+ "hyerror_last_error_message Output should be empty not [%s] (%s)\n", err,HY_GET_CALLSITE());
+ return -1;
}
- printf(" portlib shutdown\n");
+ return 0;
+}
+
+int test_hyerror_last_error_number(struct HyPortLibrary *hyportLibrary)
+{
+ hyportLibrary->error_last_error_number(hyportLibrary);
+ return 0;
+}
+int test_hyerror_startup(struct HyPortLibrary *hyportLibrary)
+{
+ HyPortLibrary hyportLibrary2;
+ HyPortLibraryVersion portLibraryVersion;
+ I_32 rc;
+ HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+ if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+ sizeof (HyPortLibrary)))
+ {
+ fprintf(stderr, "portlib init failed\n");
+ return -1;
+ }
+ rc =
+ hyportLibrary2.error_startup (&hyportLibrary2);
+ if (0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "error startup failed: %s (%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ return -1;
+ }
+ hyportLibrary2.error_shutdown(&hyportLibrary2);
+ return 0;
+}
+
+int test_hyerror_shutdown(struct HyPortLibrary *hyportLibrary)
+{
+ HyPortLibrary hyportLibrary2;
+ HyPortLibraryVersion portLibraryVersion;
+ I_32 rc;
+ HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+ if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+ sizeof (HyPortLibrary)))
+ {
+ fprintf(stderr, "portlib init failed\n");
+ return -1;
+ }
+ rc =
+ hyportLibrary2.error_startup (&hyportLibrary2);
+ if (0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "time startup failed: %s (%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ return -1;
+ }
+ hyportLibrary2.error_shutdown(&hyportLibrary2);
return 0;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile Wed Jun 20 20:21:13 2007
@@ -1,29 +1,31 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# Makefile for 'hyerror'
-#
-
-include $(HY_HDK)/build/make/defines.mk
-
-BUILDFILES = $(SHAREDSUB)hyerror.o
-MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
-ifeq ($(HY_NO_THR),true)
-MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
-endif
-EXENAME = ../hyerror
-
-include $(HY_HDK)/build/make/rules.mk
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Makefile for 'hyerror'
+#
+
+include $(HY_HDK)/build/make/defines.mk
+
+INCLUDES += -I../../hycunit
+BUILDFILES = $(SHAREDSUB)hyerror.o
+BUILDFILES += ../../hycunit/hycunit.o
+MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
+ifeq ($(HY_NO_THR),true)
+MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
+endif
+EXENAME = ../hyerror
+
+include $(HY_HDK)/build/make/rules.mk
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile Wed Jun 20 20:21:13 2007
@@ -20,9 +20,10 @@
!include <$(HY_HDK)\build\make\defines.mak>
EXENAME=..\hyerror.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
BUILDFILES = $(SHAREDSUB)hyerror.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
!IF "$(HY_NO_THR)" == "true"
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/shared/hytime.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/shared/hytime.c?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/shared/hytime.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/shared/hytime.c Wed Jun 20 20:21:13 2007
@@ -20,17 +20,26 @@
#include "hycomp.h"
#include "hyport.h"
#include "hythread.h"
+#include "hycunit.h"
+
+int test_hytime_current_time_millis(struct HyPortLibrary *hyportLibrary);
+int test_hytime_msec_clock(struct HyPortLibrary *hyportLibrary);
+int test_hytime_hires_clock(struct HyPortLibrary *hyportLibrary);
+int test_hytime_hires_delta(struct HyPortLibrary *hyportLibrary);
+int test_hytime_hires_frequency(struct HyPortLibrary *hyportLibrary);
+int test_hytime_usec_clock(struct HyPortLibrary *hyportLibrary);
+int test_hytime_shutdown(struct HyPortLibrary *hyportLibrary);
+int test_hytime_startup(struct HyPortLibrary *hyportLibrary);
int main (int argc, char **argv, char **envp)
{
HyPortLibrary hyportLibrary;
HyPortLibraryVersion portLibraryVersion;
+ int ret;
+
#ifdef HY_NO_THR
HyThreadLibrary *privateThreadLibrary;
#endif
- UDATA msec, usec;
- I_64 millis;
- U_64 hires, hires2, freq, delta;
printf("hytime:\n");
@@ -48,40 +57,138 @@
privateThreadLibrary = hyportLibrary.port_get_thread_library(&hyportLibrary);
#endif
- msec = hyportLibrary.time_msec_clock(&hyportLibrary);
- printf("msec = %u\n", msec);
+ Hytest_init(&hyportLibrary, "Portlib.Hytime");
+ Hytest_func(&hyportLibrary, test_hytime_current_time_millis, "hytime_current_time_millis");
+ Hytest_func(&hyportLibrary, test_hytime_msec_clock, "hytime_msec_clock");
+ Hytest_func(&hyportLibrary, test_hytime_hires_clock, "hytime_hires_clock");
+ Hytest_func(&hyportLibrary, test_hytime_hires_delta, "hytime_hires_delta");
+ Hytest_func(&hyportLibrary, test_hytime_hires_frequency, "hytime_hires_frequency");
+ Hytest_func(&hyportLibrary, test_hytime_usec_clock, "hytime_usec_clock");
+ Hytest_func(&hyportLibrary, test_hytime_shutdown, "hytime_shutdown");
+ Hytest_func(&hyportLibrary, test_hytime_startup, "hytime_startup");
+ ret = Hytest_close_and_output(&hyportLibrary);
+
+ if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
+ fprintf(stderr, "portlib shutdown failed\n");
+ return 1;
+ }
+ printf(" portlib shutdown\n");
- usec = hyportLibrary.time_usec_clock(&hyportLibrary);
- printf("usec = %u\n", usec);
+ return ret;
+}
- millis = hyportLibrary.time_current_time_millis(&hyportLibrary);
+int test_hytime_current_time_millis(struct HyPortLibrary *hyportLibrary)
+{
+ I_64 millis;
+ millis = hyportLibrary->time_current_time_millis(hyportLibrary);
printf("millis = %lld\n", millis);
+ return 0;
+}
- hires = hyportLibrary.time_hires_clock(&hyportLibrary);
+int test_hytime_msec_clock(struct HyPortLibrary *hyportLibrary)
+{
+ UDATA msec;
+ msec = hyportLibrary->time_msec_clock(hyportLibrary);
+ printf("msec = %u\n", msec);
+ return 0;
+}
+
+int test_hytime_hires_clock(struct HyPortLibrary *hyportLibrary)
+{
+ U_64 hires,hires2;
+ hires = hyportLibrary->time_hires_clock(hyportLibrary);
printf("hires = %llu\n", hires);
- freq = hyportLibrary.time_hires_frequency(&hyportLibrary);
+ hythread_sleep(1000);
+ hires2 = hyportLibrary->time_hires_clock(hyportLibrary);
+ printf("hires2 = %llu\n", hires2);
+ return 0;
+}
+
+int test_hytime_hires_delta(struct HyPortLibrary *hyportLibrary)
+{
+ U_64 delta,hires,hires2,freq;
+ hires = hyportLibrary->time_hires_clock(hyportLibrary);
+ printf("hires = %llu\n", hires);
+ freq = hyportLibrary->time_hires_frequency(hyportLibrary);
printf("freq = %llu\n", freq);
hythread_sleep(1000);
- hires2 = hyportLibrary.time_hires_clock(&hyportLibrary);
+ hires2 = hyportLibrary->time_hires_clock(hyportLibrary);
printf("hires2 = %llu\n", hires2);
-
- delta = hyportLibrary.time_hires_delta(&hyportLibrary,
+
+ delta = hyportLibrary->time_hires_delta(hyportLibrary,
hires, hires2,
HYPORT_TIME_DELTA_IN_MICROSECONDS);
printf("delta = %llu\n", delta);
-
if (delta <= 0) {
- fprintf(stderr, "hires_clock did not increment after 1s sleep\n");
- return 1;
+ Hytest_setErrMsg(hyportLibrary, "hires_clock did not increment after 1s sleep\n");
+ return -1;
}
+ return 0;
+}
+
+int test_hytime_hires_frequency(struct HyPortLibrary *hyportLibrary)
+{
+ U_64 freq;
+ freq = hyportLibrary->time_hires_frequency(hyportLibrary);
+ printf("freq = %llu\n", freq);
+ return 0;
+}
+
+int test_hytime_usec_clock(struct HyPortLibrary *hyportLibrary)
+{
- if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
- fprintf(stderr, "portlib shutdown failed\n");
- return 1;
+ UDATA usec;
+ usec = hyportLibrary->time_usec_clock(hyportLibrary);
+ printf("usec = %u\n", usec);
+ return 0;
+}
+
+int test_hytime_shutdown(struct HyPortLibrary *hyportLibrary)
+{
+ HyPortLibrary hyportLibrary2;
+ HyPortLibraryVersion portLibraryVersion;
+ I_32 rc;
+ HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+ if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+ sizeof (HyPortLibrary)))
+ {
+ fprintf(stderr, "portlib init failed\n");
+ return -1;
}
- printf(" portlib shutdown\n");
+ rc =
+ hyportLibrary2.time_startup (&hyportLibrary2);
+ if (0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "time startup failed: %s (%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ return -1;
+ }
+ hyportLibrary2.time_shutdown(&hyportLibrary2);
+ return 0;
+}
+int test_hytime_startup(struct HyPortLibrary *hyportLibrary)
+{
+ HyPortLibrary hyportLibrary2;
+ HyPortLibraryVersion portLibraryVersion;
+ I_32 rc;
+ HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+ if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+ sizeof (HyPortLibrary)))
+ {
+ fprintf(stderr, "portlib init failed\n");
+ return -1;
+ }
+ rc =
+ hyportLibrary2.time_startup (&hyportLibrary2);
+ if (0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "time startup failed: %s (%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ return -1;
+ }
return 0;
}
+
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile Wed Jun 20 20:21:13 2007
@@ -1,29 +1,31 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# Makefile for 'hytime'
-#
-
-include $(HY_HDK)/build/make/defines.mk
-
-BUILDFILES = $(SHAREDSUB)hytime.o
-MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
-ifeq ($(HY_NO_THR),true)
-MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
-endif
-EXENAME = ../hytime
-
-include $(HY_HDK)/build/make/rules.mk
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Makefile for 'hytime'
+#
+
+include $(HY_HDK)/build/make/defines.mk
+
+INCLUDES += -I../../hycunit
+BUILDFILES = $(SHAREDSUB)hytime.o
+BUILDFILES += ../../hycunit/hycunit.o
+MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
+ifeq ($(HY_NO_THR),true)
+MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
+endif
+EXENAME = ../hytime
+
+include $(HY_HDK)/build/make/rules.mk
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile Wed Jun 20 20:21:13 2007
@@ -20,9 +20,10 @@
!include <$(HY_HDK)\build\make\defines.mak>
EXENAME=..\hytime.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
BUILDFILES = $(SHAREDSUB)hytime.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
!IF "$(HY_NO_THR)" == "true"
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java Wed Jun 20 20:21:13 2007
@@ -198,8 +198,17 @@
if ("file".equals(codebase.getProtocol())) { //$NON-NLS-1$
File codeFile = new File(codebase.getFile());
if (codeFile.isAbsolute()) {
- codebase = new URL("file:/" + //$NON-NLS-1$
- codeFile.getAbsolutePath());
+ String absolutePath = codeFile.getAbsolutePath();
+ //Fix HARMONY-4184
+ //Unix style file path.
+ if (absolutePath.startsWith("/")) {
+ codebase = new URL("file://" + //$NON-NLS-1$
+ codeFile.getAbsolutePath());
+ } else {
+ //Windows style file path.
+ codebase = new URL("file:/" + //$NON-NLS-1$
+ codeFile.getAbsolutePath());
+ }
}
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicButtonUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicButtonUI.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicButtonUI.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicButtonUI.java Wed Jun 20 20:21:13 2007
@@ -49,6 +49,8 @@
protected int defaultTextIconGap;
protected int defaultTextShiftOffset;
+
+ private int textShiftOffset = 0;
private Color focusColor;
private Color disabledTextColor;
@@ -120,8 +122,8 @@
final AbstractButton b = (AbstractButton)c;
final Color color = b.isEnabled() ? b.getForeground() : disabledTextColor;
- final int textShiftOffset = getTextShiftOffset();
- textRect.translate(textShiftOffset, textShiftOffset);
+ final int currentTextShiftOffset = getTextShiftOffset();
+ textRect.translate(currentTextShiftOffset, currentTextShiftOffset);
ButtonCommons.paintText(g, b, textRect, text, color);
}
@@ -199,13 +201,15 @@
}
protected void setTextShiftOffset() {
+ textShiftOffset = defaultTextShiftOffset;
}
protected void clearTextShiftOffset() {
+ textShiftOffset = 0;
}
protected int getTextShiftOffset() {
- return 0;
+ return textShiftOffset;
}
private boolean isFocusPainted(final AbstractButton button) {
@@ -224,4 +228,5 @@
return null;
}
}
+
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicButtonUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicButtonUITest.java?view=diff&rev=549342&r1=549341&r2=549342
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicButtonUITest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicButtonUITest.java Wed Jun 20 20:21:13 2007
@@ -354,17 +354,27 @@
assertEquals("prefix", "Button.", ui.getPropertyPrefix());
}
- public void testSetTextShiftOffset() {
- }
+ /**
+ * The test verifies that getTextShiftOffset methods returns
+ * Button.textShiftOffset property if the setTextShiftOffset method is
+ * called and returns 0 if the clearTextShiftOffset method is called
+ */
+ @SuppressWarnings( { "boxing", "nls" })
+ public void testTextShiftOffest() {
- public void testClearTextShiftOffset() {
- ui.defaultTextShiftOffset = 100;
- ui.clearTextShiftOffset();
- assertEquals(100, ui.defaultTextShiftOffset);
- }
+ int oldTextShiftOffset = UIManager.getInt("Button.textShiftOffset");
- public void testGetTextShiftOffset() {
- ui.defaultTextShiftOffset = 100;
- assertEquals("offset", 0, ui.getTextShiftOffset());
+ UIManager.put("Button.textShiftOffset", 5);
+
+ BasicButtonUI currentUI = new BasicButtonUI();
+ currentUI.installUI(new JButton());
+
+ assertEquals(currentUI.getTextShiftOffset(), 0);
+ currentUI.setTextShiftOffset();
+ assertEquals(currentUI.getTextShiftOffset(), 5);
+ currentUI.clearTextShiftOffset();
+ assertEquals(currentUI.getTextShiftOffset(), 0);
+
+ UIManager.put("Button.textShiftOffset", oldTextShiftOffset);
}
}