The following document contains the results of PMD's CPD 4.2.2.
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletRequestScopeMap.java | 113 |
org/apache/tiles/servlet/context/ServletRequestScopeMap.java | 112 |
ServletRequest otherRequest = ((ServletRequestScopeMap) o).request; boolean retValue = true; synchronized (request) { for (Enumeration<String> attribs = request.getAttributeNames(); attribs .hasMoreElements() && retValue;) { String attributeName = attribs.nextElement(); retValue = request.getAttribute(attributeName).equals( otherRequest.getAttribute(attributeName)); } } return retValue; } /** {@inheritDoc} */ public Object get(Object key) { return (request.getAttribute(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (request.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = request.getAttributeNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public Object put(String key, Object value) { if (value == null) { return (remove(key)); } String skey = key(key); Object previous = request.getAttribute(skey); request.setAttribute(skey, value); return (previous); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends Object> map) { Iterator<? extends String> keys = map.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); request.setAttribute(key, map.get(key)); } } /** {@inheritDoc} */ public Object remove(Object key) { String skey = key(key); Object previous = request.getAttribute(skey); request.removeAttribute(skey); return (previous); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getAttributeNames(); while (keys.hasMoreElements()) { keys.nextElement(); n++; } return (n); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Collection<Object> values() { List<Object> list = new ArrayList<Object>(); Enumeration<String> keys = request.getAttributeNames(); while (keys.hasMoreElements()) { list.add(request.getAttribute(keys.nextElement())); } return (list); } /** * Returns the string representation of the key. * * @param key The key. * @return The string representation of the key. * @throws IllegalArgumentException If the key is <code>null</code>. */ private String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletApplicationScopeMap.java | 113 |
org/apache/tiles/servlet/context/ServletApplicationScopeMap.java | 113 |
ServletContext otherContext = ((ServletApplicationScopeMap) o).context; boolean retValue = true; synchronized (context) { for (Enumeration<String> attribs = context.getAttributeNames(); attribs .hasMoreElements() && retValue;) { String parameterName = attribs.nextElement(); retValue = context.getAttribute(parameterName).equals( otherContext.getAttribute(parameterName)); } } return retValue; } /** {@inheritDoc} */ public Object get(Object key) { return (context.getAttribute(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (context.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = context.getAttributeNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public Object put(String key, Object value) { if (value == null) { return (remove(key)); } String skey = key(key); Object previous = context.getAttribute(skey); context.setAttribute(skey, value); return (previous); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends Object> map) { Iterator<? extends String> keys = map.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); context.setAttribute(key, map.get(key)); } } /** {@inheritDoc} */ public Object remove(Object key) { String skey = key(key); Object previous = context.getAttribute(skey); context.removeAttribute(skey); return (previous); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = context.getAttributeNames(); while (keys.hasMoreElements()) { keys.nextElement(); n++; } return (n); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Collection<Object> values() { List<Object> list = new ArrayList<Object>(); Enumeration<String> keys = context.getAttributeNames(); while (keys.hasMoreElements()) { list.add(context.getAttribute(keys.nextElement())); } return (list); } /** * Returns the string representation of the key. * * @param key The key. * @return The string representation of the key. * @throws IllegalArgumentException If the key is <code>null</code>. */ private String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamValuesMap.java | 120 |
org/apache/tiles/servlet/context/ServletParamValuesMap.java | 111 |
ServletRequest otherRequest = ((ServletParamValuesMap) o).request; boolean retValue = true; synchronized (request) { for (Enumeration<String> attribs = request.getParameterNames(); attribs .hasMoreElements() && retValue;) { String parameterName = attribs.nextElement(); retValue = request.getParameterValues(parameterName).equals( otherRequest.getParameterValues(parameterName)); } } return retValue; } /** {@inheritDoc} */ public String[] get(Object key) { return (request.getParameterValues(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (request.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String[] put(String key, String[] value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String[]> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String[] remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { keys.nextElement(); n++; } return (n); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Collection<String[]> values() { List<String[]> list = new ArrayList<String[]>(); Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { list.add(request.getParameterValues(keys.nextElement())); } return (list); } /** * Returns the string representation of the key. * * @param key The key. * @return The string representation of the key. * @throws IllegalArgumentException If the key is <code>null</code>. */ private String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamMap.java | 105 |
org/apache/tiles/servlet/context/ServletParamMap.java | 105 |
ServletRequest otherRequest = ((ServletParamMap) o).request; boolean retValue = true; synchronized (request) { for (Enumeration<String> attribs = request.getParameterNames(); attribs .hasMoreElements() && retValue;) { String parameterName = attribs.nextElement(); retValue = request.getParameter(parameterName).equals( otherRequest.getParameter(parameterName)); } } return retValue; } /** {@inheritDoc} */ public String get(Object key) { return (request.getParameter(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (request.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String put(String key, String value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { keys.nextElement(); n++; } return (n); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Collection<String> values() { List<String> list = new ArrayList<String>(); Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { list.add(request.getParameter(keys.nextElement())); } return (list); } /** * Returns the string representation of the key. * * @param key The key. * @return The string representation of the key. * @throws IllegalArgumentException If the key is <code>null</code>. */ private String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletInitParamMap.java | 104 |
org/apache/tiles/servlet/context/ServletInitParamMap.java | 104 |
ServletContext otherContext = ((ServletInitParamMap) o).context; boolean retValue = true; synchronized (context) { for (Enumeration<String> attribs = context.getInitParameterNames(); attribs .hasMoreElements() && retValue;) { String parameterName = attribs.nextElement(); retValue = context.getInitParameter(parameterName).equals( otherContext.getInitParameter(parameterName)); } } return retValue; } /** {@inheritDoc} */ public String get(Object key) { return (context.getInitParameter(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (context.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = context.getInitParameterNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String put(String key, String value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = context.getInitParameterNames(); while (keys.hasMoreElements()) { keys.nextElement(); n++; } return (n); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Collection<String> values() { List<String> list = new ArrayList<String>(); Enumeration<String> keys = context.getInitParameterNames(); while (keys.hasMoreElements()) { list.add(context.getInitParameter(keys.nextElement())); } return (list); } /** * Returns the string representation of the key. * * @param key The key. * @return The string representation of the key. * @throws IllegalArgumentException If the key is <code>null</code>. */ private String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamValuesMap.java | 61 |
org/apache/tiles/servlet/context/ServletParamValuesMap.java | 52 |
private ServletRequest request = null; /** {@inheritDoc} */ public void clear() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public boolean containsKey(Object key) { return (request.getParameter(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { if (!(value instanceof String[])) { return (false); } String[] test = (String[]) value; Iterator<String[]> values = values().iterator(); while (values.hasNext()) { String[] actual = values.next(); if (test.length == actual.length) { boolean matched = true; for (int i = 0; i < test.length; i++) { if (!test[i].equals(actual[i])) { matched = false; break; } } if (matched) { return (true); } } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String[]>> entrySet() { Set<Map.Entry<String, String[]>> set = new HashSet<Map.Entry<String, String[]>>(); Enumeration<String> keys = request.getParameterNames(); String key; while (keys.hasMoreElements()) { key = keys.nextElement(); set.add(new MapEntry<String, String[]>(key, request |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletRequestScopeMap.java | 60 |
org/apache/tiles/servlet/context/ServletRequestScopeMap.java | 59 |
private ServletRequest request = null; /** {@inheritDoc} */ public void clear() { Iterator<String> keys = keySet().iterator(); while (keys.hasNext()) { request.removeAttribute(keys.next()); } } /** {@inheritDoc} */ public boolean containsKey(Object key) { return (request.getAttribute(key(key)) != null); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public boolean containsValue(Object value) { if (value == null) { return (false); } Enumeration<String> keys = request.getAttributeNames(); while (keys.hasMoreElements()) { Object next = request.getAttribute(keys.nextElement()); if (next == value) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> set = new HashSet<Map.Entry<String, Object>>(); Enumeration<String> keys = request.getAttributeNames(); String key; while (keys.hasMoreElements()) { key = keys.nextElement(); set.add(new MapEntry<String, Object>(key, request.getAttribute(key), true)); } return (set); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public boolean equals(Object o) { |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletApplicationScopeMap.java | 61 |
org/apache/tiles/servlet/context/ServletApplicationScopeMap.java | 60 |
private ServletContext context = null; /** {@inheritDoc} */ public void clear() { Iterator<String> keys = keySet().iterator(); while (keys.hasNext()) { context.removeAttribute(keys.next()); } } /** {@inheritDoc} */ public boolean containsKey(Object key) { return (context.getAttribute(key(key)) != null); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public boolean containsValue(Object value) { if (value == null) { return (false); } Enumeration<String> keys = context.getAttributeNames(); while (keys.hasMoreElements()) { Object next = context.getAttribute(keys.nextElement()); if (next == value) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> set = new HashSet<Map.Entry<String, Object>>(); Enumeration<String> keys = context.getAttributeNames(); String key; while (keys.hasMoreElements()) { key = keys.nextElement(); set.add(new MapEntry<String, Object>(key, context.getAttribute(key), true)); } return (set); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public boolean equals(Object o) { |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamMap.java | 60 |
org/apache/tiles/servlet/context/ServletParamMap.java | 60 |
private HttpServletRequest request = null; /** {@inheritDoc} */ public void clear() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public boolean containsKey(Object key) { return (request.getParameter(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { Iterator<String> values = values().iterator(); while (values.hasNext()) { if (value.equals(values.next())) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String>> entrySet() { Set<Map.Entry<String, String>> set = new HashSet<Map.Entry<String, String>>(); Enumeration<String> keys = request.getParameterNames(); String key; while (keys.hasMoreElements()) { key = keys.nextElement(); set.add(new MapEntry<String, String>(key, request.getParameter(key), false)); } return (set); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public boolean equals(Object o) { |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamValuesMap.java | 72 |
org/apache/tiles/servlet/context/ServletHeaderValuesMap.java | 64 |
return (request.getHeader(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { if (!(value instanceof String[])) { return (false); } String[] test = (String[]) value; Iterator<String[]> values = values().iterator(); while (values.hasNext()) { String[] actual = values.next(); if (test.length == actual.length) { boolean matched = true; for (int i = 0; i < test.length; i++) { if (!test[i].equals(actual[i])) { matched = false; break; } } if (matched) { return (true); } } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String[]>> entrySet() { Set<Map.Entry<String, String[]>> set = new HashSet<Map.Entry<String, String[]>>(); Enumeration<String> keys = request.getHeaderNames(); |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletInitParamMap.java | 60 |
org/apache/tiles/servlet/context/ServletInitParamMap.java | 59 |
private ServletContext context = null; /** {@inheritDoc} */ public void clear() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public boolean containsKey(Object key) { return (context.getInitParameter(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { Iterator<String> values = values().iterator(); while (values.hasNext()) { if (value.equals(values.next())) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String>> entrySet() { Set<Map.Entry<String, String>> set = new HashSet<Map.Entry<String, String>>(); Enumeration<String> keys = context.getInitParameterNames(); |
File | Line |
---|---|
org/apache/tiles/definition/DefinitionsImpl.java | 245 |
org/apache/tiles/impl/mgmt/DefinitionManager.java | 200 |
resolveInheritance(parent, request); overload(parent, definition); } /** * Overloads a child definition with a given parent. * All attributes present in child are kept. All missing attributes are * copied from the parent. * Special attribute 'template','role' and 'extends' are overloaded in child * if not defined * * @param parent The parent definition. * @param child The child that will be overloaded. */ // FIXME This is the same as DefinitionsImpl.overload. protected void overload(Definition parent, Definition child) { // Iterate on each parent's attribute and add it if not defined in child. for (Map.Entry<String, Attribute> entry : parent.getAttributes().entrySet()) { if (!child.hasAttributeValue(entry.getKey())) { child.putAttribute(entry.getKey(), new Attribute(entry.getValue())); } } if (child.getTemplate() == null) { child.setTemplate(parent.getTemplate()); } if (child.getRoles() == null) { child.setRoles(parent.getRoles()); } if (child.getPreparer() == null) { child.setPreparer(parent.getPreparer()); } } |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamMap.java | 71 |
org/apache/tiles/servlet/context/ServletHeaderMap.java | 70 |
return (request.getHeader(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { Iterator<String> values = values().iterator(); while (values.hasNext()) { if (value.equals(values.next())) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String>> entrySet() { Set<Map.Entry<String, String>> set = new HashSet<Map.Entry<String, String>>(); Enumeration<String> keys = request.getHeaderNames(); |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletInitParamMap.java | 71 |
org/apache/tiles/portlet/context/PortletParamMap.java | 71 |
return (request.getParameter(key(key)) != null); } /** {@inheritDoc} */ public boolean containsValue(Object value) { Iterator<String> values = values().iterator(); while (values.hasNext()) { if (value.equals(values.next())) { return (true); } } return (false); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<Map.Entry<String, String>> entrySet() { Set<Map.Entry<String, String>> set = new HashSet<Map.Entry<String, String>>(); Enumeration<String> keys = request.getParameterNames(); |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamValuesMap.java | 158 |
org/apache/tiles/servlet/context/ServletHeaderValuesMap.java | 157 |
Enumeration<String> keys = request.getHeaderNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String[] put(String key, String[] value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String[]> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String[] remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getHeaderNames(); |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamMap.java | 143 |
org/apache/tiles/servlet/context/ServletHeaderMap.java | 142 |
Enumeration<String> keys = request.getHeaderNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String put(String key, String value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getHeaderNames(); |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletParamMap.java | 123 |
org/apache/tiles/portlet/context/PortletParamValuesMap.java | 138 |
return (request.getParameterValues(key(key))); } /** {@inheritDoc} */ public int hashCode() { return (request.hashCode()); } /** {@inheritDoc} */ public boolean isEmpty() { return (size() < 1); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Set<String> keySet() { Set<String> set = new HashSet<String>(); Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String[] put(String key, String[] value) { |
File | Line |
---|---|
org/apache/tiles/portlet/context/PortletInitParamMap.java | 142 |
org/apache/tiles/portlet/context/PortletParamMap.java | 143 |
Enumeration<String> keys = request.getParameterNames(); while (keys.hasMoreElements()) { set.add(keys.nextElement()); } return (set); } /** {@inheritDoc} */ public String put(String key, String value) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public void putAll(Map<? extends String, ? extends String> map) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ public String remove(Object key) { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public int size() { int n = 0; Enumeration<String> keys = request.getParameterNames(); |