The following issues were found
litemall-db/src/main/java/org/linlinjava/litemall/db/mybatis/JsonStringArrayTypeHandler.java
5 issues
Line: 52
try {
return (String[]) mapper.readValue(content, String[].class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
return null;
}
}
Reported by PMD.
Line: 41
private String toJson(String[] params) {
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
return "[]";
}
Reported by PMD.
Line: 42
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
return "[]";
}
private String[] toObject(String content) {
Reported by PMD.
Line: 51
if (content != null && !content.isEmpty()) {
try {
return (String[]) mapper.readValue(content, String[].class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
return null;
}
Reported by PMD.
Line: 38
return this.toObject(cs.getString(columnIndex));
}
private String toJson(String[] params) {
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxFeedbackController.java
5 issues
Line: 30
@RequestMapping("/wx/feedback")
@Validated
public class WxFeedbackController {
private final Log logger = LogFactory.getLog(WxFeedbackController.class);
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
private LitemallUserService userService;
Reported by PMD.
Line: 30
@RequestMapping("/wx/feedback")
@Validated
public class WxFeedbackController {
private final Log logger = LogFactory.getLog(WxFeedbackController.class);
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
private LitemallUserService userService;
Reported by PMD.
Line: 33
private final Log logger = LogFactory.getLog(WxFeedbackController.class);
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
private LitemallUserService userService;
private Object validate(LitemallFeedback feedback) {
String content = feedback.getContent();
Reported by PMD.
Line: 35
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
private LitemallUserService userService;
private Object validate(LitemallFeedback feedback) {
String content = feedback.getContent();
if (StringUtils.isEmpty(content)) {
return ResponseUtil.badArgument();
Reported by PMD.
Line: 82
}
LitemallUser user = userService.findById(userId);
String username = user.getUsername();
feedback.setId(null);
feedback.setUserId(userId);
feedback.setUsername(username);
//状态默认是0,1表示状态已发生变化
feedback.setStatus(1);
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/mybatis/JsonIntegerArrayTypeHandler.java
5 issues
Line: 52
try {
return (Integer[]) mapper.readValue(content, Integer[].class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
return null;
}
}
Reported by PMD.
Line: 41
private String toJson(Integer[] params) {
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
return "[]";
}
Reported by PMD.
Line: 42
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
return "[]";
}
private Integer[] toObject(String content) {
Reported by PMD.
Line: 51
if (content != null && !content.isEmpty()) {
try {
return (Integer[]) mapper.readValue(content, Integer[].class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
return null;
}
Reported by PMD.
Line: 38
return this.toObject(cs.getString(columnIndex));
}
private String toJson(Integer[] params) {
try {
return mapper.writeValueAsString(params);
} catch (Exception e) {
e.printStackTrace();
}
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminCommentController.java
5 issues
Line: 22
@RequestMapping("/admin/comment")
@Validated
public class AdminCommentController {
private final Log logger = LogFactory.getLog(AdminCommentController.class);
@Autowired
private LitemallCommentService commentService;
@RequiresPermissions("admin:comment:list")
Reported by PMD.
Line: 22
@RequestMapping("/admin/comment")
@Validated
public class AdminCommentController {
private final Log logger = LogFactory.getLog(AdminCommentController.class);
@Autowired
private LitemallCommentService commentService;
@RequiresPermissions("admin:comment:list")
Reported by PMD.
Line: 25
private final Log logger = LogFactory.getLog(AdminCommentController.class);
@Autowired
private LitemallCommentService commentService;
@RequiresPermissions("admin:comment:list")
@RequiresPermissionsDesc(menu = {"商品管理", "评论管理"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String valueId,
Reported by PMD.
Line: 30
@RequiresPermissions("admin:comment:list")
@RequiresPermissionsDesc(menu = {"商品管理", "评论管理"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String valueId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallComment> commentList = commentService.querySelective(userId, valueId, page, limit, sort, order);
Reported by PMD.
Line: 14
import org.linlinjava.litemall.db.service.LitemallCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/admin/comment")
Reported by PMD.
litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/AdminConfigTest.java
5 issues
Line: 21
@Test
public void test() {
// 测试获取application-core.yml配置信息
System.out.println(environment.getProperty("litemall.express.appId"));
// 测试获取application-db.yml配置信息
System.out.println(environment.getProperty("spring.datasource.druid.url"));
// 测试获取application-admin.yml配置信息
// System.out.println(environment.getProperty(""));
// 测试获取application.yml配置信息
Reported by PMD.
Line: 23
// 测试获取application-core.yml配置信息
System.out.println(environment.getProperty("litemall.express.appId"));
// 测试获取application-db.yml配置信息
System.out.println(environment.getProperty("spring.datasource.druid.url"));
// 测试获取application-admin.yml配置信息
// System.out.println(environment.getProperty(""));
// 测试获取application.yml配置信息
System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
}
Reported by PMD.
Line: 27
// 测试获取application-admin.yml配置信息
// System.out.println(environment.getProperty(""));
// 测试获取application.yml配置信息
System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
}
}
Reported by PMD.
Line: 16
@SpringBootTest
public class AdminConfigTest {
@Autowired
private Environment environment;
@Test
public void test() {
// 测试获取application-core.yml配置信息
System.out.println(environment.getProperty("litemall.express.appId"));
Reported by PMD.
Line: 19
private Environment environment;
@Test
public void test() {
// 测试获取application-core.yml配置信息
System.out.println(environment.getProperty("litemall.express.appId"));
// 测试获取application-db.yml配置信息
System.out.println(environment.getProperty("spring.datasource.druid.url"));
// 测试获取application-admin.yml配置信息
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminConfigController.java
5 issues
Line: 21
@RequestMapping("/admin/config")
@Validated
public class AdminConfigController {
private final Log logger = LogFactory.getLog(AdminConfigController.class);
@Autowired
private LitemallSystemConfigService systemConfigService;
@RequiresPermissions("admin:config:mall:list")
Reported by PMD.
Line: 21
@RequestMapping("/admin/config")
@Validated
public class AdminConfigController {
private final Log logger = LogFactory.getLog(AdminConfigController.class);
@Autowired
private LitemallSystemConfigService systemConfigService;
@RequiresPermissions("admin:config:mall:list")
Reported by PMD.
Line: 24
private final Log logger = LogFactory.getLog(AdminConfigController.class);
@Autowired
private LitemallSystemConfigService systemConfigService;
@RequiresPermissions("admin:config:mall:list")
@RequiresPermissionsDesc(menu = {"配置管理", "商场配置"}, button = "详情")
@GetMapping("/mall")
public Object listMall() {
Reported by PMD.
Line: 27
private LitemallSystemConfigService systemConfigService;
@RequiresPermissions("admin:config:mall:list")
@RequiresPermissionsDesc(menu = {"配置管理", "商场配置"}, button = "详情")
@GetMapping("/mall")
public Object listMall() {
Map<String, String> data = systemConfigService.listMail();
return ResponseUtil.ok(data);
}
Reported by PMD.
Line: 13
import org.linlinjava.litemall.db.service.LitemallSystemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/admin/config")
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminFootprintController.java
4 issues
Line: 25
@RequestMapping("/admin/footprint")
@Validated
public class AdminFootprintController {
private final Log logger = LogFactory.getLog(AdminFootprintController.class);
@Autowired
private LitemallFootprintService footprintService;
@RequiresPermissions("admin:footprint:list")
Reported by PMD.
Line: 25
@RequestMapping("/admin/footprint")
@Validated
public class AdminFootprintController {
private final Log logger = LogFactory.getLog(AdminFootprintController.class);
@Autowired
private LitemallFootprintService footprintService;
@RequiresPermissions("admin:footprint:list")
Reported by PMD.
Line: 28
private final Log logger = LogFactory.getLog(AdminFootprintController.class);
@Autowired
private LitemallFootprintService footprintService;
@RequiresPermissions("admin:footprint:list")
@RequiresPermissionsDesc(menu = {"用户管理", "用户足迹"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String goodsId,
Reported by PMD.
Line: 33
@RequiresPermissions("admin:footprint:list")
@RequiresPermissionsDesc(menu = {"用户管理", "用户足迹"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String goodsId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallFootprint> footprintList = footprintService.querySelective(userId, goodsId, page, limit, sort,
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminCollectController.java
4 issues
Line: 25
@RequestMapping("/admin/collect")
@Validated
public class AdminCollectController {
private final Log logger = LogFactory.getLog(AdminCollectController.class);
@Autowired
private LitemallCollectService collectService;
Reported by PMD.
Line: 25
@RequestMapping("/admin/collect")
@Validated
public class AdminCollectController {
private final Log logger = LogFactory.getLog(AdminCollectController.class);
@Autowired
private LitemallCollectService collectService;
Reported by PMD.
Line: 28
private final Log logger = LogFactory.getLog(AdminCollectController.class);
@Autowired
private LitemallCollectService collectService;
@RequiresPermissions("admin:collect:list")
@RequiresPermissionsDesc(menu = {"用户管理", "用户收藏"}, button = "查询")
@GetMapping("/list")
Reported by PMD.
Line: 34
@RequiresPermissions("admin:collect:list")
@RequiresPermissionsDesc(menu = {"用户管理", "用户收藏"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String valueId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallCollect> collectList = collectService.querySelective(userId, valueId, page, limit, sort, order);
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsAttributeService.java
4 issues
Line: 15
@Service
public class LitemallGoodsAttributeService {
@Resource
private LitemallGoodsAttributeMapper goodsAttributeMapper;
public List<LitemallGoodsAttribute> queryByGid(Integer goodsId) {
LitemallGoodsAttributeExample example = new LitemallGoodsAttributeExample();
example.or().andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
return goodsAttributeMapper.selectByExample(example);
Reported by PMD.
Line: 19
public List<LitemallGoodsAttribute> queryByGid(Integer goodsId) {
LitemallGoodsAttributeExample example = new LitemallGoodsAttributeExample();
example.or().andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
return goodsAttributeMapper.selectByExample(example);
}
public void add(LitemallGoodsAttribute goodsAttribute) {
goodsAttribute.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 19
public List<LitemallGoodsAttribute> queryByGid(Integer goodsId) {
LitemallGoodsAttributeExample example = new LitemallGoodsAttributeExample();
example.or().andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
return goodsAttributeMapper.selectByExample(example);
}
public void add(LitemallGoodsAttribute goodsAttribute) {
goodsAttribute.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 35
public void deleteByGid(Integer gid) {
LitemallGoodsAttributeExample example = new LitemallGoodsAttributeExample();
example.or().andGoodsIdEqualTo(gid);
goodsAttributeMapper.logicalDeleteByExample(example);
}
public void deleteById(Integer id) {
goodsAttributeMapper.logicalDeleteByPrimaryKey(id);
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/config/ValidatorConfiguration.java
4 issues
Line: 15
public class ValidatorConfiguration {
@Bean
public Validator validator() {
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
.configure()
.addProperty("hibernate.validator.fail_fast", "true")
.buildValidatorFactory();
Validator validator = validatorFactory.getValidator();
Reported by PMD.
Line: 15
public class ValidatorConfiguration {
@Bean
public Validator validator() {
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
.configure()
.addProperty("hibernate.validator.fail_fast", "true")
.buildValidatorFactory();
Validator validator = validatorFactory.getValidator();
Reported by PMD.
Line: 15
public class ValidatorConfiguration {
@Bean
public Validator validator() {
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
.configure()
.addProperty("hibernate.validator.fail_fast", "true")
.buildValidatorFactory();
Validator validator = validatorFactory.getValidator();
Reported by PMD.
Line: 19
.configure()
.addProperty("hibernate.validator.fail_fast", "true")
.buildValidatorFactory();
Validator validator = validatorFactory.getValidator();
return validator;
}
}
Reported by PMD.