CPD Results
The following document contains the results of PMD's CPD 4.2.5.
Duplications
File | Line |
---|---|
javax/faces/component/_ClassUtils.java | 41 |
javax/faces/component/html/_ClassUtils.java | 41 |
final class _ClassUtils { // ~ Static fields/initializers ----------------------------------------------------------------- //private static final Log log = LogFactory.getLog(_ClassUtils.class); private static final Logger log = Logger.getLogger(_ClassUtils.class.getName()); public static final Class<boolean[]> BOOLEAN_ARRAY_CLASS = boolean[].class; public static final Class<byte[]> BYTE_ARRAY_CLASS = byte[].class; public static final Class<char[]> CHAR_ARRAY_CLASS = char[].class; public static final Class<short[]> SHORT_ARRAY_CLASS = short[].class; public static final Class<int[]> INT_ARRAY_CLASS = int[].class; public static final Class<long[]> LONG_ARRAY_CLASS = long[].class; public static final Class<float[]> FLOAT_ARRAY_CLASS = float[].class; public static final Class<double[]> DOUBLE_ARRAY_CLASS = double[].class; public static final Class<Object[]> OBJECT_ARRAY_CLASS = Object[].class; public static final Class<Boolean[]> BOOLEAN_OBJECT_ARRAY_CLASS = Boolean[].class; public static final Class<Byte[]> BYTE_OBJECT_ARRAY_CLASS = Byte[].class; public static final Class<Character[]> CHARACTER_OBJECT_ARRAY_CLASS = Character[].class; public static final Class<Short[]> SHORT_OBJECT_ARRAY_CLASS = Short[].class; public static final Class<Integer[]> INTEGER_OBJECT_ARRAY_CLASS = Integer[].class; public static final Class<Long[]> LONG_OBJECT_ARRAY_CLASS = Long[].class; public static final Class<Float[]> FLOAT_OBJECT_ARRAY_CLASS = Float[].class; public static final Class<Double[]> DOUBLE_OBJECT_ARRAY_CLASS = Double[].class; public static final Class<String[]> STRING_OBJECT_ARRAY_CLASS = String[].class; public static final Map<String, Class<?>> COMMON_TYPES = new HashMap<String, Class<?>>(64); static { COMMON_TYPES.put("byte", Byte.TYPE); COMMON_TYPES.put("char", Character.TYPE); COMMON_TYPES.put("double", Double.TYPE); COMMON_TYPES.put("float", Float.TYPE); COMMON_TYPES.put("int", Integer.TYPE); COMMON_TYPES.put("long", Long.TYPE); COMMON_TYPES.put("short", Short.TYPE); COMMON_TYPES.put("boolean", Boolean.TYPE); COMMON_TYPES.put("void", Void.TYPE); COMMON_TYPES.put("java.lang.Object", Object.class); COMMON_TYPES.put("java.lang.Boolean", Boolean.class); COMMON_TYPES.put("java.lang.Byte", Byte.class); COMMON_TYPES.put("java.lang.Character", Character.class); COMMON_TYPES.put("java.lang.Short", Short.class); COMMON_TYPES.put("java.lang.Integer", Integer.class); COMMON_TYPES.put("java.lang.Long", Long.class); COMMON_TYPES.put("java.lang.Float", Float.class); COMMON_TYPES.put("java.lang.Double", Double.class); COMMON_TYPES.put("java.lang.String", String.class); COMMON_TYPES.put("byte[]", BYTE_ARRAY_CLASS); COMMON_TYPES.put("char[]", CHAR_ARRAY_CLASS); COMMON_TYPES.put("double[]", DOUBLE_ARRAY_CLASS); COMMON_TYPES.put("float[]", FLOAT_ARRAY_CLASS); COMMON_TYPES.put("int[]", INT_ARRAY_CLASS); COMMON_TYPES.put("long[]", LONG_ARRAY_CLASS); COMMON_TYPES.put("short[]", SHORT_ARRAY_CLASS); COMMON_TYPES.put("boolean[]", BOOLEAN_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Object[]", OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Boolean[]", BOOLEAN_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Byte[]", BYTE_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Character[]", CHARACTER_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Short[]", SHORT_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Integer[]", INTEGER_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Long[]", LONG_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Float[]", FLOAT_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.Double[]", DOUBLE_OBJECT_ARRAY_CLASS); COMMON_TYPES.put("java.lang.String[]", STRING_OBJECT_ARRAY_CLASS); // array of void is not a valid type } /** utility class, do not instantiate */ private _ClassUtils() { // utility class, disable instantiation } // ~ Methods ------------------------------------------------------------------------------------ /** * Tries a Class.loadClass with the context class loader of the current thread first and automatically falls back to * the ClassUtils class loader (i.e. the loader of the myfaces.jar lib) if necessary. * * @param type * fully qualified name of a non-primitive non-array class * @return the corresponding Class * @throws NullPointerException * if type is null * @throws ClassNotFoundException */ public static Class<?> classForName(String type) throws ClassNotFoundException { if (type == null) { throw new NullPointerException("type"); } try { // Try WebApp ClassLoader first return Class.forName(type, false, // do not initialize for faster startup getContextClassLoader()); } catch (ClassNotFoundException ignore) { // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib) return Class.forName(type, false, // do not initialize for faster startup _ClassUtils.class.getClassLoader()); } } /** * Same as {@link #classForName(String)}, but throws a RuntimeException (FacesException) instead of a * ClassNotFoundException. * * @return the corresponding Class * @throws NullPointerException * if type is null * @throws FacesException * if class not found */ public static Class<?> simpleClassForName(String type) { try { return classForName(type); } catch (ClassNotFoundException e) { log.log(Level.SEVERE, "Class " + type + " not found", e); throw new FacesException(e); } } /** * Similar as {@link #classForName(String)}, but also supports primitive types and arrays as specified for the * JavaType element in the JavaServer Faces Config DTD. * * @param type * fully qualified class name or name of a primitive type, both optionally followed by "[]" to indicate * an array type * @return the corresponding Class * @throws NullPointerException * if type is null * @throws ClassNotFoundException */ public static Class<?> javaTypeToClass(String type) throws ClassNotFoundException { if (type == null) { throw new NullPointerException("type"); } // try common types and arrays of common types first Class<?> clazz = COMMON_TYPES.get(type); if (clazz != null) { return clazz; } int len = type.length(); if (len > 2 && type.charAt(len - 1) == ']' && type.charAt(len - 2) == '[') { String componentType = type.substring(0, len - 2); Class<?> componentTypeClass = classForName(componentType); return Array.newInstance(componentTypeClass, 0).getClass(); } return classForName(type); } /** * Same as {@link #javaTypeToClass(String)}, but throws a RuntimeException (FacesException) instead of a * ClassNotFoundException. * * @return the corresponding Class * @throws NullPointerException * if type is null * @throws FacesException * if class not found */ public static Class<?> simpleJavaTypeToClass(String type) { try { return javaTypeToClass(type); } catch (ClassNotFoundException e) { log.log(Level.SEVERE, "Class " + type + " not found", e); throw new FacesException(e); } } public static InputStream getResourceAsStream(String resource) { InputStream stream = getContextClassLoader().getResourceAsStream(resource); if (stream == null) { // fallback stream = _ClassUtils.class.getClassLoader().getResourceAsStream(resource); } return stream; } /** * @param resource * Name of resource(s) to find in classpath * @param defaultObject * The default object to use to determine the class loader (if none associated with current thread.) * @return Iterator over URL Objects */ public static Collection<? extends URL> getResources(String resource, Object defaultObject) { try { Enumeration<URL> resources = getCurrentLoader(defaultObject).getResources(resource); List<URL> lst = new ArrayList<URL>(); while (resources.hasMoreElements()) { lst.add(resources.nextElement()); } return lst; } catch (IOException e) { log.log(Level.SEVERE, e.getMessage(), e); throw new FacesException(e); } } public static Object newInstance(String type) throws FacesException { if (type == null) { return null; } return newInstance(simpleClassForName(type)); } public static Object newInstance(String type, Class<?> expectedType) throws FacesException { return newInstance(type, expectedType == null ? null : new Class[] { expectedType }); } public static Object newInstance(String type, Class<?>[] expectedTypes) { if (type == null) { return null; } Class<?> clazzForName = simpleClassForName(type); if (expectedTypes != null) { for (int i = 0, size = expectedTypes.length; i < size; i++) { if (!expectedTypes[i].isAssignableFrom(clazzForName)) { throw new FacesException("'" + type + "' does not implement expected type '" + expectedTypes[i] + "'"); } } } return newInstance(clazzForName); } public static Object newInstance(Class<?> clazz) throws FacesException { try { return clazz.newInstance(); } catch (NoClassDefFoundError e) { log.log(Level.SEVERE, "Class : " + clazz.getName() + " not found.", e); throw new FacesException(e); } catch (InstantiationException e) { log.log(Level.SEVERE, e.getMessage(), e); throw new FacesException(e); } catch (IllegalAccessException e) { log.log(Level.SEVERE, e.getMessage(), e); throw new FacesException(e); } } public static Object convertToType(Object value, Class<?> desiredClass) { if (value == null) { return null; } try { ExpressionFactory expFactory = FacesContext.getCurrentInstance().getApplication().getExpressionFactory(); return expFactory.coerceToType(value, desiredClass); } catch (Exception e) { String message = "Cannot coerce " + value.getClass().getName() + " to " + desiredClass.getName(); log.log(Level.SEVERE, message, e); throw new FacesException(message, e); } } public static Object convertToTypeNoLogging(FacesContext facesContext, Object value, Class<?> desiredClass) throws Exception { if (value == null) { return null; } ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory(); return expFactory.coerceToType(value, desiredClass); } /** * Gets the ClassLoader associated with the current thread. Returns the class loader associated with the specified * default object if no context loader is associated with the current thread. * * @param defaultObject * The default object to use to determine the class loader (if none associated with current thread.) * @return ClassLoader */ protected static ClassLoader getCurrentLoader(Object defaultObject) { ClassLoader loader = getContextClassLoader(); if (loader == null) { loader = defaultObject.getClass().getClassLoader(); } return loader; } /** * Gets the ClassLoader associated with the current thread. Returns the class loader associated with the specified * default object if no context loader is associated with the current thread. * * @return ClassLoader */ protected static ClassLoader getContextClassLoader() { if (System.getSecurityManager() != null) { try { Object cl = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PrivilegedActionException { return Thread.currentThread().getContextClassLoader(); } }); return (ClassLoader) cl; } catch (PrivilegedActionException pae) { throw new FacesException(pae); } } else { return Thread.currentThread().getContextClassLoader(); } } } |
File | Line |
---|---|
javax/faces/component/_DeltaList.java | 41 |
javax/faces/component/behavior/_DeltaList.java | 44 |
class _DeltaList<T> extends ArrayList<T> implements List<T>, PartialStateHolder, RandomAccess { private static Object[] emptyObjectArray = new Object[]{}; private boolean _initialStateMarked; public _DeltaList() { super(); } public _DeltaList(int initialCapacity) { super(initialCapacity); } @Override public void add(int index, T element) { clearInitialState(); super.add(index, element); } @Override public boolean add(T e) { clearInitialState(); return super.add(e); } @Override public boolean addAll(Collection<? extends T> c) { clearInitialState(); return super.addAll(c); } @Override public boolean addAll(int index, Collection<? extends T> c) { clearInitialState(); return super.addAll(index, c); } @Override public void clear() { clearInitialState(); super.clear(); } @Override public T remove(int index) { clearInitialState(); return super.remove(index); } @Override public boolean remove(Object o) { clearInitialState(); return super.remove(o); } @Override public boolean removeAll(Collection<?> c) { clearInitialState(); return super.removeAll(c); } @Override public boolean retainAll(Collection<?> c) { clearInitialState(); return super.retainAll(c); } @Override public T set(int index, T element) { clearInitialState(); return super.set(index, element); } @Override public boolean isTransient() { return false; } @Override public void setTransient(boolean newTransientValue) { throw new UnsupportedOperationException(); } @Override public void restoreState(FacesContext context, Object state) { if (state == null) { return; } if (initialStateMarked()) { //Restore delta Object[] lst = (Object[]) state; int j = 0; int i = 0; while (i < lst.length) { if (lst[i] instanceof _AttachedDeltaWrapper) { //Delta ((StateHolder)super.get(j)).restoreState(context, ((_AttachedDeltaWrapper) lst[i]).getWrappedStateObject()); j++; } else if (lst[i] != null) { //Full super.set(j, (T) UIComponentBase.restoreAttachedState(context, lst[i])); j++; } else { super.remove(j); } i++; } if (i != j) { // StateHolder transient objects found, next time save and restore it fully //because the size of the list changes. clearInitialState(); } } else { //Restore delegate Object[] lst = (Object[]) state; super.clear(); super.ensureCapacity(lst.length); for (int i = 0; i < lst.length; i++) { T value = (T) UIComponentBase.restoreAttachedState(context, lst[i]); if (value != null) { super.add(value); } } } } @Override public Object saveState(FacesContext context) { int size = super.size(); if (initialStateMarked()) { Object [] lst = null; boolean nullDelta = true; if (size > 0) { lst = new Object[size]; for (int i = 0; i < size; i++) { Object value = super.get(i); if (value instanceof PartialStateHolder) { //Delta PartialStateHolder holder = (PartialStateHolder) value; if (!holder.isTransient()) { Object attachedState = holder.saveState(context); if (attachedState != null) { nullDelta = false; } lst[i] = new _AttachedDeltaWrapper(value.getClass(), attachedState); } } else { //Full lst[i] = UIComponentBase.saveAttachedState(context, value); if (value instanceof StateHolder || value instanceof List) { nullDelta = false; } } } } else { lst = emptyObjectArray; } if (nullDelta) { return null; } return lst; } else { if (size > 0) { Object [] lst = new Object[size]; for (int i = 0; i < size; i++) { lst[i] = UIComponentBase.saveAttachedState(context, super.get(i)); } return lst; } else { return emptyObjectArray; } } } @Override public void clearInitialState() { //Reset delta setting to null if (_initialStateMarked) { _initialStateMarked = false; for (int i = 0; i < super.size(); i++) { T value = super.get(i); if (value instanceof PartialStateHolder) { ((PartialStateHolder)value).clearInitialState(); } } } } @Override public boolean initialStateMarked() { return _initialStateMarked; } @Override public void markInitialState() { _initialStateMarked = true; int size = super.size(); for (int i = 0; i < size; i++) { T value = super.get(i); if (value instanceof PartialStateHolder) { ((PartialStateHolder)value).markInitialState(); } } } } |
File | Line |
---|---|
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 178 |
javax/faces/component/behavior/_DeltaStateHelper.java | 281 |
} else { _deltas.put(key, value); returnValue = _fullState.put(key, value); } } else { /* if (value instanceof StateHolder) { _stateHolderKeys.add(key); } */ returnValue = _fullState.put(key, value); } return returnValue; } public Object put(Serializable key, String mapKey, Object value) { boolean returnSet = false; Object returnValue = null; if (_createDeltas()) { //Track delta case Map<String, Object> mapValues = (Map<String, Object>) _deltas .get(key); if (mapValues == null) { mapValues = new InternalMap<String, Object>(); _deltas.put(key, mapValues); } if (mapValues.containsKey(mapKey)) { returnValue = mapValues.put(mapKey, value); returnSet = true; } else { mapValues.put(mapKey, value); } } //Handle change on full map Map<String, Object> mapValues = (Map<String, Object>) _fullState .get(key); if (mapValues == null) { mapValues = new InternalMap<String, Object>(); _fullState.put(key, mapValues); } if (returnSet) { mapValues.put(mapKey, value); } else { returnValue = mapValues.put(mapKey, value); } return returnValue; } public Object remove(Serializable key) { Object returnValue = null; if (_createDeltas()) { if (_deltas.containsKey(key)) { // Keep track of the removed values using key/null pair on the delta map returnValue = _deltas.put(key, null); _fullState.remove(key); } else { // Keep track of the removed values using key/null pair on the delta map _deltas.put(key, null); returnValue = _fullState.remove(key); } } else { returnValue = _fullState.remove(key); } return returnValue; } public Object remove(Serializable key, Object valueOrKey) { // Comment by lu4242 : The spec javadoc says if it is a Collection // or Map deal with it. But the intention of this method is work // with add(?,?) and put(?,?,?), this ones return instances of // InternalMap and InternalList to prevent mixing, so to be // consistent we'll cast to those classes here. Object collectionOrMap = _fullState.get(key); Object returnValue = null; if (collectionOrMap instanceof InternalMap) { if (_createDeltas()) { returnValue = _removeValueOrKeyFromMap(_deltas, key, valueOrKey, true); _removeValueOrKeyFromMap(_fullState, key, valueOrKey, false); } else { returnValue = _removeValueOrKeyFromMap(_fullState, key, valueOrKey, false); } } else if (collectionOrMap instanceof InternalList) { if (_createDeltas()) { returnValue = _removeValueOrKeyFromCollectionDelta(_deltas, key, valueOrKey); _removeValueOrKeyFromCollection(_fullState, key, valueOrKey); } else { returnValue = _removeValueOrKeyFromCollection(_fullState, key, valueOrKey); } } return returnValue; } private static Object _removeValueOrKeyFromCollectionDelta( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey) { Object returnValue = null; Map<Object, Boolean> c = (Map<Object, Boolean>) stateMap.get(key); if (c != null) { if (c.containsKey(valueOrKey)) { returnValue = valueOrKey; } c.put(valueOrKey, Boolean.FALSE); } return returnValue; } private static Object _removeValueOrKeyFromCollection( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey) { Object returnValue = null; Collection c = (Collection) stateMap.get(key); if (c != null) { if (c.remove(valueOrKey)) { returnValue = valueOrKey; } if (c.isEmpty()) { stateMap.remove(key); } } return returnValue; } private static Object _removeValueOrKeyFromMap( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey, boolean delta) { if (valueOrKey == null) { return null; } Object returnValue = null; Map<String, Object> map = (Map<String, Object>) stateMap.get(key); if (map != null) { if (delta) { // Keep track of the removed values using key/null pair on the delta map returnValue = map.put((String) valueOrKey, null); } else { returnValue = map.remove(valueOrKey); } if (map.isEmpty()) { //stateMap.remove(key); stateMap.put(key, null); } } return returnValue; } public boolean isTransient() { return _transient; } /** * Serializing cod * the serialized data structure consists of key value pairs unless the value itself is an internal array * or a map in case of an internal array or map the value itself is another array with its initial value * myfaces.InternalArray, myfaces.internalMap * * the internal Array is then mapped to another array * * the internal Map again is then mapped to a map with key value pairs * * */ public Object saveState(FacesContext context) { Map serializableMap = (isInitialStateMarked()) ? _deltas : _fullState; if (serializableMap == null || serializableMap.isEmpty()) { return null; } /* int stateHolderKeyCount = 0; if (isInitalStateMarked()) { for (Iterator<Serializable> it = _stateHolderKeys.iterator(); it.hasNext();) { Serializable key = it.next(); if (!_deltas.containsKey(key)) { stateHolderKeyCount++; } } }*/ Map.Entry<Serializable, Object> entry; //entry == key, value, key, value Object[] retArr = new Object[serializableMap.entrySet().size() * 2]; //Object[] retArr = new Object[serializableMap.entrySet().size() * 2 + stateHolderKeyCount]; Iterator<Map.Entry<Serializable, Object>> it = serializableMap .entrySet().iterator(); int cnt = 0; while (it.hasNext()) { entry = it.next(); retArr[cnt] = entry.getKey(); Object value = entry.getValue(); // The condition in which the call to saveAttachedState // is to handle List, StateHolder or non Serializable instances. // we check it here, to prevent unnecessary calls. if (value instanceof StateHolder || value instanceof List || !(value instanceof Serializable)) { Object savedValue = saveAttachedState(context, |
File | Line |
---|---|
javax/faces/component/_MessageUtils.java | 29 |
javax/faces/component/html/_MessageUtils.java | 30 |
class _MessageUtils { private static final String DETAIL_SUFFIX = "_detail"; static void addErrorMessage(FacesContext facesContext, UIComponent component, String messageId) { facesContext.addMessage(component.getClientId(facesContext), getMessage(facesContext, facesContext.getViewRoot().getLocale(), FacesMessage.SEVERITY_ERROR, messageId, null)); } static void addErrorMessage(FacesContext facesContext, UIComponent component, String messageId, Object[] args) { facesContext.addMessage(component.getClientId(facesContext), getMessage(facesContext, facesContext.getViewRoot().getLocale(), FacesMessage.SEVERITY_ERROR, messageId, args)); } static void addErrorMessage(FacesContext facesContext, UIComponent component, Throwable cause) { facesContext.addMessage(component.getClientId(facesContext), new FacesMessage(FacesMessage.SEVERITY_ERROR, cause .getLocalizedMessage(), cause.getLocalizedMessage())); } static FacesMessage getMessage(FacesContext facesContext, Locale locale, FacesMessage.Severity severity, String messageId, Object args[]) { ResourceBundle appBundle; ResourceBundle defBundle; String summary; String detail; appBundle = getApplicationBundle(facesContext, locale); summary = getBundleString(appBundle, messageId); if (summary != null) { detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); } else { defBundle = getDefaultBundle(facesContext, locale); summary = getBundleString(defBundle, messageId); if (summary != null) { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); } else { //Try to find detail alone detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { //Neither detail nor summary found facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle"); return new FacesMessage(severity, messageId, null); } } } } if (args != null && args.length > 0) { return new _ParametrizableFacesMessage(severity, summary, detail, args, locale); } else { return new FacesMessage(severity, summary, detail); } } private static String getBundleString(ResourceBundle bundle, String key) { try { return bundle == null ? null : bundle.getString(key); } catch (MissingResourceException e) { return null; } } private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) { String bundleName = facesContext.getApplication().getMessageBundle(); return bundleName != null ? getBundle(facesContext, locale, bundleName) : null; } private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) { return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES); } private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) { try { //First we try the JSF implementation class loader return ResourceBundle.getBundle(bundleName, locale, facesContext.getClass().getClassLoader()); } catch (MissingResourceException ignore1) { try { //Next we try the JSF API class loader return ResourceBundle.getBundle(bundleName, locale, _MessageUtils.class.getClassLoader()); } catch (MissingResourceException ignore2) { try { //Last resort is the context class loader return ResourceBundle.getBundle(bundleName, locale, _ClassUtils.getContextClassLoader()); } catch (MissingResourceException damned) { facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found"); return null; } } } } static Object getLabel(FacesContext facesContext, UIComponent component) { Object label = component.getAttributes().get("label"); ValueExpression expression = null; if (label != null && label instanceof String && ((String)label).length() == 0 ) { // Note component.getAttributes().get("label") internally try to // evaluate the EL expression for the label, but in some cases, // when PSS is disabled and f:loadBundle is used, when the view is // restored the bundle is not set to the EL expression returns an // empty String. It is not possible to check if there is a // hardcoded label, but we can check if there is // an EL expression set, so the best in this case is use that, and if // there is an EL expression set, use it, otherwise use the hardcoded // value. See MYFACES-3591 for details. expression = component.getValueExpression("label"); if (expression != null) { // Set the label to null and use the EL expression instead. label = null; } } if(label != null) { return label; } expression = (expression == null) ? component.getValueExpression("label") : expression; if(expression != null) { return expression; } //If no label is not specified, use clientId return component.getClientId( facesContext ); } } |
File | Line |
---|---|
javax/faces/convert/_MessageUtils.java | 60 |
javax/faces/validator/_MessageUtils.java | 65 |
appBundle = getApplicationBundle(facesContext, locale); summary = getBundleString(appBundle, messageId); if (summary != null) { detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); } else { defBundle = getDefaultBundle(facesContext, locale); summary = getBundleString(defBundle, messageId); if (summary != null) { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); } else { //Try to find detail alone detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { //Neither detail nor summary found facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle"); return new FacesMessage(severity, messageId, null); } } } } if (args != null && args.length > 0) { return new _ParametrizableFacesMessage(severity, summary, detail, args, locale); } else { return new FacesMessage(severity, summary, detail); } } private static String getBundleString(ResourceBundle bundle, String key) { try { return bundle == null ? null : bundle.getString(key); } catch (MissingResourceException e) { return null; } } private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) { String bundleName = facesContext.getApplication().getMessageBundle(); return bundleName != null ? getBundle(facesContext, locale, bundleName) : null; } private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) { return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES); } private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) { try { //First we try the JSF implementation class loader return ResourceBundle.getBundle(bundleName, locale, facesContext.getClass().getClassLoader()); } catch (MissingResourceException ignore1) { try { //Next we try the JSF API class loader return ResourceBundle.getBundle(bundleName, locale, _MessageUtils.class.getClassLoader()); } catch (MissingResourceException ignore2) { try { //Last resort is the context class loader if (System.getSecurityManager() != null) { Object cl = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PrivilegedActionException { return Thread.currentThread().getContextClassLoader(); } }); return ResourceBundle.getBundle(bundleName,locale,(ClassLoader)cl); } else { return ResourceBundle.getBundle(bundleName,locale, Thread.currentThread().getContextClassLoader()); } } catch(PrivilegedActionException pae) { throw new FacesException(pae); } catch (MissingResourceException damned) { facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found"); return null; } } } } static Object getLabel(FacesContext facesContext, UIComponent component) { Object label = component.getAttributes().get("label"); ValueExpression expression = null; if (label != null && label instanceof String && ((String)label).length() == 0 ) { // Note component.getAttributes().get("label") internally try to // evaluate the EL expression for the label, but in some cases, // when PSS is disabled and f:loadBundle is used, when the view is // restored the bundle is not set to the EL expression returns an // empty String. It is not possible to check if there is a // hardcoded label, but we can check if there is // an EL expression set, so the best in this case is use that, and if // there is an EL expression set, use it, otherwise use the hardcoded // value. See MYFACES-3591 for details. expression = component.getValueExpression("label"); if (expression != null) { // Set the label to null and use the EL expression instead. label = null; } } if(label != null) { return label; } expression = (expression == null) ? component.getValueExpression("label") : expression; if(expression != null) { return expression; } //If no label is not specified, use clientId return component.getClientId( facesContext ); } } |
File | Line |
---|---|
javax/faces/component/_ParametrizableFacesMessage.java | 33 |
javax/faces/component/html/_ParametrizableFacesMessage.java | 33 |
class _ParametrizableFacesMessage extends FacesMessage { /** * */ private static final long serialVersionUID = 7792947730961657948L; private final Object _args[]; private String _evaluatedDetail; private String _evaluatedSummary; private transient Object _evaluatedArgs[]; private Locale _locale; public _ParametrizableFacesMessage( String summary, String detail, Object[] args, Locale locale) { super(summary, detail); if(locale == null) { throw new NullPointerException("locale"); } _locale = locale; _args = args; } public _ParametrizableFacesMessage(FacesMessage.Severity severity, String summary, String detail, Object[] args, Locale locale) { super(severity, summary, detail); if(locale == null) { throw new NullPointerException("locale"); } _locale = locale; _args = args; } @Override public String getDetail() { if (_evaluatedArgs == null && _args != null) { evaluateArgs(); } if (_evaluatedDetail == null) { MessageFormat format = new MessageFormat(super.getDetail(), _locale); _evaluatedDetail = format.format(_evaluatedArgs); } return _evaluatedDetail; } @Override public void setDetail(String detail) { super.setDetail(detail); _evaluatedDetail = null; } public String getUnformattedDetail() { return super.getDetail(); } @Override public String getSummary() { if (_evaluatedArgs == null && _args != null) { evaluateArgs(); } if (_evaluatedSummary == null) { MessageFormat format = new MessageFormat(super.getSummary(), _locale); _evaluatedSummary = format.format(_evaluatedArgs); } return _evaluatedSummary; } @Override public void setSummary(String summary) { super.setSummary(summary); _evaluatedSummary = null; } public String getUnformattedSummary() { return super.getSummary(); } private void evaluateArgs() { _evaluatedArgs = new Object[_args.length]; FacesContext facesContext = null; for (int i = 0; i < _args.length; i++) { if (_args[i] == null) { continue; } else if (_args[i] instanceof ValueBinding) { if (facesContext == null) { facesContext = FacesContext.getCurrentInstance(); } _evaluatedArgs[i] = ((ValueBinding)_args[i]).getValue(facesContext); } else if (_args[i] instanceof ValueExpression) { if (facesContext == null) { facesContext = FacesContext.getCurrentInstance(); } _evaluatedArgs[i] = ((ValueExpression)_args[i]).getValue(facesContext.getELContext()); } else { _evaluatedArgs[i] = _args[i]; } } } } |
File | Line |
---|---|
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 498 |
javax/faces/component/behavior/_DeltaStateHelper.java | 610 |
Object savedValue = restoreAttachedState(context, serializedState[cnt + 1]); if (isInitialStateMarked()) { if (savedValue instanceof InternalDeltaListMap) { for (Map.Entry<Object, Boolean> mapEntry : ((Map<Object, Boolean>) savedValue) .entrySet()) { boolean addOrRemove = mapEntry.getValue(); if (addOrRemove) { //add this.add(key, mapEntry.getKey()); } else { //remove this.remove(key, mapEntry.getKey()); } } } else if (savedValue instanceof InternalMap) { for (Map.Entry<String, Object> mapEntry : ((Map<String, Object>) savedValue) .entrySet()) { this.put(key, mapEntry.getKey(), mapEntry.getValue()); } } /* else if (savedValue instanceof _AttachedDeltaWrapper) { _AttachedStateWrapper wrapper = (_AttachedStateWrapper) savedValue; //Restore delta state ((PartialStateHolder)_fullState.get(key)).restoreState(context, wrapper.getWrappedStateObject()); //Add this key as StateHolder key _stateHolderKeys.add(key); } */ else { put(key, savedValue); } } else { put(key, savedValue); } } } public void setTransient(boolean transientValue) { _transient = transientValue; } //We use our own data structures just to make sure //nothing gets mixed up internally static class InternalMap<K, V> extends HashMap<K, V> implements StateHolder { public InternalMap() { super(); } public InternalMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } public InternalMap(Map<? extends K, ? extends V> m) { super(m); } public InternalMap(int initialSize) { super(initialSize); } public boolean isTransient() { return false; } public void setTransient(boolean newTransientValue) { // No op } public void restoreState(FacesContext context, Object state) { Object[] listAsMap = (Object[]) state; for (int cnt = 0; cnt < listAsMap.length; cnt += 2) { this.put((K) listAsMap[cnt], (V) UIComponentBase .restoreAttachedState(context, listAsMap[cnt + 1])); } } public Object saveState(FacesContext context) { int cnt = 0; Object[] mapArr = new Object[this.size() * 2]; for (Map.Entry<K, V> entry : this.entrySet()) { mapArr[cnt] = entry.getKey(); Object value = entry.getValue(); if (value instanceof StateHolder || value instanceof List || !(value instanceof Serializable)) { mapArr[cnt + 1] = saveAttachedState(context, value); |
File | Line |
---|---|
javax/faces/component/behavior/BehaviorBase.java | 151 |
javax/faces/component/behavior/_DeltaStateHelper.java | 820 |
} } private static Object saveAttachedState(FacesContext context, Object attachedObject) { if (context == null) { throw new NullPointerException ("context"); } if (attachedObject == null) { return null; } // StateHolder interface should take precedence over // List children if (attachedObject instanceof StateHolder) { StateHolder holder = (StateHolder) attachedObject; if (holder.isTransient()) { return null; } return new _AttachedStateWrapper(attachedObject.getClass(), holder.saveState(context)); } else if (attachedObject instanceof List) { List<Object> lst = new ArrayList<Object>(((List<?>) attachedObject).size()); for (Object item : (List<?>) attachedObject) { if (item != null) { lst.add(saveAttachedState(context, item)); } } return new _AttachedListStateWrapper(lst); } else if (attachedObject instanceof Serializable) { return attachedObject; } else { return new _AttachedStateWrapper(attachedObject.getClass(), null); } } private static Object restoreAttachedState(FacesContext context, Object stateObj) throws IllegalStateException { if (context == null) { throw new NullPointerException("context"); } if (stateObj == null) { return null; } if (stateObj instanceof _AttachedListStateWrapper) { List<Object> lst = ((_AttachedListStateWrapper) stateObj).getWrappedStateList(); List<Object> restoredList = new ArrayList<Object>(lst.size()); for (Object item : lst) { restoredList.add(restoreAttachedState(context, item)); } return restoredList; } else if (stateObj instanceof _AttachedStateWrapper) { Class<?> clazz = ((_AttachedStateWrapper) stateObj).getClazz(); Object restoredObject; try { restoredObject = clazz.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("Could not restore StateHolder of type " + clazz.getName() + " (missing no-args constructor?)", e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } if (restoredObject instanceof StateHolder) { _AttachedStateWrapper wrapper = (_AttachedStateWrapper) stateObj; Object wrappedState = wrapper.getWrappedStateObject(); StateHolder holder = (StateHolder) restoredObject; holder.restoreState(context, wrappedState); } return restoredObject; } else { return stateObj; } } |
File | Line |
---|---|
javax/faces/component/_MessageUtils.java | 62 |
javax/faces/convert/_MessageUtils.java | 46 |
args); } static FacesMessage getMessage(FacesContext facesContext, Locale locale, FacesMessage.Severity severity, String messageId, Object args[]) { ResourceBundle appBundle; ResourceBundle defBundle; String summary; String detail; appBundle = getApplicationBundle(facesContext, locale); summary = getBundleString(appBundle, messageId); if (summary != null) { detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); } else { defBundle = getDefaultBundle(facesContext, locale); summary = getBundleString(defBundle, messageId); if (summary != null) { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); } else { //Try to find detail alone detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { //Neither detail nor summary found facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle"); return new FacesMessage(severity, messageId, null); } } } } if (args != null && args.length > 0) { return new _ParametrizableFacesMessage(severity, summary, detail, args, locale); } else { return new FacesMessage(severity, summary, detail); } } private static String getBundleString(ResourceBundle bundle, String key) { try { return bundle == null ? null : bundle.getString(key); } catch (MissingResourceException e) { return null; } } private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) { String bundleName = facesContext.getApplication().getMessageBundle(); return bundleName != null ? getBundle(facesContext, locale, bundleName) : null; } private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) { return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES); } private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) { try { //First we try the JSF implementation class loader return ResourceBundle.getBundle(bundleName, locale, facesContext.getClass().getClassLoader()); } catch (MissingResourceException ignore1) { try { //Next we try the JSF API class loader return ResourceBundle.getBundle(bundleName, locale, _MessageUtils.class.getClassLoader()); } catch (MissingResourceException ignore2) { try { |
File | Line |
---|---|
javax/faces/component/_MessageUtils.java | 77 |
javax/faces/validator/_MessageUtils.java | 65 |
appBundle = getApplicationBundle(facesContext, locale); summary = getBundleString(appBundle, messageId); if (summary != null) { detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); } else { defBundle = getDefaultBundle(facesContext, locale); summary = getBundleString(defBundle, messageId); if (summary != null) { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); } else { //Try to find detail alone detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX); if (detail != null) { summary = null; } else { //Neither detail nor summary found facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle"); return new FacesMessage(severity, messageId, null); } } } } if (args != null && args.length > 0) { return new _ParametrizableFacesMessage(severity, summary, detail, args, locale); } else { return new FacesMessage(severity, summary, detail); } } private static String getBundleString(ResourceBundle bundle, String key) { try { return bundle == null ? null : bundle.getString(key); } catch (MissingResourceException e) { return null; } } private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) { String bundleName = facesContext.getApplication().getMessageBundle(); return bundleName != null ? getBundle(facesContext, locale, bundleName) : null; } private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) { return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES); } private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) { try { //First we try the JSF implementation class loader return ResourceBundle.getBundle(bundleName, locale, facesContext.getClass().getClassLoader()); } catch (MissingResourceException ignore1) { try { //Next we try the JSF API class loader return ResourceBundle.getBundle(bundleName, locale, _MessageUtils.class.getClassLoader()); } catch (MissingResourceException ignore2) { try { |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 511 |
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 293 |
if (_createDeltas()) { returnValue = _removeValueOrKeyFromCollectionDelta(_deltas, key, valueOrKey); _removeValueOrKeyFromCollection(_fullState, key, valueOrKey); } else { returnValue = _removeValueOrKeyFromCollection(_fullState, key, valueOrKey); } } return returnValue; } private static Object _removeValueOrKeyFromCollectionDelta( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey) { Object returnValue = null; Map<Object, Boolean> c = (Map<Object, Boolean>) stateMap.get(key); if (c != null) { if (c.containsKey(valueOrKey)) { returnValue = valueOrKey; } c.put(valueOrKey, Boolean.FALSE); } return returnValue; } private static Object _removeValueOrKeyFromCollection( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey) { Object returnValue = null; Collection c = (Collection) stateMap.get(key); if (c != null) { if (c.remove(valueOrKey)) { returnValue = valueOrKey; } if (c.isEmpty()) { stateMap.remove(key); } } return returnValue; } private static Object _removeValueOrKeyFromMap( Map<Serializable, Object> stateMap, Serializable key, Object valueOrKey, boolean delta) { if (valueOrKey == null) { return null; } Object returnValue = null; Map<String, Object> map = (Map<String, Object>) stateMap.get(key); if (map != null) { if (delta) { // Keep track of the removed values using key/null pair on the delta map returnValue = map.put((String) valueOrKey, null); } else { returnValue = map.remove(valueOrKey); } if (map.isEmpty()) { //stateMap.remove(key); stateMap.put(key, null); } } return returnValue; } |
File | Line |
---|---|
javax/faces/component/UIData.java | 928 |
javax/faces/component/UIData.java | 1009 |
UIComponent child = parent.getChildren().get(i); if (!child.isTransient()) { // Add an entry to the collection, being an array of two // elements. The first element is the state of the children // of this component; the second is the state of the current // child itself. if (child instanceof EditableValueHolder) { if (childStates == null) { childStates = new ArrayList<Object[]>( parent.getFacetCount() + parent.getChildCount() - totalChildCount + childEmptyIndex); for (int ci = 0; ci < childEmptyIndex; ci++) { childStates.add(LEAF_NO_STATE); } } childStates.add(child.getChildCount() > 0 ? new Object[]{new EditableValueHolderState((EditableValueHolder) child), saveDescendantComponentStates(child, saveChildFacets, true)} : new Object[]{new EditableValueHolderState((EditableValueHolder) child), null}); } else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0)) { Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true); if (descendantSavedState == null) { if (childStates == null) { childEmptyIndex++; } else { childStates.add(LEAF_NO_STATE); } } else { if (childStates == null) { childStates = new ArrayList<Object[]>( parent.getFacetCount() + parent.getChildCount() - totalChildCount + childEmptyIndex); for (int ci = 0; ci < childEmptyIndex; ci++) { childStates.add(LEAF_NO_STATE); } } childStates.add(new Object[]{null, descendantSavedState}); } } else { if (childStates == null) { childEmptyIndex++; } else { childStates.add(LEAF_NO_STATE); } } } totalChildCount++; } } |
File | Line |
---|---|
javax/faces/event/MethodExpressionActionListener.java | 77 |
javax/faces/event/MethodExpressionValueChangeListener.java | 76 |
Object[] params = new Object[] { event }; methodExpressionOneArg.invoke(getElContext(), params); } catch (MethodNotFoundException mnfe) { // call to the zero argument MethodExpression methodExpressionZeroArg.invoke(getElContext(), EMPTY_PARAMS); } } catch (ELException e) { // "... If that fails for any reason, throw an AbortProcessingException, // including the cause of the failure ..." // -= Leonardo Uribe =- after discussing this topic on MYFACES-3199, the conclusion is the part is an advice // for the developer implementing a listener in a method expressions that could be wrapped by this class. // The spec wording is poor but, to keep this coherently with ExceptionHandler API, // the spec and code on UIViewRoot we need: // 2a) "exception is instance of APE or any of the causes of the exception are an APE, // DON'T publish ExceptionQueuedEvent and terminate processing for current event". // 2b) for any other exception publish ExceptionQueuedEvent and continue broadcast processing. Throwable cause = e.getCause(); AbortProcessingException ape = null; if (cause != null) { do { if (cause instanceof AbortProcessingException) { ape = (AbortProcessingException) cause; break; } cause = cause.getCause(); } while (cause != null); } if (ape != null) { // 2a) "exception is instance of APE or any of the causes of the exception are an APE, // DON'T publish ExceptionQueuedEvent and terminate processing for current event". // To do this throw an AbortProcessingException here, later on UIViewRoot.broadcastAll, // this exception will be received and stored to handle later. throw ape; } //for any other exception publish ExceptionQueuedEvent and continue broadcast processing. throw e; //Throwable cause = e.getCause(); //if (cause == null) //{ // cause = e; //} //if (cause instanceof AbortProcessingException) //{ // throw (AbortProcessingException) cause; //} //else //{ // throw new AbortProcessingException(cause); //} } } public void restoreState(FacesContext context, Object state) { methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0]; methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1]; } public Object saveState(FacesContext context) { return new Object[] {methodExpressionOneArg, methodExpressionZeroArg}; } public void setTransient(boolean newTransientValue) { isTransient = newTransientValue; } public boolean isTransient() { return isTransient; } private ELContext getElContext() { return getFacesContext().getELContext(); } private FacesContext getFacesContext() { return FacesContext.getCurrentInstance(); } /** * Creates a {@link MethodExpression} with no params and with the same Expression as * param <code>methodExpression</code> * <b>WARNING!</b> This method creates new {@link MethodExpression} with expressionFactory.createMethodExpression. * That means is not decorating MethodExpression passed as parameter - * support for EL VariableMapper will not be available! * This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details). */ private void _createZeroArgsMethodExpression(MethodExpression methodExpression) { ExpressionFactory expressionFactory = getFacesContext().getApplication().getExpressionFactory(); this.methodExpressionZeroArg = expressionFactory.createMethodExpression(getElContext(), methodExpression.getExpressionString(), Void.class, EMPTY_CLASS_ARRAY); } } |
File | Line |
---|---|
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 75 |
javax/faces/component/behavior/_DeltaStateHelper.java | 174 |
_fullState = new HashMap<Serializable, Object>(); _deltas = null; //_stateHolderKeys = new HashSet<Serializable>(); } /** * Used to create delta map on demand * * @return */ private boolean _createDeltas() { if (isInitialStateMarked()) { if (_deltas == null) { _deltas = new HashMap<Serializable, Object>(2); } return true; } return false; } protected boolean isInitialStateMarked() { return _target.initialStateMarked(); } public void add(Serializable key, Object value) { if (_createDeltas()) { //Track delta case Map<Object, Boolean> deltaListMapValues = (Map<Object, Boolean>) _deltas .get(key); if (deltaListMapValues == null) { deltaListMapValues = new InternalDeltaListMap<Object, Boolean>( 3); _deltas.put(key, deltaListMapValues); } deltaListMapValues.put(value, Boolean.TRUE); } //Handle change on full map List<Object> fullListValues = (List<Object>) _fullState.get(key); if (fullListValues == null) { fullListValues = new InternalList<Object>(3); _fullState.put(key, fullListValues); } fullListValues.add(value); } public Object eval(Serializable key) { Object returnValue = _fullState.get(key); if (returnValue != null) { return returnValue; } ValueExpression expression = _target.getValueExpression(key .toString()); if (expression != null) { return expression.getValue(_target.getFacesContext() |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 926 |
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 600 |
public Object saveState(FacesContext context) { int cnt = 0; Object[] mapArr = new Object[this.size() * 2]; for (Map.Entry<K, V> entry : this.entrySet()) { mapArr[cnt] = entry.getKey(); Object value = entry.getValue(); if (value instanceof StateHolder || value instanceof List || !(value instanceof Serializable)) { mapArr[cnt + 1] = UIComponentBase.saveAttachedState(context, value); } else { mapArr[cnt + 1] = value; } cnt += 2; } return mapArr; } } /** * Map used to keep track of list changes */ static class InternalDeltaListMap<K, V> extends InternalMap<K, V> { public InternalDeltaListMap() { super(); } public InternalDeltaListMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } public InternalDeltaListMap(int initialSize) { super(initialSize); } public InternalDeltaListMap(Map<? extends K, ? extends V> m) { super(m); } } static class InternalList<T> extends ArrayList<T> implements StateHolder { public InternalList() { super(); } public InternalList(Collection<? extends T> c) { super(c); } public InternalList(int initialSize) { super(initialSize); } |
File | Line |
---|---|
javax/faces/component/UIComponentBase.java | 1693 |
javax/faces/component/UIForm.java | 393 |
} private String getComponentLocation(UIComponent component) { Location location = (Location) component.getAttributes() .get(UIComponent.VIEW_LOCATION_KEY); if (location != null) { return location.toString(); } return null; } private String getPathToComponent(UIComponent component) { StringBuffer buf = new StringBuffer(); if (component == null) { buf.append("{Component-Path : "); buf.append("[null]}"); return buf.toString(); } getPathToComponent(component, buf); buf.insert(0, "{Component-Path : "); buf.append("}"); return buf.toString(); } private void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot) component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf.toString()); getPathToComponent(component.getParent(), buf); } |
File | Line |
---|---|
javax/faces/component/UIForm.java | 311 |
javax/faces/component/UINamingContainer.java | 138 |
{ pushComponentToEL(context.getFacesContext(), this); boolean isCachedFacesContext = isCachedFacesContext(); try { if (!isCachedFacesContext) { setCachedFacesContext(context.getFacesContext()); } if (!isVisitable(context)) { return false; } VisitResult res = context.invokeVisitCallback(this, callback); switch (res) { //we are done nothing has to be processed anymore case COMPLETE: return true; case REJECT: return false; //accept default: // Take advantage of the fact this is a NamingContainer // and we can know if there are ids to visit inside it Collection<String> subtreeIdsToVisit = context.getSubtreeIdsToVisit(this); if (subtreeIdsToVisit != null && !subtreeIdsToVisit.isEmpty()) { if (getFacetCount() > 0) { for (UIComponent facet : getFacets().values()) { if (facet.visitTree(context, callback)) { return true; } } } for (int i = 0, childCount = getChildCount(); i < childCount; i++) { UIComponent child = getChildren().get(i); if (child.visitTree(context, callback)) { return true; } } } return false; } } finally { //all components must call popComponentFromEl after visiting is finished popComponentFromEL(context.getFacesContext()); if (!isCachedFacesContext) { setCachedFacesContext(null); } } } |
File | Line |
---|---|
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 613 |
javax/faces/component/behavior/_DeltaStateHelper.java | 725 |
mapArr[cnt + 1] = saveAttachedState(context, value); } else { mapArr[cnt + 1] = value; } cnt += 2; } return mapArr; } } /** * Map used to keep track of list changes */ static class InternalDeltaListMap<K, V> extends InternalMap<K, V> { public InternalDeltaListMap() { super(); } public InternalDeltaListMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } public InternalDeltaListMap(int initialSize) { super(initialSize); } public InternalDeltaListMap(Map<? extends K, ? extends V> m) { super(m); } } static class InternalList<T> extends ArrayList<T> implements StateHolder { public InternalList() { super(); } public InternalList(Collection<? extends T> c) { super(c); } public InternalList(int initialSize) { super(initialSize); } public boolean isTransient() { return false; } public void setTransient(boolean newTransientValue) { } public void restoreState(FacesContext context, Object state) { Object[] listAsArr = (Object[]) state; //since all other options would mean dual iteration //we have to do it the hard way for (Object elem : listAsArr) { add((T) restoreAttachedState(context, elem)); |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 764 |
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 494 |
for (int cnt = 0; cnt < serializedState.length; cnt += 2) { Serializable key = (Serializable) serializedState[cnt]; Object savedValue = UIComponentBase.restoreAttachedState(context, serializedState[cnt + 1]); if (isInitialStateMarked()) { if (savedValue instanceof InternalDeltaListMap) { for (Map.Entry<Object, Boolean> mapEntry : ((Map<Object, Boolean>) savedValue) .entrySet()) { boolean addOrRemove = mapEntry.getValue(); if (addOrRemove) { //add this.add(key, mapEntry.getKey()); } else { //remove this.remove(key, mapEntry.getKey()); } } } else if (savedValue instanceof InternalMap) { for (Map.Entry<String, Object> mapEntry : ((Map<String, Object>) savedValue) .entrySet()) { this.put(key, mapEntry.getKey(), mapEntry.getValue()); } } /* else if (savedValue instanceof _AttachedDeltaWrapper) { _AttachedStateWrapper wrapper = (_AttachedStateWrapper) savedValue; //Restore delta state ((PartialStateHolder)_fullState.get(key)).restoreState(context, wrapper.getWrappedStateObject()); //Add this key as StateHolder key _stateHolderKeys.add(key); } */ else { put(key, savedValue); } } else { put(key, savedValue); } } } public void setTransient(boolean transientValue) |
File | Line |
---|---|
javax/faces/component/_LabeledFacesMessage.java | 29 |
javax/faces/validator/_LabeledFacesMessage.java | 29 |
class _LabeledFacesMessage extends FacesMessage { public _LabeledFacesMessage() { super(); } public _LabeledFacesMessage(Severity severity, String summary, String detail) { super(severity, summary, detail); } public _LabeledFacesMessage(String summary, String detail) { super(summary, detail); } public _LabeledFacesMessage(String summary) { super(summary); } @Override public String getDetail() { FacesContext facesContext = FacesContext.getCurrentInstance(); ValueExpression value = facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), super.getDetail(), String.class); return (String)value.getValue(facesContext.getELContext()); } @Override public String getSummary() { FacesContext facesContext = FacesContext.getCurrentInstance(); ValueExpression value = facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), super.getSummary(), String.class); return (String)value.getValue(facesContext.getELContext()); } } |
File | Line |
---|---|
javax/faces/model/CollectionDataModel.java | 69 |
javax/faces/model/ListDataModel.java | 71 |
} @Override public int getRowIndex() { return _rowIndex; } @Override public Object getWrappedData() { return _data; } @Override public boolean isRowAvailable() { return _data != null && _rowIndex >= 0 && _rowIndex < _data.size(); } @Override public void setRowIndex(int rowIndex) { if (rowIndex < -1) { throw new IllegalArgumentException("illegal rowIndex " + rowIndex); } int oldRowIndex = _rowIndex; _rowIndex = rowIndex; if (_data != null && oldRowIndex != _rowIndex) { E data = isRowAvailable() ? getRowData() : null; DataModelEvent event = new DataModelEvent(this, _rowIndex, data); DataModelListener[] listeners = getDataModelListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].rowSelected(event); } } } @Override public void setWrappedData(Object data) { if (data == null) { setRowIndex(-1); _data = null; |
File | Line |
---|---|
javax/faces/component/UIComponentBase.java | 1709 |
javax/faces/component/_SelectItemsIterator.java | 336 |
} private String getPathToComponent(UIComponent component) { StringBuffer buf = new StringBuffer(); if (component == null) { buf.append("{Component-Path : "); buf.append("[null]}"); return buf.toString(); } getPathToComponent(component, buf); buf.insert(0, "{Component-Path : "); buf.append("}"); return buf.toString(); } private void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot) component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf); |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 767 |
javax/faces/component/behavior/_DeltaStateHelper.java | 610 |
Object savedValue = restoreAttachedState(context, serializedState[cnt + 1]); if (isInitialStateMarked()) { if (savedValue instanceof InternalDeltaListMap) { for (Map.Entry<Object, Boolean> mapEntry : ((Map<Object, Boolean>) savedValue) .entrySet()) { boolean addOrRemove = mapEntry.getValue(); if (addOrRemove) { //add this.add(key, mapEntry.getKey()); } else { //remove this.remove(key, mapEntry.getKey()); } } } else if (savedValue instanceof InternalMap) { for (Map.Entry<String, Object> mapEntry : ((Map<String, Object>) savedValue) .entrySet()) { this.put(key, mapEntry.getKey(), mapEntry.getValue()); } } /* else if (savedValue instanceof _AttachedDeltaWrapper) { _AttachedStateWrapper wrapper = (_AttachedStateWrapper) savedValue; //Restore delta state ((PartialStateHolder)_fullState.get(key)).restoreState(context, wrapper.getWrappedStateObject()); //Add this key as StateHolder key _stateHolderKeys.add(key); } */ else { put(key, savedValue); } } else { put(key, savedValue); } } } public void setTransient(boolean transientValue) |
File | Line |
---|---|
javax/faces/component/UIData.java | 774 |
javax/faces/component/UIData.java | 817 |
UIComponent component = parent.getChildren().get(i); // reset the client id (see spec 3.1.6) component.setId(component.getId()); if (!component.isTransient()) { if (descendantStateIndex == -1) { stateCollection = ((List<? extends Object[]>) state); descendantStateIndex = stateCollection.isEmpty() ? -1 : 0; } if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size()) { Object[] object = stateCollection.get(descendantStateIndex); if (object[0] != null && component instanceof EditableValueHolder) { ((EditableValueHolderState) object[0]).restoreState((EditableValueHolder) component); } // If there is descendant state to restore, call it recursively, otherwise // it is safe to skip iteration. if (object[1] != null) { restoreDescendantComponentStates(component, restoreChildFacets, object[1], true); } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } descendantStateIndex++; } } } |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 422 |
javax/faces/component/behavior/_DeltaStateHelper.java | 305 |
if (_createDeltas()) { //Track delta case Map<String, Object> mapValues = (Map<String, Object>) _deltas .get(key); if (mapValues == null) { mapValues = new InternalMap<String, Object>(); _deltas.put(key, mapValues); } if (mapValues.containsKey(mapKey)) { returnValue = mapValues.put(mapKey, value); returnSet = true; } else { mapValues.put(mapKey, value); } } //Handle change on full map Map<String, Object> mapValues = (Map<String, Object>) _fullState .get(key); if (mapValues == null) { mapValues = new InternalMap<String, Object>(); _fullState.put(key, mapValues); } if (returnSet) { mapValues.put(mapKey, value); } else { returnValue = mapValues.put(mapKey, value); } return returnValue; } |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 658 |
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 397 |
if (serializableMap == null || serializableMap.isEmpty()) { return null; } /* int stateHolderKeyCount = 0; if (isInitalStateMarked()) { for (Iterator<Serializable> it = _stateHolderKeys.iterator(); it.hasNext();) { Serializable key = it.next(); if (!_deltas.containsKey(key)) { stateHolderKeyCount++; } } }*/ Map.Entry<Serializable, Object> entry; //entry == key, value, key, value Object[] retArr = new Object[serializableMap.entrySet().size() * 2]; //Object[] retArr = new Object[serializableMap.entrySet().size() * 2 + stateHolderKeyCount]; Iterator<Map.Entry<Serializable, Object>> it = serializableMap.entrySet().iterator(); int cnt = 0; while (it.hasNext()) { entry = it.next(); retArr[cnt] = entry.getKey(); Object value = entry.getValue(); // The condition in which the call to saveAttachedState // is to handle List, StateHolder or non Serializable instances. // we check it here, to prevent unnecessary calls. if (value instanceof StateHolder || value instanceof List || !(value instanceof Serializable)) { Object savedValue = UIComponentBase.saveAttachedState(context, value); retArr[cnt + 1] = savedValue; } else { retArr[cnt + 1] = value; } cnt += 2; } /* if (isInitalStateMarked()) { for (Iterator<Serializable> it2 = _stateHolderKeys.iterator(); it.hasNext();) { Serializable key = it2.next(); if (!_deltas.containsKey(key)) { retArr[cnt] = key; Object value = _fullState.get(key); if (value instanceof PartialStateHolder) { //Could contain delta, save it as _AttachedDeltaState PartialStateHolder holder = (PartialStateHolder) value; if (holder.isTransient()) { retArr[cnt + 1] = null; } else { retArr[cnt + 1] = new _AttachedDeltaWrapper(value.getClass(), holder.saveState(context)); } } else { //Save everything retArr[cnt + 1] = UIComponentBase.saveAttachedState(context, _fullState.get(key)); } cnt += 2; } } } */ return retArr; } |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 939 |
javax/faces/component/behavior/_DeltaStateHelper.java | 725 |
mapArr[cnt + 1] = saveAttachedState(context, value); } else { mapArr[cnt + 1] = value; } cnt += 2; } return mapArr; } } /** * Map used to keep track of list changes */ static class InternalDeltaListMap<K, V> extends InternalMap<K, V> { public InternalDeltaListMap() { super(); } public InternalDeltaListMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } public InternalDeltaListMap(int initialSize) { super(initialSize); } public InternalDeltaListMap(Map<? extends K, ? extends V> m) { super(m); } } static class InternalList<T> extends ArrayList<T> implements StateHolder { public InternalList() { super(); } public InternalList(Collection<? extends T> c) { super(c); } public InternalList(int initialSize) { super(initialSize); } |
File | Line |
---|---|
javax/faces/component/_MessageUtils.java | 179 |
javax/faces/convert/_MessageUtils.java | 180 |
throw new FacesException(pae); } catch (MissingResourceException damned) { facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found"); return null; } } } } static Object getLabel(FacesContext facesContext, UIComponent component) { Object label = component.getAttributes().get("label"); ValueExpression expression = null; if (label != null && label instanceof String && ((String)label).length() == 0 ) { // Note component.getAttributes().get("label") internally try to // evaluate the EL expression for the label, but in some cases, // when PSS is disabled and f:loadBundle is used, when the view is // restored the bundle is not set to the EL expression returns an // empty String. It is not possible to check if there is a // hardcoded label, but we can check if there is // an EL expression set, so the best in this case is use that, and if // there is an EL expression set, use it, otherwise use the hardcoded // value. See MYFACES-3591 for details. expression = component.getValueExpression("label"); if (expression != null) { // Set the label to null and use the EL expression instead. label = null; } } if(label != null) { return label; } expression = (expression == null) ? component.getValueExpression("label") : expression; if(expression != null) { return expression; } //If no label is not specified, use clientId return component.getClientId( facesContext ); } } |
File | Line |
---|---|
javax/faces/component/UIComponentBase.java | 1886 |
javax/faces/component/behavior/BehaviorBase.java | 214 |
for (Object item : lst) { restoredList.add(restoreAttachedState(context, item)); } return restoredList; } else if (stateObj instanceof _AttachedStateWrapper) { Class<?> clazz = ((_AttachedStateWrapper) stateObj).getClazz(); Object restoredObject; try { restoredObject = clazz.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("Could not restore StateHolder of type " + clazz.getName() + " (missing no-args constructor?)", e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } if (restoredObject instanceof StateHolder) { _AttachedStateWrapper wrapper = (_AttachedStateWrapper) stateObj; Object wrappedState = wrapper.getWrappedStateObject(); StateHolder holder = (StateHolder) restoredObject; holder.restoreState(context, wrappedState); } return restoredObject; } else { return stateObj; } } |
File | Line |
---|---|
javax/faces/model/ArrayDataModel.java | 86 |
javax/faces/model/ScalarDataModel.java | 78 |
} @Override public void setRowIndex(int rowIndex) { if (rowIndex < -1) { throw new IllegalArgumentException("illegal rowIndex " + rowIndex); } int oldRowIndex = _rowIndex; _rowIndex = rowIndex; if (_data != null && oldRowIndex != _rowIndex) { Object data = isRowAvailable() ? getRowData() : null; DataModelEvent event = new DataModelEvent(this, _rowIndex, data); DataModelListener[] listeners = getDataModelListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].rowSelected(event); } } } @Override public void setWrappedData(Object data) { if (data == null) { setRowIndex(-1); _data = null; } else { _data = (E) data; |
File | Line |
---|---|
javax/faces/validator/LengthValidator.java | 150 |
javax/faces/validator/LongRangeValidator.java | 179 |
_minimum = new Long(minimum); clearInitialState(); } public boolean isTransient() { return _transient; } public void setTransient(boolean transientValue) { _transient = transientValue; } // RESTORE & SAVE STATE public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException("context"); } if (!initialStateMarked()) { Object values[] = new Object[2]; values[0] = _maximum; values[1] = _minimum; return values; } return null; } public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException("context"); } if (state != null) { Object values[] = (Object[])state; _maximum = (Long)values[0]; |
File | Line |
---|---|
javax/faces/component/UIInput.java | 527 |
javax/faces/component/UISelectMany.java | 432 |
} // Copied from javax.faces.component.UIInput private boolean shouldValidateEmptyFields(FacesContext context) { ExternalContext ec = context.getExternalContext(); Boolean validateEmptyFields = (Boolean) ec.getApplicationMap().get(VALIDATE_EMPTY_FIELDS_PARAM_NAME); if (validateEmptyFields == null) { String param = ec.getInitParameter(VALIDATE_EMPTY_FIELDS_PARAM_NAME); // null means the same as auto. if (param == null) { param = "auto"; } else { // The environment variables are case insensitive. param = param.toLowerCase(); } if (param.equals("auto") && _ExternalSpecifications.isBeanValidationAvailable()) { validateEmptyFields = true; } else if (param.equals("true")) { validateEmptyFields = true; } else { validateEmptyFields = false; } // cache the parsed value ec.getApplicationMap().put(VALIDATE_EMPTY_FIELDS_PARAM_NAME, validateEmptyFields); } return validateEmptyFields; } |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 658 |
javax/faces/component/behavior/_DeltaStateHelper.java | 501 |
if (serializableMap == null || serializableMap.isEmpty()) { return null; } /* int stateHolderKeyCount = 0; if (isInitalStateMarked()) { for (Iterator<Serializable> it = _stateHolderKeys.iterator(); it.hasNext();) { Serializable key = it.next(); if (!_deltas.containsKey(key)) { stateHolderKeyCount++; } } }*/ Map.Entry<Serializable, Object> entry; //entry == key, value, key, value Object[] retArr = new Object[serializableMap.entrySet().size() * 2]; //Object[] retArr = new Object[serializableMap.entrySet().size() * 2 + stateHolderKeyCount]; Iterator<Map.Entry<Serializable, Object>> it = serializableMap .entrySet().iterator(); int cnt = 0; while (it.hasNext()) { entry = it.next(); retArr[cnt] = entry.getKey(); Object value = entry.getValue(); // The condition in which the call to saveAttachedState // is to handle List, StateHolder or non Serializable instances. // we check it here, to prevent unnecessary calls. if (value instanceof StateHolder || value instanceof List || !(value instanceof Serializable)) { Object savedValue = saveAttachedState(context, |
File | Line |
---|---|
javax/faces/component/UIData.java | 585 |
javax/faces/component/UIData.java | 686 |
} } _rowIndex = rowIndex; DataModel dataModel = getDataModel(); dataModel.setRowIndex(rowIndex); String var = (String) getStateHelper().get(PropertyKeys.var); if (rowIndex == -1) { if (var != null) { facesContext.getExternalContext().getRequestMap().remove(var); } } else { if (var != null) { if (isRowAvailable()) { Object rowData = dataModel.getRowData(); facesContext.getExternalContext().getRequestMap().put(var, rowData); } else { facesContext.getExternalContext().getRequestMap().remove(var); } } } if (_initialDescendantFullComponentState != null) |
File | Line |
---|---|
javax/faces/component/UIComponentBase.java | 1730 |
javax/faces/component/_ComponentUtils.java | 432 |
private static void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot)component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf.toString()); getPathToComponent(component.getParent(), buf); } |
File | Line |
---|---|
javax/faces/component/_SelectItemsIterator.java | 357 |
javax/faces/webapp/UIComponentClassicTagBase.java | 919 |
private static void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot)component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf); getPathToComponent(component.getParent(), buf); } |
File | Line |
---|---|
javax/faces/component/_DeltaStateHelper.java | 323 |
javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java | 106 |
if (_createDeltas()) { //Track delta case Map<Object, Boolean> deltaListMapValues = (Map<Object, Boolean>) _deltas .get(key); if (deltaListMapValues == null) { deltaListMapValues = new InternalDeltaListMap<Object, Boolean>( 3); _deltas.put(key, deltaListMapValues); } deltaListMapValues.put(value, Boolean.TRUE); } //Handle change on full map List<Object> fullListValues = (List<Object>) _fullState.get(key); if (fullListValues == null) { fullListValues = new InternalList<Object>(3); _fullState.put(key, fullListValues); } fullListValues.add(value); } |
File | Line |
---|---|
javax/faces/component/UIViewRoot.java | 250 |
javax/faces/component/UIViewRoot.java | 281 |
} else if (componentId != null) { for(Iterator<UIComponent> it = componentResources.iterator(); it.hasNext();) { UIComponent component = it.next(); if(componentId.equals(component.getId()) && componentResource != component) { if (!component.isCachedFacesContext()) { try { component.setCachedFacesContext(context); it.remove(); } finally { component.setCachedFacesContext(null); } } else { it.remove(); } } else if (componentResource == component) { alreadyAdded = true; } } } |
File | Line |
---|---|
javax/faces/component/_ComponentUtils.java | 430 |
javax/faces/webapp/UIComponentClassicTagBase.java | 916 |
} /** Generate diagnostic output. */ private static void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot)component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf); |
File | Line |
---|---|
javax/faces/component/_ComponentAttributesMap.java | 367 |
javax/faces/component/_ComponentAttributesMap.java | 407 |
if (attribute.getName().equals(key)) { String attributeName = attribute.getName(); boolean isKnownMethod = "action".equals(attributeName) || "actionListener".equals(attributeName) || "validator".equals(attributeName) || "valueChangeListener".equals(attributeName); // <composite:attribute> method-signature attribute is // ValueExpression that must evaluate to String ValueExpression methodSignatureExpression = (ValueExpression) attribute.getValue("method-signature"); String methodSignature = null; if (methodSignatureExpression != null) { // Check if the value expression holds a method signature // Note that it could be null, so in that case we don't have to // do anything methodSignature = (String) methodSignatureExpression.getValue( _component.getFacesContext().getELContext()); } // either the attributeName has to be a knownMethod // or there has to be a method-signature if (isKnownMethod || methodSignature != null) { //In this case it is expecting a ValueExpression return attribute.getValue("default"); } else { value = attribute.getValue("default"); |
File | Line |
---|---|
javax/faces/component/html/_HtmlBody.java | 54 |
javax/faces/component/html/_HtmlHead.java | 52 |
public abstract String getLang(); /** * * @since 2.1.0 * @return */ @JSFProperty public abstract String getXmlns(); @JSFExclude @JSFProperty(tagExcluded=true) @Override public Converter getConverter() { return super.getConverter(); } @JSFExclude @JSFProperty(tagExcluded=true) @Override public Object getValue() { return super.getValue(); } @JSFExclude @JSFProperty(tagExcluded=true) @Override public String getId() { return super.getId(); } @JSFExclude @JSFProperty(tagExcluded=true) @Override public boolean isRendered() { return super.isRendered(); } } |
File | Line |
---|---|
javax/faces/component/UIComponentBase.java | 1730 |
javax/faces/webapp/UIComponentClassicTagBase.java | 919 |
private static void getPathToComponent(UIComponent component, StringBuffer buf) { if (component == null) { return; } StringBuffer intBuf = new StringBuffer(); intBuf.append("[Class: "); intBuf.append(component.getClass().getName()); if (component instanceof UIViewRoot) { intBuf.append(",ViewId: "); intBuf.append(((UIViewRoot)component).getViewId()); } else { intBuf.append(",Id: "); intBuf.append(component.getId()); } intBuf.append("]"); buf.insert(0, intBuf); |
File | Line |
---|---|
javax/faces/validator/DoubleRangeValidator.java | 180 |
javax/faces/validator/LengthValidator.java | 162 |
} // RESTORE & SAVE STATE public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException("context"); } if (!initialStateMarked()) { Object values[] = new Object[2]; values[0] = _maximum; values[1] = _minimum; return values; } return null; } public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException("context"); } if (state != null) { Object values[] = (Object[])state; _maximum = (Integer)values[0]; |
File | Line |
---|---|
javax/faces/component/_AttachedStateWrapper.java | 23 |
javax/faces/component/behavior/_AttachedStateWrapper.java | 23 |
class _AttachedStateWrapper implements Serializable { private static final long serialVersionUID = 4948301780259917764L; private Class<?> _class; private Object _wrappedStateObject; /** * @param clazz * null means wrappedStateObject is a List of state objects * @param wrappedStateObject */ public _AttachedStateWrapper(Class<?> clazz, Object wrappedStateObject) { if (wrappedStateObject != null && !(wrappedStateObject instanceof Serializable)) { throw new IllegalArgumentException("Attached state for Object of type " + clazz + " (Class " + wrappedStateObject.getClass().getName() + ") is not serializable"); } _class = clazz; _wrappedStateObject = wrappedStateObject; } public Class<?> getClazz() { return _class; } public Object getWrappedStateObject() { return _wrappedStateObject; } } |