rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
catch (NullPointerException e) | } else { acc = null; } } if (acc == null) { acc = _hashAccessor; try { if (acc != null) | public Object getProperty (final Context context, final Object instance, final Object[] names, int start, int end) throws PropertyException { String propName; Object nextPropValue = null; Accessor acc = null; if (names[start] instanceof String) { propName = (String) names[start]; } else if (names[start] instanceof PropertyMethod) { PropertyMethod pm = (PropertyMethod) names[start]; propName = pm.getName(); acc = (Accessor) _directAccessors.get(propName); Object[] args = pm.getArguments(context); if (acc == null) { if (isMethodRestricted(instance.getClass(), propName)) throw new PropertyException.RestrictedMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } try { nextPropValue = acc.get(instance, args); start++; } catch (NoSuchMethodException e) { throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } } else { propName = names[start].toString(); } // unary? if (acc == null) { acc = (Accessor) _unaryAccessors.get(propName); if (acc != null) { try { nextPropValue = acc.get(instance); start++; } catch (NoSuchMethodException e) { acc = null; } } } // binary? if (acc == null) { acc = (Accessor) _binaryAccessors.get(propName);// if ((acc != null) && ((start + 1) <= end)) if ((acc != null) && ((start + 1) <= names.length)) { try { nextPropValue = acc.get(instance, (String) names[start + 1]); start += 2; } catch (NoSuchMethodException e) { acc = null; } catch (ClassCastException e) { // names[start + 1] was not a String, just move on // this catch is more efficient than using instanceof // since 90% of the time it really will be a string acc = null; } } else { acc = null; } } // hash? if (acc == null) { acc = _hashAccessor; try { if (acc != null) { nextPropValue = acc.get(instance, propName); start++; } } catch (NoSuchMethodException e) { acc = null; } } if (acc == null) { // user tried to access a property of a property that doesn't exist // ex: $TestObject.FirstName.NotThere // check if object is restricted if (isMethodRestricted(instance.getClass(), "get" + propName) || isMethodRestricted(instance.getClass(), "set" + propName)) throw new PropertyException.RestrictedPropertyException( propName, fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchPropertyException( propName, fillInName(names, start), instance.getClass().getName()); } if ( start <= end) { try { return _cache.getOperator(nextPropValue) .getProperty(context, nextPropValue, names, start, end); } catch (NullPointerException e) { // $Foo.getNull().SomeProperty is what makes this happen throw new PropertyException("$" + fillInName(names, start) + " is null. Cannot access ." + names[end]); } } else { return nextPropValue; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
throw new PropertyException("$" + fillInName(names, start) + " is null. Cannot access ." + names[end]); | nextPropValue = acc.get(instance, propName); start++; | public Object getProperty (final Context context, final Object instance, final Object[] names, int start, int end) throws PropertyException { String propName; Object nextPropValue = null; Accessor acc = null; if (names[start] instanceof String) { propName = (String) names[start]; } else if (names[start] instanceof PropertyMethod) { PropertyMethod pm = (PropertyMethod) names[start]; propName = pm.getName(); acc = (Accessor) _directAccessors.get(propName); Object[] args = pm.getArguments(context); if (acc == null) { if (isMethodRestricted(instance.getClass(), propName)) throw new PropertyException.RestrictedMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } try { nextPropValue = acc.get(instance, args); start++; } catch (NoSuchMethodException e) { throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } } else { propName = names[start].toString(); } // unary? if (acc == null) { acc = (Accessor) _unaryAccessors.get(propName); if (acc != null) { try { nextPropValue = acc.get(instance); start++; } catch (NoSuchMethodException e) { acc = null; } } } // binary? if (acc == null) { acc = (Accessor) _binaryAccessors.get(propName);// if ((acc != null) && ((start + 1) <= end)) if ((acc != null) && ((start + 1) <= names.length)) { try { nextPropValue = acc.get(instance, (String) names[start + 1]); start += 2; } catch (NoSuchMethodException e) { acc = null; } catch (ClassCastException e) { // names[start + 1] was not a String, just move on // this catch is more efficient than using instanceof // since 90% of the time it really will be a string acc = null; } } else { acc = null; } } // hash? if (acc == null) { acc = _hashAccessor; try { if (acc != null) { nextPropValue = acc.get(instance, propName); start++; } } catch (NoSuchMethodException e) { acc = null; } } if (acc == null) { // user tried to access a property of a property that doesn't exist // ex: $TestObject.FirstName.NotThere // check if object is restricted if (isMethodRestricted(instance.getClass(), "get" + propName) || isMethodRestricted(instance.getClass(), "set" + propName)) throw new PropertyException.RestrictedPropertyException( propName, fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchPropertyException( propName, fillInName(names, start), instance.getClass().getName()); } if ( start <= end) { try { return _cache.getOperator(nextPropValue) .getProperty(context, nextPropValue, names, start, end); } catch (NullPointerException e) { // $Foo.getNull().SomeProperty is what makes this happen throw new PropertyException("$" + fillInName(names, start) + " is null. Cannot access ." + names[end]); } } else { return nextPropValue; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
} else { return nextPropValue; } } | } catch (NoSuchMethodException e) { acc = null; } } if (acc == null) { if (isMethodRestricted(instance.getClass(), "get" + propName) || isMethodRestricted(instance.getClass(), "set" + propName)) throw new PropertyException.RestrictedPropertyException( propName, fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchPropertyException( propName, fillInName(names, start), instance.getClass().getName()); } if ( start <= end) { try { return _cache.getOperator(nextPropValue) .getProperty(context, nextPropValue, names, start, end); } catch (NullPointerException e) { throw new PropertyException("$" + fillInName(names, start) + " is null. Cannot access ." + names[end]); } } else { return nextPropValue; } } | public Object getProperty (final Context context, final Object instance, final Object[] names, int start, int end) throws PropertyException { String propName; Object nextPropValue = null; Accessor acc = null; if (names[start] instanceof String) { propName = (String) names[start]; } else if (names[start] instanceof PropertyMethod) { PropertyMethod pm = (PropertyMethod) names[start]; propName = pm.getName(); acc = (Accessor) _directAccessors.get(propName); Object[] args = pm.getArguments(context); if (acc == null) { if (isMethodRestricted(instance.getClass(), propName)) throw new PropertyException.RestrictedMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } try { nextPropValue = acc.get(instance, args); start++; } catch (NoSuchMethodException e) { throw new PropertyException.NoSuchMethodException( pm.toString(), fillInName(names, start), instance.getClass().getName()); } } else { propName = names[start].toString(); } // unary? if (acc == null) { acc = (Accessor) _unaryAccessors.get(propName); if (acc != null) { try { nextPropValue = acc.get(instance); start++; } catch (NoSuchMethodException e) { acc = null; } } } // binary? if (acc == null) { acc = (Accessor) _binaryAccessors.get(propName);// if ((acc != null) && ((start + 1) <= end)) if ((acc != null) && ((start + 1) <= names.length)) { try { nextPropValue = acc.get(instance, (String) names[start + 1]); start += 2; } catch (NoSuchMethodException e) { acc = null; } catch (ClassCastException e) { // names[start + 1] was not a String, just move on // this catch is more efficient than using instanceof // since 90% of the time it really will be a string acc = null; } } else { acc = null; } } // hash? if (acc == null) { acc = _hashAccessor; try { if (acc != null) { nextPropValue = acc.get(instance, propName); start++; } } catch (NoSuchMethodException e) { acc = null; } } if (acc == null) { // user tried to access a property of a property that doesn't exist // ex: $TestObject.FirstName.NotThere // check if object is restricted if (isMethodRestricted(instance.getClass(), "get" + propName) || isMethodRestricted(instance.getClass(), "set" + propName)) throw new PropertyException.RestrictedPropertyException( propName, fillInName(names, start), instance.getClass().getName()); throw new PropertyException.NoSuchPropertyException( propName, fillInName(names, start), instance.getClass().getName()); } if ( start <= end) { try { return _cache.getOperator(nextPropValue) .getProperty(context, nextPropValue, names, start, end); } catch (NullPointerException e) { // $Foo.getNull().SomeProperty is what makes this happen throw new PropertyException("$" + fillInName(names, start) + " is null. Cannot access ." + names[end]); } } else { return nextPropValue; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
static Object invoke (Method meth, Object instance, Object[] args) throws PropertyException { try { Object obj = meth.invoke(instance, args); if (obj == null && meth.getReturnType() == java.lang.Void.TYPE) return org.webmacro.engine.VoidMacro.instance; else return obj; } catch (IllegalAccessException e) { throw new PropertyException( "You don't have permission to access the requested method (" + meth + " in class " + instance.getClass() + " on object " + instance + "). Private/protected/package access " + " values cannot be accessed via property introspection.", e); } catch (IllegalArgumentException e) { throw new PropertyException( "Some kind of error occurred processing your request: this " + "indicates a failure in PropertyOperator.java that should be " + "reported: attempt to access method " + meth + " on object " + instance + " with " + args.length + " parameters " + " threw an exception: " + e, e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof PropertyException.UndefinedVariableException) throw (PropertyException) e.getTargetException(); throw new PropertyException( "Attempt to invoke method " + meth + " on object " + instance.getClass().getName() + " raised an exception: " + e.getTargetException().getClass().getName(), e.getTargetException()); } catch (NullPointerException e) { throw new PropertyException( "NullPointerException thrown from method " + meth + " on object " + instance + " -- most likely you have attempted " + "to use an undefined value, or a failure in that method.", e); } } | static Object invoke(Method meth, Object instance, Object[] args) throws PropertyException { try { Object obj = meth.invoke(instance, args); if (obj == null && meth.getReturnType() == java.lang.Void.TYPE) return org.webmacro.engine.VoidMacro.instance; else return obj; } catch (IllegalAccessException e) { throw new PropertyException( "You don't have permission to access the requested method (" + meth + " in class " + instance.getClass() + " on object " + instance + "). Private/protected/package access " + " values cannot be accessed via property introspection.", e); } catch (IllegalArgumentException e) { throw new PropertyException( "Some kind of error occurred processing your request: this " + "indicates a failure in PropertyOperator.java that should be " + "reported: attempt to access method " + meth + " on object " + instance + " with " + args.length + " parameters " + " threw an exception: " + e, e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof PropertyException.UndefinedVariableException) throw (PropertyException) e.getTargetException(); throw new PropertyException( "Attempt to invoke method " + meth + " on object " + instance.getClass().getName() + " raised an exception: " + e.getTargetException().getClass().getName(), e.getTargetException()); } catch (NullPointerException e) { throw new PropertyException( "NullPointerException thrown from method " + meth + " on object " + instance + " -- most likely you have attempted " + "to use an undefined value, or a failure in that method.", e); } } | static Object invoke (Method meth, Object instance, Object[] args) throws PropertyException { try { Object obj = meth.invoke(instance, args); // if the method's return type is void return the VoidMacro // instance, instead of the 'null' we used to return here // otherwise, just return whatever the method returned if (obj == null && meth.getReturnType() == java.lang.Void.TYPE) return org.webmacro.engine.VoidMacro.instance; else return obj; } catch (IllegalAccessException e) { throw new PropertyException( "You don't have permission to access the requested method (" + meth + " in class " + instance.getClass() + " on object " + instance + "). Private/protected/package access " + " values cannot be accessed via property introspection.", e); } catch (IllegalArgumentException e) { throw new PropertyException( "Some kind of error occurred processing your request: this " + "indicates a failure in PropertyOperator.java that should be " + "reported: attempt to access method " + meth + " on object " + instance + " with " + args.length + " parameters " + " threw an exception: " + e, e); } catch (InvocationTargetException e) { // if this is a wrapped UndefinedVariableException, unwrap and rethrow it if (e.getTargetException() instanceof PropertyException.UndefinedVariableException) throw (PropertyException) e.getTargetException(); throw new PropertyException( "Attempt to invoke method " + meth + " on object " + instance.getClass().getName() + " raised an exception: " + e.getTargetException().getClass().getName(), e.getTargetException()); } catch (NullPointerException e) { throw new PropertyException( "NullPointerException thrown from method " + meth + " on object " + instance + " -- most likely you have attempted " + "to use an undefined value, or a failure in that method.", e); } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
boolean isMethodAllowed (Method m) { Class c = m.getDeclaringClass(); Map restrictedClasses = _cache.getRestrictedClassMap(); if (restrictedClasses.containsKey(c)) { List okMeths = (List) restrictedClasses.get(c); return (okMeths != null && okMeths.contains(m.getName())); } return true; } | boolean isMethodAllowed(Method m) { Class c = m.getDeclaringClass(); Map restrictedClasses = _cache.getRestrictedClassMap(); if (restrictedClasses.containsKey(c)) { List okMeths = (List) restrictedClasses.get(c); return (okMeths != null && okMeths.contains(m.getName())); } return true; } | boolean isMethodAllowed (Method m) { Class c = m.getDeclaringClass(); Map restrictedClasses = _cache.getRestrictedClassMap(); if (restrictedClasses.containsKey(c)) { // this class is restricted, check if method is allowed List okMeths = (List) restrictedClasses.get(c); return (okMeths != null && okMeths.contains(m.getName())); } return true; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
boolean isMethodRestricted (Class c, String name) { Map restrictedClassMap = _cache.getRestrictedClassMap(); if (!restrictedClassMap.containsKey(c)) { return false; } else { Method[] meths = c.getMethods(); for (int i = 0; i < meths.length; i++) | boolean isMethodRestricted(Class c, String name) { Map restrictedClassMap = _cache.getRestrictedClassMap(); if (!restrictedClassMap.containsKey(c)) { return false; } else { Method[] meths = c.getMethods(); for (int i = 0; i < meths.length; i++) { if (meths[i].getName().equals(name)) | boolean isMethodRestricted (Class c, String name) { // check if object is restricted Map restrictedClassMap = _cache.getRestrictedClassMap(); if (!restrictedClassMap.containsKey(c)) { return false; // there are no restrictions on this class } else { // restricted class, check method Method[] meths = c.getMethods(); for (int i = 0; i < meths.length; i++) { if (meths[i].getName().equals(name)) { // check if method is explicitly allowed List l = (List) restrictedClassMap.get(c); if (l != null) return !l.contains(name); } } } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
if (meths[i].getName().equals(name)) { List l = (List) restrictedClassMap.get(c); if (l != null) return !l.contains(name); } | List l = (List) restrictedClassMap.get(c); if (l != null) return !l.contains(name); | boolean isMethodRestricted (Class c, String name) { // check if object is restricted Map restrictedClassMap = _cache.getRestrictedClassMap(); if (!restrictedClassMap.containsKey(c)) { return false; // there are no restrictions on this class } else { // restricted class, check method Method[] meths = c.getMethods(); for (int i = 0; i < meths.length; i++) { if (meths[i].getName().equals(name)) { // check if method is explicitly allowed List l = (List) restrictedClassMap.get(c); if (l != null) return !l.contains(name); } } } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
} return false; } | } } return false; } | boolean isMethodRestricted (Class c, String name) { // check if object is restricted Map restrictedClassMap = _cache.getRestrictedClassMap(); if (!restrictedClassMap.containsKey(c)) { return false; // there are no restrictions on this class } else { // restricted class, check method Method[] meths = c.getMethods(); for (int i = 0; i < meths.length; i++) { if (meths[i].getName().equals(name)) { // check if method is explicitly allowed List l = (List) restrictedClassMap.get(c); if (l != null) return !l.contains(name); } } } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
private int precedes (Class[] lhs, Class[] rhs) { if (lhs.length == rhs.length) { for (int i = 0; i < lhs.length; i++) | private int precedes(Class[] lhs, Class[] rhs) { if (lhs.length == rhs.length) { for (int i = 0; i < lhs.length; i++) { if (!rhs[i].equals(lhs[i])) | private int precedes (Class[] lhs, Class[] rhs) { if (lhs.length == rhs.length) { for (int i = 0; i < lhs.length; i++) { if (!rhs[i].equals(lhs[i])) { if (lhs[i].isAssignableFrom(rhs[i])) { // rhs is more specific than lhs return 1; } if (rhs[i].isAssignableFrom(lhs[i])) { // lhs is more specific than rhs return -1; } // not related by inheritance, put lhs later on return 1; } } return 0; // all the same } else { return (lhs.length < rhs.length) ? -1 : 1; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
if (!rhs[i].equals(lhs[i])) { if (lhs[i].isAssignableFrom(rhs[i])) { return 1; } if (rhs[i].isAssignableFrom(lhs[i])) { return -1; } return 1; } | if (lhs[i].isAssignableFrom(rhs[i])) { return 1; } if (rhs[i].isAssignableFrom(lhs[i])) { return -1; } return 1; | private int precedes (Class[] lhs, Class[] rhs) { if (lhs.length == rhs.length) { for (int i = 0; i < lhs.length; i++) { if (!rhs[i].equals(lhs[i])) { if (lhs[i].isAssignableFrom(rhs[i])) { // rhs is more specific than lhs return 1; } if (rhs[i].isAssignableFrom(lhs[i])) { // lhs is more specific than rhs return -1; } // not related by inheritance, put lhs later on return 1; } } return 0; // all the same } else { return (lhs.length < rhs.length) ? -1 : 1; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
return 0; } else { return (lhs.length < rhs.length) ? -1 : 1; } } | } return 0; } else { return (lhs.length < rhs.length) ? -1 : 1; } } | private int precedes (Class[] lhs, Class[] rhs) { if (lhs.length == rhs.length) { for (int i = 0; i < lhs.length; i++) { if (!rhs[i].equals(lhs[i])) { if (lhs[i].isAssignableFrom(rhs[i])) { // rhs is more specific than lhs return 1; } if (rhs[i].isAssignableFrom(lhs[i])) { // lhs is more specific than rhs return -1; } // not related by inheritance, put lhs later on return 1; } } return 0; // all the same } else { return (lhs.length < rhs.length) ? -1 : 1; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
public boolean setProperty (Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { int binPos = names.length - 2; if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } if (pos == binPos) { Object parent = null; | public boolean setProperty(Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { int binPos = names.length - 2; if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } if (pos == binPos) { Object parent = null; try { parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } } catch (NoSuchMethodException e) { } Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { | public boolean setProperty (Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { // names[pos] is what we could set from here int binPos = names.length - 2; // if we're not yet at the binary-settable parent, go there if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } // if we're at the binary-settable parent, try direct first if (pos == binPos) { // try direct -- move to direct parent and try from there Object parent = null; try { parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } } catch (NoSuchMethodException e) { // oh well, keep trying: XXX this makes binOp expensive } // if direct failed, try binary Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { try { return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { // names[pos+1] was not a string, just move on return false; } catch (NoSuchMethodException e) { return false; } } return false; } // we're the direct parent, use unaryOp or hash method Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { // fall through } catch (ClassCastException e) { // names[pos] was not a string, fall through } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } | return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { return false; | public boolean setProperty (Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { // names[pos] is what we could set from here int binPos = names.length - 2; // if we're not yet at the binary-settable parent, go there if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } // if we're at the binary-settable parent, try direct first if (pos == binPos) { // try direct -- move to direct parent and try from there Object parent = null; try { parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } } catch (NoSuchMethodException e) { // oh well, keep trying: XXX this makes binOp expensive } // if direct failed, try binary Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { try { return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { // names[pos+1] was not a string, just move on return false; } catch (NoSuchMethodException e) { return false; } } return false; } // we're the direct parent, use unaryOp or hash method Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { // fall through } catch (ClassCastException e) { // names[pos] was not a string, fall through } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
return false; | public boolean setProperty (Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { // names[pos] is what we could set from here int binPos = names.length - 2; // if we're not yet at the binary-settable parent, go there if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } // if we're at the binary-settable parent, try direct first if (pos == binPos) { // try direct -- move to direct parent and try from there Object parent = null; try { parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } } catch (NoSuchMethodException e) { // oh well, keep trying: XXX this makes binOp expensive } // if direct failed, try binary Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { try { return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { // names[pos+1] was not a string, just move on return false; } catch (NoSuchMethodException e) { return false; } } return false; } // we're the direct parent, use unaryOp or hash method Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { // fall through } catch (ClassCastException e) { // names[pos] was not a string, fall through } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
|
Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { try { return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { return false; } catch (NoSuchMethodException e) { return false; } } return false; } Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { } catch (ClassCastException e) { } return false; } | } return false; } Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { } catch (ClassCastException e) { } return false; } | public boolean setProperty (Context context, Object instance, Object[] names, Object value, int pos) throws PropertyException, NoSuchMethodException { // names[pos] is what we could set from here int binPos = names.length - 2; // if we're not yet at the binary-settable parent, go there if (pos < binPos) { Object grandparent = getProperty(context, instance, names, pos, binPos - 1); PropertyOperator po = _cache.getOperator(grandparent); return po.setProperty(context, grandparent, names, value, binPos); } // if we're at the binary-settable parent, try direct first if (pos == binPos) { // try direct -- move to direct parent and try from there Object parent = null; try { parent = getProperty(context, instance, names, pos, pos); if (parent != null) { PropertyOperator po = _cache.getOperator(parent); if (po.setProperty(context, parent, names, value, pos + 1)) { return true; } } } catch (NoSuchMethodException e) { // oh well, keep trying: XXX this makes binOp expensive } // if direct failed, try binary Accessor binOp = (Accessor) _binaryAccessors.get(names[pos]); if (binOp != null) { try { return binOp.set(instance, (String) names[pos + 1], value); } catch (ClassCastException e) { // names[pos+1] was not a string, just move on return false; } catch (NoSuchMethodException e) { return false; } } return false; } // we're the direct parent, use unaryOp or hash method Accessor unaryOp = (Accessor) _unaryAccessors.get(names[pos]); try { if ((unaryOp != null) && unaryOp.set(instance, value)) { return true; } if (_hashAccessor != null) { return _hashAccessor.set(instance, (String) names[pos], value); } } catch (NoSuchMethodException e) { // fall through } catch (ClassCastException e) { // names[pos] was not a string, fall through } return false; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
public PropertyOperatorCache () { } | public PropertyOperatorCache() { } | public PropertyOperatorCache () { } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final public Iterator getIterator (Object instance) throws PropertyException { if (instance instanceof Object[]) return new ArrayIterator((Object[]) instance); else if (instance.getClass().isArray()) return new PrimitiveArrayIterator(instance); else if (instance instanceof Iterator) return (Iterator) instance; else if (instance instanceof Enumeration) return new EnumIterator((Enumeration) instance); else return getOperator(instance).findIterator(instance); } | final public Iterator getIterator(Object instance) throws PropertyException { if (instance instanceof Object[]) return new ArrayIterator((Object[]) instance); else if (instance.getClass().isArray()) return new PrimitiveArrayIterator(instance); else if (instance instanceof Iterator) return (Iterator) instance; else if (instance instanceof Enumeration) return new EnumIterator((Enumeration) instance); else return getOperator(instance).findIterator(instance); } | final public Iterator getIterator (Object instance) throws PropertyException { if (instance instanceof Object[]) return new ArrayIterator((Object[]) instance); else if (instance.getClass().isArray()) return new PrimitiveArrayIterator(instance); else if (instance instanceof Iterator) return (Iterator) instance; else if (instance instanceof Enumeration) return new EnumIterator((Enumeration) instance); else return getOperator(instance).findIterator(instance); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final public PropertyOperator getOperator (final Class type) throws PropertyException { Object o = _cache.get(type); if (o == null) { PropertyOperator po = new PropertyOperator(type, this); _cache.put(type, po); return po; } else return (PropertyOperator) o; } | final public PropertyOperator getOperator(final Class type) throws PropertyException { Object o = _cache.get(type); if (o == null) { PropertyOperator po = new PropertyOperator(type, this); _cache.put(type, po); return po; } else return (PropertyOperator) o; } | final public PropertyOperator getOperator (final Class type) throws PropertyException { Object o = _cache.get(type); if (o == null) { PropertyOperator po = new PropertyOperator(type, this); _cache.put(type, po); return po; } else return (PropertyOperator) o; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final public Object getProperty (final Context context, final Object instance, final Object[] names, int start) throws PropertyException, SecurityException { if (instance == null) { return null; } else { return getOperator(instance).getProperty( context, instance, names, start, names.length - 1); } } | final public Object getProperty(final Context context, final Object instance, final Object[] names, int start) throws PropertyException, SecurityException { if (instance == null) { return null; } else { return getOperator(instance).getProperty( context, instance, names, start, names.length - 1); } } | final public Object getProperty (final Context context, final Object instance, final Object[] names, int start) throws PropertyException, SecurityException { if (instance == null) { return null; } else { return getOperator(instance).getProperty( context, instance, names, start, names.length - 1); } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
Map getRestrictedClassMap () { return _restrictedClasses; } | Map getRestrictedClassMap() { return _restrictedClasses; } | Map getRestrictedClassMap () { return _restrictedClasses; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); | final public void init(Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); | final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
} else { | } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); | final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
_cache = (CacheManager) b.classForName(cacheManager).newInstance(); | Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); | final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
_log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); | _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); | final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
} _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | } } } | final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final public boolean setProperty (final Context context, Object instance, final Object[] names, int start, final Object value) throws PropertyException, SecurityException { try { if (instance == null) { return false; } return getOperator(instance) .setProperty(context, instance, names, value, start); } catch (PropertyException e) { throw e; } catch (NoSuchMethodException e) { throw new PropertyException("No method to access property: " + e, e); } } | final public boolean setProperty(final Context context, Object instance, final Object[] names, int start, final Object value) throws PropertyException, SecurityException { try { if (instance == null) { return false; } return getOperator(instance) .setProperty(context, instance, names, value, start); } catch (PropertyException e) { throw e; } catch (NoSuchMethodException e) { throw new PropertyException("No method to access property: " + e, e); } } | final public boolean setProperty (final Context context, Object instance, final Object[] names, int start, final Object value) throws PropertyException, SecurityException { try { if (instance == null) { return false; } return getOperator(instance) .setProperty(context, instance, names, value, start); } catch (PropertyException e) { throw e; } catch (NoSuchMethodException e) { throw new PropertyException("No method to access property: " + e, e); } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
UnaryMethodAccessor (final String name, final Method m, final Class[] params) throws PropertyException { super(name, m, params); } | UnaryMethodAccessor(final String name, final Method m, final Class[] params) throws PropertyException { super(name, m, params); } | UnaryMethodAccessor (final String name, final Method m, final Class[] params) throws PropertyException { super(name, m, params); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final Object get (final Object instance) throws PropertyException, NoSuchMethodException { return PropertyOperator.invoke(_getMethod, instance, null); } | final Object get(final Object instance) throws PropertyException, NoSuchMethodException { return PropertyOperator.invoke(_getMethod, instance, null); } | final Object get (final Object instance) throws PropertyException, NoSuchMethodException { return PropertyOperator.invoke(_getMethod, instance, null); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final int numArgsGet () { return 0; } | final int numArgsGet() { return 0; } | final int numArgsGet () { return 0; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final int numArgsSet () { return 1; } | final int numArgsSet() { return 1; } | final int numArgsSet () { return 1; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final boolean set (final Object instance, final Object value) throws PropertyException, NoSuchMethodException { Object[] args = {value}; return setImpl(instance, args); } | final boolean set(final Object instance, final Object value) throws PropertyException, NoSuchMethodException { Object[] args = {value}; return setImpl(instance, args); } | final boolean set (final Object instance, final Object value) throws PropertyException, NoSuchMethodException { Object[] args = {value}; return setImpl(instance, args); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/67ca4e7044b0f2675e520acfb786c52497facbe2/PropertyOperatorCache.java/buggy/webmacro/src/org/webmacro/engine/PropertyOperatorCache.java |
final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); | final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); | private void retrieveNotes() { final PrivateNotes privateNotes = PrivateNotes.getPrivateNotes(); String text = privateNotes.getNotes(); final JLabel titleLabel = new JLabel("Notepad"); titleLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 13)); titleLabel.setHorizontalAlignment(JLabel.CENTER); final Image backgroundImage = SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage(); final JTextPane pane = new JTextPane(); pane.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); pane.setText(text); final RolloverButton button = new RolloverButton("Save", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); final JFrame frame = new JFrame("Notes"); frame.setUndecorated(true); titleLabel.addMouseMotionListener(new DragWindowAdapter(frame)); final JPanel mainPanel = new JPanel() { public void paintComponent(Graphics g) { double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }; pane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } } }); mainPanel.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); frame.setIconImage(SparkManager.getMainWindow().getIconImage()); frame.getContentPane().add(mainPanel); mainPanel.add(titleLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(scrollPane, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(button, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); frame.pack(); frame.setSize(400, 400); GraphicUtils.centerWindowOnComponent(frame, SparkManager.getMainWindow()); frame.setVisible(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/574c15c5effb6d20a2b7e90ba6b59211402c8696/ScratchPadPlugin.java/buggy/src/java/org/jivesoftware/sparkimpl/plugin/scratchpad/ScratchPadPlugin.java |
pane.setCaretPosition(0); | private void retrieveNotes() { final PrivateNotes privateNotes = PrivateNotes.getPrivateNotes(); String text = privateNotes.getNotes(); final JLabel titleLabel = new JLabel("Notepad"); titleLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 13)); titleLabel.setHorizontalAlignment(JLabel.CENTER); final Image backgroundImage = SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage(); final JTextPane pane = new JTextPane(); pane.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); pane.setText(text); final RolloverButton button = new RolloverButton("Save", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); final JFrame frame = new JFrame("Notes"); frame.setUndecorated(true); titleLabel.addMouseMotionListener(new DragWindowAdapter(frame)); final JPanel mainPanel = new JPanel() { public void paintComponent(Graphics g) { double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }; pane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } } }); mainPanel.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); frame.setIconImage(SparkManager.getMainWindow().getIconImage()); frame.getContentPane().add(mainPanel); mainPanel.add(titleLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(scrollPane, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(button, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); frame.pack(); frame.setSize(400, 400); GraphicUtils.centerWindowOnComponent(frame, SparkManager.getMainWindow()); frame.setVisible(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/574c15c5effb6d20a2b7e90ba6b59211402c8696/ScratchPadPlugin.java/buggy/src/java/org/jivesoftware/sparkimpl/plugin/scratchpad/ScratchPadPlugin.java |
|
return StringEvaluate.eval(ruby, self, this); | if (simple) { return getLiteral().to_s(); } else { return StringEvaluate.eval(ruby, self, this); } | public RubyObject eval(Ruby ruby, RubyObject self) { return StringEvaluate.eval(ruby, self, this); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/58f05ce53c167c336c9619e751471924f79325f3/DXStrNode.java/clean/org/jruby/nodes/DXStrNode.java |
view.setMoviePlay(true); | public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/10741ce22be9051166109de0c40e67fef675822e/MoviePlayerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/util/MoviePlayerControl.java |
|
view.setMoviePlay(false); | public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/10741ce22be9051166109de0c40e67fef675822e/MoviePlayerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/util/MoviePlayerControl.java |
|
view.setMoviePlay(false); | public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/10741ce22be9051166109de0c40e67fef675822e/MoviePlayerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/util/MoviePlayerControl.java |
|
ui.toFront(); | public static void showCreateCategoryDialog(CategoryUI parent, CategoryCtrl control, CategoryGroup group) { CategoryEditUI ui = new CategoryEditUI(NEW_CATEGORY_MODE,parent, control,group,null,null); ui.setTitle("Create Phenotype"); ui.pack(); ui.show(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cc2b318f78e93a57d60aaae0e3c9bbbfc8350f25/CategoryEditUI.java/clean/SRC/org/openmicroscopy/shoola/agents/classifier/CategoryEditUI.java |
|
ui.toFront(); | public static void showCreateGroupDialog(CategoryUI parent, CategoryCtrl control) { CategoryEditUI ui = new CategoryEditUI(NEW_GROUP_MODE,parent, control,null,null,null); ui.setTitle("Create Group"); ui.pack(); ui.show(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cc2b318f78e93a57d60aaae0e3c9bbbfc8350f25/CategoryEditUI.java/clean/SRC/org/openmicroscopy/shoola/agents/classifier/CategoryEditUI.java |
|
ui.toFront(); | public static void showEditCategoryDialog(CategoryUI parent, CategoryCtrl control, CategoryGroup group, Category category) { CategoryEditUI ui = new CategoryEditUI(EDIT_CATEGORY_MODE,parent, control,null,group,category); ui.setTitle("Edit Phenotype"); ui.pack(); ui.show(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cc2b318f78e93a57d60aaae0e3c9bbbfc8350f25/CategoryEditUI.java/clean/SRC/org/openmicroscopy/shoola/agents/classifier/CategoryEditUI.java |
|
ui.toFront(); | public static void showEditGroupDialog(CategoryUI parent, CategoryCtrl control, CategoryGroup group) { CategoryEditUI ui = new CategoryEditUI(EDIT_GROUP_MODE,parent, control,null,group,null); ui.setTitle("Edit Group"); ui.pack(); ui.show(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cc2b318f78e93a57d60aaae0e3c9bbbfc8350f25/CategoryEditUI.java/clean/SRC/org/openmicroscopy/shoola/agents/classifier/CategoryEditUI.java |
|
void visitCollection(Collection collection) throws BeansException; | void visitCollection(Collection collection, Object data) throws BeansException; | void visitCollection(Collection collection) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues) throws BeansException; | void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues, Object data) throws BeansException; | void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitMap(Map map) throws BeansException; | void visitMap(Map map, Object data) throws BeansException; | void visitMap(Map map) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitMutablePropertyValues(MutablePropertyValues propertyValues) throws BeansException; | void visitMutablePropertyValues(MutablePropertyValues propertyValues, Object data) throws BeansException; | void visitMutablePropertyValues(MutablePropertyValues propertyValues) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitObject(Object value) throws BeansException; | void visitObject(Object value, Object data) throws BeansException; | void visitObject(Object value) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitPropertyValue(PropertyValue propertyValue) throws BeansException; | void visitPropertyValue(PropertyValue propertyValue, Object data) throws BeansException; | void visitPropertyValue(PropertyValue propertyValue) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException; | void visitRuntimeBeanReference(RuntimeBeanReference beanReference, Object data) throws BeansException; | void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException; | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/6a661ce4fbc3261ed4b3a744b1e1919df53cbbf7/SpringVisitor.java/buggy/kernel/src/java/org/gbean/spring/SpringVisitor.java |
if (method.isUndefined()) { throw new RubyBugException("undefined method '" + name + "'; can't happen"); } | Asserts.assertTrue(!method.isUndefined(), "undefined method '" + name + "'"); | public RubyModule module_function(IRubyObject[] args) { if (getRuntime().getSafeLevel() >= 4 && !isTaint()) { throw new RubySecurityException(getRuntime(), "Insecure: can't change method visibility"); } if (args.length == 0) { getRuntime().setCurrentVisibility(Visibility.MODULE_FUNCTION); } else { setMethodVisibility(args, Visibility.PRIVATE); for (int i = 0; i < args.length; i++) { String name = args[i].toId(); ICallable method = searchMethod(name); if (method.isUndefined()) { throw new RubyBugException("undefined method '" + name + "'; can't happen"); } getSingletonClass().addMethod(name, new WrapperCallable(method, Visibility.PUBLIC)); callMethod("singleton_method_added", RubySymbol.newSymbol(getRuntime(), name)); } } return this; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/071973606d94103b2d5cb6c793aa1e8809fc7b2a/RubyModule.java/buggy/org/jruby/RubyModule.java |
if (millis > millis_other) { | long usec_other = (other instanceof RubyTime) ? ((RubyTime)other).usec : 0; if (millis > millis_other || (millis == millis_other && usec > usec_other)) { | public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f6bd30c3aeb10bd8a3e4eca732851a097e2e32d9/RubyTime.java/clean/src/org/jruby/RubyTime.java |
} else if (millis < millis_other) { | } else if (millis < millis_other || (millis == millis_other && usec < usec_other)) { | public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f6bd30c3aeb10bd8a3e4eca732851a097e2e32d9/RubyTime.java/clean/src/org/jruby/RubyTime.java |
return Collections.EMPTY_LIST; | return EMPTY_LIST; | public List childNodes() { return Collections.EMPTY_LIST; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b1293eda8454686e846e2a9837b348e2983bb423/TrueNode.java/buggy/src/org/jruby/ast/TrueNode.java |
super(ruby, bean.name, null); | super(ruby, "$" + bean.name, null); | public BeanGlobalVariable(Ruby ruby, BSFDeclaredBean bean) { super(ruby, bean.name, null); this.bean = bean; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9028c57cb1199775e0b355581f41e146adcb60c1/JRubyEngine.java/clean/org/jruby/javasupport/bsf/JRubyEngine.java |
ruby.evalScript((String) sb.toString(), null); | ruby.evalScript(sb.toString(), null); | public Object apply(String file, int line, int col, Object funcBody, Vector paramNames, Vector args) { ISourcePosition oldPosition = ruby.getPosition(); ruby.setPosition(file, line); StringBuffer sb = new StringBuffer(((String) funcBody).length() + 100); sb.append("def __jruby_bsf_anonymous ("); int paramLength = paramNames.size(); for (int i = 0; i < paramLength; i++) { if (i > 0) { sb.append(", "); } sb.append(paramNames.elementAt(i)); } sb.append(") \n"); sb.append(funcBody); sb.append("\nend\n"); ruby.evalScript((String) sb.toString(), null); IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(ruby, args.toArray()); Object result = JavaUtil.convertRubyToJava(ruby, ruby.getTopSelf().callMethod("__jruby_bsf_anonymous", rubyArgs)); ruby.setPosition(oldPosition); return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9028c57cb1199775e0b355581f41e146adcb60c1/JRubyEngine.java/clean/org/jruby/javasupport/bsf/JRubyEngine.java |
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); ruby = Ruby.getDefaultInstance(); int size = declaredBeans.size(); for (int i = 0; i < size; i++) { BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i); ruby.defineVariable(new BeanGlobalVariable(ruby, bean)); } // ruby.defineGlobalFunction("declareBean", method); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9028c57cb1199775e0b355581f41e146adcb60c1/JRubyEngine.java/clean/org/jruby/javasupport/bsf/JRubyEngine.java |
||
return "Token: Type = " + getType() + "; Line = " + getLine() + "; Column = " + getColumn() + "; Data = \"" + String.valueOf(getData()).replaceAll("\n", "\\\\n") + "\""; | return "Token: Type = " + getType() + "; Line = " + getLine() + "; Column = " + getColumn() + "; Data = \"" + String.valueOf(getData()) + "\""; | public String toString() { return "Token: Type = " + getType() + "; Line = " + getLine() + "; Column = " + getColumn() + "; Data = \"" + String.valueOf(getData()).replaceAll("\n", "\\\\n") + "\""; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/742f8fd97af6c2f991faa72df939aae10ee99048/Token.java/clean/org/jruby/scanner/Token.java |
return ((RubyString) l2Conv).getValue(); | return ((RubyString) l2Conv).toString(); | private static String convert2String(IRubyObject l2Conv) { IRuby runtime = l2Conv.getRuntime(); if (l2Conv.getMetaClass() != runtime.getClass("String")) { l2Conv = l2Conv.convertToType("String", "to_s", true); //we may need a false here, not sure } return ((RubyString) l2Conv).getValue(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/Pack.java/buggy/src/org/jruby/util/Pack.java |
PtrList format = new PtrList(formatString.getValue()); | PtrList format = new PtrList(formatString.toString()); | public static RubyString pack(List list, RubyString formatString) { IRuby runtime = formatString.getRuntime(); PtrList format = new PtrList(formatString.getValue()); StringBuffer result = new StringBuffer(); int listSize = list.size(); char type = format.nextChar(); int idx = 0; String lCurElemString; while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); if (Character.isWhitespace(type)) { // skip all spaces type = next; continue; } if (next == '!' || next == '_') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } next = format.nextChar(); } // Determine how many of type are needed (default: 1) boolean isStar = false; int occurrences = 1; if (next == '*') { if ("@Xxu".indexOf(type) != -1) { occurrences = 0; } else { occurrences = listSize; isStar = true; } next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); // an exception may occur here if an int can't hold this but ... occurrences = format.nextAsciiNumber(); next = format.nextChar(); } Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { idx = encode(runtime, occurrences, result, list, idx, converter); type = next; continue; } switch (type) { case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : case 'a' : case 'Z' : case 'B' : case 'b' : case 'H' : case 'h' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (isStar) { occurrences = lCurElemString.length(); } switch (type) { case 'a' : case 'A' : case 'Z' : if (lCurElemString.length() >= occurrences) { result.append(lCurElemString.toCharArray(), 0, occurrences); } else {//need padding //I'm fairly sure there is a library call to create a //string filled with a given char with a given length but I couldn't find it result.append(lCurElemString); occurrences -= lCurElemString.length(); grow(result, (type == 'a') ? sNil10 : sSp10, occurrences); } break; //I believe there is a bug in the b and B case we skip a char too easily case 'b' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { if ((lCurElemString.charAt(i++) & 1) != 0) {//if the low bit is set currentByte |= 128; //set the high bit of the result } if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte >>= 1; //shift the byte } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte >>= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } //do some padding, I don't understand the padding strategy result.setLength(result.length() + padLength); } break; case 'B' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { currentByte |= lCurElemString.charAt(i++) & 1; // we filled up current byte; append it and create next one if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte <<= 1; } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte <<= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'h' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= (((currentChar & 15) + 9) & 15) << 4; } else { currentByte |= (currentChar & 15) << 4; } if ((i & 1) != 0) { currentByte >>= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'H' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= ((currentChar & 15) + 9) & 15; } else { currentByte |= currentChar & 15; } if ((i & 1) != 0) { currentByte <<= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; } break; } case 'x' : grow(result, sNil10, occurrences); break; case 'X' : try { shrink(result, occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `pack': X outside of string"); } break; case '@' : occurrences -= result.length(); if (occurrences > 0) { grow(result, sNil10, occurrences); } occurrences = -occurrences; if (occurrences > 0) { shrink(result, occurrences); } break; case 'u' : case 'm' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); occurrences = occurrences <= 2 ? 45 : occurrences / 3 * 3; for (;;) { encodes(runtime, result, lCurElemString, occurrences, type); if (occurrences >= lCurElemString.length()) { break; } lCurElemString = lCurElemString.substring(occurrences); } } break; case 'M' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (occurrences <= 1) { occurrences = 72; } qpencode(result, lCurElemString, occurrences); } break; case 'U' : char[] c = new char[occurrences]; for (int cIndex = 0; occurrences-- > 0; cIndex++) { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); long l = from == runtime.getNil() ? 0 : RubyNumeric.num2long(from); c[cIndex] = (char) l; } try { byte[] bytes = new String(c).getBytes("UTF-8"); result.append(RubyString.bytesToString(bytes)); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert to UTF8"; } break; } type = next; } return runtime.newString(result.toString()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/Pack.java/buggy/src/org/jruby/util/Pack.java |
PtrList format = new PtrList(formatString.getValue()); | PtrList format = new PtrList(formatString.toString()); | public static RubyArray unpack(String encodedString, RubyString formatString) { IRuby runtime = formatString.getRuntime(); RubyArray result = runtime.newArray(); PtrList format = new PtrList(formatString.getValue()); PtrList encode = new PtrList(encodedString); char type = format.nextChar(); // Type to be unpacked while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); // Next indicates to decode using native encoding format if (next == '_' || next == '!') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } // We advance in case occurences follows next = format.nextChar(); } // How many occurrences of 'type' we want int occurrences = 0; if (format.isAtEnd()) { occurrences = 1; } else if (next == '*') { occurrences = IS_STAR; next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); occurrences = format.nextAsciiNumber(); next = format.nextChar(); } else { occurrences = type == '@' ? 0 : 1; } // See if we have a converter for the job... Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { decode(runtime, encode, occurrences, result, converter); type = next; continue; } // Otherwise the unpack should be here... switch (type) { case '@' : encode.setPosition(occurrences); break; case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0' && c != ' ') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'Z' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'a' : if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } result.append(runtime.newString(encode.nextSubstring(occurrences))); break; case 'b' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) { bits >>>= 1; } else { bits = encode.nextChar(); } lElem.append((bits & 1) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'B' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) bits <<= 1; else bits = encode.nextChar(); lElem.append((bits & 128) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'h' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) { bits >>>= 4; } else { bits = encode.nextChar(); } lElem.append(sHexDigits[bits & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'H' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) bits <<= 4; else bits = encode.nextChar(); lElem.append(sHexDigits[(bits >>> 4) & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'u': { int length = encode.remaining() * 3 / 4; StringBuffer lElem = new StringBuffer(length); char s; int total = 0; s = encode.nextChar(); while (!encode.isAtEnd() && s > ' ' && s < 'a') { int a, b, c, d; char[] hunk = new char[3]; int len = (s - ' ') & 077; s = encode.nextChar(); total += len; if (total > length) { len -= total - length; total = length; } while (len > 0) { int mlen = len > 3 ? 3 : len; if (!encode.isAtEnd() && s >= ' ') { a = (s - ' ') & 077; s = encode.nextChar(); } else a = 0; if (!encode.isAtEnd() && s >= ' ') { b = (s - ' ') & 077; s = encode.nextChar(); } else b = 0; if (!encode.isAtEnd() && s >= ' ') { c = (s - ' ') & 077; s = encode.nextChar(); } else c = 0; if (!encode.isAtEnd() && s >= ' ') { d = (s - ' ') & 077; s = encode.nextChar(); } else d = 0; hunk[0] = (char) ((a << 2 | b >> 4) & 255); hunk[1] = (char) ((b << 4 | c >> 2) & 255); hunk[2] = (char) ((c << 6 | d) & 255); lElem.append(hunk, 0, (int) mlen); len -= mlen; } if (s == '\r') s = encode.nextChar(); if (s == '\n') s = encode.nextChar(); else if (!encode.isAtEnd()) { if (encode.nextChar() == '\n') { encode.nextChar(); // Possible Checksum Byte } else if (!encode.isAtEnd()) { encode.backup(1); } } } result.append(runtime.newString(lElem.toString())); } break; case 'm': { int length = encode.remaining()*3/4; StringBuffer lElem = new StringBuffer(length); int a = -1, b = -1, c = 0, d; while (!encode.isAtEnd()) { char s; do { s = encode.nextChar(); } while (s == '\r' || s == '\n'); if ((a = b64_xtable[s]) == -1) break; if ((b = b64_xtable[s = encode.nextChar()]) == -1) break; if ((c = b64_xtable[s = encode.nextChar()]) == -1) break; if ((d = b64_xtable[s = encode.nextChar()]) == -1) break; lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); lElem.append((char)((c << 6 | d) & 255)); } if (a != -1 && b != -1) { int remaining = encode.remaining(); char[] s = encode.nextSubstring(4).toCharArray(); if (remaining > 2 && s[2] == '=') lElem.append((char)((a << 2 | b >> 4) & 255)); if (c != -1 && remaining > 3 && s[3] == '=') { lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); } } result.append(runtime.newString(lElem.toString())); } break; case 'M' : { StringBuffer lElem = new StringBuffer(Math.max(encode.remaining(),0)); for(;;) { char c = encode.nextChar(); if (encode.isAtEnd()) break; if (c != '=') { lElem.append(c); } else { char c1 = encode.nextChar(); if (encode.isAtEnd()) break; if (c1 == '\n') continue; char c2 = encode.nextChar(); if (encode.isAtEnd()) break; String hexString = new String(new char[]{c1,c2}); int value = Integer.parseInt(hexString,16); lElem.append((char)value); } } result.append(runtime.newString(lElem.toString())); } break; case 'U' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } //get the correct substring String toUnpack = encode.nextSubstring(occurrences); String lUtf8 = null; try { lUtf8 = new String(toUnpack.getBytes("iso8859-1"), "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert from UTF8"; } char[] c = lUtf8.toCharArray(); for (int lCurCharIdx = 0; occurrences-- > 0 && lCurCharIdx < c.length; lCurCharIdx++) result.append(runtime.newFixnum(c[lCurCharIdx])); } break; case 'X': if (occurrences == IS_STAR) { occurrences = encode.getLength() - encode.remaining(); } try { encode.backup(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': X outside of string"); } break; case 'x': if (occurrences == IS_STAR) { occurrences = encode.remaining(); } try { encode.nextSubstring(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': x outside of string"); } break; } type = next; } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/Pack.java/buggy/src/org/jruby/util/Pack.java |
try { checkForOldSettings(); } catch (Exception e) { Log.error(e); } | public LoginDialog() { localPref = SettingsManager.getLocalPreferences(); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/888bf176de3f6a56283b4a961224040ed59e1ed4/LoginDialog.java/buggy/src/java/org/jivesoftware/LoginDialog.java |
|
public void invoke(JFrame parentFrame) { // Before creating any connections. Update proxy if needed. try { updateProxyConfig(); } catch (Exception e) { Log.error(e); } LoginPanel loginPanel = new LoginPanel(); // Construct Dialog loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME)); loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); final JPanel mainPanel = new GrayBackgroundPanel(); final GridBagLayout mainLayout = new GridBagLayout(); mainPanel.setLayout(mainLayout); final ImagePanel imagePanel = new ImagePanel(); mainPanel.add(imagePanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY); if (ModelUtil.hasLength(showPoweredBy) && "true".equals(showPoweredBy)) { // Handle PoweredBy for custom clients. final JLabel poweredBy = new JLabel(SparkRes.getImageIcon(SparkRes.POWERED_BY_IMAGE)); mainPanel.add(poweredBy, new GridBagConstraints(0, 1, 4, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 2, 0), 0, 0)); } // imagePanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.lightGray)); loginPanel.setOpaque(false); mainPanel.add(loginPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); loginDialog.setContentPane(mainPanel); loginDialog.setLocationRelativeTo(parentFrame); loginDialog.setResizable(false); loginDialog.pack(); // Center dialog on screen GraphicUtils.centerWindowOnScreen(loginDialog); // Show dialog loginDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quitLogin(); } }); if (loginPanel.getUsername().trim().length() > 0) { loginPanel.getPasswordField().requestFocus(); } if (!localPref.isStartedHidden() || !localPref.isAutoLogin()) { // Make dialog top most. loginDialog.setVisible(true); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/888bf176de3f6a56283b4a961224040ed59e1ed4/LoginDialog.java/buggy/src/java/org/jivesoftware/LoginDialog.java |
||
Dimension imageDim = new Dimension(imageWidth, imageHeight); zoomPanel.setPreferredSize(imageDim); zoomPanel.setSize(imageDim); | void setZoomPanel(ZoomPanel zoomPanel) { this.zoomPanel = zoomPanel; Dimension imageDim = new Dimension(imageWidth, imageHeight); zoomPanel.setPreferredSize(imageDim); zoomPanel.setSize(imageDim); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/020251919a9bc041ddec075006ba48f2bcfddd48/ImageInspectorManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/ImageInspectorManager.java |
|
{ Integer index = (Integer) values.get(new Double(level)); Iterator i = items.keySet().iterator(); AbstractButton item; Integer j; if (index != null) { while (i.hasNext()) { j = (Integer) i.next(); item = (AbstractButton) items.get(j); item.setSelected(j.equals(index)); } } else { while (i.hasNext()) { item = (AbstractButton) items.get(i.next()); item.setSelected(false); } } } | { Integer index = (Integer) values.get(new Double(level)); Iterator i = items.keySet().iterator(); AbstractButton item; Integer j; if (index != null) { while (i.hasNext()) { j = (Integer) i.next(); item = (AbstractButton) items.get(j); item.setSelected(j.equals(index)); } } else { while (i.hasNext()) { item = (AbstractButton) items.get(i.next()); item.setSelected(false); } } } | public void setItemSelected(double level) { Integer index = (Integer) values.get(new Double(level)); Iterator i = items.keySet().iterator(); AbstractButton item; Integer j; if (index != null) { while (i.hasNext()) { j = (Integer) i.next(); item = (AbstractButton) items.get(j); item.setSelected(j.equals(index)); } } else { while (i.hasNext()) { item = (AbstractButton) items.get(i.next()); item.setSelected(false); } } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomMenuManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomMenuManager.java |
private void addUser(RosterEntry entry) { String name = entry.getName(); if (!ModelUtil.hasLength(name)) { name = entry.getUser(); } String nickname = entry.getName(); if (!ModelUtil.hasLength(nickname)) { nickname = entry.getUser(); } ContactItem newContactItem = new ContactItem(nickname, entry.getUser()); // Update users icon Presence presence = SparkManager.getConnection().getRoster().getPresence(entry.getUser()); newContactItem.setPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)) { // Ignore, since the new user is pending to be added. for (RosterGroup group : entry.getGroups()) { ContactGroup contactGroup = getContactGroup(group.getName()); if (contactGroup == null) { contactGroup = addContactGroup(group.getName()); } contactGroup.addContactItem(newContactItem); } return; } else { offlineGroup.addContactItem(newContactItem); } if (presence != null) { updateUserPresence(presence); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | private void buildContactList() { XMPPConnection con = SparkManager.getConnection(); final Roster roster = con.getRoster(); roster.addRosterListener(this); for (RosterGroup group : roster.getGroups()) { ContactGroup contactGroup = addContactGroup(group.getName()); for (RosterEntry entry : group.getEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); contactItem.setPresence(null); if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Add to contact group. contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); } else { if (offlineGroup.getContactItemByJID(entry.getUser()) == null) { offlineGroup.addContactItem(contactItem); } } } } // Add Unfiled Group // addContactGroup(unfiledGroup); for (RosterEntry entry : roster.getUnfiledEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); offlineGroup.addContactItem(contactItem); } unfiledGroup.setVisible(false); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
public void connectionClosedOnError(final Exception ex) { String errorMessage = Res.getString("message.disconnected.error"); if (ex != null && ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { errorMessage = Res.getString("message.disconnected.conflict.error"); } else { errorMessage = Res.getString("message.general.error", reason); } } final String message = errorMessage; SwingUtilities.invokeLater(new Runnable() { public void run() { reconnect(message); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { | private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { | public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { | public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
Iterator contactGroups = new ArrayList(getContactGroups()).iterator(); | final Iterator contactGroups = new ArrayList(getContactGroups()).iterator(); | private void removeAllUsers() { // Behind the scenes, move everyone to the offline group. Iterator contactGroups = new ArrayList(getContactGroups()).iterator(); while (contactGroups.hasNext()) { ContactGroup contactGroup = (ContactGroup)contactGroups.next(); Iterator contactItems = new ArrayList(contactGroup.getContactItems()).iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); contactGroup.removeContactItem(item); } } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = Res.getString("message.approve.subscription", UserManager.unescapeJID(jid)); final JPanel layoutPanel = new JPanel(); layoutPanel.setBackground(Color.white); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); RolloverButton acceptButton = new RolloverButton(); ResourceUtils.resButton(acceptButton, Res.getString("button.accept")); RolloverButton viewInfoButton = new RolloverButton(); ResourceUtils.resButton(viewInfoButton, Res.getString("button.profile")); RolloverButton denyButton = new RolloverButton(); ResourceUtils.resButton(denyButton, Res.getString("button.deny")); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), Res.getString("message.add.user"), Res.getString("message.add.to.roster"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(UserManager.unescapeJID(jid)); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); SparkManager.getWorkspace().addAlert(layoutPanel); SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow()); | final SubscriptionDialog subscriptionDialog = new SubscriptionDialog(); subscriptionDialog.invoke(jid); | private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = Res.getString("message.approve.subscription", UserManager.unescapeJID(jid)); final JPanel layoutPanel = new JPanel(); layoutPanel.setBackground(Color.white); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); RolloverButton acceptButton = new RolloverButton(); ResourceUtils.resButton(acceptButton, Res.getString("button.accept")); RolloverButton viewInfoButton = new RolloverButton(); ResourceUtils.resButton(viewInfoButton, Res.getString("button.profile")); RolloverButton denyButton = new RolloverButton(); ResourceUtils.resButton(denyButton, Res.getString("button.deny")); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), Res.getString("message.add.user"), Res.getString("message.add.to.roster"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(UserManager.unescapeJID(jid)); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog SparkManager.getWorkspace().addAlert(layoutPanel); SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow()); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); | && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); | private void updateUserPresence(Presence presence) { if (presence == null) { return; } Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); RosterEntry entry = roster.getEntry(bareJID); boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); // If online, check to see if they are in the offline group. // If so, remove from offline group and add to all groups they // belong to. if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null) { changeOfflineToOnline(bareJID, entry, presence); } else if (presence.getFrom().indexOf("workgroup.") != -1) { changeOfflineToOnline(bareJID, entry, presence); } // If online, but not in offline group, update presence. else if (presence.getType() == Presence.Type.available) { final Iterator groupIterator = groupList.iterator(); while (groupIterator.hasNext()) { ContactGroup group = (ContactGroup)groupIterator.next(); ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.setPresence(presence); group.fireContactGroupUpdated(); } } } // If not available, move to offline group. else if (presence.getType() == Presence.Type.unavailable && !isPending) { presence = roster.getPresence(bareJID); if (presence == null) { moveToOfflineGroup(bareJID); } } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/d039de56513c7dd0e3c5c2762f184ca886fb4900/ContactList.java/buggy/src/java/org/jivesoftware/spark/ui/ContactList.java |
insertText(Res.getString("message.your.voice.revoked")); | insertText(Res.getString("message.your.voice.granted")); | private void setupListeners() { chat.addParticipantStatusListener(new DefaultParticipantStatusListener() { public void kicked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.kicked.from.room", nickname)); } public void voiceGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.given.voice", nickname)); } public void voiceRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.voice.revoked", nickname)); } public void banned(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.banned", nickname)); } public void membershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.membership", nickname)); } public void membershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.membership", nickname)); } public void moderatorGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.moderator", nickname)); } public void moderatorRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.moderator", nickname)); } public void ownershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.owner", nickname)); } public void ownershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.owner", nickname)); } public void adminGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.admin", nickname)); } public void adminRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.admin", nickname)); } public void nicknameChanged(String participant, String nickname) { insertText(Res.getString("message.user.nickname.changed", StringUtils.parseResource(participant), nickname)); } }); chat.addUserStatusListener(new DefaultUserStatusListener() { public void kicked(String s, String reason) { insertText(Res.getString("message.your.kicked", s)); getChatInputEditor().setEnabled(false); getSplitPane().setRightComponent(null); leaveChatRoom(); } public void voiceGranted() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(true); } public void voiceRevoked() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(false); } public void banned(String s, String reason) { insertText(Res.getString("message.your.banned")); } public void membershipGranted() { insertText(Res.getString("message.your.membership.granted")); } public void membershipRevoked() { insertText(Res.getString("message.your.membership.revoked")); } public void moderatorGranted() { insertText(Res.getString("message.your.moderator.granted")); } public void moderatorRevoked() { insertText(Res.getString("message.your.moderator.revoked")); } public void ownershipGranted() { insertText(Res.getString("message.your.ownership.granted")); } public void ownershipRevoked() { insertText(Res.getString("message.your.ownership.revoked")); } public void adminGranted() { insertText(Res.getString("message.your.admin.granted")); } public void adminRevoked() { insertText(Res.getString("message.your.revoked.granted")); } }); chat.addSubjectUpdatedListener(new SubjectListener()); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/3c6985b831267b490cc461f5b9bda423d6a7aa00/GroupChatRoom.java/buggy/src/java/org/jivesoftware/spark/ui/rooms/GroupChatRoom.java |
insertText(Res.getString("message.your.voice.revoked")); | insertText(Res.getString("message.your.voice.granted")); | public void voiceGranted() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(true); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/3c6985b831267b490cc461f5b9bda423d6a7aa00/GroupChatRoom.java/buggy/src/java/org/jivesoftware/spark/ui/rooms/GroupChatRoom.java |
StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); | public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/2b67e7302b05b2cf189de97bd46023342930e7c6/ChatRoomImpl.java/clean/src/java/org/jivesoftware/spark/ui/rooms/ChatRoomImpl.java |
|
if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } | tabIcon = SparkManager.getUserManager().getIconFromPresence(presence); | public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/2b67e7302b05b2cf189de97bd46023342930e7c6/ChatRoomImpl.java/clean/src/java/org/jivesoftware/spark/ui/rooms/ChatRoomImpl.java |
showImages();; | showImages(); break; case IMAGES_SELECTION: bringSelector(e); break; | public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case SAVE: save(); break; case CANCEL: cancel(); break; case SELECT_IMAGE: selectImage(); break; case RESET_SELECT_IMAGE: resetSelectionImage(); break; case SHOW_IMAGES: showImages();; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a82d641ae8b6aae180291dcfe5e2b1c45e55ea11/CreateCategoryEditorMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/editors/category/CreateCategoryEditorMng.java |
attachBoxListeners(view.getImagesSelection(), IMAGES_SELECTION); | void initListeners() { attachButtonListener(view.getSaveButton(), SAVE); attachButtonListener(view.getCancelButton(), CANCEL); attachButtonListener(view.getSelectButton(), SELECT_IMAGE); attachButtonListener(view.getResetButton(), RESET_SELECT_IMAGE); attachButtonListener(view.getShowImagesButton(), SHOW_IMAGES); JTextArea nameField = view.getCategoryName(); nameField.getDocument().addDocumentListener(this); nameField.addMouseListener(this); JTextArea descriptionArea = view.getCategoryDescription(); descriptionArea.getDocument().addDocumentListener(this); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a82d641ae8b6aae180291dcfe5e2b1c45e55ea11/CreateCategoryEditorMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/editors/category/CreateCategoryEditorMng.java |
|
case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; | private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a82d641ae8b6aae180291dcfe5e2b1c45e55ea11/CreateCategoryEditorMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/editors/category/CreateCategoryEditorMng.java |
|
if (images == null || images.size() == 0) return; view.showImages(images); | displayListImages(images); | private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a82d641ae8b6aae180291dcfe5e2b1c45e55ea11/CreateCategoryEditorMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/editors/category/CreateCategoryEditorMng.java |
actionsMap.put(COLOR_PICKER, new ColorPickerAction(model)); | private void createActions() { actionsMap.put(RENDERER, new RendererAction(model)); actionsMap.put(MOVIE, new MovieAction(model)); actionsMap.put(SAVE, new SaveAction(model)); ViewerAction action = new ZoomAction(model, ZoomAction.ZOOM_25); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_25, action); action = new ZoomAction(model, ZoomAction.ZOOM_50); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_50, action); action = new ZoomAction(model, ZoomAction.ZOOM_75); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_75, action); action = new ZoomAction(model, ZoomAction.ZOOM_100); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_100, action); action = new ZoomAction(model, ZoomAction.ZOOM_125); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_125, action); action = new ZoomAction(model, ZoomAction.ZOOM_150); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_150, action); action = new ZoomAction(model, ZoomAction.ZOOM_175); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_175, action); action = new ZoomAction(model, ZoomAction.ZOOM_200); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_200, action); action = new ZoomAction(model, ZoomAction.ZOOM_225); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_225, action); action = new ZoomAction(model, ZoomAction.ZOOM_250); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_250, action); action = new ZoomAction(model, ZoomAction.ZOOM_275); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_275, action); action = new ZoomAction(model, ZoomAction.ZOOM_300); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_300, action); action = new ZoomAction(model, ZoomAction.ZOOM_FIT_TO_WINDOW); action.addPropertyChangeListener(this); actionsMap.put(ZOOM_FIT_TO_WINDOW, action); actionsMap.put(LENS, new LensAction(model)); action = new ColorModelAction(model, ColorModelAction.GREY_SCALE_MODEL); actionsMap.put(GREY_SCALE_MODEL, action); action = new ColorModelAction(model, ColorModelAction.RGB_MODEL); actionsMap.put(RGB_MODEL, action); action = new ColorModelAction(model, ColorModelAction.HSB_MODEL); actionsMap.put(HSB_MODEL, action); action = new RateImageAction(model, RateImageAction.RATE_ONE); action.addPropertyChangeListener(this); actionsMap.put(RATING_ONE, action); action = new RateImageAction(model, RateImageAction.RATE_TWO); action.addPropertyChangeListener(this); actionsMap.put(RATING_TWO, action); action = new RateImageAction(model, RateImageAction.RATE_THREE); action.addPropertyChangeListener(this); actionsMap.put(RATING_THREE, action); action = new RateImageAction(model, RateImageAction.RATE_FOUR); action.addPropertyChangeListener(this); actionsMap.put(RATING_FOUR, action); action = new RateImageAction(model, RateImageAction.RATE_FIVE); action.addPropertyChangeListener(this); actionsMap.put(RATING_FIVE, action); actionsMap.put(CHANNEL_MOVIE, new ChannelMovieAction(model)); actionsMap.put(UNIT_BAR, new UnitBarAction(model)); actionsMap.put(UNIT_BAR_ONE, new UnitBarSizeAction(model, UnitBarSizeAction.ONE)); actionsMap.put(UNIT_BAR_TWO, new UnitBarSizeAction(model, UnitBarSizeAction.TWO)); actionsMap.put(UNIT_BAR_FIVE, new UnitBarSizeAction(model, UnitBarSizeAction.FIVE)); actionsMap.put(UNIT_BAR_TEN, new UnitBarSizeAction(model, UnitBarSizeAction.TEN)); actionsMap.put(UNIT_BAR_TWENTY, new UnitBarSizeAction(model, UnitBarSizeAction.TWENTY)); actionsMap.put(UNIT_BAR_FIFTY, new UnitBarSizeAction(model, UnitBarSizeAction.FIFTY)); actionsMap.put(UNIT_BAR_HUNDRED, new UnitBarSizeAction(model, UnitBarSizeAction.HUNDRED)); actionsMap.put(UNIT_BAR_CUSTOM, new UnitBarSizeAction(model, UnitBarSizeAction.CUSTOMIZED)); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/ImViewerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java |
|
} else if (ChannelButton.CHANNEL_COLOR_PROPERTY.equals(propName)) { | } else if (ChannelButton.CHANNEL_COLOR_PROPERTY.equals(propName) || ChannelColorMenuItem.CHANNEL_COLOR_PROPERTY.equals(propName)) { | public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (ImViewer.Z_SELECTED_PROPERTY.equals(propName)) { view.setZSection(((Integer) pce.getNewValue()).intValue()); } else if (ImViewer.T_SELECTED_PROPERTY.equals(propName)) { view.setTimepoint(((Integer) pce.getNewValue()).intValue()); } else if (ChannelButton.CHANNEL_SELECTED_PROPERTY.equals(propName)) { Map map = (Map) pce.getNewValue(); if (map == null) return; if (map.size() != 1) return; Iterator i = map.keySet().iterator(); Integer index; while (i.hasNext()) { index = (Integer) i.next(); model.setChannelSelection(index.intValue(), ((Boolean) map.get(index)).booleanValue()); } } else if (ZoomAction.ZOOM_PROPERTY.equals(propName)) { view.setZoomFactor((ViewerAction) pce.getNewValue()); } else if (RateImageAction.RATE_IMAGE_PROPERTY.equals(propName)) { view.setRatingFactor((ViewerAction) pce.getNewValue()); } else if (LoadingWindow.CLOSED_PROPERTY.equals(propName)) { model.discard(); } else if (Renderer.RENDER_PLANE_PROPERTY.equals(propName)) { model.renderXYPlane(); } else if (Renderer.SELECTED_CHANNEL_PROPERTY.equals(propName)) { if (model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL)) { int c = ((Integer) pce.getNewValue()).intValue(); for (int i = 0; i < model.getMaxC(); i++) model.setChannelActive(i, i == c); model.displayChannelMovie(); } } else if (ChannelButton.INFO_PROPERTY.equals(propName)) { int index = ((Integer) pce.getNewValue()).intValue(); ChannelMetadata data = model.getChannelMetadata(index); if (data != null) { InfoDialog dialog = new InfoDialog(model.getUI(), data); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else { UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo("Channel info", "No metadata for the " + "selected channel."); } } else if (ChannelButton.CHANNEL_COLOR_PROPERTY.equals(propName)) { colorPickerIndex = ((Integer) pce.getNewValue()).intValue(); Color c = model.getChannelColor(colorPickerIndex); ColourPicker dialog = new ColourPicker(view, c); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else if (ColourPicker.COLOUR_PROPERTY.equals(propName)) { Color c = (Color) pce.getNewValue(); if (colorPickerIndex != -1) { model.setChannelColor(colorPickerIndex, c); } } else if (UnitBarSizeDialog.UNIT_BAR_VALUE_PROPERTY.equals(propName)) { double v = ((Double) pce.getNewValue()).doubleValue(); model.setUnitBarSize(v); } else if (InfoDialog.UPDATE_PROPERTY.equals(propName)) { //TODO: implement method } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/ImViewerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java |
return "AnalysisNodeExecution"+(analysisNodeExecutionId==null ? ":Hash"+this.hashCode() : ":"+analysisNodeExecutionId); | return "AnalysisNodeExecution"+(analysisNodeExecutionId==null ? ":Hash_"+this.hashCode() : ":Id_"+analysisNodeExecutionId); | public String toString(){ return "AnalysisNodeExecution"+(analysisNodeExecutionId==null ? ":Hash"+this.hashCode() : ":"+analysisNodeExecutionId); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/51a3c546dfc7a7a98b29771a459df19094fc5b51/AnalysisNodeExecution.java/clean/components/common/src/ome/model/AnalysisNodeExecution.java |
titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); | titleLabel.setFont(new Font("Dialog", Font.BOLD, 11)); | public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); | ResourceUtils.resButton(acceptLabel, Res.getString("accept")); ResourceUtils.resButton(declineLabel, Res.getString("reject")); | public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); | declineLabel.setFont(new Font("Dialog", Font.BOLD, 10)); acceptLabel.setFont(new Font("Dialog", Font.BOLD, 10)); | public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
titleLabel.setText(contactItem.getNickname() + " is sending you a file."); | titleLabel.setText(Res.getString("message.user.is.sending.you.a.file", contactItem.getNickname())); | public void acceptFileTransfer(final FileTransferRequest request) { String fileName = request.getFileName(); long fileSize = request.getFileSize(); String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText(contactItem.getNickname() + " is sending you a file."); File tempFile = new File(Spark.getUserHome(), "Spark/tmp"); try { tempFile.mkdirs(); File file = new File(tempFile, fileName); file.delete(); BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("a"); out.close(); imageLabel.setIcon(GraphicUtils.getIcon(file)); // Delete temp file when program exits. file.delete(); } catch (IOException e) { imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); Log.error(e); } acceptLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { acceptRequest(request); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { rejectRequest(request); } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
titleLabel.setText("Negotiating file transfer. Please wait..."); | titleLabel.setText(Res.getString("message.negotiate.file.transfer")); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { | if (status == FileTransfer.Status.error || status == FileTransfer.Status.complete || status == FileTransfer.Status.cancelled || status == FileTransfer.Status.refused) { | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); | else if (status == FileTransfer.Status.negotiating_stream) { titleLabel.setText(Res.getString("message.negotiate.stream")); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); | else if (status == FileTransfer.Status.in_progress) { titleLabel.setText(Res.getString("message.receiving.file", contactItem.getNickname())); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); | imageLabel.setToolTipText(Res.getString("message.click.to.open")); titleLabel.setToolTipText(Res.getString("message.click.to.open")); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
if (transfer.getStatus() == FileTransfer.Status.ERROR) { | if (transfer.getStatus() == FileTransfer.Status.error) { | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
transferMessage = "There was an error during file transfer."; | transferMessage = Res.getString("message.error.during.file.transfer"); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; | else if (transfer.getStatus() == FileTransfer.Status.refused) { transferMessage = Res.getString("message.transfer.refused"); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
else if (transfer.getStatus() == FileTransfer.Status.CANCLED || | else if (transfer.getStatus() == FileTransfer.Status.cancelled || | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
transferMessage = "The file transfer was cancelled."; | transferMessage = Res.getString("message.transfer.cancelled"); | private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { | if (status == FileTransfer.Status.error || status == FileTransfer.Status.complete || status == FileTransfer.Status.cancelled || status == FileTransfer.Status.refused) { | public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); | else if (status == FileTransfer.Status.negotiating_stream) { titleLabel.setText(Res.getString("message.negotiate.stream")); | public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/ReceiveMessage.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/ui/ReceiveMessage.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.