The following issues were found
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminStorageController.java
8 issues
Line: 27
@RequestMapping("/admin/storage")
@Validated
public class AdminStorageController {
private final Log logger = LogFactory.getLog(AdminStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
Reported by PMD.
Line: 27
@RequestMapping("/admin/storage")
@Validated
public class AdminStorageController {
private final Log logger = LogFactory.getLog(AdminStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
Reported by PMD.
Line: 30
private final Log logger = LogFactory.getLog(AdminStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
@RequiresPermissions("admin:storage:list")
@RequiresPermissionsDesc(menu = {"系统管理", "对象存储"}, button = "查询")
Reported by PMD.
Line: 32
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
@RequiresPermissions("admin:storage:list")
@RequiresPermissionsDesc(menu = {"系统管理", "对象存储"}, button = "查询")
@GetMapping("/list")
public Object list(String key, String name,
Reported by PMD.
Line: 35
private LitemallStorageService litemallStorageService;
@RequiresPermissions("admin:storage:list")
@RequiresPermissionsDesc(menu = {"系统管理", "对象存储"}, button = "查询")
@GetMapping("/list")
public Object list(String key, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 35
private LitemallStorageService litemallStorageService;
@RequiresPermissions("admin:storage:list")
@RequiresPermissionsDesc(menu = {"系统管理", "对象存储"}, button = "查询")
@GetMapping("/list")
public Object list(String key, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 37
@RequiresPermissions("admin:storage:list")
@RequiresPermissionsDesc(menu = {"系统管理", "对象存储"}, button = "查询")
@GetMapping("/list")
public Object list(String key, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallStorage> storageList = litemallStorageService.querySelective(key, name, page, limit, sort, order);
Reported by PMD.
Line: 16
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.List;
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/LocalStorage.java
8 issues
Line: 59
try {
Files.copy(inputStream, rootLocation.resolve(keyName), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new RuntimeException("Failed to store file " + keyName, e);
}
}
@Override
public Stream<Path> loadAll() {
Reported by PMD.
Line: 70
.filter(path -> !path.equals(rootLocation))
.map(path -> rootLocation.relativize(path));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored files", e);
}
}
@Override
Reported by PMD.
Line: 24
public class LocalStorage implements Storage {
private final Log logger = LogFactory.getLog(LocalStorage.class);
private String storagePath;
private String address;
private Path rootLocation;
Reported by PMD.
Line: 24
public class LocalStorage implements Storage {
private final Log logger = LogFactory.getLog(LocalStorage.class);
private String storagePath;
private String address;
private Path rootLocation;
Reported by PMD.
Line: 29
private String storagePath;
private String address;
private Path rootLocation;
public String getStoragePath() {
return storagePath;
}
Reported by PMD.
Line: 66
@Override
public Stream<Path> loadAll() {
try {
return Files.walk(rootLocation, 1)
.filter(path -> !path.equals(rootLocation))
.map(path -> rootLocation.relativize(path));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored files", e);
}
Reported by PMD.
Line: 66
@Override
public Stream<Path> loadAll() {
try {
return Files.walk(rootLocation, 1)
.filter(path -> !path.equals(rootLocation))
.map(path -> rootLocation.relativize(path));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored files", e);
}
Reported by PMD.
Line: 84
public Resource loadAsResource(String filename) {
try {
Path file = load(filename);
Resource resource = new UrlResource(file.toUri());
if (resource.exists() || resource.isReadable()) {
return resource;
} else {
return null;
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/AliyunStorage.java
8 issues
Line: 25
*/
public class AliyunStorage implements Storage {
private final Log logger = LogFactory.getLog(AliyunStorage.class);
private String endpoint;
private String accessKeyId;
private String accessKeySecret;
private String bucketName;
Reported by PMD.
Line: 25
*/
public class AliyunStorage implements Storage {
private final Log logger = LogFactory.getLog(AliyunStorage.class);
private String endpoint;
private String accessKeyId;
private String accessKeySecret;
private String bucketName;
Reported by PMD.
Line: 89
objectMetadata.setContentType(contentType);
// 对象键(Key)是对象在存储桶中的唯一标识。
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
PutObjectResult putObjectResult = getOSSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
Reported by PMD.
Line: 89
objectMetadata.setContentType(contentType);
// 对象键(Key)是对象在存储桶中的唯一标识。
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
PutObjectResult putObjectResult = getOSSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
Reported by PMD.
Line: 90
// 对象键(Key)是对象在存储桶中的唯一标识。
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
PutObjectResult putObjectResult = getOSSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
Reported by PMD.
Line: 125
@Override
public void delete(String keyName) {
try {
getOSSClient().deleteObject(bucketName, keyName);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Reported by PMD.
Line: 126
public void delete(String keyName) {
try {
getOSSClient().deleteObject(bucketName, keyName);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Reported by PMD.
Line: 89
objectMetadata.setContentType(contentType);
// 对象键(Key)是对象在存储桶中的唯一标识。
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
PutObjectResult putObjectResult = getOSSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
Reported by PMD.
litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/WxConfigTest.java
7 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-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.app-id"));
// 测试获取application-wx.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-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.app-id"));
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.notify-url"));
// 测试获取application.yml配置信息
Reported by PMD.
Line: 25
// 测试获取application-db.yml配置信息
System.out.println(environment.getProperty("spring.datasource.druid.url"));
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.app-id"));
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.notify-url"));
// 测试获取application.yml配置信息
System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
}
Reported by PMD.
Line: 27
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.app-id"));
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.notify-url"));
// 测试获取application.yml配置信息
System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
}
}
Reported by PMD.
Line: 29
// 测试获取application-wx.yml配置信息
System.out.println(environment.getProperty("litemall.wx.notify-url"));
// 测试获取application.yml配置信息
System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
}
}
Reported by PMD.
Line: 16
@SpringBootTest
public class WxConfigTest {
@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-wx.yml配置信息
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAdController.java
7 issues
Line: 24
@RequestMapping("/admin/ad")
@Validated
public class AdminAdController {
private final Log logger = LogFactory.getLog(AdminAdController.class);
@Autowired
private LitemallAdService adService;
@RequiresPermissions("admin:ad:list")
Reported by PMD.
Line: 24
@RequestMapping("/admin/ad")
@Validated
public class AdminAdController {
private final Log logger = LogFactory.getLog(AdminAdController.class);
@Autowired
private LitemallAdService adService;
@RequiresPermissions("admin:ad:list")
Reported by PMD.
Line: 27
private final Log logger = LogFactory.getLog(AdminAdController.class);
@Autowired
private LitemallAdService adService;
@RequiresPermissions("admin:ad:list")
@RequiresPermissionsDesc(menu = {"推广管理", "广告管理"}, button = "查询")
@GetMapping("/list")
public Object list(String name, String content,
Reported by PMD.
Line: 30
private LitemallAdService adService;
@RequiresPermissions("admin:ad:list")
@RequiresPermissionsDesc(menu = {"推广管理", "广告管理"}, button = "查询")
@GetMapping("/list")
public Object list(String name, String content,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 30
private LitemallAdService adService;
@RequiresPermissions("admin:ad:list")
@RequiresPermissionsDesc(menu = {"推广管理", "广告管理"}, button = "查询")
@GetMapping("/list")
public Object list(String name, String content,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 32
@RequiresPermissions("admin:ad:list")
@RequiresPermissionsDesc(menu = {"推广管理", "广告管理"}, button = "查询")
@GetMapping("/list")
public Object list(String name, String content,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallAd> adList = adService.querySelective(name, content, page, limit, sort, order);
Reported by PMD.
Line: 15
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminBrandController.java
7 issues
Line: 25
@RequestMapping("/admin/brand")
@Validated
public class AdminBrandController {
private final Log logger = LogFactory.getLog(AdminBrandController.class);
@Autowired
private LitemallBrandService brandService;
@RequiresPermissions("admin:brand:list")
Reported by PMD.
Line: 25
@RequestMapping("/admin/brand")
@Validated
public class AdminBrandController {
private final Log logger = LogFactory.getLog(AdminBrandController.class);
@Autowired
private LitemallBrandService brandService;
@RequiresPermissions("admin:brand:list")
Reported by PMD.
Line: 28
private final Log logger = LogFactory.getLog(AdminBrandController.class);
@Autowired
private LitemallBrandService brandService;
@RequiresPermissions("admin:brand:list")
@RequiresPermissionsDesc(menu = {"商场管理", "品牌管理"}, button = "查询")
@GetMapping("/list")
public Object list(String id, String name,
Reported by PMD.
Line: 31
private LitemallBrandService brandService;
@RequiresPermissions("admin:brand:list")
@RequiresPermissionsDesc(menu = {"商场管理", "品牌管理"}, button = "查询")
@GetMapping("/list")
public Object list(String id, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 31
private LitemallBrandService brandService;
@RequiresPermissions("admin:brand:list")
@RequiresPermissionsDesc(menu = {"商场管理", "品牌管理"}, button = "查询")
@GetMapping("/list")
public Object list(String id, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 33
@RequiresPermissions("admin:brand:list")
@RequiresPermissionsDesc(menu = {"商场管理", "品牌管理"}, button = "查询")
@GetMapping("/list")
public Object list(String id, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallBrand> brandList = brandService.querySelective(id, name, page, limit, sort, order);
Reported by PMD.
Line: 15
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminKeywordController.java
7 issues
Line: 24
@RequestMapping("/admin/keyword")
@Validated
public class AdminKeywordController {
private final Log logger = LogFactory.getLog(AdminKeywordController.class);
@Autowired
private LitemallKeywordService keywordService;
@RequiresPermissions("admin:keyword:list")
Reported by PMD.
Line: 24
@RequestMapping("/admin/keyword")
@Validated
public class AdminKeywordController {
private final Log logger = LogFactory.getLog(AdminKeywordController.class);
@Autowired
private LitemallKeywordService keywordService;
@RequiresPermissions("admin:keyword:list")
Reported by PMD.
Line: 27
private final Log logger = LogFactory.getLog(AdminKeywordController.class);
@Autowired
private LitemallKeywordService keywordService;
@RequiresPermissions("admin:keyword:list")
@RequiresPermissionsDesc(menu = {"商场管理", "关键词"}, button = "查询")
@GetMapping("/list")
public Object list(String keyword, String url,
Reported by PMD.
Line: 30
private LitemallKeywordService keywordService;
@RequiresPermissions("admin:keyword:list")
@RequiresPermissionsDesc(menu = {"商场管理", "关键词"}, button = "查询")
@GetMapping("/list")
public Object list(String keyword, String url,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 30
private LitemallKeywordService keywordService;
@RequiresPermissions("admin:keyword:list")
@RequiresPermissionsDesc(menu = {"商场管理", "关键词"}, button = "查询")
@GetMapping("/list")
public Object list(String keyword, String url,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 32
@RequiresPermissions("admin:keyword:list")
@RequiresPermissionsDesc(menu = {"商场管理", "关键词"}, button = "查询")
@GetMapping("/list")
public Object list(String keyword, String url,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallKeyword> keywordList = keywordService.querySelective(keyword, url, page, limit, sort, order);
Reported by PMD.
Line: 15
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
Reported by PMD.
litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/CreateShareImageTest.java
7 issues
Line: 18
@SpringBootTest
public class CreateShareImageTest {
@Autowired
QCodeService qCodeService;
@Autowired
LitemallGoodsService litemallGoodsService;
@Test
public void test() {
Reported by PMD.
Line: 20
@Autowired
QCodeService qCodeService;
@Autowired
LitemallGoodsService litemallGoodsService;
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
Reported by PMD.
Line: 23
LitemallGoodsService litemallGoodsService;
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
}
}
Reported by PMD.
Line: 25
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
}
}
Reported by PMD.
Line: 25
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
}
}
Reported by PMD.
Line: 25
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
}
}
Reported by PMD.
Line: 25
@Test
public void test() {
LitemallGoods good = litemallGoodsService.findById(1181010);
qCodeService.createGoodShareImage(good.getId().toString(), good.getPicUrl(), good.getName());
}
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/TencentStorage.java
7 issues
Line: 26
*/
public class TencentStorage implements Storage {
private final Log logger = LogFactory.getLog(TencentStorage.class);
private String secretId;
private String secretKey;
private String region;
private String bucketName;
Reported by PMD.
Line: 26
*/
public class TencentStorage implements Storage {
private final Log logger = LogFactory.getLog(TencentStorage.class);
private String secretId;
private String secretKey;
private String region;
private String bucketName;
Reported by PMD.
Line: 33
private String region;
private String bucketName;
private COSClient cosClient;
public String getSecretId() {
return secretId;
}
Reported by PMD.
Line: 93
// 对象键(Key)是对象在存储桶中的唯一标识。例如,在对象的访问域名 `bucket1-1250000000.cos.ap-guangzhou.myqcloud.com/doc1/pic1.jpg`
// 中,对象键为 doc1/pic1.jpg, 详情参考 [对象键](https://cloud.tencent.com/document/product/436/13324)
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
getCOSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
Reported by PMD.
Line: 94
// 中,对象键为 doc1/pic1.jpg, 详情参考 [对象键](https://cloud.tencent.com/document/product/436/13324)
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, inputStream, objectMetadata);
getCOSClient().putObject(putObjectRequest);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
@Override
Reported by PMD.
Line: 126
@Override
public void delete(String keyName) {
try {
getCOSClient().deleteObject(bucketName, keyName);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Reported by PMD.
Line: 127
public void delete(String keyName) {
try {
getCOSClient().deleteObject(bucketName, keyName);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/system/SystemInistService.java
7 issues
Line: 19
*/
@Component
class SystemInistService {
private SystemInistService systemInistService;
@Autowired
private Environment environment;
Reported by PMD.
Line: 19
*/
@Component
class SystemInistService {
private SystemInistService systemInistService;
@Autowired
private Environment environment;
Reported by PMD.
Line: 19
*/
@Component
class SystemInistService {
private SystemInistService systemInistService;
@Autowired
private Environment environment;
Reported by PMD.
Line: 19
*/
@Component
class SystemInistService {
private SystemInistService systemInistService;
@Autowired
private Environment environment;
Reported by PMD.
Line: 23
@Autowired
private Environment environment;
@PostConstruct
private void inist() {
systemInistService = this;
initConfigs();
Reported by PMD.
Line: 26
private Environment environment;
@PostConstruct
private void inist() {
systemInistService = this;
initConfigs();
SystemInfoPrinter.printInfo("Litemall 初始化信息", getSystemInfo());
}
Reported by PMD.
Line: 61
}
@Autowired
private LitemallSystemConfigService litemallSystemConfigService;
private void initConfigs() {
// 1. 读取数据库全部配置信息
Map<String, String> configs = litemallSystemConfigService.queryAll();
Reported by PMD.