The following issues were found
litemall-core/src/main/java/org/linlinjava/litemall/core/util/RegexUtil.java
7 issues
Line: 15
* https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/constant
* /RegexConstants.java
*/
public class RegexUtil {
/**
* Regex of simple mobile.
*/
public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
Reported by PMD.
Line: 268
return Collections.emptyList();
List<String> matches = new ArrayList<>();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
matches.add(matcher.group());
}
return matches;
}
Reported by PMD.
Line: 269
List<String> matches = new ArrayList<>();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
matches.add(matcher.group());
}
return matches;
}
Reported by PMD.
Line: 304
final String replacement) {
if (input == null)
return "";
return Pattern.compile(regex).matcher(input).replaceFirst(replacement);
}
/**
* Replace every subsequence of the input sequence that matches the
* pattern with the given replacement string.
Reported by PMD.
Line: 304
final String replacement) {
if (input == null)
return "";
return Pattern.compile(regex).matcher(input).replaceFirst(replacement);
}
/**
* Replace every subsequence of the input sequence that matches the
* pattern with the given replacement string.
Reported by PMD.
Line: 323
final String replacement) {
if (input == null)
return "";
return Pattern.compile(regex).matcher(input).replaceAll(replacement);
}
}
Reported by PMD.
Line: 323
final String replacement) {
if (input == null)
return "";
return Pattern.compile(regex).matcher(input).replaceAll(replacement);
}
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/util/bcrypt/BCryptPasswordEncoder.java
7 issues
Line: 33
* @author Dave Syer
*/
public class BCryptPasswordEncoder {
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
Reported by PMD.
Line: 33
* @author Dave Syer
*/
public class BCryptPasswordEncoder {
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
Reported by PMD.
Line: 34
*/
public class BCryptPasswordEncoder {
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
public BCryptPasswordEncoder() {
Reported by PMD.
Line: 35
public class BCryptPasswordEncoder {
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
public BCryptPasswordEncoder() {
this(-1);
Reported by PMD.
Line: 36
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
public BCryptPasswordEncoder() {
this(-1);
}
Reported by PMD.
Line: 36
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
private Pattern BCRYPT_PATTERN = Pattern
.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
public BCryptPasswordEncoder() {
this(-1);
}
Reported by PMD.
Line: 82
return false;
}
if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) {
logger.warn("Encoded password does not look like BCrypt");
return false;
}
return BCrypt.checkpw(rawPassword.toString(), encodedPassword);
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/ExpressTest.java
7 issues
Line: 20
@SpringBootTest(classes = Application.class)
public class ExpressTest {
private final Log logger = LogFactory.getLog(ExpressTest.class);
@Autowired
private ExpressService expressService;
@Test
public void test() {
Reported by PMD.
Line: 20
@SpringBootTest(classes = Application.class)
public class ExpressTest {
private final Log logger = LogFactory.getLog(ExpressTest.class);
@Autowired
private ExpressService expressService;
@Test
public void test() {
Reported by PMD.
Line: 22
private final Log logger = LogFactory.getLog(ExpressTest.class);
@Autowired
private ExpressService expressService;
@Test
public void test() {
ExpressInfo ei = null;
try {
Reported by PMD.
Line: 25
private ExpressService expressService;
@Test
public void test() {
ExpressInfo ei = null;
try {
ei = expressService.getExpressInfo("YTO", "800669400640887922");
} catch (Exception e) {
logger.error(e.getMessage(), e);
Reported by PMD.
Line: 29
ExpressInfo ei = null;
try {
ei = expressService.getExpressInfo("YTO", "800669400640887922");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
logger.info(ei);
}
}
Reported by PMD.
Line: 11
import org.linlinjava.litemall.core.express.dao.ExpressInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
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.
Line: 26
@Test
public void test() {
ExpressInfo ei = null;
try {
ei = expressService.getExpressInfo("YTO", "800669400640887922");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/mybatis/JsonNodeTypeHandler.java
7 issues
Line: 24
@Override
public void setNonNullParameter(PreparedStatement ps, int i, JsonNode parameter, JdbcType jdbcType) throws SQLException {
String str = null;
try {
str = mapper.writeValueAsString(parameter);
} catch (JsonProcessingException e) {
e.printStackTrace();
str = "{}";
Reported by PMD.
Line: 28
try {
str = mapper.writeValueAsString(parameter);
} catch (JsonProcessingException e) {
e.printStackTrace();
str = "{}";
}
ps.setString(i, str);
}
Reported by PMD.
Line: 44
JsonNode jsonNode = mapper.readTree(jsonSource);
return jsonNode;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
Reported by PMD.
Line: 59
JsonNode jsonNode = mapper.readTree(jsonSource);
return jsonNode;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
Reported by PMD.
Line: 75
JsonNode jsonNode = mapper.readTree(jsonSource);
return jsonNode;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
Reported by PMD.
Line: 24
@Override
public void setNonNullParameter(PreparedStatement ps, int i, JsonNode parameter, JdbcType jdbcType) throws SQLException {
String str = null;
try {
str = mapper.writeValueAsString(parameter);
} catch (JsonProcessingException e) {
e.printStackTrace();
str = "{}";
Reported by PMD.
Line: 26
public void setNonNullParameter(PreparedStatement ps, int i, JsonNode parameter, JdbcType jdbcType) throws SQLException {
String str = null;
try {
str = mapper.writeValueAsString(parameter);
} catch (JsonProcessingException e) {
e.printStackTrace();
str = "{}";
}
ps.setString(i, str);
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallBrandService.java
7 issues
Line: 18
@Service
public class LitemallBrandService {
@Resource
private LitemallBrandMapper brandMapper;
private Column[] columns = new Column[]{Column.id, Column.name, Column.desc, Column.picUrl, Column.floorPrice};
public List<LitemallBrand> query(Integer page, Integer limit, String sort, String order) {
LitemallBrandExample example = new LitemallBrandExample();
example.or().andDeletedEqualTo(false);
Reported by PMD.
Line: 19
public class LitemallBrandService {
@Resource
private LitemallBrandMapper brandMapper;
private Column[] columns = new Column[]{Column.id, Column.name, Column.desc, Column.picUrl, Column.floorPrice};
public List<LitemallBrand> query(Integer page, Integer limit, String sort, String order) {
LitemallBrandExample example = new LitemallBrandExample();
example.or().andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
Reported by PMD.
Line: 19
public class LitemallBrandService {
@Resource
private LitemallBrandMapper brandMapper;
private Column[] columns = new Column[]{Column.id, Column.name, Column.desc, Column.picUrl, Column.floorPrice};
public List<LitemallBrand> query(Integer page, Integer limit, String sort, String order) {
LitemallBrandExample example = new LitemallBrandExample();
example.or().andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
Reported by PMD.
Line: 23
public List<LitemallBrand> query(Integer page, Integer limit, String sort, String order) {
LitemallBrandExample example = new LitemallBrandExample();
example.or().andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, limit);
return brandMapper.selectByExampleSelective(example, columns);
Reported by PMD.
Line: 39
return brandMapper.selectByPrimaryKey(id);
}
public List<LitemallBrand> querySelective(String id, String name, Integer page, Integer size, String sort, String order) {
LitemallBrandExample example = new LitemallBrandExample();
LitemallBrandExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(id)) {
criteria.andIdEqualTo(Integer.valueOf(id));
Reported by PMD.
Line: 49
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
Line: 76
public List<LitemallBrand> all() {
LitemallBrandExample example = new LitemallBrandExample();
example.or().andDeletedEqualTo(false);
return brandMapper.selectByExample(example);
}
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsProductService.java
7 issues
Line: 17
@Service
public class LitemallGoodsProductService {
@Resource
private LitemallGoodsProductMapper litemallGoodsProductMapper;
@Resource
private GoodsProductMapper goodsProductMapper;
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
Reported by PMD.
Line: 19
@Resource
private LitemallGoodsProductMapper litemallGoodsProductMapper;
@Resource
private GoodsProductMapper goodsProductMapper;
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
return litemallGoodsProductMapper.selectByExample(example);
Reported by PMD.
Line: 23
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
return litemallGoodsProductMapper.selectByExample(example);
}
public LitemallGoodsProduct findById(Integer id) {
return litemallGoodsProductMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 23
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
return litemallGoodsProductMapper.selectByExample(example);
}
public LitemallGoodsProduct findById(Integer id) {
return litemallGoodsProductMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 43
public int count() {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andDeletedEqualTo(false);
return (int) litemallGoodsProductMapper.countByExample(example);
}
public void deleteByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
Reported by PMD.
Line: 49
public void deleteByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid);
litemallGoodsProductMapper.logicalDeleteByExample(example);
}
public int addStock(Integer id, Short num){
return goodsProductMapper.addStock(id, num);
Reported by PMD.
Line: 3
package org.linlinjava.litemall.db.service;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.dao.GoodsProductMapper;
import org.linlinjava.litemall.db.dao.LitemallGoodsProductMapper;
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
import org.linlinjava.litemall.db.domain.LitemallGoodsProductExample;
import org.springframework.stereotype.Service;
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallNoticeService.java
7 issues
Line: 19
@Service
public class LitemallNoticeService {
@Resource
private LitemallNoticeMapper noticeMapper;
public List<LitemallNotice> querySelective(String title, String content, Integer page, Integer limit, String sort, String order) {
LitemallNoticeExample example = new LitemallNoticeExample();
LitemallNoticeExample.Criteria criteria = example.createCriteria();
Reported by PMD.
Line: 22
private LitemallNoticeMapper noticeMapper;
public List<LitemallNotice> querySelective(String title, String content, Integer page, Integer limit, String sort, String order) {
LitemallNoticeExample example = new LitemallNoticeExample();
LitemallNoticeExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(title)) {
criteria.andTitleLike("%" + title + "%");
Reported by PMD.
Line: 32
if (!StringUtils.isEmpty(content)) {
criteria.andContentLike("%" + content + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
Line: 63
public void deleteByIds(List<Integer> ids) {
LitemallNoticeExample example = new LitemallNoticeExample();
example.or().andIdIn(ids).andDeletedEqualTo(false);
LitemallNotice notice = new LitemallNotice();
notice.setUpdateTime(LocalDateTime.now());
notice.setDeleted(true);
noticeMapper.updateByExampleSelective(notice, example);
}
Reported by PMD.
Line: 63
public void deleteByIds(List<Integer> ids) {
LitemallNoticeExample example = new LitemallNoticeExample();
example.or().andIdIn(ids).andDeletedEqualTo(false);
LitemallNotice notice = new LitemallNotice();
notice.setUpdateTime(LocalDateTime.now());
notice.setDeleted(true);
noticeMapper.updateByExampleSelective(notice, example);
}
Reported by PMD.
Line: 6
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallNoticeMapper;
import org.linlinjava.litemall.db.domain.LitemallNotice;
import org.linlinjava.litemall.db.domain.LitemallNoticeAdmin;
import org.linlinjava.litemall.db.domain.LitemallNoticeAdminExample;
import org.linlinjava.litemall.db.domain.LitemallNoticeExample;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
Reported by PMD.
Line: 7
import org.linlinjava.litemall.db.dao.LitemallNoticeMapper;
import org.linlinjava.litemall.db.domain.LitemallNotice;
import org.linlinjava.litemall.db.domain.LitemallNoticeAdmin;
import org.linlinjava.litemall.db.domain.LitemallNoticeAdminExample;
import org.linlinjava.litemall.db.domain.LitemallNoticeExample;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxIssueController.java
7 issues
Line: 23
@RequestMapping("/wx/issue")
@Validated
public class WxIssueController {
private final Log logger = LogFactory.getLog(WxIssueController.class);
@Autowired
private LitemallIssueService issueService;
/**
Reported by PMD.
Line: 23
@RequestMapping("/wx/issue")
@Validated
public class WxIssueController {
private final Log logger = LogFactory.getLog(WxIssueController.class);
@Autowired
private LitemallIssueService issueService;
/**
Reported by PMD.
Line: 26
private final Log logger = LogFactory.getLog(WxIssueController.class);
@Autowired
private LitemallIssueService issueService;
/**
* 帮助中心
*/
@GetMapping("/list")
Reported by PMD.
Line: 3
package org.linlinjava.litemall.wx.web;
import com.github.pagehelper.PageInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.linlinjava.litemall.db.domain.LitemallIssue;
Reported by PMD.
Line: 13
import org.linlinjava.litemall.db.service.LitemallIssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Reported by PMD.
Line: 15
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/wx/issue")
Reported by PMD.
Line: 17
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/wx/issue")
@Validated
public class WxIssueController {
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/AsyncTask.java
6 issues
Line: 14
@Async
public void asyncMethod() {
logger.info("Execute method asynchronously. "
+ Thread.currentThread().getName());
}
public void nonasyncMethod() {
logger.info("Execute method nonasynchronously. "
Reported by PMD.
Line: 19
}
public void nonasyncMethod() {
logger.info("Execute method nonasynchronously. "
+ Thread.currentThread().getName());
}
}
Reported by PMD.
Line: 10
@Service
public class AsyncTask {
private final Log logger = LogFactory.getLog(AsyncTask.class);
@Async
public void asyncMethod() {
logger.info("Execute method asynchronously. "
+ Thread.currentThread().getName());
Reported by PMD.
Line: 10
@Service
public class AsyncTask {
private final Log logger = LogFactory.getLog(AsyncTask.class);
@Async
public void asyncMethod() {
logger.info("Execute method asynchronously. "
+ Thread.currentThread().getName());
Reported by PMD.
Line: 15
@Async
public void asyncMethod() {
logger.info("Execute method asynchronously. "
+ Thread.currentThread().getName());
}
public void nonasyncMethod() {
logger.info("Execute method nonasynchronously. "
+ Thread.currentThread().getName());
Reported by PMD.
Line: 20
public void nonasyncMethod() {
logger.info("Execute method nonasynchronously. "
+ Thread.currentThread().getName());
}
}
Reported by PMD.
litemall-db/sql/litemall_schema.sql
6 issues
Line: 2
Column: 21
drop database if exists litemall;
drop user if exists 'litemall'@'%';
-- 支持emoji:需要mysql数据库参数: character_set_server=utf8mb4
create database litemall default character set utf8mb4 collate utf8mb4_unicode_ci;
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.
Line: 4
Column: 26
drop database if exists litemall;
drop user if exists 'litemall'@'%';
-- 支持emoji:需要mysql数据库参数: character_set_server=utf8mb4
create database litemall default character set utf8mb4 collate utf8mb4_unicode_ci;
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.
Line: 5
Column: 1
drop user if exists 'litemall'@'%';
-- 支持emoji:需要mysql数据库参数: character_set_server=utf8mb4
create database litemall default character set utf8mb4 collate utf8mb4_unicode_ci;
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.
Line: 6
Column: 13
-- 支持emoji:需要mysql数据库参数: character_set_server=utf8mb4
create database litemall default character set utf8mb4 collate utf8mb4_unicode_ci;
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.
Line: 7
Column: 36
create database litemall default character set utf8mb4 collate utf8mb4_unicode_ci;
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.
Line: 8
Column: 1
use litemall;
create user 'litemall'@'%' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'%';
flush privileges;
Reported by SQLint.