The following issues were found
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminDashbordController.java
6 issues
Line: 23
@RequestMapping("/admin/dashboard")
@Validated
public class AdminDashbordController {
private final Log logger = LogFactory.getLog(AdminDashbordController.class);
@Autowired
private LitemallUserService userService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 23
@RequestMapping("/admin/dashboard")
@Validated
public class AdminDashbordController {
private final Log logger = LogFactory.getLog(AdminDashbordController.class);
@Autowired
private LitemallUserService userService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 26
private final Log logger = LogFactory.getLog(AdminDashbordController.class);
@Autowired
private LitemallUserService userService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallGoodsProductService productService;
@Autowired
Reported by PMD.
Line: 28
@Autowired
private LitemallUserService userService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallGoodsProductService productService;
@Autowired
private LitemallOrderService orderService;
Reported by PMD.
Line: 30
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallGoodsProductService productService;
@Autowired
private LitemallOrderService orderService;
@GetMapping("")
public Object info() {
Reported by PMD.
Line: 32
@Autowired
private LitemallGoodsProductService productService;
@Autowired
private LitemallOrderService orderService;
@GetMapping("")
public Object info() {
int userTotal = userService.count();
int goodsTotal = goodsService.count();
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/StorageService.java
5 issues
Line: 20
private String active;
private Storage storage;
@Autowired
private LitemallStorageService litemallStorageService;
public String getActive() {
return active;
}
Reported by PMD.
Line: 66
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
Reported by PMD.
Line: 67
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
}
Reported by PMD.
Line: 66
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
Reported by PMD.
Line: 67
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/config/GlobalExceptionHandler.java
5 issues
Line: 63
Set<ConstraintViolation<?>> violations = exs.getConstraintViolations();
for (ConstraintViolation<?> item : violations) {
String message = ((PathImpl) item.getPropertyPath()).getLeafNode().getName() + item.getMessage();
return ResponseUtil.fail(402, message);
}
}
return ResponseUtil.badArgumentValue();
}
Reported by PMD.
Line: 24
@Order
public class GlobalExceptionHandler {
private Log logger = LogFactory.getLog(GlobalExceptionHandler.class);
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public Object badArgumentHandler(IllegalArgumentException e) {
logger.error(e.getMessage(), e);
Reported by PMD.
Line: 24
@Order
public class GlobalExceptionHandler {
private Log logger = LogFactory.getLog(GlobalExceptionHandler.class);
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public Object badArgumentHandler(IllegalArgumentException e) {
logger.error(e.getMessage(), e);
Reported by PMD.
Line: 24
@Order
public class GlobalExceptionHandler {
private Log logger = LogFactory.getLog(GlobalExceptionHandler.class);
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public Object badArgumentHandler(IllegalArgumentException e) {
logger.error(e.getMessage(), e);
Reported by PMD.
Line: 60
logger.error(e.getMessage(), e);
if (e instanceof ConstraintViolationException) {
ConstraintViolationException exs = (ConstraintViolationException) e;
Set<ConstraintViolation<?>> violations = exs.getConstraintViolations();
for (ConstraintViolation<?> item : violations) {
String message = ((PathImpl) item.getPropertyPath()).getLeafNode().getName() + item.getMessage();
return ResponseUtil.fail(402, message);
}
}
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/CoreConfigTest.java
5 issues
Line: 18
@RunWith(SpringRunner.class)
@SpringBootTest
public class CoreConfigTest {
private final Log logger = LogFactory.getLog(CoreConfigTest.class);
@Autowired
Environment environment;
@Test
public void test() {
Reported by PMD.
Line: 18
@RunWith(SpringRunner.class)
@SpringBootTest
public class CoreConfigTest {
private final Log logger = LogFactory.getLog(CoreConfigTest.class);
@Autowired
Environment environment;
@Test
public void test() {
Reported by PMD.
Line: 20
public class CoreConfigTest {
private final Log logger = LogFactory.getLog(CoreConfigTest.class);
@Autowired
Environment environment;
@Test
public void test() {
// 测试获取application-core.yml配置信息
logger.info(environment.getProperty("litemall.express.appId"));
Reported by PMD.
Line: 23
Environment environment;
@Test
public void test() {
// 测试获取application-core.yml配置信息
logger.info(environment.getProperty("litemall.express.appId"));
}
}
Reported by PMD.
Line: 10
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@WebAppConfiguration
@RunWith(SpringRunner.class)
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
5 issues
Line: 20
@RestController
@RequestMapping("/wx/order")
@Validated
public class WxOrderController {
private final Log logger = LogFactory.getLog(WxOrderController.class);
@Autowired
private WxOrderService wxOrderService;
Reported by PMD.
Line: 21
@RequestMapping("/wx/order")
@Validated
public class WxOrderController {
private final Log logger = LogFactory.getLog(WxOrderController.class);
@Autowired
private WxOrderService wxOrderService;
/**
Reported by PMD.
Line: 21
@RequestMapping("/wx/order")
@Validated
public class WxOrderController {
private final Log logger = LogFactory.getLog(WxOrderController.class);
@Autowired
private WxOrderService wxOrderService;
/**
Reported by PMD.
Line: 24
private final Log logger = LogFactory.getLog(WxOrderController.class);
@Autowired
private WxOrderService wxOrderService;
/**
* 订单列表
*
* @param userId 用户ID
Reported by PMD.
Line: 11
import org.linlinjava.litemall.wx.service.WxOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxBrandController.java
5 issues
Line: 29
@RequestMapping("/wx/brand")
@Validated
public class WxBrandController {
private final Log logger = LogFactory.getLog(WxBrandController.class);
@Autowired
private LitemallBrandService brandService;
/**
Reported by PMD.
Line: 29
@RequestMapping("/wx/brand")
@Validated
public class WxBrandController {
private final Log logger = LogFactory.getLog(WxBrandController.class);
@Autowired
private LitemallBrandService brandService;
/**
Reported by PMD.
Line: 32
private final Log logger = LogFactory.getLog(WxBrandController.class);
@Autowired
private LitemallBrandService brandService;
/**
* 品牌列表
*
* @param page 分页页数
Reported by PMD.
Line: 18
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 专题服务
Reported by PMD.
Line: 20
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 专题服务
*/
@RestController
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/util/CharUtil.java
5 issues
Line: 5
import java.util.Random;
public class CharUtil {
public static String getRandomString(Integer num) {
String base = "abcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
Reported by PMD.
Line: 8
public class CharUtil {
public static String getRandomString(Integer num) {
String base = "abcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < num; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
Reported by PMD.
Line: 9
public static String getRandomString(Integer num) {
String base = "abcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < num; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
Reported by PMD.
Line: 19
}
public static String getRandomNum(Integer num) {
String base = "0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < num; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
Reported by PMD.
Line: 20
public static String getRandomNum(Integer num) {
String base = "0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < num; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/NotifyProperties.java
5 issues
Line: 10
import java.util.Map;
@ConfigurationProperties(prefix = "litemall.notify")
public class NotifyProperties {
private Mail mail;
private Sms sms;
public Mail getMail() {
return mail;
Reported by PMD.
Line: 30
this.sms = sms;
}
public static class Mail {
private boolean enable;
private String host;
private String username;
private String password;
private String sendfrom;
Reported by PMD.
Line: 95
}
}
public static class Sms {
private boolean enable;
private String active;
private String sign;
private Tencent tencent;
private Aliyun aliyun;
Reported by PMD.
Line: 151
this.aliyun = aliyun;
}
public static class Tencent {
private int appid;
private String appkey;
public int getAppid() {
return appid;
Reported by PMD.
Line: 172
}
}
public static class Aliyun {
private String regionId;
private String accessKeyId;
private String accessKeySecret;
public String getRegionId() {
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/config/StorageProperties.java
5 issues
Line: 6
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "litemall.storage")
public class StorageProperties {
private String active;
private Local local;
private Aliyun aliyun;
private Tencent tencent;
private Qiniu qiniu;
Reported by PMD.
Line: 53
this.qiniu = qiniu;
}
public static class Local {
private String address;
private String storagePath;
public String getAddress() {
return address;
Reported by PMD.
Line: 74
}
}
public static class Tencent {
private String secretId;
private String secretKey;
private String region;
private String bucketName;
Reported by PMD.
Line: 113
}
}
public static class Aliyun {
private String endpoint;
private String accessKeyId;
private String accessKeySecret;
private String bucketName;
Reported by PMD.
Line: 152
}
}
public static class Qiniu {
private String endpoint;
private String accessKey;
private String secretKey;
private String bucketName;
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/OrderGoodsVo.java
5 issues
Line: 6
import java.math.BigDecimal;
import java.util.Arrays;
public class OrderGoodsVo {
private Integer id;
private String goodsName;
private String picUrl;
private Integer goodsId;
private Integer productId;
Reported by PMD.
Line: 65
}
public String[] getSpecifications() {
return specifications;
}
public void setSpecifications(String[] specifications) {
this.specifications = specifications;
}
Reported by PMD.
Line: 68
return specifications;
}
public void setSpecifications(String[] specifications) {
this.specifications = specifications;
}
public Integer getNumber() {
return number;
Reported by PMD.
Line: 4
package org.linlinjava.litemall.db.domain;
import java.math.BigDecimal;
import java.util.Arrays;
public class OrderGoodsVo {
private Integer id;
private String goodsName;
private String picUrl;
Reported by PMD.
Line: 68
return specifications;
}
public void setSpecifications(String[] specifications) {
this.specifications = specifications;
}
public Integer getNumber() {
return number;
Reported by PMD.