harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r390246 [1/15] - in /incubator/harmony/enhanced/classlib/trunk: archive/modules/security/src/main/java/java/security/ modules/archive/src/main/java/java/util/jar/ modules/archive/src/test/java/tests/api/java/util/zip/ modules/beans/src/main...
Date Thu, 30 Mar 2006 21:34:28 GMT
Author: tellison
Date: Thu Mar 30 13:34:23 2006
New Revision: 390246

URL: http://svn.apache.org/viewcvs?rev=390246&view=rev
Log:
Fix for HARMONY-252 (trivial typo fixes)

Modified:
    incubator/harmony/enhanced/classlib/trunk/archive/modules/security/src/main/java/java/security/Security.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InvalidAttributeValueException.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingEvent.java
    incubator/harmony/enhanced/classlib/trunk/modules/kernel/src/main/java/java/lang/Thread.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/Reader.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/Writer.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/CharSequence.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Integer.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Readable.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/UnknownHostException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Random.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Stack.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PushbackInputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/ConstructorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileChannel.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/Charset.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetEncoder.java
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/Preferences.java
    incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/util/regex/MatchResultImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/AlgorithmParameterGenerator.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/AlgorithmParameters.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/KeyFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/KeyPairGenerator.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/KeyStore.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/MessageDigest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/SecureRandom.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/Signature.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/cert/CertPathBuilder.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/cert/CertPathValidator.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/cert/CertStore.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/cert/CertificateFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/java/security/cert/X509CertSelector.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/security/auth/login/LoginContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/org/apache/harmony/security/fortress/Services.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/org/apache/harmony/security/x509/GeneralSubtree.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/org/apache/harmony/security/x509/PolicyQualifierInfo.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/windows/javasrc/org/apache/harmony/security/x/security/auth/module/NTSystem.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/CodeSourceTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/IdentityTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/security/auth/login/LoginContextTest_1.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/org/apache/harmony/security/TestCertUtils.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/ResultSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/BreakIterator.java
    incubator/harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/SSLContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java
    incubator/harmony/enhanced/classlib/trunk/native-src/shared/zip/zipsup.c
    incubator/harmony/enhanced/classlib/trunk/native-src/win.IA32/luni/procimpl.c

Modified: incubator/harmony/enhanced/classlib/trunk/archive/modules/security/src/main/java/java/security/Security.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/archive/modules/security/src/main/java/java/security/Security.java?rev=390246&r1=390245&r2=390246&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/archive/modules/security/src/main/java/java/security/Security.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/archive/modules/security/src/main/java/java/security/Security.java
Thu Mar 30 13:34:23 2006
@@ -573,7 +573,7 @@
 	 */
 	private static void loadSecurityProviders() {
 		synchronized (providersByPriority) {
-			// needed for syncronization issues
+			// needed for synchronization issues
 			if (providersLoaded)
 				return;
 			// must be set before calling addProvider()

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java?rev=390246&r1=390245&r2=390246&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
Thu Mar 30 13:34:23 2006
@@ -262,7 +262,7 @@
 
 	/**
 	 * Contructs a new Manifest instance obtaining Attribute information from
-	 * the paramter InputStream.
+	 * the parameter InputStream.
 	 * 
 	 * @param is
 	 *            The InputStream to read from

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java?rev=390246&r1=390245&r2=390246&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
Thu Mar 30 13:34:23 2006
@@ -380,7 +380,7 @@
 			iis.close();
 			f1.delete();
 
-			// Test for trying to write more bytes than availble from the array
+			// Test for trying to write more bytes than available from the array
 			File f2 = new File("writeBII2.tst");
 			FileOutputStream fos2 = new FileOutputStream(f2);
 			DeflaterOutputStream dos2 = new DeflaterOutputStream(fos2);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java?rev=390246&r1=390245&r2=390246&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
Thu Mar 30 13:34:23 2006
@@ -1,308 +1,308 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed 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.
- */
-
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.14.6.4 $
- */
-package java.beans;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-import org.apache.harmony.beans.NullPersistenceDelegate;
-import org.apache.harmony.beans.ObjectNode;
-import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
-
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.14.6.4 $
- */
-
-public class Encoder {
-    
-    private ExceptionListener exceptionListener = null;
-    private HashMap persistenceDelegates = new HashMap();
-    
-    Vector roots = new Vector();
-    HashMap nodes = new HashMap();
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public Encoder() {}
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public Object get(Object oldInstance) {
-        if(oldInstance == null) {
-            return null;
-        }
-        
-        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
-        Object result = getValue(node);
-        return result;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public Object remove(Object oldInstance) {
-        //TODO - notify refernces on node deletion
-        if(oldInstance == null) {
-            return null;
-        }
-        
-        ObjectNode node = (ObjectNode) nodes.remove(oldInstance);
-        return getValue(node);
-    }
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public PersistenceDelegate getPersistenceDelegate(Class type) {
-        PersistenceDelegate result =
-                (PersistenceDelegate) persistenceDelegates.get(type);
-        
-        if(result == null) {
-             result = DefaultPersistenceDelegatesFactory.getPersistenceDelegate(
-                     type);
-        }
-        
-        return result;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public void setPersistenceDelegate(Class type,
-            PersistenceDelegate persistenceDelegate) {
-        persistenceDelegates.put(type, persistenceDelegate);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    protected void writeObject(Object object) {
-        roots.add(object);
-        doWriteObject(object);
-    }
-    
-    void doWriteObject(Object object) {
-           PersistenceDelegate pd = (object != null) ?
-               getPersistenceDelegate(object.getClass()) :
-                   new NullPersistenceDelegate();
-               
-           if(pd == null) {
-               pd = new DefaultPersistenceDelegate();
-           }
-           
-           pd.writeObject(object, this);
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public void writeStatement(Statement oldStm) {
-        ObjectNode node = (ObjectNode) nodes.get(oldStm.getTarget());
-        if(node != null) {
-            try {
-                Object[] oldArgs = oldStm.getArguments();
-                Object[] newArgs = write(oldArgs);
-                
-                Statement statement = new Statement(node.getObjectValue(),
-                        oldStm.getMethodName(), oldArgs);
-                node.addStatement(statement);
-            } catch (Exception e) {
-                getExceptionListener().exceptionThrown(e);
-            }
-        } else {
-            System.out.println("no node is found for statement with target = "
-                    + oldStm.getTarget());
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public void writeExpression(Expression oldExp) {
-        try {
-            Object oldInstance = oldExp.getValue();
-            
-            ObjectNode node = null;
-            Class type = null;
-            
-            if(oldInstance != null) {
-                type = oldInstance.getClass();
-                node = (ObjectNode) nodes.get(oldInstance);
-            }
-            
-            if(node == null) {
-                if(isNull(type) || isPrimitive(type) || isString(type)
-                        || isClass(type)) {
-                    node = new ObjectNode(oldExp);
-                } else {
-                    write(oldExp.getArguments());
-                    node = new ObjectNode(oldExp, nodes);
-                }
-                
-                nodes.put(oldInstance, node);
-                
-                // if an expression is not a constructor
-                if(!(oldExp.getTarget() instanceof Class)) {
-                    ObjectNode parent = (ObjectNode) nodes.get(
-                            oldExp.getTarget());
-                    parent.addExpression(oldExp);
-                }
-            } else if(oldExp.getMethodName().equals("new")) {
-                node.addReference();
-            } else {
-                node.addReferencedExpression(oldExp);
-            }
-        } catch (Exception e) {
-            // TODO - remove written args
-            getExceptionListener().exceptionThrown(e);
-        }
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public void setExceptionListener(ExceptionListener exceptionListener) {
-        this.exceptionListener = exceptionListener;
-    }
-
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public ExceptionListener getExceptionListener() {
-        if(exceptionListener == null) {
-            exceptionListener = new ExceptionListener() {
-                public void exceptionThrown(Exception e) {
-                    System.out.println(e.getClass() + ": " + e.getMessage());
-                }
-            };
-        }
-        
-        return exceptionListener;
-    }
-    
-    private Object write(Object oldInstance) throws Exception {
-        if(oldInstance == null) {
-            return null;
-        }
-
-        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
-        if(node == null) {
-            Class type = oldInstance.getClass();
-            
-            if(isPrimitive(type) || isString(type) || isClass(type)) {
-                Expression expr = new Expression(type, "new",
-                        new Object[] { oldInstance });
-                nodes.put(oldInstance, new ObjectNode(expr));
-            } else {
-                doWriteObject(oldInstance);
-            }
-            
-            node = (ObjectNode) nodes.get(oldInstance);
-        } else {
-            node.addReference();
-        }
-        
-        return node.getObjectValue();
-    }
-    
-    private Object[] write(Object[] oldInstances) throws Exception {
-        if(oldInstances != null) {
-            Object[] newInstances = new Object[oldInstances.length];
-            
-            for(int i = 0; i < oldInstances.length; ++i) {
-                newInstances[i] = write(oldInstances[i]);
-            }
-            
-            return newInstances;
-        }
-        
-        return null;
-    }
-
-    private Object getValue(ObjectNode node) {
-        if(node != null) {
-            try {
-                Object result = node.getObjectValue();
-                return result;
-            } catch (Exception e) {
-                getExceptionListener().exceptionThrown(e);
-            }
-        }
-        
-        return null;
-    }
-    
-    static boolean isNull(Class type) {
-        return (type == null);
-    }
-    
-    static boolean isPrimitive(Class type) {
-        return (type == Boolean.class) || (type == Byte.class) ||
-            (type == Character.class) || (type == Double.class) ||
-            (type == Float.class) || (type == Integer.class) ||
-            (type == Long.class) || (type == Short.class);
-    }
-    
-    static boolean isString(Class type) {
-        return (type == String.class);
-        
-    }
-    
-    static boolean isClass(Class type) {
-        return (type == Class.class);
-    }
-    
-    
-    static boolean isArray(Class type) {
-        return type.isArray();
-    }
-    
-    static String getPrimitiveName(Class type) {
-        String result = null;
-        
-        if(type == Boolean.class) {
-            result = "boolean";
-        } else if(type == Byte.class) {
-            result = "byte";
-        } else if(type == Character.class) {
-            result = "char";
-        } else if(type == Double.class) {
-            result = "double";
-        } else if(type == Float.class) {
-            result = "float";
-        } else if(type == Integer.class) {
-            result = "int";
-        } else if(type == Long.class) {
-            result = "long";
-        } else if(type == Short.class) {
-            result = "short";
-        } else if(type == String.class) {
-            result = "string";
-        } else if(type == Class.class) {
-            result = "class";
-        }
-        
-        return result;
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.14.6.4 $
+ */
+package java.beans;
+
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.apache.harmony.beans.NullPersistenceDelegate;
+import org.apache.harmony.beans.ObjectNode;
+import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.14.6.4 $
+ */
+
+public class Encoder {
+    
+    private ExceptionListener exceptionListener = null;
+    private HashMap persistenceDelegates = new HashMap();
+    
+    Vector roots = new Vector();
+    HashMap nodes = new HashMap();
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Encoder() {}
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object get(Object oldInstance) {
+        if(oldInstance == null) {
+            return null;
+        }
+        
+        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
+        Object result = getValue(node);
+        return result;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object remove(Object oldInstance) {
+        //TODO - notify references on node deletion
+        if(oldInstance == null) {
+            return null;
+        }
+        
+        ObjectNode node = (ObjectNode) nodes.remove(oldInstance);
+        return getValue(node);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public PersistenceDelegate getPersistenceDelegate(Class type) {
+        PersistenceDelegate result =
+                (PersistenceDelegate) persistenceDelegates.get(type);
+        
+        if(result == null) {
+             result = DefaultPersistenceDelegatesFactory.getPersistenceDelegate(
+                     type);
+        }
+        
+        return result;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void setPersistenceDelegate(Class type,
+            PersistenceDelegate persistenceDelegate) {
+        persistenceDelegates.put(type, persistenceDelegate);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void writeObject(Object object) {
+        roots.add(object);
+        doWriteObject(object);
+    }
+    
+    void doWriteObject(Object object) {
+           PersistenceDelegate pd = (object != null) ?
+               getPersistenceDelegate(object.getClass()) :
+                   new NullPersistenceDelegate();
+               
+           if(pd == null) {
+               pd = new DefaultPersistenceDelegate();
+           }
+           
+           pd.writeObject(object, this);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void writeStatement(Statement oldStm) {
+        ObjectNode node = (ObjectNode) nodes.get(oldStm.getTarget());
+        if(node != null) {
+            try {
+                Object[] oldArgs = oldStm.getArguments();
+                Object[] newArgs = write(oldArgs);
+                
+                Statement statement = new Statement(node.getObjectValue(),
+                        oldStm.getMethodName(), oldArgs);
+                node.addStatement(statement);
+            } catch (Exception e) {
+                getExceptionListener().exceptionThrown(e);
+            }
+        } else {
+            System.out.println("no node is found for statement with target = "
+                    + oldStm.getTarget());
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void writeExpression(Expression oldExp) {
+        try {
+            Object oldInstance = oldExp.getValue();
+            
+            ObjectNode node = null;
+            Class type = null;
+            
+            if(oldInstance != null) {
+                type = oldInstance.getClass();
+                node = (ObjectNode) nodes.get(oldInstance);
+            }
+            
+            if(node == null) {
+                if(isNull(type) || isPrimitive(type) || isString(type)
+                        || isClass(type)) {
+                    node = new ObjectNode(oldExp);
+                } else {
+                    write(oldExp.getArguments());
+                    node = new ObjectNode(oldExp, nodes);
+                }
+                
+                nodes.put(oldInstance, node);
+                
+                // if an expression is not a constructor
+                if(!(oldExp.getTarget() instanceof Class)) {
+                    ObjectNode parent = (ObjectNode) nodes.get(
+                            oldExp.getTarget());
+                    parent.addExpression(oldExp);
+                }
+            } else if(oldExp.getMethodName().equals("new")) {
+                node.addReference();
+            } else {
+                node.addReferencedExpression(oldExp);
+            }
+        } catch (Exception e) {
+            // TODO - remove written args
+            getExceptionListener().exceptionThrown(e);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void setExceptionListener(ExceptionListener exceptionListener) {
+        this.exceptionListener = exceptionListener;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public ExceptionListener getExceptionListener() {
+        if(exceptionListener == null) {
+            exceptionListener = new ExceptionListener() {
+                public void exceptionThrown(Exception e) {
+                    System.out.println(e.getClass() + ": " + e.getMessage());
+                }
+            };
+        }
+        
+        return exceptionListener;
+    }
+    
+    private Object write(Object oldInstance) throws Exception {
+        if(oldInstance == null) {
+            return null;
+        }
+
+        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
+        if(node == null) {
+            Class type = oldInstance.getClass();
+            
+            if(isPrimitive(type) || isString(type) || isClass(type)) {
+                Expression expr = new Expression(type, "new",
+                        new Object[] { oldInstance });
+                nodes.put(oldInstance, new ObjectNode(expr));
+            } else {
+                doWriteObject(oldInstance);
+            }
+            
+            node = (ObjectNode) nodes.get(oldInstance);
+        } else {
+            node.addReference();
+        }
+        
+        return node.getObjectValue();
+    }
+    
+    private Object[] write(Object[] oldInstances) throws Exception {
+        if(oldInstances != null) {
+            Object[] newInstances = new Object[oldInstances.length];
+            
+            for(int i = 0; i < oldInstances.length; ++i) {
+                newInstances[i] = write(oldInstances[i]);
+            }
+            
+            return newInstances;
+        }
+        
+        return null;
+    }
+
+    private Object getValue(ObjectNode node) {
+        if(node != null) {
+            try {
+                Object result = node.getObjectValue();
+                return result;
+            } catch (Exception e) {
+                getExceptionListener().exceptionThrown(e);
+            }
+        }
+        
+        return null;
+    }
+    
+    static boolean isNull(Class type) {
+        return (type == null);
+    }
+    
+    static boolean isPrimitive(Class type) {
+        return (type == Boolean.class) || (type == Byte.class) ||
+            (type == Character.class) || (type == Double.class) ||
+            (type == Float.class) || (type == Integer.class) ||
+            (type == Long.class) || (type == Short.class);
+    }
+    
+    static boolean isString(Class type) {
+        return (type == String.class);
+        
+    }
+    
+    static boolean isClass(Class type) {
+        return (type == Class.class);
+    }
+    
+    
+    static boolean isArray(Class type) {
+        return type.isArray();
+    }
+    
+    static String getPrimitiveName(Class type) {
+        String result = null;
+        
+        if(type == Boolean.class) {
+            result = "boolean";
+        } else if(type == Byte.class) {
+            result = "byte";
+        } else if(type == Character.class) {
+            result = "char";
+        } else if(type == Double.class) {
+            result = "double";
+        } else if(type == Float.class) {
+            result = "float";
+        } else if(type == Integer.class) {
+            result = "int";
+        } else if(type == Long.class) {
+            result = "long";
+        } else if(type == Short.class) {
+            result = "short";
+        } else if(type == String.class) {
+            result = "string";
+        } else if(type == Class.class) {
+            result = "class";
+        }
+        
+        return result;
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java?rev=390246&r1=390245&r2=390246&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
Thu Mar 30 13:34:23 2006
@@ -479,8 +479,8 @@
             Collection col = new ArrayList();
             
             // Remove all children from BeanContext that are in the collection
-            // one by one. This operation is successfull if all the
-            // removals succeded
+            // one by one. This operation is successful if all the
+            // removals succeeded
             for (Iterator i = iterator(); i.hasNext(); ) {
                 try {  
                     Object next = i.next();
@@ -1066,8 +1066,8 @@
             Collection col = new ArrayList();
             
             // Remove all children from BeanContext that are in the collection
-            // one by one. This operation is successfull if all the
-            // removals succeded
+            // one by one. This operation is successful if all the
+            // removals succeeded
             for (Iterator i = c.iterator(); i.hasNext(); ) {
                 try {
                     Object next = i.next();
@@ -1153,7 +1153,7 @@
                 
                 // Remove all children from BeanContext that are not in the 
                 // collection
-                // This operation is successfull if all the removals succeded
+                // This operation is successful if all the removals succeeded
                 for (Iterator i = iterator(); i.hasNext(); ) {   
                     Object nextKey = i.next();
                     Object nextValue = this.children.get(nextKey);



Mime
View raw message