nexus061 / struts2-arianna-plugin

Automatically exported from code.google.com/p/struts2-arianna-plugin
0 stars 0 forks source link

Request Comprator Null pointer #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
NOTE: Is it possible for me to participate in development/bug fixing ?

What steps will reproduce the problem?
If using request comprator , and ther are two links  with same # of total 
params, but with different key/values. Comparator fails complaining about NULL 
pointer issue.

What is the expected output? What do you see instead?
Comparator should return computed true/false depending on the incoming params.

What version of the product are you using?
0.5.1

Please provide any additional information below.
Fix is to check for nulls in v2 variable. Code below.

    private boolean compareParametersMap(Map m1, Map m2) {
        if (m1.size() != m2.size())
            return false;

        for (Object key : m1.keySet()) {
            String[] v1;
            try {
                v1 = (String[]) m1.get(key);
            } catch (ClassCastException e) {
                v1 = new String[] { (String) m1.get(key) };
            }

            String[] v2;
            try {
                v2 = (String[]) m2.get(key);
            } catch (ClassCastException e) {
                v2 = new String[] { (String) m2.get(key) };
            }

            if (v2==null || (v1.length != v2.length))
                return false;
            for (int i = 0; i < v2.length; i++) {
                if (!v1[i].equals(v2[i]))
                    return false;
            }
        }
        return true;
    }

Original issue reported on code.google.com by omer.raf...@gmail.com on 3 Jun 2013 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by giovanni...@gmail.com on 3 Jun 2013 at 8:14

GoogleCodeExporter commented 9 years ago
Hi I sent you a private message to your google email , can you check if you 
have received it

Original comment by giovanni...@gmail.com on 4 Jun 2013 at 8:39