The following issues were found

src/test/java/com/alibaba/json/bvt/support/spring/mock/testcase/FastJsonpHttpMessageConverter4Case3Test.java
96 issues
This class has too many methods, consider refactoring it.
Design

Line: 38

              @RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration
public class FastJsonpHttpMessageConverter4Case3Test {
    private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 42

                  private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 44

                  @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc
    @Configuration
    protected static class Config extends WebMvcConfigurerAdapter {

            

Reported by PMD.

The String literal 'UTF-8' appears 9 times in this file; the first occurrence is on line 65
Error

Line: 65

                  @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) //
                .addFilter(new CharacterEncodingFilter("UTF-8", true)) // 设置服务器端返回的字符集为:UTF-8
                .build();
    }

    @Test
    public void checkDefaultJSONPQueryParamNames() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 76

                  }

    @Test
    public void isInjectComponent() {
        wac.getBean(FastJsonpResponseBodyAdvice.class);
    }

    @Test
    public void test1() throws Exception {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 81

                  }

    @Test
    public void test1() throws Exception {

        JSONObject json = new JSONObject();

        json.put("id", 123);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 89

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 89

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 90

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 90

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/util/AntiCollisionHashMap.java
95 issues
Overridable method 'init' called during object construction
Error

Line: 110

                      this.loadFactor = loadFactor;
        threshold = (int) (capacity * loadFactor);
        table = new Entry[capacity];
        init();
    }

    /**
     * Constructs an empty <tt>SafelyHashMap</tt> with the specified initial
     * capacity and the default load factor (0.75).

            

Reported by PMD.

Overridable method 'init' called during object construction
Error

Line: 134

                      this.loadFactor = DEFAULT_LOAD_FACTOR;
        threshold = (int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);
        table = new Entry[DEFAULT_INITIAL_CAPACITY];
        init();
    }

    /**
     * Constructs a new <tt>SafelyHashMap</tt> with the same mappings as the
     * specified <tt>Map</tt>. The <tt>SafelyHashMap</tt> is created with

            

Reported by PMD.

Avoid reassigning parameters such as 'initialCapacity'
Design

Line: 92

                      return (hash ^ (hash >> 1)) & M_MASK;
    }

    public AntiCollisionHashMap(int initialCapacity, float loadFactor) {
        if (initialCapacity < 0)
            throw new IllegalArgumentException("Illegal initial capacity: "
                    + initialCapacity);
        if (initialCapacity > MAXIMUM_CAPACITY)
            initialCapacity = MAXIMUM_CAPACITY;

            

Reported by PMD.

Avoid reassigning parameters such as 'h'
Design

Line: 173

                   * encounter collisions for hashCodes that do not differ in lower bits.
     * Note: Null keys always map to hash 0, thus index 0.
     */
    static int hash(int h) {
        // This function ensures that hashCodes that differ only by
        // constant multiples at each bit position have a bounded
        // number of collisions (approximately 8 at default load factor).
        h = h * h;
        h ^= (h >>> 20) ^ (h >>> 12);

            

Reported by PMD.

Avoid reassigning parameters such as 'h'
Design

Line: 173

                   * encounter collisions for hashCodes that do not differ in lower bits.
     * Note: Null keys always map to hash 0, thus index 0.
     */
    static int hash(int h) {
        // This function ensures that hashCodes that differ only by
        // constant multiples at each bit position have a bounded
        // number of collisions (approximately 8 at default load factor).
        h = h * h;
        h ^= (h >>> 20) ^ (h >>> 12);

            

Reported by PMD.

Possible God Class (WMC=121, ATFD=68, TCC=31.261%)
Design

Line: 10

              /**
 * @deprecated
 */
public class AntiCollisionHashMap<K, V> extends AbstractMap<K, V> implements
        Map<K, V>, Cloneable, Serializable {

    transient volatile Set<K> keySet = null;
    transient volatile Collection<V> values = null;


            

Reported by PMD.

The class 'AntiCollisionHashMap' has a total cyclomatic complexity of 121 (highest 9).
Design

Line: 10

              /**
 * @deprecated
 */
public class AntiCollisionHashMap<K, V> extends AbstractMap<K, V> implements
        Map<K, V>, Cloneable, Serializable {

    transient volatile Set<K> keySet = null;
    transient volatile Collection<V> values = null;


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 11

               * @deprecated
 */
public class AntiCollisionHashMap<K, V> extends AbstractMap<K, V> implements
        Map<K, V>, Cloneable, Serializable {

    transient volatile Set<K> keySet = null;
    transient volatile Collection<V> values = null;

    /**

            

Reported by PMD.

Avoid using redundant field initializer for 'keySet'
Performance

Line: 13

              public class AntiCollisionHashMap<K, V> extends AbstractMap<K, V> implements
        Map<K, V>, Cloneable, Serializable {

    transient volatile Set<K> keySet = null;
    transient volatile Collection<V> values = null;

    /**
     * The default initial capacity - MUST be a power of two.
     */

            

Reported by PMD.

Field keySet has the same name as a method
Error

Line: 13

              public class AntiCollisionHashMap<K, V> extends AbstractMap<K, V> implements
        Map<K, V>, Cloneable, Serializable {

    transient volatile Set<K> keySet = null;
    transient volatile Collection<V> values = null;

    /**
     * The default initial capacity - MUST be a power of two.
     */

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/support/spring/mock/testcase/FastJsonpHttpMessageConverter4Case2Test.java
95 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 42

                  private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 44

                  @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc
    @Configuration
    protected static class Config extends WebMvcConfigurerAdapter {

            

Reported by PMD.

The String literal 'UTF-8' appears 9 times in this file; the first occurrence is on line 65
Error

Line: 65

                  @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) //
                .addFilter(new CharacterEncodingFilter("UTF-8", true)) // 设置服务器端返回的字符集为:UTF-8
                .build();
    }

    @Test
    public void isInjectComponent() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 70

                  }

    @Test
    public void isInjectComponent() {
        wac.getBean(FastJsonpResponseBodyAdvice.class);
    }

    @Test
    public void test1() throws Exception {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 75

                  }

    @Test
    public void test1() throws Exception {

        JSONObject json = new JSONObject();

        json.put("id", 123);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 83

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 83

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 84

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 84

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 84

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

src/test/java/data/media/MediaGenDecoder.java
95 issues
The class 'MediaGenDecoder' has a Standard Cyclomatic Complexity of 23 (Highest = 65).
Design

Line: 13

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();

            

Reported by PMD.

Possible God Class (WMC=78, ATFD=86, TCC=0.000%)
Design

Line: 13

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();

            

Reported by PMD.

The class 'MediaGenDecoder' has a Modified Cyclomatic Complexity of 23 (Highest = 65).
Design

Line: 13

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();

            

Reported by PMD.

Too many fields
Design

Line: 13

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 14

              import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();

            

Reported by PMD.

Private field 'size_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 14

              import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 15

              
public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();
    private char[] bitrate_gen_prefix__ = "\"bitrate\":".toCharArray();

            

Reported by PMD.

Private field 'uri_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 15

              
public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();
    private char[] bitrate_gen_prefix__ = "\"bitrate\":".toCharArray();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 16

              public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();
    private char[] bitrate_gen_prefix__ = "\"bitrate\":".toCharArray();
    private char[] persons_gen_prefix__ = "\"persons\":".toCharArray();

            

Reported by PMD.

Private field 'title_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 16

              public class MediaGenDecoder extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] size_gen_prefix__ = "\"size\":".toCharArray();
    private char[] uri_gen_prefix__ = "\"uri\":".toCharArray();
    private char[] title_gen_prefix__ = "\"title\":".toCharArray();
    private char[] width_gen_prefix__ = "\"width\":".toCharArray();
    private char[] height_gen_prefix__ = "\"height\":".toCharArray();
    private char[] duration_gen_prefix__ = "\"duration\":".toCharArray();
    private char[] bitrate_gen_prefix__ = "\"bitrate\":".toCharArray();
    private char[] persons_gen_prefix__ = "\"persons\":".toCharArray();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/support/spring/mock/testcase/FastJsonpHttpMessageConverter4Case1Test.java
95 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 35

                  private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @Before
    public void setup() {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

                  @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) //
                .addFilter(new CharacterEncodingFilter("UTF-8", true)) // 设置服务器端返回的字符集为:UTF-8

            

Reported by PMD.

The String literal 'UTF-8' appears 9 times in this file; the first occurrence is on line 42
Error

Line: 42

                  @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) //
                .addFilter(new CharacterEncodingFilter("UTF-8", true)) // 设置服务器端返回的字符集为:UTF-8
                .build();
    }

    @Test
    public void isInjectComponent() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 47

                  }

    @Test
    public void isInjectComponent() {
        wac.getBean(FastJsonpResponseBodyAdvice.class);
    }

    @Test
    public void test1() throws Exception {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 52

                  }

    @Test
    public void test1() throws Exception {

        JSONObject json = new JSONObject();

        json.put("id", 123);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

              
        json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 61

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 61

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 61

                      json.put("name", "哈哈哈");

        mockMvc.perform(
                (post("/fastjson/test1").characterEncoding("UTF-8").content(json.toJSONString())
                        .contentType(MediaType.APPLICATION_JSON))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test1_2() throws Exception {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvtVO/PushMsg.java
93 issues
Avoid reassigning parameters such as 'url'
Design

Line: 257

                          return url;
        }

        public void setUrl(String url) {
            if (null != url) {
                url = url.trim();
            }
            this.url = url;
        }

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 1

              package com.alibaba.json.bvtVO;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created by haihong.xiahh on 13-12-23.
 */

            

Reported by PMD.

Avoid unnecessary if..then..else statements when returning booleans
Design

Line: 108

                          return false;
        }// end if

        if (!msg.isValid()) {
            return false;
        }// end if

        return true;
    }

            

Reported by PMD.

Avoid unnecessary if..then..else statements when returning booleans
Design

Line: 132

                          return false;
        }// end if

        if (!isImagesReady()) {
            return false;
        }// end if

        return true;
    }

            

Reported by PMD.

Avoid empty if statements
Error

Line: 146

                   */
    public boolean hasUrl() {
        boolean result = true;
        if (null != msg) {
        } else {
            result = false;
        }



            

Reported by PMD.

Avoid empty if statements
Error

Line: 157

              
    public boolean hasText() {
        boolean result = true;
        if (null != msg) {
        } else {
            result = false;
        }



            

Reported by PMD.

Substitute calls to size() == 0 (or size() != 0, size() > 0, size() < 1) with calls to isEmpty()
Design

Line: 173

                   */
    private boolean isImagesReady() {
        List<String> list = getNewImageUrlList();
        boolean ret = null == list || 0 == list.size();
        if (!ret) {
            preparedImages(list);
        }
        return ret;
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 173

                   */
    private boolean isImagesReady() {
        List<String> list = getNewImageUrlList();
        boolean ret = null == list || 0 == list.size();
        if (!ret) {
            preparedImages(list);
        }
        return ret;
    }

            

Reported by PMD.

The class 'Msg' is suspected to be a Data Class (WOC=9.091%, NOPA=0, NOAM=19, WMC=24)
Design

Line: 201

                      return null;
    }

    public static class Msg implements Serializable {
        /**
         * 
         */
        private static final long serialVersionUID = -2020714577526457332L;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 224

                       */
        private String simg;

        private ControlFlags controlFlags;

        public Msg() {
        }

        public String getGid() {

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/parser/deserializer/FieldDeserializer.java
93 issues
Avoid reassigning parameters such as 'value'
Design

Line: 57

                  }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public void setValue(Object object, Object value) {
        if (value == null //
                && fieldInfo.fieldClass.isPrimitive()) {
            return;
        } else if (fieldInfo.fieldClass == String.class
                && fieldInfo.format != null

            

Reported by PMD.

The class 'FieldDeserializer' has a Standard Cyclomatic Complexity of 4 (Highest = 40).
Design

Line: 16

              import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

public abstract class FieldDeserializer {

    public final FieldInfo fieldInfo;

    protected final Class<?> clazz;


            

Reported by PMD.

Possible God Class (WMC=72, ATFD=72, TCC=2.222%)
Design

Line: 16

              import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

public abstract class FieldDeserializer {

    public final FieldInfo fieldInfo;

    protected final Class<?> clazz;


            

Reported by PMD.

The class 'FieldDeserializer' has a Modified Cyclomatic Complexity of 4 (Highest = 40).
Design

Line: 16

              import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

public abstract class FieldDeserializer {

    public final FieldInfo fieldInfo;

    protected final Class<?> clazz;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 18

              
public abstract class FieldDeserializer {

    public final FieldInfo fieldInfo;

    protected final Class<?> clazz;

    protected BeanContext beanContext;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 20

              
    public final FieldInfo fieldInfo;

    protected final Class<?> clazz;

    protected BeanContext beanContext;

    public FieldDeserializer(Class<?> clazz, FieldInfo fieldInfo) {
        this.clazz = clazz;

            

Reported by PMD.

Avoid really long methods.
Design

Line: 57

                  }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public void setValue(Object object, Object value) {
        if (value == null //
                && fieldInfo.fieldClass.isPrimitive()) {
            return;
        } else if (fieldInfo.fieldClass == String.class
                && fieldInfo.format != null

            

Reported by PMD.

The method 'setValue(Object, Object)' has a NCSS line count of 111.
Design

Line: 57

                  }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public void setValue(Object object, Object value) {
        if (value == null //
                && fieldInfo.fieldClass.isPrimitive()) {
            return;
        } else if (fieldInfo.fieldClass == String.class
                && fieldInfo.format != null

            

Reported by PMD.

The method 'setValue(Object, Object)' has a cyclomatic complexity of 58.
Design

Line: 57

                  }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public void setValue(Object object, Object value) {
        if (value == null //
                && fieldInfo.fieldClass.isPrimitive()) {
            return;
        } else if (fieldInfo.fieldClass == String.class
                && fieldInfo.format != null

            

Reported by PMD.

The method 'setValue' has a Standard Cyclomatic Complexity of 40.
Design

Line: 57

                  }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public void setValue(Object object, Object value) {
        if (value == null //
                && fieldInfo.fieldClass.isPrimitive()) {
            return;
        } else if (fieldInfo.fieldClass == String.class
                && fieldInfo.format != null

            

Reported by PMD.

src/test/java/com/alibaba/json/test/codegen/DepartmentCodec.java
89 issues
Possible God Class (WMC=49, ATFD=65, TCC=0.000%)
Design

Line: 15

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();

            

Reported by PMD.

The class 'DepartmentCodec' has a Standard Cyclomatic Complexity of 15 (Highest = 41).
Design

Line: 15

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();

            

Reported by PMD.

The class 'DepartmentCodec' has a Modified Cyclomatic Complexity of 15 (Highest = 41).
Design

Line: 15

              import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();

            

Reported by PMD.

Private field 'name_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 16

              import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 16

              import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 17

              
public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();
    

            

Reported by PMD.

Private field 'root_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 17

              
public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();
    

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 18

              public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();
    
    private ObjectDeserializer name_gen_deser__;

            

Reported by PMD.

Private field 'type_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 18

              public class DepartmentCodec extends JavaBeanDeserializer implements ObjectDeserializer {
    private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();
    
    private ObjectDeserializer name_gen_deser__;

            

Reported by PMD.

Private field 'id_gen_prefix__' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 19

                  private char[] name_gen_prefix__ = "\"name\":".toCharArray();
    private char[] root_gen_prefix__ = "\"root\":".toCharArray();
    private char[] type_gen_prefix__ = "\"type\":".toCharArray();
    private char[] id_gen_prefix__ = "\"id\":".toCharArray();
    private char[] leader_gen_prefix__ = "\"leader\":".toCharArray();
    private char[] members_gen_prefix__ = "\"members\":".toCharArray();
    
    private ObjectDeserializer name_gen_deser__;
    private ObjectDeserializer leader_gen_deser__;

            

Reported by PMD.

src/test/resources/classicmodels.sql
88 issues
Syntax error at or near "mysql"
Syntax error

Line: 24 Column: 10

              -- CREATE DATABASE IF NOT EXISTS classicmodels;
-- USE classicmodels;
create schema IF NOT EXISTS classicmodels; -- Uncomment this also to execute in MySQL
SET MODE MySQL;
SET IGNORECASE TRUE;


DROP TABLE IF EXISTS `classicmodels`.`Customer`;
CREATE TABLE  `classicmodels`.`Customer` (

            

Reported by SQLint.

Syntax error at or near "true"
Syntax error

Line: 25 Column: 16

              -- USE classicmodels;
create schema IF NOT EXISTS classicmodels; -- Uncomment this also to execute in MySQL
SET MODE MySQL;
SET IGNORECASE TRUE;


DROP TABLE IF EXISTS `classicmodels`.`Customer`;
CREATE TABLE  `classicmodels`.`Customer` (
  `customerNumber` int(11) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 28 Column: 22

              SET IGNORECASE TRUE;


DROP TABLE IF EXISTS `classicmodels`.`Customer`;
CREATE TABLE  `classicmodels`.`Customer` (
  `customerNumber` int(11) NOT NULL,
  `customerName` varchar(50) NOT NULL,
  `contactLastName` varchar(50) NOT NULL,
  `contactFirstName` varchar(50) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 29 Column: 15

              

DROP TABLE IF EXISTS `classicmodels`.`Customer`;
CREATE TABLE  `classicmodels`.`Customer` (
  `customerNumber` int(11) NOT NULL,
  `customerName` varchar(50) NOT NULL,
  `contactLastName` varchar(50) NOT NULL,
  `contactFirstName` varchar(50) NOT NULL,
  `phone` varchar(50) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 45 Column: 13

                `creditLimit` double DEFAULT NULL,
  PRIMARY KEY (`customerNumber`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`) VALUES 
 (103,'Atelier graphique','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000),
 (112,'Signal Gift Stores','King','Sue','7025551838','8489 Strong St.',NULL,'Las Vegas','NV','83030','USA',1166,71800),
 (114,'Australian Collectors, Co.','Ferguson','Peter','03 9520 4555','636 St Kilda Road','Level 3','Melbourne','Victoria','3004','Australia',1611,117300),
 (119,'La Rochelle Gifts','Labrune','Janine ','40.67.8555','67, rue des Cinquante Otages',NULL,'Nantes',NULL,'44000','France',1370,118200),
 (121,'Baane Mini Imports','Bergulfsen','Jonas ','07-98 9555','Erling Skakkes gate 78',NULL,'Stavern',NULL,'4110','Norway',1504,81700),

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 169 Column: 22

               (495,'Diecast Collectables','Franco','Valarie','6175552555','6251 Ingle Ln.',NULL,'Boston','MA','51003','USA',1188,85100),
 (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland  ',NULL,'','New Zealand',1612,110000);

DROP TABLE IF EXISTS `classicmodels`.`Employee`;
CREATE TABLE  `classicmodels`.`Employee` (
  `employeeNumber` int(11) NOT NULL,
  `lastName` varchar(50) NOT NULL,
  `firstName` varchar(50) NOT NULL,
  `extension` varchar(10) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 170 Column: 15

               (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland  ',NULL,'','New Zealand',1612,110000);

DROP TABLE IF EXISTS `classicmodels`.`Employee`;
CREATE TABLE  `classicmodels`.`Employee` (
  `employeeNumber` int(11) NOT NULL,
  `lastName` varchar(50) NOT NULL,
  `firstName` varchar(50) NOT NULL,
  `extension` varchar(10) NOT NULL,
  `email` varchar(100) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 181 Column: 13

                `jobTitle` varchar(50) NOT NULL,
  PRIMARY KEY (`employeeNumber`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `classicmodels`.`Employee` (`employeeNumber`,`lastName`,`firstName`,`extension`,`email`,`officeCode`,`reportsTo`,`jobTitle`) VALUES 
 (1002,'Murphy','Diane','x5800','dmurphy@classicmodelcars.com','1',NULL,'President'),
 (1056,'Patterson','Mary','x4611','mpatterso@classicmodelcars.com','1',1002,'VP Sales'),
 (1076,'Firrelli','Jeff','x9273','jfirrelli@classicmodelcars.com','1',1002,'VP Marketing'),
 (1088,'Patterson','William','x4871','wpatterson@classicmodelcars.com','6',1056,'Sales Manager (JAPAN, APAC)'),
 (1102,'Bondur','Gerard','x5408','athompson@classicmodelcars.com','4',1056,'Sale Manager (EMEA)'),

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 206 Column: 22

               (1625,'Kato','Yoshimi','x102','ekato@classicmodelcars.com','5',1088,'Sales Rep'),
 (1702,'Gerard','Martin','x2312','gmartin@classicmodelcars.com','4',1102,'Sales Rep');

DROP TABLE IF EXISTS `classicmodels`.`Office`;
CREATE TABLE  `classicmodels`.`Office` (
  `officeCode` varchar(50) NOT NULL,
  `city` varchar(50) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `addressLine1` varchar(50) NOT NULL,

            

Reported by SQLint.

Syntax error at or near "`"
Syntax error

Line: 207 Column: 15

               (1702,'Gerard','Martin','x2312','gmartin@classicmodelcars.com','4',1102,'Sales Rep');

DROP TABLE IF EXISTS `classicmodels`.`Office`;
CREATE TABLE  `classicmodels`.`Office` (
  `officeCode` varchar(50) NOT NULL,
  `city` varchar(50) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `addressLine1` varchar(50) NOT NULL,
  `addressLine2` varchar(50) DEFAULT NULL,

            

Reported by SQLint.

src/test/java/com/alibaba/json/bvt/bug/Issue248_orderedField.java
84 issues
System.out.println is used
Design

Line: 16

                  public void test_0() throws Exception {
        String text = "{\"b\":\"b\",\"d\":\"d\",\"c\":\"c\",\"a\":\"a\"}";
        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("b", object.keySet().toArray()[0]);
        Assert.assertEquals("d", object.keySet().toArray()[1]);
        Assert.assertEquals("c", object.keySet().toArray()[2]);
        Assert.assertEquals("a", object.keySet().toArray()[3]);

            

Reported by PMD.

System.out.println is used
Design

Line: 26

              
    public void test_1() throws Exception {
        String text = "{\"a\":\"a\",\"b\":\"b\",\"c\":\"c\",\"d\":\"d\"}";
        System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("a", object.keySet().toArray()[0]);

            

Reported by PMD.

System.out.println is used
Design

Line: 29

                      System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("a", object.keySet().toArray()[0]);
        Assert.assertEquals("b", object.keySet().toArray()[1]);
        Assert.assertEquals("c", object.keySet().toArray()[2]);
        Assert.assertEquals("d", object.keySet().toArray()[3]);

            

Reported by PMD.

System.out.println is used
Design

Line: 40

              
    public void test_2() throws Exception {
        String text = "{\"k1\":\"v1\",\"k3\":\"v3\",\"k2\":\"v2\",\"map\":{\"k1\":\"v1\",\"k3\":\"v3\",\"k2\":\"v2\",\"map\":{\"k1\":\"v1\",\"k3\":\"v3\",\"k2\":\"v2\"}}}";
        System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("k1", object.keySet().toArray()[0]);

            

Reported by PMD.

System.out.println is used
Design

Line: 43

                      System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("k1", object.keySet().toArray()[0]);
        Assert.assertEquals("k3", object.keySet().toArray()[1]);
        Assert.assertEquals("k2", object.keySet().toArray()[2]);
        Assert.assertEquals("map", object.keySet().toArray()[3]);

            

Reported by PMD.

System.out.println is used
Design

Line: 62

              
    public void test_3() throws Exception {
        String text = "{\"k1\":\"v1\",\"k3\":\"v3\",\"k2\":\"v2\",\"list\":[\"v1\",\"v3\",\"v2\",{\"map\":{\"k1\":\"v1\",\"k3\":\"v3\",\"k2\":\"v2\"}}]}";
        System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("k1", object.keySet().toArray()[0]);

            

Reported by PMD.

System.out.println is used
Design

Line: 65

                      System.out.println(JSON.parseObject(text));

        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("k1", object.keySet().toArray()[0]);
        Assert.assertEquals("k3", object.keySet().toArray()[1]);
        Assert.assertEquals("k2", object.keySet().toArray()[2]);
        Assert.assertEquals("list", object.keySet().toArray()[3]);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 13

              
public class Issue248_orderedField extends TestCase {

    public void test_0() throws Exception {
        String text = "{\"b\":\"b\",\"d\":\"d\",\"c\":\"c\",\"a\":\"a\"}";
        JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("b", object.keySet().toArray()[0]);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 18

                      JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("b", object.keySet().toArray()[0]);
        Assert.assertEquals("d", object.keySet().toArray()[1]);
        Assert.assertEquals("c", object.keySet().toArray()[2]);
        Assert.assertEquals("a", object.keySet().toArray()[3]);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 18

                      JSONObject object = JSON.parseObject(text, Feature.OrderedField);
        System.out.println(object);

        Assert.assertEquals("b", object.keySet().toArray()[0]);
        Assert.assertEquals("d", object.keySet().toArray()[1]);
        Assert.assertEquals("c", object.keySet().toArray()[2]);
        Assert.assertEquals("a", object.keySet().toArray()[3]);
    }


            

Reported by PMD.