Author: sebb Date: Sat Aug 15 18:21:26 2009 New Revision: 804509 URL: http://svn.apache.org/viewvc?rev=804509&view=rev Log: Fix up some raw types
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileListPanel.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanel.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/Entry.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BSFBeanInfoSupport.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellBeanInfoSupport.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileListPanel.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileListPanel.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileListPanel.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileListPanel.java Sat Aug 15 18:21:26 2009 @@ -62,7 +62,7 @@ private JButton delete = new JButton(JMeterUtils.getResString("delete")); // $NON-NLS-1$ - private List listeners = new LinkedList(); + private List<ChangeListener> listeners = new LinkedList<ChangeListener>(); private String title; @@ -181,9 +181,9 @@ } private void fireFileChanged() { - Iterator iter = listeners.iterator(); + Iterator<ChangeListener> iter = listeners.iterator(); while (iter.hasNext()) { - ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this)); + iter.next().stateChanged(new ChangeEvent(this)); } } Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanel.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanel.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanel.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanel.java Sat Aug 15 18:21:26 2009 @@ -39,44 +39,42 @@ * author Michael Stover Created April 18, 2002 */ public class FilePanel extends HorizontalPanel implements ActionListener { - JTextField filename = new JTextField(20); + private final JTextField filename = new JTextField(20); - JLabel label = new JLabel(JMeterUtils.getResString("file_visualizer_filename")); //$NON-NLS-1$ + private final JLabel label = new JLabel(JMeterUtils.getResString("file_visualizer_filename")); //$NON-NLS-1$ - JButton browse = new JButton(JMeterUtils.getResString("browse")); //$NON-NLS-1$ + private final JButton browse = new JButton(JMeterUtils.getResString("browse")); //$NON-NLS-1$ private static final String ACTION_BROWSE = "browse"; //$NON-NLS-1$ - List listeners = new LinkedList(); + private final List<ChangeListener> listeners = new LinkedList<ChangeListener>(); - String title; + private final String title; - String filetype; + private final String filetype; /** * Constructor for the FilePanel object. */ public FilePanel() { - title = ""; //$NON-NLS-1$ - init(); + this("", null); } public FilePanel(String title) { - this.title = title; - init(); + this(title, null); } public FilePanel(String title, String filetype) { - this(title); + this.title = title; this.filetype = filetype; + init(); } /** * Constructor for the FilePanel object. */ public FilePanel(ChangeListener l, String title) { - this.title = title; - init(); + this(title, null); listeners.add(l); } @@ -131,9 +129,9 @@ } private void fireFileChanged() { - Iterator iter = listeners.iterator(); + Iterator<ChangeListener> iter = listeners.iterator(); while (iter.hasNext()) { - ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this)); + iter.next().stateChanged(new ChangeEvent(this)); } } Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/Entry.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/Entry.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/Entry.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/Entry.java Sat Aug 15 18:21:26 2009 @@ -29,37 +29,37 @@ // TODO - not used at present - could perhaps be removed public class Entry { - private Map configSet; + private Map<Class<?>, ConfigElement> configSet; // Set clonedSet; - private Class sampler; + private Class<?> sampler; - private List assertions; + private List<Assertion> assertions; public Entry() { - configSet = new HashMap(); + configSet = new HashMap<Class<?>, ConfigElement>(); // clonedSet = new HashSet(); - assertions = new LinkedList(); + assertions = new LinkedList<Assertion>(); } public void addAssertion(Assertion assertion) { assertions.add(assertion); } - public List getAssertions() { + public List<Assertion> getAssertions() { return assertions; } - public void setSamplerClass(Class samplerClass) { + public void setSamplerClass(Class<?> samplerClass) { this.sampler = samplerClass; } - public Class getSamplerClass() { + public Class<?> getSamplerClass() { return this.sampler; } - public ConfigElement getConfigElement(Class configClass) { - return (ConfigElement) configSet.get(configClass); + public ConfigElement getConfigElement(Class<?> configClass) { + return configSet.get(configClass); } public void addConfigElement(ConfigElement config) { @@ -70,9 +70,9 @@ * Add a config element as a specific class. Usually this is done to add a * subclass as one of it's parent classes. */ - public void addConfigElement(ConfigElement config, Class asClass) { + public void addConfigElement(ConfigElement config, Class<?> asClass) { if (config != null) { - ConfigElement current = (ConfigElement) configSet.get(asClass); + ConfigElement current = configSet.get(asClass); if (current == null) { configSet.put(asClass, cloneIfNecessary(config)); } else { Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java Sat Aug 15 18:21:26 2009 @@ -48,7 +48,7 @@ public class TestCompiler implements HashTreeTraverser { private static final Logger log = LoggingManager.getLoggerForClass(); - private final LinkedList stack = new LinkedList(); + private final LinkedList<Object> stack = new LinkedList<Object>(); private final Map<Sampler, SamplePackage> samplerConfigMap = new HashMap<Sampler, SamplePackage>(); Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BSFBeanInfoSupport.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BSFBeanInfoSupport.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BSFBeanInfoSupport.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BSFBeanInfoSupport.java Sat Aug 15 18:21:26 2009 @@ -28,7 +28,7 @@ */ public abstract class BSFBeanInfoSupport extends BeanInfoSupport { - protected BSFBeanInfoSupport(Class beanClass) { + protected BSFBeanInfoSupport(Class<?> beanClass) { super(beanClass); PropertyDescriptor p; Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellBeanInfoSupport.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellBeanInfoSupport.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellBeanInfoSupport.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellBeanInfoSupport.java Sat Aug 15 18:21:26 2009 @@ -28,7 +28,7 @@ */ public abstract class BeanShellBeanInfoSupport extends BeanInfoSupport { - protected BeanShellBeanInfoSupport(Class beanClass) { + protected BeanShellBeanInfoSupport(Class<?> beanClass) { super(beanClass); PropertyDescriptor p; Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Sat Aug 15 18:21:26 2009 @@ -49,19 +49,19 @@ private static final Method bshSource; - private static final Class bshClass; + private static final Class<?> bshClass; private static final String BSH_INTERPRETER = "bsh.Interpreter"; //$NON-NLS-1$ static { // Temporary copies, so can set the final ones Method get = null, eval = null, set = null, source = null; - Class clazz = null; + Class<?> clazz = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { clazz = loader.loadClass(BSH_INTERPRETER); - Class string = String.class; - Class object = Object.class; + Class<String> string = String.class; + Class<Object> object = Object.class; get = clazz.getMethod("get", //$NON-NLS-1$ new Class[] { string }); Modified: jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java (original) +++ jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java Sat Aug 15 18:21:26 2009 @@ -27,6 +27,10 @@ /** * This class serves as a way to calculate the median of a list of values. It is * not threadsafe. + * + * TODO - currently only works properly for Long (because getDistribution() assumes Long) + * Will never work for mixed values (e.g. Long and Integer) so should probably be converted to + * typed class. */ public class StatCalculator { List values = new ArrayList(); @@ -136,7 +140,7 @@ Iterator itr = this.values.iterator(); Number[] dis; while (itr.hasNext()) { - Long nx = (Long) itr.next(); + Long nx = (Long) itr.next(); // TODO this assumes the entries are all Long if (items.containsKey(nx)) { dis = (Number[]) items.get(nx); dis[1] = new Integer(dis[1].intValue() + 1); Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java Sat Aug 15 18:21:26 2009 @@ -76,7 +76,7 @@ log.info("Maximum connection retries = "+MAX_CONN_RETRIES); // $NON-NLS-1$ // Temporary copies, so can set the final ones Method _setConnectTimeout = null, _setReadTimeout = null; - Class clazz = URLConnection.class; + Class<URLConnection> clazz = URLConnection.class; try { _setConnectTimeout = clazz.getMethod("setConnectTimeout", //$NON-NLS-1$ new Class[] { Integer.TYPE }); @@ -406,18 +406,18 @@ private String getConnectionHeaders(HttpURLConnection conn) { // Get all the request properties, which are the headers set on the connection StringBuffer hdrs = new StringBuffer(100); - Map requestHeaders = conn.getRequestProperties(); - Set headerFields = requestHeaders.entrySet(); - for(Iterator i = headerFields.iterator(); i.hasNext();) { - Map.Entry entry = (Map.Entry)i.next(); - String headerKey=(String) entry.getKey(); + Map<String, List<String>> requestHeaders = conn.getRequestProperties(); + Set<Map.Entry<String, List<String>>> headerFields = requestHeaders.entrySet(); + for(Iterator<Map.Entry<String, List<String>>> i = headerFields.iterator(); i.hasNext();) { + Map.Entry<String, List<String>> entry = i.next(); + String headerKey=entry.getKey(); // Exclude the COOKIE header, since cookie is reported separately in the sample if(!HEADER_COOKIE.equalsIgnoreCase(headerKey)) { - List values = (List) entry.getValue();// value is a List of Strings + List<String> values = entry.getValue();// value is a List of Strings for (int j=0;j<values.size();j++){ hdrs.append(headerKey); hdrs.append(": "); // $NON-NLS-1$ - hdrs.append((String) values.get(j)); + hdrs.append(values.get(j)); hdrs.append("\n"); // $NON-NLS-1$ } } Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java Sat Aug 15 18:21:26 2009 @@ -54,9 +54,9 @@ try { is = new FileInputStream(f); props.load(is); - Iterator pi = props.entrySet().iterator(); + Iterator<Map.Entry<Object, Object>> pi = props.entrySet().iterator(); while(pi.hasNext()){ - Map.Entry me = (Map.Entry) pi.next(); + Map.Entry<Object, Object> me = pi.next(); String key = (String) me.getKey(); String value = (String)me.getValue(); int typeSep = key.indexOf("$"); // $NON-NLS-1$ Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java Sat Aug 15 18:21:26 2009 @@ -614,12 +614,12 @@ public void addEncodedArgument(String name, String value, String metaData) { } - public String convertSoapHeaders(Hashtable ht) { - Enumeration en = ht.keys(); + public String convertSoapHeaders(Hashtable<String, String> ht) { + Enumeration<String> en = ht.keys(); StringBuffer buf = new StringBuffer(); while (en.hasMoreElements()) { - Object key = en.nextElement(); - buf.append((String) key).append("=").append((String) ht.get(key)).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + String key = en.nextElement(); + buf.append(key).append("=").append(ht.get(key)).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ } return buf.toString(); } Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java?rev=804509&r1=804508&r2=804509&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java Sat Aug 15 18:21:26 2009 @@ -43,7 +43,7 @@ * test on an old system will likely run into memory or CPU problems long * before the HashMap is an issue. */ - private static final HashMap MEMCACHE = new HashMap(50); + private static final HashMap<Object, Document> MEMCACHE = new HashMap<Object, Document>(50); /** * Return a document. @@ -52,7 +52,7 @@ * @return Document */ public static synchronized Document getDocument(Object key) { - return (Document) MEMCACHE.get(key); + return MEMCACHE.get(key); } /** @@ -61,7 +61,7 @@ * @param key * @param data */ - public static synchronized void putDocument(Object key, Object data) { + public static synchronized void putDocument(Object key, Document data) { MEMCACHE.put(key, data); } --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org