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/07/25 06:40:30 UTC
svn commit: r559312 [2/2] - in /harmony/enhanced/classlib/branches/java6:
depends/ depends/build/ depends/jars/
modules/awt/src/main/java/common/java/awt/
modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/
modules/awt/src/main/java/unix/org...
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java Tue Jul 24 21:40:21 2007
@@ -24,7 +24,7 @@
public class IndexedPropertyDescriptor extends PropertyDescriptor {
- private Class indexedPropertyType;
+ private Class<?> indexedPropertyType;
private Method indexedGetter;
@@ -54,18 +54,19 @@
setIndexedByName(beanClass, indexedGetterName, indexedSetterName);
}
- private void setIndexedByName(Class beanClass, String indexedGetterName,
+ private void setIndexedByName(Class<?> beanClass, String indexedGetterName,
String indexedSetterName) throws IntrospectionException {
- if (indexedGetterName == null) {
+ String theIndexedGetterName = indexedGetterName;
+ if (theIndexedGetterName == null) {
if (indexedSetterName != null) {
setIndexedWriteMethod(beanClass, indexedSetterName);
}
} else {
- if (indexedGetterName.length() == 0) {
- indexedGetterName = "get" + name;
+ if (theIndexedGetterName.length() == 0) {
+ theIndexedGetterName = "get" + name; //$NON-NLS-1$
}
- setIndexedReadMethod(beanClass, indexedGetterName);
+ setIndexedReadMethod(beanClass, theIndexedGetterName);
if (indexedSetterName != null) {
setIndexedWriteMethod(beanClass, indexedSetterName,
indexedPropertyType);
@@ -79,12 +80,12 @@
}
private boolean isCompatible() {
- Class propertyType = getPropertyType();
+ Class<?> propertyType = getPropertyType();
if (propertyType == null) {
return true;
}
- Class componentTypeOfProperty = propertyType.getComponentType();
+ Class<?> componentTypeOfProperty = propertyType.getComponentType();
if (componentTypeOfProperty == null) {
return false;
}
@@ -233,7 +234,7 @@
return indexedPropertyType;
}
- private void setIndexedReadMethod(Class beanClass, String indexedGetterName)
+ private void setIndexedReadMethod(Class<?> beanClass, String indexedGetterName)
throws IntrospectionException {
Method getter;
try {
@@ -249,15 +250,15 @@
internalSetIndexedReadMethod(getter);
}
- private void internalSetIndexedReadMethod(Method indexedGetter)
+ private void internalSetIndexedReadMethod(Method indexGetter)
throws IntrospectionException {
// Clearing the indexed read method.
- if (indexedGetter == null) {
+ if (indexGetter == null) {
if (indexedSetter == null) {
if (getPropertyType() != null) {
// beans.5A=Indexed method is not compatible with non indexed method
throw new IntrospectionException(Messages
- .getString("beans.5A"));
+ .getString("beans.5A")); //$NON-NLS-1$
}
indexedPropertyType = null;
}
@@ -265,17 +266,17 @@
return;
}
// Validate the indexed getter.
- if ((indexedGetter.getParameterTypes().length != 1)
- || (indexedGetter.getParameterTypes()[0] != Integer.TYPE)) {
+ if ((indexGetter.getParameterTypes().length != 1)
+ || (indexGetter.getParameterTypes()[0] != Integer.TYPE)) {
// beans.5B=Indexed read method must take a single int argument
throw new IntrospectionException(Messages.getString("beans.5B")); //$NON-NLS-1$
}
- Class indexedReadType = indexedGetter.getReturnType();
+ Class<?> indexedReadType = indexGetter.getReturnType();
if (indexedReadType == Void.TYPE) {
// beans.5B=Indexed read method must take a single int argument
throw new IntrospectionException(Messages.getString("beans.5B")); //$NON-NLS-1$
} else if (indexedSetter != null
- && indexedGetter.getReturnType() != indexedSetter
+ && indexGetter.getReturnType() != indexedSetter
.getParameterTypes()[1]) {
// beans.5A=Indexed read method is not compatible with indexed write method
throw new IntrospectionException(Messages.getString("beans.5A")); //$NON-NLS-1$
@@ -293,10 +294,10 @@
}
// Set the indexed getter
- this.indexedGetter = indexedGetter;
+ this.indexedGetter = indexGetter;
}
- private void setIndexedWriteMethod(Class beanClass, String indexedSetterName)
+ private void setIndexedWriteMethod(Class<?> beanClass, String indexedSetterName)
throws IntrospectionException {
Method setter = null;
try {
@@ -312,8 +313,8 @@
internalSetIndexedWriteMethod(setter, true);
}
- private void setIndexedWriteMethod(Class beanClass,
- String indexedSetterName, Class argType)
+ private void setIndexedWriteMethod(Class<?> beanClass,
+ String indexedSetterName, Class<?> argType)
throws IntrospectionException {
try {
Method setter = beanClass.getMethod(indexedSetterName, new Class[] {
@@ -328,15 +329,15 @@
}
}
- private void internalSetIndexedWriteMethod(Method indexedSetter,
+ private void internalSetIndexedWriteMethod(Method indexSetter,
boolean initialize) throws IntrospectionException {
// Clearing the indexed write method.
- if (indexedSetter == null) {
+ if (indexSetter == null) {
if (indexedGetter == null) {
if (getPropertyType() != null) {
// beans.5E=Indexed method is not compatible with non indexed method
throw new IntrospectionException(Messages
- .getString("beans.5E"));
+ .getString("beans.5E")); //$NON-NLS-1$
}
indexedPropertyType = null;
}
@@ -345,7 +346,7 @@
}
// Validate the indexed write method.
- Class[] indexedSetterArgs = indexedSetter.getParameterTypes();
+ Class[] indexedSetterArgs = indexSetter.getParameterTypes();
if (indexedSetterArgs.length != 2) {
// beans.5F=Indexed write method must take two arguments
throw new IntrospectionException(Messages.getString("beans.5F")); //$NON-NLS-1$
@@ -357,7 +358,7 @@
// Set the indexed property type if not already set, confirm validity if
// it is.
- Class indexedWriteType = indexedSetterArgs[1];
+ Class<?> indexedWriteType = indexedSetterArgs[1];
if (initialize && indexedGetter == null) {
indexedPropertyType = indexedWriteType;
} else {
@@ -368,7 +369,7 @@
}
// Set the indexed write method.
- this.indexedSetter = indexedSetter;
+ this.indexedSetter = indexSetter;
}
private static String initialUpperCase(String string) {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Introspector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Introspector.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Introspector.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Introspector.java Tue Jul 24 21:40:21 2007
@@ -83,7 +83,7 @@
// The cache to store Bean Info objects that have been found or created
private static final int DEFAULT_CAPACITY = 128;
- private static Map<Class, StandardBeanInfo> theCache = Collections.synchronizedMap(new WeakHashMap<Class, StandardBeanInfo>(DEFAULT_CAPACITY));
+ private static Map<Class<?>, StandardBeanInfo> theCache = Collections.synchronizedMap(new WeakHashMap<Class<?>, StandardBeanInfo>(DEFAULT_CAPACITY));
private Introspector() {
super();
@@ -253,7 +253,7 @@
searchPath = path;
}
- private static StandardBeanInfo getBeanInfoImpl(Class beanClass, Class stopClass,
+ private static StandardBeanInfo getBeanInfoImpl(Class<?> beanClass, Class<?> stopClass,
int flags) throws IntrospectionException {
BeanInfo explicitInfo = null;
if (flags == USE_ALL_BEANINFO) {
@@ -269,11 +269,11 @@
}
// recursive get beaninfo for super classes
- Class beanSuperClass = beanClass.getSuperclass();
+ Class<?> beanSuperClass = beanClass.getSuperclass();
if (beanSuperClass != stopClass) {
if (beanSuperClass == null)
throw new IntrospectionException(
- "Stop class is not super class of bean class");
+ "Stop class is not super class of bean class"); //$NON-NLS-1$
int superflags = flags == IGNORE_IMMEDIATE_BEANINFO ? USE_ALL_BEANINFO
: flags;
BeanInfo superBeanInfo = getBeanInfoImpl(beanSuperClass, stopClass,
@@ -285,7 +285,7 @@
return beanInfo;
}
- private static BeanInfo getExplicitBeanInfo(Class beanClass) {
+ private static BeanInfo getExplicitBeanInfo(Class<?> beanClass) {
BeanInfo theBeanInfo = null;
String beanInfoClassName = beanClass.getName() + "BeanInfo"; //$NON-NLS-1$
try{
@@ -297,7 +297,7 @@
int index = beanInfoClassName.lastIndexOf('.');
String beanInfoName = index>=0? beanInfoClassName.substring(index+1):beanInfoClassName;
for (int i = 0; i < searchPath.length; i++) {
- beanInfoClassName = searchPath[i] + "." + beanInfoName;
+ beanInfoClassName = searchPath[i] + "." + beanInfoName; //$NON-NLS-1$
try{
theBeanInfo = loadBeanInfo(beanInfoClassName, beanClass);
break;
@@ -322,7 +322,7 @@
* are problems instantiating the instance
*/
private static BeanInfo loadBeanInfo(String beanInfoClassName,
- Class beanClass) throws Exception{
+ Class<?> beanClass) throws Exception{
try {
ClassLoader cl = beanClass.getClassLoader();
if(cl != null){
@@ -342,8 +342,8 @@
Thread.currentThread().getContextClassLoader()).newInstance();
}
- private static StandardBeanInfo getBeanInfoImplAndInit(Class beanClass,
- Class stopClass, int flag) throws IntrospectionException {
+ private static StandardBeanInfo getBeanInfoImplAndInit(Class<?> beanClass,
+ Class<?> stopClass, int flag) throws IntrospectionException {
StandardBeanInfo standardBeanInfo = getBeanInfoImpl(beanClass,
stopClass, flag);
standardBeanInfo.init();
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ParameterDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ParameterDescriptor.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ParameterDescriptor.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ParameterDescriptor.java Tue Jul 24 21:40:21 2007
@@ -20,5 +20,6 @@
public class ParameterDescriptor extends FeatureDescriptor {
public ParameterDescriptor() {
+ // do nothing
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -54,7 +54,7 @@
*/
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
- Class c = type.getSuperclass();
+ Class<?> c = type.getSuperclass();
if (null != c) {
PersistenceDelegate pd = enc.getPersistenceDelegate(c);
pd.initialize(c, oldInstance, newInstance, enc);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java Tue Jul 24 21:40:21 2007
@@ -184,7 +184,7 @@
ArrayList<PropertyChangeListener> result = new ArrayList<PropertyChangeListener>(
globalListeners);
for (String propertyName : children.keySet()) {
- PropertyChangeSupport namedListener = (PropertyChangeSupport) children
+ PropertyChangeSupport namedListener = children
.get(propertyName);
PropertyChangeListener[] listeners = namedListener
.getPropertyChangeListeners();
@@ -198,7 +198,7 @@
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
- PropertyChangeListener[] gListeners = (PropertyChangeListener[]) globalListeners
+ PropertyChangeListener[] gListeners = globalListeners
.toArray(new PropertyChangeListener[0]);
for (int i = 0; i < gListeners.length; i++) {
if (gListeners[i] instanceof Serializable) {
@@ -236,11 +236,13 @@
return new PropertyChangeEvent(source, propertyName, oldValue, newValue);
}
+ @SuppressWarnings("boxing")
private PropertyChangeEvent createPropertyChangeEvent(String propertyName,
boolean oldValue, boolean newValue) {
return new PropertyChangeEvent(source, propertyName, oldValue, newValue);
}
+ @SuppressWarnings("boxing")
private PropertyChangeEvent createPropertyChangeEvent(String propertyName,
int oldValue, int newValue) {
return new PropertyChangeEvent(source, propertyName, oldValue, newValue);
@@ -254,7 +256,7 @@
}
// Collect up the global listeners
- PropertyChangeListener[] gListeners = (PropertyChangeListener[]) globalListeners
+ PropertyChangeListener[] gListeners = globalListeners
.toArray(new PropertyChangeListener[0]);
// Fire the events for global listeners
for (int i = 0; i < gListeners.length; i++) {
@@ -263,7 +265,7 @@
// Fire the events for the property specific listeners if any
if (event.getPropertyName() != null) {
- PropertyChangeSupport namedListener = (PropertyChangeSupport) children
+ PropertyChangeSupport namedListener = children
.get(event.getPropertyName());
if (namedListener != null) {
namedListener.firePropertyChange(event);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorManager.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorManager.java Tue Jul 24 21:40:21 2007
@@ -27,6 +27,7 @@
private static final Map<Class<?>, Class<?>> registeredEditors = new HashMap<Class<?>, Class<?>>();
public PropertyEditorManager() {
+ // expected
}
public static void registerEditor(Class<?> targetType, Class<?> editorClass) {
@@ -58,6 +59,7 @@
try {
editor = (PropertyEditor) editorClass.newInstance();
} catch (Exception e) {
+ // expected
}
}
@@ -91,9 +93,11 @@
editorClass.asSubclass(PropertyEditorSupport.class);
break;
} catch (Exception e) {
+ // expected
}
}
} catch (Exception e) {
+ // expected
}
if(editorClass != null){
try {
@@ -101,6 +105,7 @@
// registeredEditors.put(targetType, editorClass);
editor = (PropertyEditor) editorClass.newInstance();
} catch (Exception e) {
+ // expected
}
}
}
@@ -112,11 +117,8 @@
if (sm != null) {
sm.checkPropertiesAccess();
}
- if(apath == null){
- apath = new String[0];
- }
synchronized(PropertyEditorManager.class){
- path = apath;
+ path = (apath == null)? new String[0] : apath;
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java Tue Jul 24 21:40:21 2007
@@ -47,6 +47,7 @@
}
public void paintValue(Graphics gfx, Rectangle box) {
+ // expected
}
public void setAsText(String text) throws IllegalArgumentException {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java Tue Jul 24 21:40:21 2007
@@ -23,7 +23,9 @@
public class SimpleBeanInfo implements BeanInfo {
- public SimpleBeanInfo() {}
+ public SimpleBeanInfo() {
+ // expected
+ }
public Image loadImage(String resourceName) {
if (null == resourceName) {
@@ -34,9 +36,8 @@
if (file != null) {
return Toolkit.getDefaultToolkit().createImage(file);
- } else {
- return null;
}
+ return null;
}
public PropertyDescriptor[] getPropertyDescriptors() {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java Tue Jul 24 21:40:21 2007
@@ -63,7 +63,7 @@
BeanInfo[] additionalBeanInfo = null;
- private Class beanClass;
+ private Class<?> beanClass;
private int defaultEventIndex = -1;
@@ -77,7 +77,7 @@
private boolean canRemovePropertyChangeListener;
- StandardBeanInfo(Class beanClass, BeanInfo explicitBeanInfo, Class stopClass)
+ StandardBeanInfo(Class<?> beanClass, BeanInfo explicitBeanInfo, Class<?> stopClass)
throws IntrospectionException {
assert (beanClass != null);
this.beanClass = beanClass;
@@ -138,22 +138,27 @@
}
}
+ @Override
public BeanInfo[] getAdditionalBeanInfo() {
return null;
}
+ @Override
public EventSetDescriptor[] getEventSetDescriptors() {
return events;
}
+ @Override
public MethodDescriptor[] getMethodDescriptors() {
return methods;
}
+ @Override
public PropertyDescriptor[] getPropertyDescriptors() {
return properties;
}
+ @Override
public BeanDescriptor getBeanDescriptor() {
if (explicitBeanInfo != null) {
BeanDescriptor beanDesc = explicitBeanInfo.getBeanDescriptor();
@@ -164,14 +169,17 @@
return new BeanDescriptor(beanClass);
}
+ @Override
public int getDefaultEventIndex() {
return this.defaultEventIndex;
}
+ @Override
public int getDefaultPropertyIndex() {
return this.defaultPropertyIndex;
}
+ @Override
public Image getIcon(int iconKind) {
return icon[iconKind - 1];
}
@@ -248,10 +256,10 @@
Method superGet = superDesc.getReadMethod();
Method superSet = superDesc.getWriteMethod();
- Class superType = superDesc.getPropertyType();
- Class superIndexedType = null;
- Class subType = ((PropertyDescriptor) value).getPropertyType();
- Class subIndexedType = null;
+ Class<?> superType = superDesc.getPropertyType();
+ Class<?> superIndexedType = null;
+ Class<?> subType = ((PropertyDescriptor) value).getPropertyType();
+ Class<?> subIndexedType = null;
if (value instanceof IndexedPropertyDescriptor) {
subIndexedType = ((IndexedPropertyDescriptor) value)
@@ -487,7 +495,7 @@
}
private MethodDescriptor[] introspectMethods(boolean includeSuper,
- Class introspectorClass) {
+ Class<?> introspectorClass) {
// Get the list of methods belonging to this class
Method[] basicMethods = includeSuper ? introspectorClass.getMethods()
@@ -515,7 +523,7 @@
MethodDescriptor[] theMethods = null;
if (methodCount > 0) {
theMethods = new MethodDescriptor[methodCount];
- theMethods = (MethodDescriptor[]) methodList.toArray(theMethods);
+ theMethods = methodList.toArray(theMethods);
}
return theMethods;
@@ -530,7 +538,8 @@
* @return The list of Properties as an array of PropertyDescriptors
* @throws IntrospectionException
*/
- private PropertyDescriptor[] introspectProperties(Class stopClass)
+ @SuppressWarnings("unchecked")
+ private PropertyDescriptor[] introspectProperties(Class<?> stopClass)
throws IntrospectionException {
// Get descriptors for the public methods
@@ -560,7 +569,7 @@
tempMethods.add(method);
}
}
- allMethods = (MethodDescriptor[]) tempMethods
+ allMethods = tempMethods
.toArray(new MethodDescriptor[0]);
}
}
@@ -570,9 +579,9 @@
// Put the properties found into the PropertyDescriptor array
ArrayList<PropertyDescriptor> propertyList = new ArrayList<PropertyDescriptor>();
- Iterator keys = propertyTable.keySet().iterator();
+ Iterator<String> keys = propertyTable.keySet().iterator();
while (keys.hasNext()) {
- String propertyName = (String) keys.next();
+ String propertyName = keys.next();
HashMap table = propertyTable.get(propertyName);
if (table == null) {
continue;
@@ -610,7 +619,7 @@
} else {
propertyDesc.setBound(false);
}
- if (table.get("isConstrained") == Boolean.TRUE) {
+ if (table.get("isConstrained") == Boolean.TRUE) { //$NON-NLS-1$
propertyDesc.setConstrained(true);
}
propertyList.add(propertyDesc);
@@ -632,6 +641,7 @@
return false;
}
+ @SuppressWarnings("nls")
private void introspectPropertyListener(Method theMethod) {
String methodName = theMethod.getName();
Class[] param = theMethod.getParameterTypes();
@@ -798,7 +808,7 @@
Class[] exceptions = theMethod.getExceptionTypes();
for (Class e : exceptions) {
if (e.equals(PropertyVetoException.class)) {
- table.put("isConstrained", Boolean.TRUE);
+ table.put("isConstrained", Boolean.TRUE); //$NON-NLS-1$
}
}
propertyTable.put(propertyName, table);
@@ -812,8 +822,8 @@
* @return the events
* @throws IntrospectionException
*/
- private EventSetDescriptor[] introspectEvents()
- throws IntrospectionException {
+ @SuppressWarnings("unchecked")
+ private EventSetDescriptor[] introspectEvents() {
// Get descriptors for the public methods
// FIXME: performance
MethodDescriptor[] theMethods = introspectMethods();
@@ -835,9 +845,9 @@
}
ArrayList<EventSetDescriptor> eventList = new ArrayList<EventSetDescriptor>();
- Iterator keys = eventTable.keySet().iterator();
+ Iterator<String> keys = eventTable.keySet().iterator();
while (keys.hasNext()) {
- String key = (String) keys.next();
+ String key = keys.next();
HashMap table = eventTable.get(key);
Method add = (Method) table.get(PREFIX_ADD);
Method remove = (Method) table.get(PREFIX_REMOVE);
@@ -847,7 +857,7 @@
}
Method get = (Method) table.get(PREFIX_GET);
- Class listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$
+ Class<?> listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$
Method[] listenerMethods = (Method[]) table.get("listenerMethods"); //$NON-NLS-1$
EventSetDescriptor eventSetDescriptor = new EventSetDescriptor(
decapitalize(key), listenerType, listenerMethods, add,
@@ -867,9 +877,9 @@
/*
* find the add, remove listener method
*/
- @SuppressWarnings( { "unchecked", "unchecked" })
+ @SuppressWarnings("unchecked")
private static void introspectListenerMethods(String type,
- Method theMethod, HashMap methodsTable) {
+ Method theMethod, HashMap<String, HashMap> methodsTable) {
String methodName = theMethod.getName();
if (methodName == null) {
return;
@@ -892,7 +902,7 @@
return;
}
- Class listenerType = paramTypes[0];
+ Class<?> listenerType = paramTypes[0];
if (!EventListener.class.isAssignableFrom(listenerType)) {
return;
@@ -902,7 +912,7 @@
return;
}
- HashMap table = (HashMap) methodsTable.get(eventName);
+ HashMap table = methodsTable.get(eventName);
if (table == null) {
table = new HashMap();
}
@@ -932,7 +942,7 @@
methodsTable.put(eventName, table);
}
- private static Method[] introspectListenerMethods(Class listenerType) {
+ private static Method[] introspectListenerMethods(Class<?> listenerType) {
Method[] methods = listenerType.getDeclaredMethods();
ArrayList<Method> list = new ArrayList<Method>();
for (int i = 0; i < methods.length; i++) {
@@ -952,7 +962,7 @@
@SuppressWarnings("unchecked")
private static void introspectGetListenerMethods(Method theMethod,
- HashMap methodsTable) {
+ HashMap<String, HashMap> methodsTable) {
String type = PREFIX_GET;
String methodName = theMethod.getName();
@@ -985,7 +995,7 @@
return;
}
- HashMap table = (HashMap) methodsTable.get(eventName);
+ HashMap table = methodsTable.get(eventName);
if (table == null) {
table = new HashMap();
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java Tue Jul 24 21:40:21 2007
@@ -63,27 +63,27 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- Object target = getTarget();
- String methodName = getMethodName();
- Object[] arguments = getArguments();
- String targetVar = target != null ? convertClassName(target.getClass()) : "null"; //$NON-NLS-1$
+ Object theTarget = getTarget();
+ String theMethodName = getMethodName();
+ Object[] theArguments = getArguments();
+ String targetVar = theTarget != null ? convertClassName(theTarget.getClass()) : "null"; //$NON-NLS-1$
sb.append(targetVar);
sb.append('.');
- sb.append(methodName);
+ sb.append(theMethodName);
sb.append('(');
- if (arguments != null) {
- for (int i = 0; i < arguments.length; ++i) {
+ if (theArguments != null) {
+ for (int i = 0; i < theArguments.length; ++i) {
if (i > 0) {
sb.append(", "); //$NON-NLS-1$
}
- if (arguments[i] == null) {
+ if (theArguments[i] == null) {
sb.append("null"); //$NON-NLS-1$
- } else if (arguments[i] instanceof String) {
+ } else if (theArguments[i] instanceof String) {
sb.append('"');
- sb.append(arguments[i].toString());
+ sb.append(theArguments[i].toString());
sb.append('"');
} else {
- sb.append(convertClassName(arguments[i].getClass()));
+ sb.append(convertClassName(theArguments[i].getClass()));
}
}
}
@@ -111,29 +111,29 @@
Object invokeMethod() throws Exception {
Object result = null;
try {
- Object target = getTarget();
- String methodName = getMethodName();
- Object[] arguments = getArguments();
- if (target.getClass().isArray()) {
- Method method = findArrayMethod(methodName, arguments);
- Object[] args = new Object[arguments.length + 1];
- args[0] = target;
- System.arraycopy(arguments, 0, args, 1, arguments.length);
+ Object theTarget = getTarget();
+ String theMethodName = getMethodName();
+ Object[] theArguments = getArguments();
+ if (theTarget.getClass().isArray()) {
+ Method method = findArrayMethod(theMethodName, theArguments);
+ Object[] args = new Object[theArguments.length + 1];
+ args[0] = theTarget;
+ System.arraycopy(theArguments, 0, args, 1, theArguments.length);
result = method.invoke(null, args);
- } else if (methodName.equals("newInstance") //$NON-NLS-1$
- && target == Array.class) {
- Class<?> componentType = (Class) arguments[0];
- int length = ((Integer) arguments[1]).intValue();
+ } else if (theMethodName.equals("newInstance") //$NON-NLS-1$
+ && theTarget == Array.class) {
+ Class<?> componentType = (Class) theArguments[0];
+ int length = ((Integer) theArguments[1]).intValue();
result = Array.newInstance(componentType, length);
- } else if (methodName.equals("new") //$NON-NLS-1$
- || methodName.equals("newInstance")) { //$NON-NLS-1$
- if (target instanceof Class) {
- Constructor<?> constructor = findConstructor((Class)target, arguments);
- result = constructor.newInstance(arguments);
+ } else if (theMethodName.equals("new") //$NON-NLS-1$
+ || theMethodName.equals("newInstance")) { //$NON-NLS-1$
+ if (theTarget instanceof Class) {
+ Constructor<?> constructor = findConstructor((Class)theTarget, theArguments);
+ result = constructor.newInstance(theArguments);
} else {
throw new NoSuchMethodException(this.toString());
}
- } else if (target instanceof Class) {
+ } else if (theTarget instanceof Class) {
Method method = null;
boolean found = false;
try {
@@ -142,36 +142,37 @@
* given Class object at first process only if the class
* differs from Class itself
*/
- if (target != Class.class) {
- method = findMethod((Class) target, methodName, arguments, true);
- result = method.invoke(null, arguments);
+ if (theTarget != Class.class) {
+ method = findMethod((Class) theTarget, theMethodName, theArguments, true);
+ result = method.invoke(null, theArguments);
found = true;
}
} catch (NoSuchMethodException e) {
+ // expected
}
if (!found) {
// static method was not found
// try to invoke method of Class object
- if (methodName.equals("forName") //$NON-NLS-1$
- && arguments.length == 1 && arguments[0] instanceof String) {
+ if (theMethodName.equals("forName") //$NON-NLS-1$
+ && theArguments.length == 1 && theArguments[0] instanceof String) {
// special handling of Class.forName(String)
try {
- result = Class.forName((String) arguments[0]);
+ result = Class.forName((String) theArguments[0]);
} catch (ClassNotFoundException e2) {
- result = Class.forName((String) arguments[0], true, Thread
+ result = Class.forName((String) theArguments[0], true, Thread
.currentThread().getContextClassLoader());
}
} else {
- method = findMethod(target.getClass(), methodName, arguments, false);
- result = method.invoke(target, arguments);
+ method = findMethod(theTarget.getClass(), theMethodName, theArguments, false);
+ result = method.invoke(theTarget, theArguments);
}
}
- } else if (target instanceof Iterator){
- final Iterator iterator = (Iterator) target;
- final Method method = findMethod(target.getClass(), methodName,
- arguments, false);
+ } else if (theTarget instanceof Iterator){
+ final Iterator<?> iterator = (Iterator) theTarget;
+ final Method method = findMethod(theTarget.getClass(), theMethodName,
+ theArguments, false);
if (iterator.hasNext()) {
- PrivilegedAction action = new PrivilegedAction() {
+ PrivilegedAction<Object> action = new PrivilegedAction<Object>() {
public Object run() {
try {
@@ -187,8 +188,8 @@
result = action.run();
}
} else {
- Method method = findMethod(target.getClass(), methodName, arguments, false);
- result = method.invoke(target, arguments);
+ Method method = findMethod(theTarget.getClass(), theMethodName, theArguments, false);
+ result = method.invoke(theTarget, theArguments);
}
} catch (InvocationTargetException ite) {
Throwable t = ite.getCause();
@@ -197,18 +198,18 @@
return result;
}
- private Method findArrayMethod(String methodName, Object[] arguments) throws NoSuchMethodException {
+ private Method findArrayMethod(String theMethodName, Object[] theArguments) throws NoSuchMethodException {
// the code below reproduces exact RI exception throwing behavior
- if (!methodName.equals("set") && !methodName.equals("get")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (!theMethodName.equals("set") && !theMethodName.equals("get")) { //$NON-NLS-1$ //$NON-NLS-2$
throw new NoSuchMethodException(Messages.getString("beans.3C")); //$NON-NLS-1$
- } else if (arguments.length > 0 && arguments[0].getClass() != Integer.class) {
+ } else if (theArguments.length > 0 && theArguments[0].getClass() != Integer.class) {
throw new ClassCastException(Messages.getString("beans.3D")); //$NON-NLS-1$
- } else if (methodName.equals("get") && (arguments.length != 1)) { //$NON-NLS-1$
+ } else if (theMethodName.equals("get") && (theArguments.length != 1)) { //$NON-NLS-1$
throw new ArrayIndexOutOfBoundsException(Messages.getString("beans.3E")); //$NON-NLS-1$
- } else if (methodName.equals("set") && (arguments.length != 2)) { //$NON-NLS-1$
+ } else if (theMethodName.equals("set") && (theArguments.length != 2)) { //$NON-NLS-1$
throw new ArrayIndexOutOfBoundsException(Messages.getString("beans.3F")); //$NON-NLS-1$
}
- if (methodName.equals("get")) { //$NON-NLS-1$
+ if (theMethodName.equals("get")) { //$NON-NLS-1$
return Array.class.getMethod("get", new Class[] { Object.class, //$NON-NLS-1$
int.class });
}
@@ -216,8 +217,8 @@
int.class, Object.class });
}
- private Constructor<?> findConstructor(Class targetClass, Object[] arguments) throws NoSuchMethodException {
- Class<?>[] argClasses = getClasses(arguments);
+ private Constructor<?> findConstructor(Class<?> targetClass, Object[] theArguments) throws NoSuchMethodException {
+ Class<?>[] argClasses = getClasses(theArguments);
Constructor<?> result = null;
Constructor<?>[] constructors = targetClass.getConstructors();
for (Constructor<?> constructor : constructors) {
@@ -297,7 +298,7 @@
int difference = comparator.compare(chosenOne, foundMethodsArr[i]);
//if 2 methods have same relevance, throw exception
if(difference == 0){
- throw new NoSuchMethodException("Cannot decide which method to call: "+methodName);
+ throw new NoSuchMethodException("Cannot decide which method to call: "+methodName); //$NON-NLS-1$
}
if(difference > 0){
chosenOne = foundMethodsArr[i];
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -35,7 +35,7 @@
try {
value = field[i].get(clz);
} catch (Exception e) {
- // expected
+ return;
}
if (value.getClass() == clz) {
pairs.put(value, field[i].getName());
@@ -51,7 +51,7 @@
} catch (Exception e) {
enc.getExceptionListener().exceptionThrown(e);
}
- return new Expression(oldInstance, field, "get",
+ return new Expression(oldInstance, field, "get", //$NON-NLS-1$
new Object[] { oldInstance.getClass() });
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -25,7 +25,9 @@
*
*/
class SwingAbstractButtonPersistenceDelegate extends DefaultPersistenceDelegate{
- protected void initialize(Class<?> type, Object oldInstance,
+ @Override
+ @SuppressWarnings({ "boxing", "nls" })
+ protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
// Call the initialization of the super type
super.initialize(type, oldInstance, newInstance, enc);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -20,12 +20,15 @@
import javax.swing.Box;
class SwingBoxPersistenceDelegate extends PersistenceDelegate {
- protected Expression instantiate(Object oldInstance, Encoder enc) {
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder enc) {
return new Expression(oldInstance, oldInstance.getClass(),
- "createVerticalBox", null);
+ "createVerticalBox", null); //$NON-NLS-1$
}
- protected void initialize(Class<?> type, Object oldInstance,
+ @Override
+ @SuppressWarnings({ "nls", "boxing" })
+ protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
Box box = (Box) oldInstance;
Expression getterExp = new Expression(box.getAlignmentX(), box,
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -22,7 +22,9 @@
class SwingDefaultComboBoxModelPersistenceDelegate extends
DefaultPersistenceDelegate {
- protected void initialize(Class<?> type, Object oldInstance,
+ @Override
+ @SuppressWarnings({ "nls", "boxing" })
+ protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
super.initialize(type, oldInstance, newInstance, enc);
@@ -42,7 +44,7 @@
// Get the current property value in the new environment
Object newVal = null;
try {
- newVal = new Expression(((DefaultComboBoxModel) newInstance), "getElementAt",
+ newVal = new Expression(newInstance, "getElementAt",
new Object[] { i }).getValue();
} catch (IndexOutOfBoundsException ex) {
// The newInstance has no elements, so current property
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -22,7 +22,9 @@
import javax.swing.JFrame;
class SwingJFramePersistenceDelegate extends DefaultPersistenceDelegate {
- protected void initialize(Class<?> type, Object oldInstance,
+ @Override
+ @SuppressWarnings("nls")
+ protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
// Call the initialization of the super type
super.initialize(type, oldInstance, newInstance, enc);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -21,7 +21,9 @@
class SwingJTabbedPanePersistenceDelegate extends
DefaultPersistenceDelegate {
- protected void initialize(Class<?> type, Object oldInstance,
+ @Override
+ @SuppressWarnings({ "nls", "boxing" })
+ protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
// Call the initialization of the super type
super.initialize(type, oldInstance, newInstance, enc);
@@ -66,11 +68,9 @@
enc.writeStatement(setterStm);
}
} else {
- PersistenceDelegate pd = enc
- .getPersistenceDelegate(targetVal.getClass());
- Statement setterStm = new Statement(oldInstance, "addTab",
- new Object[] { pane.getTitleAt(i), oldVal });
- enc.writeStatement(setterStm);
+ Statement setterStm = new Statement(oldInstance, "addTab",
+ new Object[] { pane.getTitleAt(i), oldVal });
+ enc.writeStatement(setterStm);
}
} catch (Exception ex) {
enc.getExceptionListener().exceptionThrown(ex);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -22,7 +22,7 @@
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
return new Expression(oldInstance, oldInstance.getClass(),
- "sharedInstance", null);
+ "sharedInstance", null); //$NON-NLS-1$
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -23,11 +23,12 @@
class UtilCollectionPersistenceDelegate extends
DefaultPersistenceDelegate {
@Override
+ @SuppressWarnings("nls")
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
- Collection oldList = (Collection) oldInstance, newList = (Collection)newInstance;
- Iterator oldIterator = oldList.iterator(), newIterator = newList.iterator();
+ Collection<?> oldList = (Collection) oldInstance, newList = (Collection)newInstance;
+ Iterator<?> oldIterator = oldList.iterator(), newIterator = newList.iterator();
for (; oldIterator.hasNext();) {
Expression getterExp = new Expression(oldIterator, "next", null);
try {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java Tue Jul 24 21:40:21 2007
@@ -20,10 +20,12 @@
import java.util.List;
class UtilListPersistenceDelegate extends DefaultPersistenceDelegate {
+ @Override
+ @SuppressWarnings({ "nls", "boxing" })
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
- List list = (List) oldInstance;
+ List<?> list = (List) oldInstance;
int size = list.size();
for (int i = 0; i < size; i++) {
Expression getterExp = new Expression(oldInstance, "get",
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java Tue Jul 24 21:40:21 2007
@@ -37,6 +37,10 @@
private transient ArrayList<VetoableChangeListener> globalListeners = new ArrayList<VetoableChangeListener>();
private Object source;
+
+ @SuppressWarnings("unused")
+ // for serialization
+ private int vetoableChangeSupportSerializedDataVersion = 2;
public VetoableChangeSupport(Object sourceBean) {
if (sourceBean == null) {
@@ -117,10 +121,10 @@
result.addAll(globalListeners);
}
- for (Iterator iterator = children.keySet().iterator(); iterator
+ for (Iterator<String> iterator = children.keySet().iterator(); iterator
.hasNext();) {
- String propertyName = (String) iterator.next();
- VetoableChangeSupport namedListener = (VetoableChangeSupport) children
+ String propertyName = iterator.next();
+ VetoableChangeSupport namedListener = children
.get(propertyName);
VetoableChangeListener[] childListeners = namedListener
.getVetoableChangeListeners();
@@ -129,7 +133,7 @@
childListeners[i]));
}
}
- return (VetoableChangeListener[]) (result
+ return (result
.toArray(new VetoableChangeListener[result.size()]));
}
@@ -163,6 +167,7 @@
} while (listener != null);
}
+ @SuppressWarnings("boxing")
public void fireVetoableChange(String propertyName, boolean oldValue,
boolean newValue) throws PropertyVetoException {
PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
@@ -170,6 +175,7 @@
doFirePropertyChange(event);
}
+ @SuppressWarnings("boxing")
public void fireVetoableChange(String propertyName, int oldValue,
int newValue) throws PropertyVetoException {
PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
@@ -230,6 +236,7 @@
try {
listener.vetoableChange(revertEvent);
} catch (PropertyVetoException ignored) {
+ // expected
}
}
throw pve;
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java Tue Jul 24 21:40:21 2007
@@ -47,7 +47,7 @@
public void exceptionThrown(Exception e) {
e.printStackTrace();
- System.err.println("Continue...");
+ System.err.println("Continue..."); //$NON-NLS-1$
}
}
@@ -57,13 +57,14 @@
HashMap<String, Object> idObjMap = new HashMap<String, Object>();
+ @Override
public void characters(char[] ch, int start, int length)
throws SAXException {
if (!inJavaElem) {
return;
}
if (readObjs.size() > 0) {
- Elem elem = (Elem) readObjs.peek();
+ Elem elem = readObjs.peek();
if (elem.isBasicType) {
String str = new String(ch, start, length);
elem.methodName = elem.methodName == null ? str
@@ -72,6 +73,8 @@
}
}
+ @SuppressWarnings("nls")
+ @Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if (!inJavaElem) {
@@ -100,7 +103,8 @@
}
}
- private void startObjectElem(Attributes attributes) throws SAXException {
+ @SuppressWarnings("nls")
+ private void startObjectElem(Attributes attributes) {
Elem elem = new Elem();
elem.isExpression = true;
elem.id = attributes.getValue("id");
@@ -114,7 +118,7 @@
}
private void obtainTarget(Elem elem, Attributes attributes) {
- String className = attributes.getValue("class");
+ String className = attributes.getValue("class"); //$NON-NLS-1$
if (className != null) {
try {
elem.target = classForName(className);
@@ -131,6 +135,7 @@
}
}
+ @SuppressWarnings("nls")
private void obtainMethod(Elem elem, Attributes attributes) {
elem.methodName = attributes.getValue("method");
if (elem.methodName != null) {
@@ -164,7 +169,8 @@
elem.methodName = "new"; // default method name
}
- private Class classForName(String className)
+ @SuppressWarnings("nls")
+ private Class<?> classForName(String className)
throws ClassNotFoundException {
if ("boolean".equals(className)) {
return Boolean.TYPE;
@@ -189,13 +195,14 @@
}
}
+ @SuppressWarnings("nls")
private void startArrayElem(Attributes attributes) {
Elem elem = new Elem();
elem.isExpression = true;
elem.id = attributes.getValue("id");
try {
// find componet class
- Class compClass = classForName(attributes.getValue("class"));
+ Class<?> compClass = classForName(attributes.getValue("class"));
// find length
int length = Integer.parseInt(attributes.getValue("length"));
// execute, new array instance
@@ -207,6 +214,7 @@
readObjs.push(elem);
}
+ @SuppressWarnings("nls")
private void startVoidElem(Attributes attributes) {
Elem elem = new Elem();
elem.id = attributes.getValue("id");
@@ -215,6 +223,7 @@
readObjs.push(elem);
}
+ @SuppressWarnings("nls")
private void startBasicElem(String tagName, Attributes attributes) {
Elem elem = new Elem();
elem.isBasicType = true;
@@ -225,12 +234,13 @@
readObjs.push(elem);
}
+ @Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (!inJavaElem) {
return;
}
- if ("java".equals(qName)) {
+ if ("java".equals(qName)) { //$NON-NLS-1$
inJavaElem = false;
return;
}
@@ -252,7 +262,7 @@
private Elem latestUnclosedElem() {
for (int i = readObjs.size() - 1; i >= 0; i--) {
- Elem elem = (Elem) readObjs.get(i);
+ Elem elem = readObjs.get(i);
if (!elem.isClosed) {
return elem;
}
@@ -287,11 +297,12 @@
return elem.result;
}
+ @SuppressWarnings("nls")
private Object executeCommon(Elem elem) throws Exception {
// pop args
ArrayList<Object> args = new ArrayList<Object>(5);
while (readObjs.peek() != elem) {
- Elem argElem = (Elem) readObjs.pop();
+ Elem argElem = readObjs.pop();
args.add(0, argElem.result);
}
// decide method name
@@ -316,14 +327,13 @@
if(elem.target == owner) {
if("getOwner".equals(method)) {
return owner;
- } else {
- Class[] c = new Class[args.size()];
- for(int i = 0; i < args.size(); i++) {
- c[i] = args.get(i).getClass();
- }
- Method m = owner.getClass().getMethod(method, c);
- return m.invoke(owner, args.toArray());
}
+ Class[] c = new Class[args.size()];
+ for(int i = 0; i < args.size(); i++) {
+ c[i] = args.get(i).getClass();
+ }
+ Method m = owner.getClass().getMethod(method, c);
+ return m.invoke(owner, args.toArray());
}
// execute
@@ -337,6 +347,7 @@
return buf.toString();
}
+ @SuppressWarnings("nls")
private Object executeBasic(Elem elem) throws Exception {
String tag = (String) elem.target;
String value = elem.methodName;
@@ -368,14 +379,17 @@
}
}
+ @Override
public void error(SAXParseException e) throws SAXException {
listener.exceptionThrown(e);
}
+ @Override
public void fatalError(SAXParseException e) throws SAXException {
listener.exceptionThrown(e);
}
+ @Override
public void warning(SAXParseException e) throws SAXException {
listener.exceptionThrown(e);
}
@@ -448,20 +462,17 @@
public XMLDecoder(InputStream inputStream, Object owner,
ExceptionListener listener) {
if (inputStream == null) {
- throw new IllegalArgumentException("Input stream cannot be null");
- }
- if (listener == null) {
- listener = new DefaultExceptionListener();
+ throw new IllegalArgumentException("Input stream cannot be null"); //$NON-NLS-1$
}
this.inputStream = inputStream;
this.owner = owner;
- this.listener = listener;
+ this.listener = (listener == null)? new DefaultExceptionListener(): listener;
try {
SAXParserFactory.newInstance().newSAXParser().parse(inputStream,
new SAXHandler());
} catch (Exception e) {
- listener.exceptionThrown(e);
+ this.listener.exceptionThrown(e);
}
}
@@ -504,11 +515,12 @@
* @return the next object
* @exception ArrayIndexOutOfBoundsException if no more objects to read
*/
+ @SuppressWarnings("nls")
public Object readObject() {
if (readObjIndex >= readObjs.size()) {
throw new ArrayIndexOutOfBoundsException("no more objects to read");
}
- Elem elem = (Elem) readObjs.get(readObjIndex);
+ Elem elem = readObjs.get(readObjIndex);
if (!elem.isClosed) {
// bad element, error occured while parsing
throw new ArrayIndexOutOfBoundsException("no more objects to read");
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java Tue Jul 24 21:40:21 2007
@@ -106,7 +106,7 @@
if (null != out) {
try {
this.out = new PrintWriter(
- new OutputStreamWriter(out, "UTF-8"), true);
+ new OutputStreamWriter(out, "UTF-8"), true); //$NON-NLS-1$
} catch (UnsupportedEncodingException e) {
// never occur
e.printStackTrace();
@@ -120,7 +120,7 @@
*/
public void close() {
flush();
- out.println("</java>");
+ out.println("</java>"); //$NON-NLS-1$
out.close();
}
@@ -137,7 +137,8 @@
* writtern. Then all pending objects since last flush are writtern.
* </p>
*/
- public void flush() {
+ @SuppressWarnings("nls")
+ public void flush() {
synchronized (this) {
// write xml header
if (!hasXmlHeader) {
@@ -149,7 +150,7 @@
}
// preprocess pending objects
- for (Iterator iter = flushPending.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();) {
Object o = iter.next();
Record rec = (Record) records.get(o);
if (rec != null) {
@@ -158,7 +159,7 @@
}
// flush pending objects
- for (Iterator iter = flushPending.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();) {
Object o = iter.next();
flushObject(o, INDENT_UNIT);
// remove flushed obj
@@ -174,7 +175,8 @@
}
}
- private void flushBasicObject(Object obj, int indent) {
+ @SuppressWarnings("nls")
+ private void flushBasicObject(Object obj, int indent) {
if( obj instanceof Proxy) {
return;
}
@@ -236,7 +238,8 @@
}
}
- private void flushExpression(Object obj, Record rec, int indent,
+ @SuppressWarnings("nls")
+ private void flushExpression(Object obj, Record rec, int indent,
boolean asStatement) {
// not first time, use idref
if (rec.id != null) {
@@ -261,7 +264,7 @@
private void flushIndent(int indent) {
for (int i = 0; i < indent; i++) {
- out.print(" ");
+ out.print(" "); //$NON-NLS-1$
}
}
@@ -287,7 +290,8 @@
}
}
- private void flushOwner(Object obj, Record rec, int indent) {
+ @SuppressWarnings("nls")
+ private void flushOwner(Object obj, Record rec, int indent) {
if (rec.refCount > 1) {
rec.id = nameForClass(obj.getClass()) + idSerialNo;
idSerialNo++;
@@ -329,7 +333,8 @@
out.println(">");
}
- private void flushStatArray(Statement stat, String id, List subStats,
+ @SuppressWarnings("nls")
+ private void flushStatArray(Statement stat, String id, List<?> subStats,
int indent) {
// open tag, begin
flushIndent(indent);
@@ -364,7 +369,8 @@
out.println("</array>");
}
- private void flushStatCommon(Statement stat, String id, List subStats,
+ @SuppressWarnings("nls")
+ private void flushStatCommon(Statement stat, String id, List<?> subStats,
int indent) {
// open tag, begin
flushIndent(indent);
@@ -415,7 +421,8 @@
out.println(">");
}
- private void flushStatement(Statement stat, String id, List subStats,
+ @SuppressWarnings("nls")
+ private void flushStatement(Statement stat, String id, List<?> subStats,
int indent) {
Object target = stat.getTarget();
String method = stat.getMethodName();
@@ -440,7 +447,7 @@
if (isStaticConstantsSupported
&& "getField".equals(stat.getMethodName())) {
- flushStatField(stat, id, subStats, indent);
+ flushStatField(stat, id, indent);
return;
}
@@ -448,7 +455,8 @@
flushStatCommon(stat, id, subStats, indent);
}
- private void flushStatField(Statement stat, String id, List subStats,
+ @SuppressWarnings("nls")
+ private void flushStatField(Statement stat, String id,
int indent) {
// open tag, begin
flushIndent(indent);
@@ -483,15 +491,16 @@
out.print(stat.getMethodName());
out.print("\"");
out.println(">");
- Object fieldName = (String) stat.getArguments()[0];
+ Object fieldName = stat.getArguments()[0];
flushObject(fieldName, indent + INDENT_UNIT);
flushIndent(indent);
out.println("</object>");
}
}
- private void flushStatGetterSetter(Statement stat, String id,
- List subStats, int indent) {
+ @SuppressWarnings("nls")
+ private void flushStatGetterSetter(Statement stat, String id,
+ List<?> subStats, int indent) {
// open tag, begin
flushIndent(indent);
String tagName = stat instanceof Expression ? "object" : "void";
@@ -539,7 +548,8 @@
out.println(">");
}
- private void flushStatIndexed(Statement stat, String id, List subStats,
+ @SuppressWarnings("nls")
+ private void flushStatIndexed(Statement stat, String id, List<?> subStats,
int indent) {
// open tag, begin
flushIndent(indent);
@@ -588,7 +598,8 @@
out.println(">");
}
- private void flushString(String s) {
+ @SuppressWarnings("nls")
+ private void flushString(String s) {
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
@@ -608,7 +619,7 @@
}
}
- private void flushSubStatements(List subStats, int indent) {
+ private void flushSubStatements(List<?> subStats, int indent) {
for (int i = 0; i < subStats.size(); i++) {
Statement subStat = (Statement) subStats.get(i);
try {
@@ -647,35 +658,33 @@
}
private boolean isGetArrayStat(Object target, String method, Object[] args) {
- return ("get".equals(method) && args.length == 1
+ return ("get".equals(method) && args.length == 1 //$NON-NLS-1$
&& args[0] instanceof Integer && target.getClass().isArray());
}
private boolean isGetPropertyStat(String method, Object[] args) {
- return (method.startsWith("get") && method.length() > 3 && args.length == 0);
+ return (method.startsWith("get") && method.length() > 3 && args.length == 0); //$NON-NLS-1$
}
private boolean isSetArrayStat(Object target, String method, Object[] args) {
- return ("set".equals(method) && args.length == 2
+ return ("set".equals(method) && args.length == 2 //$NON-NLS-1$
&& args[0] instanceof Integer && target.getClass().isArray());
}
private boolean isSetPropertyStat(String method, Object[] args) {
- return (method.startsWith("set") && method.length() > 3 && args.length == 1);
+ return (method.startsWith("set") && method.length() > 3 && args.length == 1); //$NON-NLS-1$
}
- private String nameForClass(Class c) {
+ private String nameForClass(Class<?> c) {
if (c.isArray()) {
- return nameForClass(c.getComponentType()) + "Array";
- } else {
- String name = c.getName();
- int i = name.lastIndexOf('.');
- if (-1 == i) {
- return name;
- } else {
- return name.substring(i + 1);
- }
+ return nameForClass(c.getComponentType()) + "Array"; //$NON-NLS-1$
}
+ String name = c.getName();
+ int i = name.lastIndexOf('.');
+ if (-1 == i) {
+ return name;
+ }
+ return name.substring(i + 1);
}
/*
@@ -698,7 +707,7 @@
// deal with 'field' property
try {
if (isStaticConstantsSupported
- && "getField".equals(((Record) records.get(rec.exp
+ && "getField".equals(((Record) records.get(rec.exp //$NON-NLS-1$
.getTarget())).exp.getMethodName())) {
records.remove(obj);
}
@@ -717,7 +726,7 @@
}
}
- for (Iterator iter = rec.stats.iterator(); iter.hasNext();) {
+ for (Iterator<?> iter = rec.stats.iterator(); iter.hasNext();) {
Statement subStat = (Statement) iter.next();
if (subStat instanceof Expression) {
try {
@@ -765,14 +774,10 @@
if (rec.exp == null) {
// it is generated by its sub stats
- for (Iterator iter = rec.stats.iterator(); iter.hasNext();) {
+ for (Iterator<?> iter = rec.stats.iterator(); iter.hasNext();) {
Statement stat = (Statement) iter.next();
try {
if (stat instanceof Expression) {
- // Expression expr = (Expression) stat;
- // Object subObj = expr.getValue();
- // if(expr.getTarget().getClass() ==
- // Class.class.getClass())
flushPrePending.add(value);
}
} catch (Exception e) {
@@ -822,7 +827,8 @@
* Records the expression so that it can be writtern out later, then calls
* super implementation.
*/
- public void writeExpression(Expression oldExp) {
+ @Override
+ public void writeExpression(Expression oldExp) {
boolean oldWritingObject = writingObject;
writingObject = true;
// get expression value
@@ -832,7 +838,7 @@
} catch (Exception e) {
getExceptionListener()
.exceptionThrown(
- new Exception("failed to execute expression: "
+ new Exception("failed to execute expression: " //$NON-NLS-1$
+ oldExp, e));
return;
}
@@ -855,7 +861,8 @@
* Records the object so that it can be writtern out later, then calls super
* implementation.
*/
- public void writeObject(Object o) {
+ @Override
+ public void writeObject(Object o) {
synchronized (this) {
boolean oldWritingObject = writingObject;
writingObject = true;
@@ -889,7 +896,8 @@
* Records the statement so that it can be writtern out later, then calls
* super implementation.
*/
- public void writeStatement(Statement oldStat) {
+ @Override
+ public void writeStatement(Statement oldStat) {
// record how the object is changed
recordStatement(oldStat);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java Tue Jul 24 21:40:21 2007
@@ -973,6 +973,75 @@
assertEquals(manager, aManager);
assertEquals(manager.getDismissDelay(), aManager.getDismissDelay());
}
+
+ public static class DummyBean {
+
+ private String value;
+
+ public DummyBean() {
+ }
+
+ public DummyBean(String s) {
+ value = s;
+ }
+
+ public String getDummyValue() {
+ return value;
+ }
+
+ public void setDummyValue(String s) {
+ value = s;
+ }
+
+ public boolean equals(Object bean) {
+ if (!(bean instanceof DummyBean)) {
+ return false;
+ }
+ DummyBean aBean = (DummyBean) bean;
+
+ if (aBean.value == null && value != null || value != null
+ && aBean.value == null) {
+ return false;
+ } else if(value != null && aBean.value != null){
+ return value.equals(aBean.value);
+ }
+ return true;
+ }
+ }
+ public void test_writeExpression_writeObject() {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ XMLEncoder encoder = new XMLEncoder( output );
+
+ Date date = new Date(2007, 06, 26);
+ Expression expression = new Expression( date, "toString", null );
+ String date_string = null;
+ try {
+ date_string = (String) expression.getValue();
+ } catch (Exception e ) {
+ System.out.println("Failed to get the date value.");
+ e.printStackTrace();
+ }
+ DummyBean bean = new DummyBean( date_string );
+ // The expression knows about the date object.
+ encoder.writeExpression( expression );
+ encoder.writeObject( date );
+ // The value for the bean is already part of the expression
+ // so instead of writing the value we write a reference to
+ // the extpression.
+ encoder.writeObject( bean );
+
+ encoder.flush();
+ encoder.close();
+
+ DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+ output.toByteArray()));
+ XMLDecoder decoder = new XMLDecoder(stream);
+ Date aDate = (Date) decoder.readObject();
+ assertEquals(date, aDate);
+
+ DummyBean aBean = (DummyBean) decoder.readObject();
+ assertEquals(bean, aBean);
+ }
// <--
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java Tue Jul 24 21:40:21 2007
@@ -1918,5 +1918,7 @@
public void testSerializationForm(){
ObjectStreamClass objectStreamClass = ObjectStreamClass.lookup(VetoableChangeSupport.class);
assertNotNull(objectStreamClass.getField("source"));
+ assertNotNull(objectStreamClass.getField("children"));
+ assertNotNull(objectStreamClass.getField("vetoableChangeSupportSerializedDataVersion"));
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/NameParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/NameParser.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/NameParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/NameParser.java Tue Jul 24 21:40:21 2007
@@ -38,6 +38,6 @@
* when the supplied string violates format rules
* @throws NamingException
*/
- public Name parse(String s) throws InvalidNameException, NamingException;
+ public Name parse(String s) throws NamingException;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java Tue Jul 24 21:40:21 2007
@@ -104,7 +104,7 @@
* if any other exception is encountered
*/
public static Object getObjectInstance(Object o, Name n, Context c,
- Hashtable<?, ?> h, Attributes a) throws NamingException, Exception {
+ Hashtable<?, ?> h, Attributes a) throws Exception {
// 1. try ObjectFactoryBuilder, if it is set
if (null != ofb) {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/InputStreamReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/InputStreamReader.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/InputStreamReader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/InputStreamReader.java Tue Jul 24 21:40:21 2007
@@ -100,7 +100,8 @@
CodingErrorAction.REPLACE).onUnmappableCharacter(
CodingErrorAction.REPLACE);
} catch (IllegalArgumentException e) {
- throw new UnsupportedEncodingException();
+ throw (UnsupportedEncodingException)
+ new UnsupportedEncodingException().initCause(e);
}
bytes.limit(0);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/GregorianCalendar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/GregorianCalendar.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/GregorianCalendar.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/GregorianCalendar.java Tue Jul 24 21:40:21 2007
@@ -330,7 +330,7 @@
int dayOfYear = computeYearAndDay(days, timeVal + zoneOffset);
fields[DAY_OF_YEAR] = dayOfYear;
- if(fields[YEAR] == changeYear && gregorianCutover < timeVal + zoneOffset){
+ if(fields[YEAR] == changeYear && gregorianCutover <= timeVal + zoneOffset){
dayOfYear += currentYearSkew;
}
int month = dayOfYear / 32;
@@ -361,7 +361,7 @@
dayOfYear = computeYearAndDay(days, timeVal - zoneOffset
+ dstOffset);
fields[DAY_OF_YEAR] = dayOfYear;
- if(fields[YEAR] == changeYear && gregorianCutover < timeVal - zoneOffset + dstOffset){
+ if(fields[YEAR] == changeYear && gregorianCutover <= timeVal - zoneOffset + dstOffset){
dayOfYear += currentYearSkew;
}
month = dayOfYear / 32;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java Tue Jul 24 21:40:21 2007
@@ -724,6 +724,17 @@
gc.setTimeInMillis(Date.parse("Dec 1 00:00:01 GMT 2000"));
assertEquals(1, gc.get(Calendar.DAY_OF_MONTH));
assertEquals(11, gc.get(Calendar.MONTH));
+
+ // Regression test for HARMONY-4513
+ gc = new GregorianCalendar(1582, Calendar.OCTOBER, 15);
+ assertEquals(1582, gc.get(Calendar.YEAR));
+ assertEquals(Calendar.OCTOBER, gc.get(Calendar.MONTH));
+ assertEquals(15, gc.get(Calendar.DAY_OF_MONTH));
+ assertEquals(0, gc.get(Calendar.HOUR_OF_DAY));
+ assertEquals(0, gc.get(Calendar.MINUTE));
+ assertEquals(0, gc.get(Calendar.SECOND));
+ gc = new GregorianCalendar(1582, Calendar.OCTOBER, 14);
+ assertEquals(24, gc.get(Calendar.DAY_OF_MONTH));
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java?view=diff&rev=559312&r1=559311&r2=559312
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java Tue Jul 24 21:40:21 2007
@@ -76,8 +76,10 @@
int rightCompY = leftCompY;
int rightCompWidth = container.getWidth() - leftCompWidth - divWidth - insets.left - insets.right;
- if (rightCompWidth < components[RIGHT_COMPONENT_INDEX].getMinimumSize().width
- && leftCompWidth > components[LEFT_COMPONENT_INDEX].getMinimumSize().width) {
+ if ((components[RIGHT_COMPONENT_INDEX] != null)
+ && (components[LEFT_COMPONENT_INDEX] != null)
+ && rightCompWidth < components[RIGHT_COMPONENT_INDEX].getMinimumSize().width
+ && leftCompWidth > components[LEFT_COMPONENT_INDEX].getMinimumSize().width) {
rightCompWidth = components[RIGHT_COMPONENT_INDEX].getMinimumSize().width;
leftCompWidth = container.getWidth() - rightCompWidth - divWidth - insets.left - insets.right;
@@ -122,9 +124,13 @@
int rightCompY = divY + divHeight;
int rightCompHeight = container.getHeight() - leftCompHeight - divHeight - insets.top - insets.bottom;
- if (rightCompHeight < components[RIGHT_COMPONENT_INDEX].getMinimumSize().height
- && leftCompHeight > components[LEFT_COMPONENT_INDEX].getMinimumSize().height) {
-
+ if ((components[RIGHT_COMPONENT_INDEX] != null)
+ && (components[LEFT_COMPONENT_INDEX] != null)
+ && rightCompHeight < components[RIGHT_COMPONENT_INDEX]
+ .getMinimumSize().height
+ && leftCompHeight > components[LEFT_COMPONENT_INDEX]
+ .getMinimumSize().height) {
+
rightCompHeight = components[RIGHT_COMPONENT_INDEX].getMinimumSize().height;
leftCompHeight = container.getHeight() - rightCompHeight - divHeight - insets.top - insets.bottom;