The following issues were found
litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/PermissionTest.java
4 issues
Line: 22
public class PermissionTest {
@Autowired
private ApplicationContext context;
@Test
public void test() {
final String basicPackage = "org.linlinjava.litemall.admin";
List<Permission> permissionList = PermissionUtil.listPermission(context, basicPackage);
Reported by PMD.
Line: 25
private ApplicationContext context;
@Test
public void test() {
final String basicPackage = "org.linlinjava.litemall.admin";
List<Permission> permissionList = PermissionUtil.listPermission(context, basicPackage);
List<PermVo> permVoList = PermissionUtil.listPermVo(permissionList);
permVoList.stream().forEach(System.out::println);
}
Reported by PMD.
Line: 29
final String basicPackage = "org.linlinjava.litemall.admin";
List<Permission> permissionList = PermissionUtil.listPermission(context, basicPackage);
List<PermVo> permVoList = PermissionUtil.listPermVo(permissionList);
permVoList.stream().forEach(System.out::println);
}
}
Reported by PMD.
Line: 29
final String basicPackage = "org.linlinjava.litemall.admin";
List<Permission> permissionList = PermissionUtil.listPermission(context, basicPackage);
List<PermVo> permVoList = PermissionUtil.listPermVo(permissionList);
permVoList.stream().forEach(System.out::println);
}
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallRegionService.java
4 issues
Line: 17
public class LitemallRegionService {
@Resource
private LitemallRegionMapper regionMapper;
public List<LitemallRegion> getAll(){
LitemallRegionExample example = new LitemallRegionExample();
byte b = 4;
example.or().andTypeNotEqualTo(b);
Reported by PMD.
Line: 22
public List<LitemallRegion> getAll(){
LitemallRegionExample example = new LitemallRegionExample();
byte b = 4;
example.or().andTypeNotEqualTo(b);
return regionMapper.selectByExample(example);
}
public List<LitemallRegion> queryByPid(Integer parentId) {
LitemallRegionExample example = new LitemallRegionExample();
Reported by PMD.
Line: 28
public List<LitemallRegion> queryByPid(Integer parentId) {
LitemallRegionExample example = new LitemallRegionExample();
example.or().andPidEqualTo(parentId);
return regionMapper.selectByExample(example);
}
public LitemallRegion findById(Integer id) {
return regionMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 38
public List<LitemallRegion> querySelective(String name, Integer code, Integer page, Integer size, String sort, String order) {
LitemallRegionExample example = new LitemallRegionExample();
LitemallRegionExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
if (!StringUtils.isEmpty(code)) {
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminUserController.java
4 issues
Line: 29
@RequestMapping("/admin/user")
@Validated
public class AdminUserController {
private final Log logger = LogFactory.getLog(AdminUserController.class);
@Autowired
private LitemallUserService userService;
@RequiresPermissions("admin:user:list")
Reported by PMD.
Line: 29
@RequestMapping("/admin/user")
@Validated
public class AdminUserController {
private final Log logger = LogFactory.getLog(AdminUserController.class);
@Autowired
private LitemallUserService userService;
@RequiresPermissions("admin:user:list")
Reported by PMD.
Line: 32
private final Log logger = LogFactory.getLog(AdminUserController.class);
@Autowired
private LitemallUserService userService;
@RequiresPermissions("admin:user:list")
@RequiresPermissionsDesc(menu = {"用户管理", "会员管理"}, button = "查询")
@GetMapping("/list")
public Object list(String username, String mobile,
Reported by PMD.
Line: 37
@RequiresPermissions("admin:user:list")
@RequiresPermissionsDesc(menu = {"用户管理", "会员管理"}, button = "查询")
@GetMapping("/list")
public Object list(String username, String mobile,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallUser> userList = userService.querySelective(username, mobile, page, limit, sort, order);
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminIndexController.java
4 issues
Line: 16
@RestController
@RequestMapping("/admin/index")
public class AdminIndexController {
private final Log logger = LogFactory.getLog(AdminIndexController.class);
@RequestMapping("/index")
public Object index() {
return ResponseUtil.ok("hello world, this is admin service");
}
Reported by PMD.
Line: 16
@RestController
@RequestMapping("/admin/index")
public class AdminIndexController {
private final Log logger = LogFactory.getLog(AdminIndexController.class);
@RequestMapping("/index")
public Object index() {
return ResponseUtil.ok("hello world, this is admin service");
}
Reported by PMD.
Line: 20
@RequestMapping("/index")
public Object index() {
return ResponseUtil.ok("hello world, this is admin service");
}
@RequiresGuest
@RequestMapping("/guest")
public Object guest() {
Reported by PMD.
Line: 5
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.*;
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminHistoryController.java
4 issues
Line: 23
@RestController
@RequestMapping("/admin/history")
public class AdminHistoryController {
private final Log logger = LogFactory.getLog(AdminHistoryController.class);
@Autowired
private LitemallSearchHistoryService searchHistoryService;
@RequiresPermissions("admin:history:list")
Reported by PMD.
Line: 23
@RestController
@RequestMapping("/admin/history")
public class AdminHistoryController {
private final Log logger = LogFactory.getLog(AdminHistoryController.class);
@Autowired
private LitemallSearchHistoryService searchHistoryService;
@RequiresPermissions("admin:history:list")
Reported by PMD.
Line: 26
private final Log logger = LogFactory.getLog(AdminHistoryController.class);
@Autowired
private LitemallSearchHistoryService searchHistoryService;
@RequiresPermissions("admin:history:list")
@RequiresPermissionsDesc(menu = {"用户管理", "搜索历史"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String keyword,
Reported by PMD.
Line: 31
@RequiresPermissions("admin:history:list")
@RequiresPermissionsDesc(menu = {"用户管理", "搜索历史"}, button = "查询")
@GetMapping("/list")
public Object list(String userId, String keyword,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallSearchHistory> historyList = searchHistoryService.querySelective(userId, keyword, page, limit,
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/HomeCacheManager.java
4 issues
Line: 11
/**
* 简单缓存的数据
*/
public class HomeCacheManager {
public static final boolean ENABLE = false;
public static final String INDEX = "index";
public static final String CATALOG = "catalog";
public static final String GOODS = "goods";
Reported by PMD.
Line: 36
cacheData.putAll(data);
cacheData.put("isCache", "true");
//设置缓存有效期为10分钟
cacheData.put("expireTime", LocalDateTime.now().plusMinutes(10));
cacheDataList.put(cacheKey, cacheData);
}
public static Map<String, Object> getCacheData(String cacheKey) {
return cacheDataList.get(cacheKey);
Reported by PMD.
Line: 58
return false;
} else {
LocalDateTime expire = (LocalDateTime) cacheData.get("expireTime");
if (expire.isBefore(LocalDateTime.now())) {
return false;
} else {
return true;
}
}
Reported by PMD.
Line: 58
return false;
} else {
LocalDateTime expire = (LocalDateTime) cacheData.get("expireTime");
if (expire.isBefore(LocalDateTime.now())) {
return false;
} else {
return true;
}
}
Reported by PMD.
litemall-db/src/test/java/org/linlinjava/litemall/db/DbConfigTest.java
4 issues
Line: 21
@Test
public void test() {
System.out.println(environment.getProperty("spring.datasource.druid.url"));
}
}
Reported by PMD.
Line: 17
@SpringBootTest
public class DbConfigTest {
@Autowired
Environment environment;
@Test
public void test() {
System.out.println(environment.getProperty("spring.datasource.druid.url"));
}
Reported by PMD.
Line: 20
Environment environment;
@Test
public void test() {
System.out.println(environment.getProperty("spring.datasource.druid.url"));
}
}
Reported by PMD.
Line: 8
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-core/src/main/java/org/linlinjava/litemall/core/validator/SortValidator.java
4 issues
Line: 10
import java.util.List;
public class SortValidator implements ConstraintValidator<Sort, String> {
private List<String> valueList;
@Override
public void initialize(Sort sort) {
valueList = Lists.newArrayList();
for (String val : sort.accepts()) {
Reported by PMD.
Line: 16
public void initialize(Sort sort) {
valueList = Lists.newArrayList();
for (String val : sort.accepts()) {
valueList.add(val.toUpperCase());
}
}
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
Reported by PMD.
Line: 22
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
if (!valueList.contains(s.toUpperCase())) {
return false;
}
return true;
}
}
Reported by PMD.
Line: 22
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
if (!valueList.contains(s.toUpperCase())) {
return false;
}
return true;
}
}
Reported by PMD.
litemall-db/src/test/java/org/linlinjava/litemall/db/DbUtilTest.java
4 issues
Line: 10
public class DbUtilTest {
@Test
public void testBackup() {
File file = new File("test.sql");
DbUtil.backup(file, "litemall", "litemall123456", "litemall");
}
// 这个测试用例会重置litemall数据库,所以比较危险,请开发者注意
Reported by PMD.
Line: 12
@Test
public void testBackup() {
File file = new File("test.sql");
DbUtil.backup(file, "litemall", "litemall123456", "litemall");
}
// 这个测试用例会重置litemall数据库,所以比较危险,请开发者注意
// @Test
public void testLoad() {
Reported by PMD.
Line: 17
// 这个测试用例会重置litemall数据库,所以比较危险,请开发者注意
// @Test
public void testLoad() {
File file = new File("test.sql");
DbUtil.load(file, "litemall", "litemall123456", "litemall");
}
}
Reported by PMD.
Line: 17
// 这个测试用例会重置litemall数据库,所以比较危险,请开发者注意
// @Test
public void testLoad() {
File file = new File("test.sql");
DbUtil.load(file, "litemall", "litemall123456", "litemall");
}
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/validator/OrderValidator.java
4 issues
Line: 10
import java.util.List;
public class OrderValidator implements ConstraintValidator<Order, String> {
private List<String> valueList;
@Override
public void initialize(Order order) {
valueList = Lists.newArrayList();
for (String val : order.accepts()) {
Reported by PMD.
Line: 16
public void initialize(Order order) {
valueList = Lists.newArrayList();
for (String val : order.accepts()) {
valueList.add(val.toUpperCase());
}
}
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
Reported by PMD.
Line: 22
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
if (!valueList.contains(s.toUpperCase())) {
return false;
}
return true;
}
}
Reported by PMD.
Line: 22
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
if (!valueList.contains(s.toUpperCase())) {
return false;
}
return true;
}
}
Reported by PMD.