The following issues were found

src/main/java/com/alibaba/fastjson/support/jaxrs/FastJsonAutoDiscoverable.java
3 issues
A catch statement should never catch throwable since it includes errors.
Error

Line: 28

                      try {
            autoDiscover = Boolean.parseBoolean(
                    System.getProperty(FASTJSON_AUTO_DISCOVERABLE, String.valueOf(autoDiscover)));
        } catch (Throwable ex) {
            //skip
        }
    }

    public void configure(final FeatureContext context) {

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 28

                      try {
            autoDiscover = Boolean.parseBoolean(
                    System.getProperty(FASTJSON_AUTO_DISCOVERABLE, String.valueOf(autoDiscover)));
        } catch (Throwable ex) {
            //skip
        }
    }

    public void configure(final FeatureContext context) {

            

Reported by PMD.

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

Line: 38

                      final Configuration config = context.getConfiguration();

        // Register FastJson.
        if (!config.isRegistered(FastJsonFeature.class) && autoDiscover) {

            context.register(FastJsonFeature.class);
        }
    }


            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/Polygon.java
3 issues
Returning 'coordinates' may expose an internal array.
Design

Line: 17

                  }

    public double[][][] getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }

            

Reported by PMD.

The user-supplied array 'coordinates' is stored directly.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

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

Line: 22

                              "this is a test" });
        String json = JSON.toJSONString(remoteInvocation);
        remoteInvocation = JSON.parseObject(json, RemoteInvocation.class);
        System.out.println(remoteInvocation);
    }
}

            

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

               * Created by wenshao on 02/07/2017.
 */
public class Issue363 extends TestCase {
    public void test_for_issue() throws Exception {
        RemoteInvocation remoteInvocation = new RemoteInvocation();
        remoteInvocation.setMethodName("test");
        remoteInvocation.setParameterTypes(new Class[] { int.class, Date.class,
                String.class });
        remoteInvocation.setArguments(new Object[] { 1, new Date(),

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 02/07/2017.
 */
public class Issue363 extends TestCase {
    public void test_for_issue() throws Exception {
        RemoteInvocation remoteInvocation = new RemoteInvocation();
        remoteInvocation.setMethodName("test");
        remoteInvocation.setParameterTypes(new Class[] { int.class, Date.class,
                String.class });
        remoteInvocation.setArguments(new Object[] { 1, new Date(),

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/Point.java
3 issues
The class 'Point' is suspected to be a Data Class (WOC=28.571%, NOPA=0, NOAM=4, WMC=10)
Design

Line: 10

               * @since 1.2.68
 */
@JSONType(typeName = "Point", orders = {"type", "bbox", "coordinates"})
public class Point extends Geometry {
    private double longitude;
    private double latitude;

    public Point() {
        super("Point");

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 29

                          return;
        }

        if (coordinates.length == 1) {
            this.longitude = coordinates[0];
            return;
        }

        this.longitude = coordinates[0];

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 22

                      return new double[] {longitude, latitude};
    }

    public void setCoordinates(double[] coordinates) {
        if (coordinates == null || coordinates.length == 0) {
            this.longitude = 0;
            this.latitude = 0;
            return;
        }

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/MultiPolygon.java
3 issues
Returning 'coordinates' may expose an internal array.
Design

Line: 18

                  }

    public double[][][][] getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(double[][][][] coordinates) {
        this.coordinates = coordinates;
    }

            

Reported by PMD.

The user-supplied array 'coordinates' is stored directly.
Design

Line: 21

                      return coordinates;
    }

    public void setCoordinates(double[][][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 21

                      return coordinates;
    }

    public void setCoordinates(double[][][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/MultiPoint.java
3 issues
Returning 'coordinates' may expose an internal array.
Design

Line: 17

                  }

    public double[][] getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }

            

Reported by PMD.

The user-supplied array 'coordinates' is stored directly.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue689.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 14

              import junit.framework.TestCase;

public class Issue689 extends TestCase {
    public void test_0() throws Exception {
        Map<String, ?> map = Collections.singletonMap("value", "A B");
        String json = JSON.toJSONString(map);
        Assert.assertEquals("{\"value\":\"A B\"}", json);
        
        JSONObject obj = JSON.parseObject(json);

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("{\"value\":\"A B\"}", json);
        
        JSONObject obj = JSON.parseObject(json);
        Assert.assertEquals(obj.get("value"), map.get("value"));
    }
}

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("{\"value\":\"A B\"}", json);
        
        JSONObject obj = JSON.parseObject(json);
        Assert.assertEquals(obj.get("value"), map.get("value"));
    }
}

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/MultiLineString.java
3 issues
Returning 'coordinates' may expose an internal array.
Design

Line: 17

                  }

    public double[][][] getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }

            

Reported by PMD.

The user-supplied array 'coordinates' is stored directly.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/geo/LineString.java
3 issues
Returning 'coordinates' may expose an internal array.
Design

Line: 17

                  }

    public double[][] getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }

            

Reported by PMD.

The user-supplied array 'coordinates' is stored directly.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 20

                      return coordinates;
    }

    public void setCoordinates(double[][] coordinates) {
        this.coordinates = coordinates;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue793.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

               * Created by wenshao on 16/8/27.
 */
public class Issue793 extends TestCase {
    public void test_for_issue() throws Exception {
        String text = "{ \"code\": 1000, \"data\": \"success\", \"game_data\": [], \"member_list\": [], \"message\": \"\\u6210\\u529f\" }";
        JSONObject json = JSON.parseObject(text);
        assertEquals(1000, json.get("code"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                  public void test_for_issue() throws Exception {
        String text = "{ \"code\": 1000, \"data\": \"success\", \"game_data\": [], \"member_list\": [], \"message\": \"\\u6210\\u529f\" }";
        JSONObject json = JSON.parseObject(text);
        assertEquals(1000, json.get("code"));
    }
}

            

Reported by PMD.

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

Line: 14

                  public void test_for_issue() throws Exception {
        String text = "{ \"code\": 1000, \"data\": \"success\", \"game_data\": [], \"member_list\": [], \"message\": \"\\u6210\\u529f\" }";
        JSONObject json = JSON.parseObject(text);
        assertEquals(1000, json.get("code"));
    }
}

            

Reported by PMD.