The following issues were found
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxHomeController.java
18 issues
Line: 33
@RequestMapping("/wx/home")
@Validated
public class WxHomeController {
private final Log logger = LogFactory.getLog(WxHomeController.class);
@Autowired
private LitemallAdService adService;
@Autowired
Reported by PMD.
Line: 33
@RequestMapping("/wx/home")
@Validated
public class WxHomeController {
private final Log logger = LogFactory.getLog(WxHomeController.class);
@Autowired
private LitemallAdService adService;
@Autowired
Reported by PMD.
Line: 36
private final Log logger = LogFactory.getLog(WxHomeController.class);
@Autowired
private LitemallAdService adService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
Reported by PMD.
Line: 39
private LitemallAdService adService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallBrandService brandService;
@Autowired
Reported by PMD.
Line: 42
private LitemallGoodsService goodsService;
@Autowired
private LitemallBrandService brandService;
@Autowired
private LitemallTopicService topicService;
@Autowired
Reported by PMD.
Line: 45
private LitemallBrandService brandService;
@Autowired
private LitemallTopicService topicService;
@Autowired
private LitemallCategoryService categoryService;
@Autowired
Reported by PMD.
Line: 48
private LitemallTopicService topicService;
@Autowired
private LitemallCategoryService categoryService;
@Autowired
private WxGrouponRuleService grouponService;
@Autowired
Reported by PMD.
Line: 51
private LitemallCategoryService categoryService;
@Autowired
private WxGrouponRuleService grouponService;
@Autowired
private LitemallCouponService couponService;
private final static ArrayBlockingQueue<Runnable> WORK_QUEUE = new ArrayBlockingQueue<>(9);
Reported by PMD.
Line: 54
private WxGrouponRuleService grouponService;
@Autowired
private LitemallCouponService couponService;
private final static ArrayBlockingQueue<Runnable> WORK_QUEUE = new ArrayBlockingQueue<>(9);
private final static RejectedExecutionHandler HANDLER = new ThreadPoolExecutor.CallerRunsPolicy();
Reported by PMD.
Line: 64
@GetMapping("/cache")
public Object cache(@NotNull String key) {
if (!key.equals("litemall_cache")) {
return ResponseUtil.fail();
}
// 清除缓存
HomeCacheManager.clearAll();
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/WxGrouponRuleService.java
18 issues
Line: 19
@Service
public class WxGrouponRuleService {
private final Log logger = LogFactory.getLog(WxGrouponRuleService.class);
@Autowired
private LitemallGrouponRulesService grouponRulesService;
@Autowired
private LitemallGrouponService grouponService;
Reported by PMD.
Line: 19
@Service
public class WxGrouponRuleService {
private final Log logger = LogFactory.getLog(WxGrouponRuleService.class);
@Autowired
private LitemallGrouponRulesService grouponRulesService;
@Autowired
private LitemallGrouponService grouponService;
Reported by PMD.
Line: 22
private final Log logger = LogFactory.getLog(WxGrouponRuleService.class);
@Autowired
private LitemallGrouponRulesService grouponRulesService;
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 24
@Autowired
private LitemallGrouponRulesService grouponRulesService;
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private LitemallGoodsService goodsService;
public List<GrouponRuleVo> queryList(Integer page, Integer size) {
Reported by PMD.
Line: 26
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private LitemallGoodsService goodsService;
public List<GrouponRuleVo> queryList(Integer page, Integer size) {
return queryList(page, size, "add_time", "desc");
}
Reported by PMD.
Line: 38
Page<LitemallGrouponRules> grouponRulesList = (Page<LitemallGrouponRules>)grouponRulesService.queryList(page, size, sort, order);
Page<GrouponRuleVo> grouponList = new Page<GrouponRuleVo>();
grouponList.setPages(grouponRulesList.getPages());
grouponList.setPageNum(grouponRulesList.getPageNum());
grouponList.setPageSize(grouponRulesList.getPageSize());
grouponList.setTotal(grouponRulesList.getTotal());
for (LitemallGrouponRules rule : grouponRulesList) {
Reported by PMD.
Line: 39
Page<GrouponRuleVo> grouponList = new Page<GrouponRuleVo>();
grouponList.setPages(grouponRulesList.getPages());
grouponList.setPageNum(grouponRulesList.getPageNum());
grouponList.setPageSize(grouponRulesList.getPageSize());
grouponList.setTotal(grouponRulesList.getTotal());
for (LitemallGrouponRules rule : grouponRulesList) {
Integer goodsId = rule.getGoodsId();
Reported by PMD.
Line: 40
Page<GrouponRuleVo> grouponList = new Page<GrouponRuleVo>();
grouponList.setPages(grouponRulesList.getPages());
grouponList.setPageNum(grouponRulesList.getPageNum());
grouponList.setPageSize(grouponRulesList.getPageSize());
grouponList.setTotal(grouponRulesList.getTotal());
for (LitemallGrouponRules rule : grouponRulesList) {
Integer goodsId = rule.getGoodsId();
LitemallGoods goods = goodsService.findById(goodsId);
Reported by PMD.
Line: 41
grouponList.setPages(grouponRulesList.getPages());
grouponList.setPageNum(grouponRulesList.getPageNum());
grouponList.setPageSize(grouponRulesList.getPageSize());
grouponList.setTotal(grouponRulesList.getTotal());
for (LitemallGrouponRules rule : grouponRulesList) {
Integer goodsId = rule.getGoodsId();
LitemallGoods goods = goodsService.findById(goodsId);
if (goods == null)
Reported by PMD.
Line: 49
if (goods == null)
continue;
GrouponRuleVo grouponRuleVo = new GrouponRuleVo();
grouponRuleVo.setId(goods.getId());
grouponRuleVo.setName(goods.getName());
grouponRuleVo.setBrief(goods.getBrief());
grouponRuleVo.setPicUrl(goods.getPicUrl());
grouponRuleVo.setCounterPrice(goods.getCounterPrice());
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/notify/AliyunSmsSender.java
18 issues
Line: 118
smsResult.setSuccessful(true);
}else {
smsResult.setSuccessful(false);
logger.error("短信发送失败:"+response.getData());
}
return smsResult;
} catch (ServerException e) {
e.printStackTrace();
Reported by PMD.
Line: 22
/*
* 阿里云短信服务
*/
public class AliyunSmsSender implements SmsSender {
private final Log logger = LogFactory.getLog(AliyunSmsSender.class);
private String regionId;
private String accessKeyId;
private String accessKeySecret;
Reported by PMD.
Line: 23
* 阿里云短信服务
*/
public class AliyunSmsSender implements SmsSender {
private final Log logger = LogFactory.getLog(AliyunSmsSender.class);
private String regionId;
private String accessKeyId;
private String accessKeySecret;
private String sign;
Reported by PMD.
Line: 23
* 阿里云短信服务
*/
public class AliyunSmsSender implements SmsSender {
private final Log logger = LogFactory.getLog(AliyunSmsSender.class);
private String regionId;
private String accessKeyId;
private String accessKeySecret;
private String sign;
Reported by PMD.
Line: 30
private String accessKeySecret;
private String sign;
private final String okCode = "OK";
public String getRegionId() {
return regionId;
}
Reported by PMD.
Line: 30
private String accessKeySecret;
private String sign;
private final String okCode = "OK";
public String getRegionId() {
return regionId;
}
Reported by PMD.
Line: 94
如果开发者在阿里云短信申请的模板参数是其他命名,请开发者自行调整这里的代码,或者直接写死。
*/
String templateParam = "{}";
if(params.length == 1){
Map<String, String> data = new HashMap<>();
data.put("code", params[0]);
templateParam = JacksonUtil.toJson(data);
}
else if(params.length > 1){
Reported by PMD.
Line: 99
data.put("code", params[0]);
templateParam = JacksonUtil.toJson(data);
}
else if(params.length > 1){
Map<String, String> data = new HashMap<>();
data.put("code", params[0]);
for(int i = 1; i < params.length; i++){
data.put("code" + i, params[i]);
}
Reported by PMD.
Line: 113
CommonResponse response = client.getCommonResponse(request);
SmsResult smsResult = new SmsResult();
smsResult.setResult(response);
String code = Jackson.jsonNodeOf(response.getData()).get("Code").asText();
if (response.getHttpResponse().isSuccess() && okCode.equals(code) ){
smsResult.setSuccessful(true);
}else {
smsResult.setSuccessful(false);
logger.error("短信发送失败:"+response.getData());
Reported by PMD.
Line: 113
CommonResponse response = client.getCommonResponse(request);
SmsResult smsResult = new SmsResult();
smsResult.setResult(response);
String code = Jackson.jsonNodeOf(response.getData()).get("Code").asText();
if (response.getHttpResponse().isSuccess() && okCode.equals(code) ){
smsResult.setSuccessful(true);
}else {
smsResult.setSuccessful(false);
logger.error("短信发送失败:"+response.getData());
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/express/ExpressService.java
18 issues
Line: 134
* @param charset 编码方式
* @return DataSign签名
*/
private String encrypt(String content, String keyValue, String charset) {
if (keyValue != null) {
content = content + keyValue;
}
byte[] src;
try {
Reported by PMD.
Line: 24
*/
public class ExpressService {
private final Log logger = LogFactory.getLog(ExpressService.class);
//请求url
private String ReqURL = "http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
private ExpressProperties properties;
Reported by PMD.
Line: 24
*/
public class ExpressService {
private final Log logger = LogFactory.getLog(ExpressService.class);
//请求url
private String ReqURL = "http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
private ExpressProperties properties;
Reported by PMD.
Line: 26
private final Log logger = LogFactory.getLog(ExpressService.class);
//请求url
private String ReqURL = "http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
private ExpressProperties properties;
public ExpressProperties getProperties() {
return properties;
Reported by PMD.
Line: 26
private final Log logger = LogFactory.getLog(ExpressService.class);
//请求url
private String ReqURL = "http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
private ExpressProperties properties;
public ExpressProperties getProperties() {
return properties;
Reported by PMD.
Line: 46
*/
public String getVendorName(String vendorCode) {
for (Map<String, String> item : properties.getVendors()) {
if (item.get("code").equals(vendorCode))
return item.get("name");
}
return null;
}
Reported by PMD.
Line: 72
String result = getOrderTracesByJson(expCode, expNo);
ObjectMapper objMap = new ObjectMapper();
ExpressInfo ei = objMap.readValue(result, ExpressInfo.class);
ei.setShipperName(getVendorName(expCode));
return ei;
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
Reported by PMD.
Line: 74
ExpressInfo ei = objMap.readValue(result, ExpressInfo.class);
ei.setShipperName(getVendorName(expCode));
return ei;
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
Reported by PMD.
Line: 86
*
* @throws Exception
*/
private String getOrderTracesByJson(String expCode, String expNo) throws Exception {
String requestData = "{'OrderCode':'','ShipperCode':'" + expCode + "','LogisticCode':'" + expNo + "'}";
Map<String, String> params = new HashMap<String, String>();
params.put("RequestData", URLEncoder.encode(requestData, "UTF-8"));
params.put("EBusinessID", properties.getAppId());
Reported by PMD.
Line: 111
* @param charset 编码方式
* @throws Exception
*/
private String MD5(String str, String charset) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes(charset));
byte[] result = md.digest();
StringBuilder sb = new StringBuilder(32);
for (int i = 0; i < result.length; i++) {
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/util/bcrypt/BCryptTest.java
17 issues
Line: 15
import java.security.SecureRandom;
@RunWith(PowerMockRunner.class)
public class BCryptTest {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
Reported by PMD.
Line: 18
public class BCryptTest {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void testHashpwSaltIsNull() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", null);
Reported by PMD.
Line: 21
public final ExpectedException thrown = ExpectedException.none();
@Test
public void testHashpwSaltIsNull() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", null);
}
@Test
Reported by PMD.
Line: 23
@Test
public void testHashpwSaltIsNull() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", null);
}
@Test
public void testHashpwSaltTooShort() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
Reported by PMD.
Line: 27
}
@Test
public void testHashpwSaltTooShort() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "foo");
}
@Test
Reported by PMD.
Line: 33
}
@Test
public void testHashpwInvalidSaltVersion() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "+2a$10$.....................");
}
@Test
Reported by PMD.
Line: 39
}
@Test
public void testHashpwInvalidSaltVersion2() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "$1a$10$.....................");
}
@Test
Reported by PMD.
Line: 45
}
@Test
public void testHashpwInvalidSaltRevision() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "$2+$10$.....................");
}
@Test
Reported by PMD.
Line: 51
}
@Test
public void testHashpwInvalidSaltRevision2() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "$2a+10$.....................");
}
@Test
Reported by PMD.
Line: 57
}
@Test
public void testHashpwSaltTooShort2() throws IllegalArgumentException {
thrown.expect(IllegalArgumentException.class);
BCrypt.hashpw("foo", "$2a$10+.....................");
}
@Test
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCommentController.java
17 issues
Line: 31
@RestController
@RequestMapping("/wx/comment")
@Validated
public class WxCommentController {
private final Log logger = LogFactory.getLog(WxCommentController.class);
@Autowired
private LitemallCommentService commentService;
@Autowired
Reported by PMD.
Line: 31
@RestController
@RequestMapping("/wx/comment")
@Validated
public class WxCommentController {
private final Log logger = LogFactory.getLog(WxCommentController.class);
@Autowired
private LitemallCommentService commentService;
@Autowired
Reported by PMD.
Line: 32
@RequestMapping("/wx/comment")
@Validated
public class WxCommentController {
private final Log logger = LogFactory.getLog(WxCommentController.class);
@Autowired
private LitemallCommentService commentService;
@Autowired
private LitemallUserService userService;
Reported by PMD.
Line: 32
@RequestMapping("/wx/comment")
@Validated
public class WxCommentController {
private final Log logger = LogFactory.getLog(WxCommentController.class);
@Autowired
private LitemallCommentService commentService;
@Autowired
private LitemallUserService userService;
Reported by PMD.
Line: 35
private final Log logger = LogFactory.getLog(WxCommentController.class);
@Autowired
private LitemallCommentService commentService;
@Autowired
private LitemallUserService userService;
@Autowired
private UserInfoService userInfoService;
@Autowired
Reported by PMD.
Line: 37
@Autowired
private LitemallCommentService commentService;
@Autowired
private LitemallUserService userService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
Reported by PMD.
Line: 39
@Autowired
private LitemallUserService userService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallTopicService topicService;
Reported by PMD.
Line: 41
@Autowired
private UserInfoService userInfoService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallTopicService topicService;
private Object validate(LitemallComment comment) {
String content = comment.getContent();
Reported by PMD.
Line: 43
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallTopicService topicService;
private Object validate(LitemallComment comment) {
String content = comment.getContent();
if (StringUtils.isEmpty(content)) {
return ResponseUtil.badArgument();
Reported by PMD.
Line: 45
@Autowired
private LitemallTopicService topicService;
private Object validate(LitemallComment comment) {
String content = comment.getContent();
if (StringUtils.isEmpty(content)) {
return ResponseUtil.badArgument();
}
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/JwtHelper.java
17 issues
Line: 75
return 0;
}
public Date getAfterDate(Date date, int year, int month, int day, int hour, int minute, int second){
if(date == null){
date = new Date();
}
Calendar cal = new GregorianCalendar();
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 37
Date expireDate = getAfterDate(nowDate,0,0,0,2,0,0);
map.put("alg", "HS256");
map.put("typ", "JWT");
String token = JWT.create()
// 设置头部信息 Header
.withHeader(map)
// 设置 载荷 Payload
.withClaim("userId", userId)
.withIssuer(ISSUSER)
Reported by PMD.
Line: 53
.sign(algorithm);
return token;
} catch (JWTCreationException exception){
exception.printStackTrace();
}
return null;
}
public Integer verifyTokenAndGetUserId(String token) {
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallUserService.java
17 issues
Line: 16
import java.util.List;
@Service
public class LitemallUserService {
@Resource
private LitemallUserMapper userMapper;
public LitemallUser findById(Integer userId) {
return userMapper.selectByPrimaryKey(userId);
Reported by PMD.
Line: 18
@Service
public class LitemallUserService {
@Resource
private LitemallUserMapper userMapper;
public LitemallUser findById(Integer userId) {
return userMapper.selectByPrimaryKey(userId);
}
Reported by PMD.
Line: 27
public UserVo findUserVoById(Integer userId) {
LitemallUser user = findById(userId);
UserVo userVo = new UserVo();
userVo.setNickname(user.getNickname());
userVo.setAvatar(user.getAvatar());
return userVo;
}
public LitemallUser queryByOid(String openId) {
Reported by PMD.
Line: 28
LitemallUser user = findById(userId);
UserVo userVo = new UserVo();
userVo.setNickname(user.getNickname());
userVo.setAvatar(user.getAvatar());
return userVo;
}
public LitemallUser queryByOid(String openId) {
LitemallUserExample example = new LitemallUserExample();
Reported by PMD.
Line: 34
public LitemallUser queryByOid(String openId) {
LitemallUserExample example = new LitemallUserExample();
example.or().andWeixinOpenidEqualTo(openId).andDeletedEqualTo(false);
return userMapper.selectOneByExample(example);
}
public void add(LitemallUser user) {
user.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 34
public LitemallUser queryByOid(String openId) {
LitemallUserExample example = new LitemallUserExample();
example.or().andWeixinOpenidEqualTo(openId).andDeletedEqualTo(false);
return userMapper.selectOneByExample(example);
}
public void add(LitemallUser user) {
user.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 49
return userMapper.updateByPrimaryKeySelective(user);
}
public List<LitemallUser> querySelective(String username, String mobile, Integer page, Integer size, String sort, String order) {
LitemallUserExample example = new LitemallUserExample();
LitemallUserExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(username)) {
criteria.andUsernameLike("%" + username + "%");
Reported by PMD.
Line: 59
if (!StringUtils.isEmpty(mobile)) {
criteria.andMobileEqualTo(mobile);
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
Line: 71
public int count() {
LitemallUserExample example = new LitemallUserExample();
example.or().andDeletedEqualTo(false);
return (int) userMapper.countByExample(example);
}
public List<LitemallUser> queryByUsername(String username) {
Reported by PMD.
Line: 78
public List<LitemallUser> queryByUsername(String username) {
LitemallUserExample example = new LitemallUserExample();
example.or().andUsernameEqualTo(username).andDeletedEqualTo(false);
return userMapper.selectByExample(example);
}
public boolean checkByUsername(String username) {
LitemallUserExample example = new LitemallUserExample();
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/TencentStorageTest.java
16 issues
Line: 32
public void test() throws IOException {
String test = getClass().getClassLoader().getResource("litemall.png").getFile();
File testFile = new File(test);
tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png");
logger.info("test file " + test);
logger.info("store file " + resource.getURI());
logger.info("generate url " + url);
Reported by PMD.
Line: 35
tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png");
logger.info("test file " + test);
logger.info("store file " + resource.getURI());
logger.info("generate url " + url);
}
}
Reported by PMD.
Line: 36
Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png");
logger.info("test file " + test);
logger.info("store file " + resource.getURI());
logger.info("generate url " + url);
}
}
Reported by PMD.
Line: 37
String url = tencentStorage.generateUrl("litemall.png");
logger.info("test file " + test);
logger.info("store file " + resource.getURI());
logger.info("generate url " + url);
}
}
Reported by PMD.
Line: 24
@SpringBootTest
public class TencentStorageTest {
private Log logger = LogFactory.getLog(TencentStorageTest.class);
@Autowired
private TencentStorage tencentStorage;
@Test
public void test() throws IOException {
Reported by PMD.
Line: 24
@SpringBootTest
public class TencentStorageTest {
private Log logger = LogFactory.getLog(TencentStorageTest.class);
@Autowired
private TencentStorage tencentStorage;
@Test
public void test() throws IOException {
Reported by PMD.
Line: 24
@SpringBootTest
public class TencentStorageTest {
private Log logger = LogFactory.getLog(TencentStorageTest.class);
@Autowired
private TencentStorage tencentStorage;
@Test
public void test() throws IOException {
Reported by PMD.
Line: 26
private Log logger = LogFactory.getLog(TencentStorageTest.class);
@Autowired
private TencentStorage tencentStorage;
@Test
public void test() throws IOException {
String test = getClass().getClassLoader().getResource("litemall.png").getFile();
File testFile = new File(test);
Reported by PMD.
Line: 29
private TencentStorage tencentStorage;
@Test
public void test() throws IOException {
String test = getClass().getClassLoader().getResource("litemall.png").getFile();
File testFile = new File(test);
tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png");
Reported by PMD.
Line: 30
@Test
public void test() throws IOException {
String test = getClass().getClassLoader().getResource("litemall.png").getFile();
File testFile = new File(test);
tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png");
logger.info("test file " + test);
Reported by PMD.
litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/DbTest.java
16 issues
Line: 30
int index1 = url.indexOf("3306/");
int index2 = url.indexOf("?");
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
}
@Test
Reported by PMD.
Line: 31
int index2 = url.indexOf("?");
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
}
@Test
public void testFileCreate() throws IOException {
Reported by PMD.
Line: 32
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
}
@Test
public void testFileCreate() throws IOException {
LocalDate localDate = LocalDate.now();
Reported by PMD.
Line: 39
public void testFileCreate() throws IOException {
LocalDate localDate = LocalDate.now();
String fileName = localDate.toString() + ".sql";
System.out.println(fileName);
File file = new File("backup", fileName);
file.getParentFile().mkdirs();
file.createNewFile();
}
Reported by PMD.
Line: 50
public void testFileDelete() throws IOException {
LocalDate localDate = LocalDate.now();
String fileName = localDate.toString() + ".sql";
System.out.println(fileName);
File file = new File("backup", fileName);
file.deleteOnExit();
}
}
Reported by PMD.
Line: 20
@SpringBootTest
public class DbTest {
@Autowired
private Environment environment;
@Test
public void test() {
String user = environment.getProperty("spring.datasource.druid.username");
String password = environment.getProperty("spring.datasource.druid.password");
Reported by PMD.
Line: 23
private Environment environment;
@Test
public void test() {
String user = environment.getProperty("spring.datasource.druid.username");
String password = environment.getProperty("spring.datasource.druid.password");
String url = environment.getProperty("spring.datasource.druid.url");
int index1 = url.indexOf("3306/");
int index2 = url.indexOf("?");
Reported by PMD.
Line: 27
String user = environment.getProperty("spring.datasource.druid.username");
String password = environment.getProperty("spring.datasource.druid.password");
String url = environment.getProperty("spring.datasource.druid.url");
int index1 = url.indexOf("3306/");
int index2 = url.indexOf("?");
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
Reported by PMD.
Line: 28
String password = environment.getProperty("spring.datasource.druid.password");
String url = environment.getProperty("spring.datasource.druid.url");
int index1 = url.indexOf("3306/");
int index2 = url.indexOf("?");
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
}
Reported by PMD.
Line: 28
String password = environment.getProperty("spring.datasource.druid.password");
String url = environment.getProperty("spring.datasource.druid.url");
int index1 = url.indexOf("3306/");
int index2 = url.indexOf("?");
String db = url.substring(index1+5, index2);
System.out.println(user);
System.out.println(password);
System.out.println(db);
}
Reported by PMD.