findAll(int start, int pageSize) {
- return dao.findAll(new PageRequest(start - 1, pageSize));
- }
-
- @Override
- public WorksModel findById(Long id) {
- return dao.findOne(id);
- }
-
- @Override
- public WorksModel findByName(String name) {
- return dao.findWorkByName(name);
- }
-
- @Override
- public WorksModel update(WorksModel model) {
- WorksModel result = dao.findOne(model.getId());
- if (result == null) {
- return null;
- }
- if ("".equals(model.getCompleteTime()) && model.getCompleteTime() != null) {
- result.setCompleteTime(model.getCompleteTime());
- }
- if ("".equals(model.getImgUrl()) && model.getImgUrl() != null) {
- result.setImgUrl(model.getImgUrl());
- }
- if ("".equals(model.getName()) && model.getName() != null) {
- result.setName(model.getName());
- }
- if ("".equals(model.getSummary()) && model.getSummary() != null) {
- result.setSummary(model.getSummary());
- }
- if ("".equals(model.getUrl()) && model.getUrl() != null) {
- result.setUrl(model.getUrl());
- }
- result.setUpdateTime(new Date());
- return dao.save(result);
- }
-
- @Override
- public WorksModel add(WorksModel model) {
- model.setCreateTime(new Date());
- model.setUpdateTime(new Date());
- return dao.save(model);
- }
-
- @Override
- public void del(Long id) {
- dao.delete(id);
- }
-}
diff --git a/api/src/main/resources/config/application.properties b/api/src/main/resources/config/application.properties
deleted file mode 100644
index 7191cb3e..00000000
--- a/api/src/main/resources/config/application.properties
+++ /dev/null
@@ -1,45 +0,0 @@
-logging.config=classpath:config/logback-dev.xml
-server.port=8080
-server.session.timeout=1800
-server.max-http-header-size=20971520
-
-#datasource
-spring.datasource.url=jdbc:mysql://106.15.188.160/xiaomo?characterEncoding=utf8&useSSL=true
-spring.datasource.username=xiaomo
-spring.datasource.password=xiaomo
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
-# \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
-#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
-#spring.jackson.time-zone=GMT+8
-
-#jpa
-spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
-spring.jpa.hibernate.ddl-auto=update
-spring.jpa.show-sql=true
-
-
-
-# redis
-# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
-spring.redis.database=0
-spring.redis.host=ip
-spring.redis.port=6379
-spring.redis.password=
-# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
-spring.redis.pool.max-active=8
-# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
-spring.redis.pool.max-wait=-1
-# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
-spring.redis.pool.max-idle=8
-# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
-spring.redis.pool.min-idle=0
-# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
-spring.redis.timeout=0
-
-#\u90AE\u4EF6
-spring.mail.host=smtp.qq.com
-spring.mail.username=
-spring.mail.password=
-spring.mail.properties.mail.smtp.auth=true
-spring.mail.properties.mail.smtp.starttls.enable=true
-spring.mail.properties.mail.smtp.starttls.required=true
diff --git a/async/pom.xml b/async/pom.xml
index d2faf39b..60d54b74 100644
--- a/async/pom.xml
+++ b/async/pom.xml
@@ -5,7 +5,7 @@
xiaomo
info.xiaomo
- 2017.1
+ 2020.1
4.0.0
@@ -14,7 +14,7 @@
info.xiaomo
core
- 2017.1
+ 2020.1
@@ -23,6 +23,13 @@
org.springframework.boot
spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
diff --git a/async/src/main/java/info/xiaomo/anysc/AsyncMain.java b/async/src/main/java/info/xiaomo/anysc/AsyncMain.java
index 51820745..79e1fce0 100644
--- a/async/src/main/java/info/xiaomo/anysc/AsyncMain.java
+++ b/async/src/main/java/info/xiaomo/anysc/AsyncMain.java
@@ -13,18 +13,18 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年4月1日 15:38
* Description: RabbitMq启动器
* Copyright(©) 2015 by xiaomo.
**/
@Configuration
-@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
+@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@ComponentScan("info.xiaomo")
@EntityScan("info.xiaomo.*.model")
public class AsyncMain {
diff --git a/async/src/main/java/info/xiaomo/anysc/controller/TestController.java b/async/src/main/java/info/xiaomo/anysc/controller/TestController.java
index 709049b6..0817a3a8 100644
--- a/async/src/main/java/info/xiaomo/anysc/controller/TestController.java
+++ b/async/src/main/java/info/xiaomo/anysc/controller/TestController.java
@@ -14,12 +14,12 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年11月15日 15:12
* Description: 用户实体类
* Copyright(©) 2015 by xiaomo.
diff --git a/async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java b/async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java
index cee66fd7..73ac1fc5 100644
--- a/async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java
+++ b/async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java
@@ -7,10 +7,13 @@
import java.util.Random;
import java.util.concurrent.Future;
+/**
+ * @author : xiaomo
+ */
@Component
public class AsyncTask {
- private static Random random =new Random();
+ private static Random random = new Random();
@Async
public Future doTaskOne() throws Exception {
diff --git a/async/src/main/resources/config/application.properties b/async/src/main/resources/config/application.properties
index 2bbf0e38..79ef9397 100644
--- a/async/src/main/resources/config/application.properties
+++ b/async/src/main/resources/config/application.properties
@@ -1,8 +1,9 @@
logging.config=classpath:config/logback-dev.xml
server.port=8080
-server.session.timeout=1800
+
server.max-http-header-size=20971520
# \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
\ No newline at end of file
diff --git a/core/pom.xml b/core/pom.xml
index f36c7119..8e3af9eb 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -5,7 +5,7 @@
info.xiaomo
xiaomo
- 2017.1
+ 2020.1
4.0.0
@@ -84,4 +84,18 @@
poi
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ none
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/java/info/xiaomo/core/base/AuthOperate.java b/core/src/main/java/info/xiaomo/core/base/AuthOperate.java
index 78cc964c..76889389 100644
--- a/core/src/main/java/info/xiaomo/core/base/AuthOperate.java
+++ b/core/src/main/java/info/xiaomo/core/base/AuthOperate.java
@@ -5,7 +5,7 @@
import java.util.Date;
/**
- * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo)
+ * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
* @version : 2017年1月13日 9:51
*/
public interface AuthOperate {
diff --git a/core/src/main/java/info/xiaomo/core/base/BaseController.java b/core/src/main/java/info/xiaomo/core/base/BaseController.java
index a1b0b739..b2f5d2c8 100644
--- a/core/src/main/java/info/xiaomo/core/base/BaseController.java
+++ b/core/src/main/java/info/xiaomo/core/base/BaseController.java
@@ -10,7 +10,7 @@
import java.util.List;
/**
- * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo)
+ * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
* @version : 2017年1月11日 16:41
*/
@RestController
diff --git a/core/src/main/java/info/xiaomo/core/base/BaseDao.java b/core/src/main/java/info/xiaomo/core/base/BaseDao.java
index 00fdc512..d9c6941a 100644
--- a/core/src/main/java/info/xiaomo/core/base/BaseDao.java
+++ b/core/src/main/java/info/xiaomo/core/base/BaseDao.java
@@ -4,15 +4,25 @@
import org.springframework.stereotype.Repository;
/**
- * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo)
+ * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
* @version : 2017年1月13日 11:23
*/
@Repository
public interface BaseDao extends JpaRepository {
- T findById(Long id);
-
+ /**
+ * 根据名字查
+ *
+ * @param name
+ * @return
+ */
T findByName(String name);
+ /**
+ * 删除
+ *
+ * @param name
+ * @return
+ */
boolean deleteByName(String name);
}
diff --git a/core/src/main/java/info/xiaomo/core/base/BaseModel.java b/core/src/main/java/info/xiaomo/core/base/BaseModel.java
index 41de675a..37d18bbe 100644
--- a/core/src/main/java/info/xiaomo/core/base/BaseModel.java
+++ b/core/src/main/java/info/xiaomo/core/base/BaseModel.java
@@ -10,12 +10,12 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年4月1日 20:37
* Copyright(©) 2015 by xiaomo.
**/
diff --git a/core/src/main/java/info/xiaomo/core/base/BaseService.java b/core/src/main/java/info/xiaomo/core/base/BaseService.java
index 59407108..4ff3a02f 100644
--- a/core/src/main/java/info/xiaomo/core/base/BaseService.java
+++ b/core/src/main/java/info/xiaomo/core/base/BaseService.java
@@ -6,27 +6,81 @@
import java.util.List;
/**
- * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo)
+ * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
* @version : 2017年1月11日 16:42
*/
@Service
public interface BaseService {
+ /**
+ * 根据id查
+ *
+ * @param id
+ * @return
+ */
T findById(Long id);
+ /**
+ * 根据名字查
+ *
+ * @param name
+ * @return
+ */
T findByName(String name);
+ /**
+ * 查找所有
+ *
+ * @return
+ */
List findAll();
+ /**
+ * 分页查询
+ *
+ * @param start
+ * @param pageSize
+ * @return
+ */
Page findAll(int start, int pageSize);
+ /**
+ * 根据id删除
+ *
+ * @param id
+ * @return
+ */
boolean deleteById(Long id);
+ /**
+ * 根据名字删除
+ *
+ * @param name
+ * @return
+ */
boolean deleteByName(String name);
+ /**
+ * 增加
+ *
+ * @param model
+ * @return
+ */
boolean add(T model);
+ /**
+ * 更新
+ *
+ * @param model
+ * @return
+ */
boolean update(T model);
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return
+ */
boolean deleteByIds(List ids);
}
diff --git a/core/src/main/java/info/xiaomo/core/base/Result.java b/core/src/main/java/info/xiaomo/core/base/Result.java
index 04ae26c9..4ec1cb45 100644
--- a/core/src/main/java/info/xiaomo/core/base/Result.java
+++ b/core/src/main/java/info/xiaomo/core/base/Result.java
@@ -6,12 +6,12 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年10月31日 15:25
* Description: 返回结果
* Copyright(©) 2015 by xiaomo.
diff --git a/core/src/main/java/info/xiaomo/core/constant/CodeConst.java b/core/src/main/java/info/xiaomo/core/constant/CodeConst.java
index 133fea5d..9b411ca5 100644
--- a/core/src/main/java/info/xiaomo/core/constant/CodeConst.java
+++ b/core/src/main/java/info/xiaomo/core/constant/CodeConst.java
@@ -4,17 +4,20 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年10月29日 10:59
* Description: 错误码
* Copyright(©) 2015 by xiaomo.
*/
public enum CodeConst {
+ /**
+ * success
+ */
SUCCESS(200, "成功"),
NOT_FOUNT(404, "找不到"),
REPEAT(992, "数据重复"),
diff --git a/core/src/main/java/info/xiaomo/core/constant/FileConst.java b/core/src/main/java/info/xiaomo/core/constant/FileConst.java
index ddc052bd..c816674f 100644
--- a/core/src/main/java/info/xiaomo/core/constant/FileConst.java
+++ b/core/src/main/java/info/xiaomo/core/constant/FileConst.java
@@ -1,5 +1,9 @@
package info.xiaomo.core.constant;
+/**
+ * @author qq
+ */
+
public enum FileConst {
/**
* JEPG.
@@ -148,11 +152,11 @@ public enum FileConst {
*/
MF("4D616E69666573742D56"),
/**
- *EXE Archive.
+ * EXE Archive.
*/
EXE("4D5A9000030000000400"),
/**
- *CHM Archive.
+ * CHM Archive.
*/
CHM("49545346030000006000"),
/*
@@ -219,7 +223,7 @@ public enum FileConst {
*
* @param value
*/
- private FileConst(String value) {
+ FileConst(String value) {
this.value = value;
}
diff --git a/core/src/main/java/info/xiaomo/core/constant/GenderConst.java b/core/src/main/java/info/xiaomo/core/constant/GenderConst.java
index 735f82c4..05694372 100644
--- a/core/src/main/java/info/xiaomo/core/constant/GenderConst.java
+++ b/core/src/main/java/info/xiaomo/core/constant/GenderConst.java
@@ -4,22 +4,22 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年1月12日 16:37
* Description: 性别
* Copyright(©) 2015 by xiaomo.
**/
public interface GenderConst {
- int secret = 0;
+ int SECRET = 0;
- int man = 1;
+ int MAN = 1;
- int woman = 2;
+ int WOMAN = 2;
}
diff --git a/core/src/main/java/info/xiaomo/core/constant/SymbolConst.java b/core/src/main/java/info/xiaomo/core/constant/SymbolConst.java
index 46be4f6a..c4dbcfeb 100644
--- a/core/src/main/java/info/xiaomo/core/constant/SymbolConst.java
+++ b/core/src/main/java/info/xiaomo/core/constant/SymbolConst.java
@@ -1,5 +1,8 @@
package info.xiaomo.core.constant;
+/**
+ * @author : xiaomo
+ */
public class SymbolConst {
public static final String JINHAO = "#";
public static final String AND = "&";
diff --git a/core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java b/core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java
index 277163ad..ee06bc04 100644
--- a/core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java
+++ b/core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java
@@ -12,12 +12,12 @@
* |╭---╮把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 16/4/3 11:08
* Description: 找不到用户异常
* Copyright(©) 2015 by xiaomo.
diff --git a/core/src/main/java/info/xiaomo/core/field/LoginField.java b/core/src/main/java/info/xiaomo/core/field/LoginField.java
index 6de80592..e6ea5173 100644
--- a/core/src/main/java/info/xiaomo/core/field/LoginField.java
+++ b/core/src/main/java/info/xiaomo/core/field/LoginField.java
@@ -4,64 +4,59 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info(83387856)
* Date: 2016年1月8日 13:16
* Description: QQ登录常量类
* Copyright(©) 2015 by xiaomo.
*/
public interface LoginField {
- //qq
- String QQOpenId = "openid";
- String QQNickname = "nickname";
- String QQPhotourl = "figureurl_qq_2";
- String QQGender = "gender";
- //sina
- String sinaNickName = "screen_name";
- String sinaOpenId = "id";
- String sinaHeadPhoto = "avatar_large";
- //github
- String githubNickName = "name";
- String githubOpenId = "id";
- String githubHeadPhoto = "avatar_url";
- String githubEmail = "email";
- //baidu
- String baiduNickName = "name";
- String baiduOpenId = "id";
- String baiduHeadPhoto = "avatar_url";
- String baiduGender = "";
- //osc
- String oscNickName = "name";
- String oscOpenId = "id";
- String oscHeadPhoto = "avatar";
- String oscEmail = "email";
- String oscGender = "gender";
+ String Q_Q_OPEN_ID = "openid";
+ String Q_Q_NICKNAME = "nickname";
+ String Q_Q_PHOTOURL = "figureurl_qq_2";
+ String Q_Q_GENDER = "gender";
+ String SINA_NICK_NAME = "screen_name";
+ String SINA_OPEN_ID = "id";
+ String SINA_HEAD_PHOTO = "avatar_large";
+ String GITHUB_NICK_NAME = "name";
+ String GITHUB_OPEN_ID = "id";
+ String GITHUB_HEAD_PHOTO = "avatar_url";
+ String GITHUB_EMAIL = "email";
+ String BAIDU_NICK_NAME = "name";
+ String BAIDU_OPEN_ID = "id";
+ String BAIDU_HEAD_PHOTO = "avatar_url";
+ String BAIDU_GENDER = "";
+
+ String OSC_NICK_NAME = "name";
+ String OSC_OPEN_ID = "id";
+ String OSC_HEAD_PHOTO = "avatar";
+ String OSC_EMAIL = "email";
+ String OSC_GENDER = "gender";
- //renren
- String renrenNickName = "name";
- String renrenOpenId = "id";
- String renrenHeadPhoto = "url";
- String renrenEmail = "email";
- String renrenGender = "gender";
- String renrenPhoto = "avatar";
+ String RENREN_NICK_NAME = "name";
+ String RENREN_OPEN_ID = "id";
+ String RENREN_HEAD_PHOTO = "url";
+ String RENREN_EMAIL = "email";
+ String RENREN_GENDER = "gender";
+ String RENREN_PHOTO = "avatar";
- String id = "id";
- String password = "password";
- String email = "email";
- String emailVerify = "emailVerify"; // EmailVerifyConst 是否验证
- String sex = "gender"; //GenderType 性别
- String birthday = "birthday"; //GenderType 性别
- String status = "status"; // UserStatusType 帐号状态
- String lastLoginTime = "lastLoginTime";
+ String ID = "id";
+ String PASSWORD = "password";
+ String EMAIL = "email";
+ String EMAILVERIFY = "emailVerify";
+ String SEX = "gender";
+ String BIRTHDAY = "birthday";
+ String STATUS = "status";
+ String LAST_LOGIN_TIME = "lastLoginTime";
- String type = "type"; //LoginTypeConst 登录类型
- String contribution = "contribution";
- String authority = "authority"; // OauthType 权限类型
- String updateTime = "updateTime";
- String createTime = "createTime";
- String index = "/index.html";
+ String TYPE = "type";
+ String CONTRIBUTION = "contribution";
+ String AUTHORITY = "authority";
+ String UPDATETIME = "updateTime";
+ String CREATETIME = "createTime";
+ String INDEX = "/index.html";
}
diff --git a/core/src/main/java/info/xiaomo/core/filter/CORSFilter.java b/core/src/main/java/info/xiaomo/core/filter/CorsFilter.java
similarity index 92%
rename from core/src/main/java/info/xiaomo/core/filter/CORSFilter.java
rename to core/src/main/java/info/xiaomo/core/filter/CorsFilter.java
index fd39f152..75ccacf3 100644
--- a/core/src/main/java/info/xiaomo/core/filter/CORSFilter.java
+++ b/core/src/main/java/info/xiaomo/core/filter/CorsFilter.java
@@ -10,18 +10,18 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016/4/1516:25
* Description:
* Copyright(©) 2015 by xiaomo.
**/
@Component
-public class CORSFilter implements Filter {
+public class CorsFilter implements Filter {
/**
@@ -44,6 +44,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
* @throws IOException IOException
* @throws ServletException ServletException
*/
+ @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
@@ -57,6 +58,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
/**
* 销毁对象
*/
+ @Override
public void destroy() {
}
}
diff --git a/core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java b/core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java
index 8c58cadd..e46cfb8f 100644
--- a/core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java
+++ b/core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java
@@ -9,6 +9,9 @@
import java.text.SimpleDateFormat;
import java.util.Date;
+/**
+ * @author : xiaomo
+ */
public class CustomDateSerializerFilter extends JsonSerializer {
@Override
diff --git a/core/src/main/java/info/xiaomo/core/untils/AuthUtil.java b/core/src/main/java/info/xiaomo/core/untils/AuthUtil.java
index b1e95418..670f0d70 100644
--- a/core/src/main/java/info/xiaomo/core/untils/AuthUtil.java
+++ b/core/src/main/java/info/xiaomo/core/untils/AuthUtil.java
@@ -6,12 +6,12 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* @email: xiaomo@xiaomo.info
-
+ *
* Date: 20161131 9:50
* Copyright(©) 2015 by xiaomo.
**/
diff --git a/core/src/main/java/info/xiaomo/core/untils/CastUtil.java b/core/src/main/java/info/xiaomo/core/untils/CastUtil.java
index a95027e2..a3c19f4c 100644
--- a/core/src/main/java/info/xiaomo/core/untils/CastUtil.java
+++ b/core/src/main/java/info/xiaomo/core/untils/CastUtil.java
@@ -2,6 +2,7 @@
import java.io.*;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -10,18 +11,18 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
+
*
- * author: xiaomo
- * github: https://github.com/xiaomoinfo
+ * @author : xiaomo
+ * github: https://github.com/houko
* email: xiaomo@xiaomo.info
-
+ *
* Date: 2016年11月22日 14:55
* Copyright(©) 2015 by xiaomo.
**/
public class CastUtil {
- protected static final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ protected static final ByteArrayOutputStream OUT = new ByteArrayOutputStream();
protected static ObjectOutputStream oos;
public CastUtil() {
@@ -119,7 +120,7 @@ public static int isNumeric(String str) {
}
public static HashMap copyMap(HashMap map) {
- HashMap newmap = new HashMap();
+ HashMap newmap = new HashMap(10);
for (Object key : map.keySet()) {
newmap.put(key, map.get(key));
@@ -162,7 +163,7 @@ public static String objectToString(Object obj) {
ObjectOutputStream e = new ObjectOutputStream(out);
e.writeObject(obj);
byte[] bytes = out.toByteArray();
- return new String(bytes, "ISO-8859-1");
+ return new String(bytes, StandardCharsets.ISO_8859_1);
} catch (IOException var4) {
var4.printStackTrace();
return null;
@@ -172,7 +173,7 @@ public static String objectToString(Object obj) {
public static Object stringToObject(String string) {
try {
- byte[] e = string.getBytes("ISO-8859-1");
+ byte[] e = string.getBytes(StandardCharsets.ISO_8859_1);
ByteArrayInputStream in = new ByteArrayInputStream(e);
ObjectInputStream ois = new ObjectInputStream(in);
return ois.readObject();
@@ -208,20 +209,20 @@ public static Object bytesToObject(byte[] bytes) {
}
public static byte[] objectToBytes(Object obj) throws IOException {
- out.reset();
+ OUT.reset();
byte[] var2;
try {
if (oos == null) {
- oos = new ObjectOutputStream(out);
+ oos = new ObjectOutputStream(OUT);
} else {
oos.reset();
}
oos.writeObject(obj);
- var2 = out.toByteArray();
+ var2 = OUT.toByteArray();
} finally {
- out.close();
+ OUT.close();
}
return var2;
@@ -290,7 +291,7 @@ public static int[] stringToInts(String str, String regex) {
}
public static String bytesToHexString(byte[] src) {
- StringBuilder stringBuilder = new StringBuilder("");
+ StringBuilder stringBuilder = new StringBuilder();
if (src != null && src.length> 0) {
for (byte aSrc : src) {
int v = aSrc & 255;
@@ -309,7 +310,7 @@ public static String bytesToHexString(byte[] src) {
}
public static byte[] hexStringToBytes(String hexString) {
- if (hexString != null && !hexString.equals("")) {
+ if (hexString != null && !"".equals(hexString)) {
hexString = hexString.toUpperCase();
int length = hexString.length() / 2;
char[] hexChars = hexString.toCharArray();
@@ -330,7 +331,7 @@ public static double strToDouble(String str) {
if (str != null && !str.isEmpty()) {
int len = str.length();
int p = str.indexOf(37);
- return p == len - 1 ? Double.valueOf(str.substring(0, len - 1)) / 100.0D : (p> -1 ? 0.0D : (str.equals("true") ? 1.0D : toDouble(str)));
+ return p == len - 1 ? Double.valueOf(str.substring(0, len - 1)) / 100.0D : (p> -1 ? 0.0D : ("true".equals(str) ? 1.0D : toDouble(str)));
} else {
return 0.0D;
}
diff --git a/core/src/main/java/info/xiaomo/core/untils/CharUtil.java b/core/src/main/java/info/xiaomo/core/untils/CharUtil.java
index 846fecbe..17b3e973 100644
--- a/core/src/main/java/info/xiaomo/core/untils/CharUtil.java
+++ b/core/src/main/java/info/xiaomo/core/untils/CharUtil.java
@@ -1,23 +1,24 @@
package info.xiaomo.core.untils;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.Objects;
/**
* Title:字符编码工具类
*
+ * @author : xiaomo
* @version 1.0
- * author: xiaomo
*/
public class CharUtil {
/**
* 转换编码 ISO-8859-1到GB2312
*/
- public static String ISO2GB(String text) {
+ public static String iso2gb(String text) {
String result;
try {
- result = new String(text.getBytes("ISO-8859-1"), "GB2312");
+ result = new String(text.getBytes(StandardCharsets.ISO_8859_1), "GB2312");
} catch (UnsupportedEncodingException ex) {
result = ex.toString();
}
@@ -27,10 +28,10 @@ public static String ISO2GB(String text) {
/**
* 转换编码 GB2312到ISO-8859-1
*/
- public static String GB2ISO(String text) {
+ public static String gb2iso(String text) {
String result = "";
try {
- result = new String(text.getBytes("GB2312"), "ISO-8859-1");
+ result = new String(text.getBytes("GB2312"), StandardCharsets.ISO_8859_1);
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
@@ -40,7 +41,7 @@ public static String GB2ISO(String text) {
/**
* Utf8URL编码
*/
- public static String Utf8URLEncode(String text) {
+ public static String utf8urlencode(String text) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < text.length(); i++) { @@ -51,13 +52,15 @@ public static String Utf8URLEncode(String text) { byte[] b = new byte[0]; try { - b = Character.toString(c).getBytes("UTF-8"); + b = Character.toString(c).getBytes(StandardCharsets.UTF_8); } catch (Exception ignored) { } for (byte aB : b) { int k = aB; - if (k < 0) k += 256; + if (k < 0) { + k += 256; + } result.append("%").append(Integer.toHexString(k).toUpperCase()); } @@ -69,19 +72,23 @@ public static String Utf8URLEncode(String text) { /** * Utf8URL解码 */ - public static String Utf8URLDecode(String text) { - String result = ""; + public static String utf8urldecode(String text) { + StringBuilder result = new StringBuilder(); int p; if (text != null && text.length()> 0) {
text = text.toLowerCase();
p = text.indexOf("%e");
- if (p == -1) return text;
+ if (p == -1) {
+ return text;
+ }
while (p != -1) {
- result += text.substring(0, p);
- text = text.substring(p, text.length());
- if (Objects.equals(text, "") || text.length() < 9) return result; - result += CodeToWord(text.substring(0, 9)); - text = text.substring(9, text.length()); + result.append(text, 0, p); + text = text.substring(p); + if (Objects.equals(text, "") || text.length() < 9) { + return result.toString(); + } + result.append(codetoword(text.substring(0, 9))); + text = text.substring(9); p = text.indexOf("%e"); } } @@ -91,18 +98,14 @@ public static String Utf8URLDecode(String text) { /** * utf8URL编码转字符 */ - private static String CodeToWord(String text) { + private static String codetoword(String text) { String result; - if (Utf8codeCheck(text)) { + if (utf8codecheck(text)) { byte[] code = new byte[3]; code[0] = (byte) (Integer.parseInt(text.substring(1, 3), 16) - 256); code[1] = (byte) (Integer.parseInt(text.substring(4, 6), 16) - 256); code[2] = (byte) (Integer.parseInt(text.substring(7, 9), 16) - 256); - try { - result = new String(code, "UTF-8"); - } catch (UnsupportedEncodingException ex) { - result = null; - } + result = new String(code, StandardCharsets.UTF_8); } else { result = text; } @@ -112,17 +115,19 @@ private static String CodeToWord(String text) { /** * 编码是否有效 */ - private static boolean Utf8codeCheck(String text) { + private static boolean utf8codecheck(String text) { String sign = ""; - if (text.startsWith("%e")) { + String prefix = "%e"; + if (text.startsWith(prefix)) { for (int p = 0; p != -1; ) { p = text.indexOf("%", p); - if (p != -1) + if (p != -1) { p++; + } sign += p; } } - return sign.equals("147-1"); + return "147-1".equals(sign); } /** @@ -131,10 +136,11 @@ private static boolean Utf8codeCheck(String text) { public static boolean isUtf8Url(String text) { text = text.toLowerCase(); int p = text.indexOf("%"); - if (p != -1 && text.length() - p> 9) {
- text = text.substring(p, p + 9);
+ int nine = 9;
+ if (p != -1 && text.length() - p> nine) {
+ text = text.substring(p, p + nine);
}
- return Utf8codeCheck(text);
+ return utf8codecheck(text);
}
/**
@@ -147,24 +153,28 @@ public static char regularize(char input) {
input = (char) 32;
} else if (input> 65280 && input < 65375) { input = (char) (input - 65248); - } else if (input>= 'A' && input <= 'Z') { - input += 32; + } else { + char a = 'A'; + char z = 'Z'; + if (input>= a && input <= z) { + input += 32; + } } return input; } public static void main(String[] args) { String url; - System.out.println(Utf8URLEncode("小莫")); - System.out.println(ISO2GB("小莫")); - System.out.println(GB2ISO("小莫")); + System.out.println(utf8urlencode("小莫")); + System.out.println(iso2gb("小莫")); + System.out.println(gb2iso("小莫")); url = "http://www.google.com/search?hl=zh-CN&newwindow=1&q=%E4%B8%AD%E5%9B%BD%E5%A4%A7%E7%99%BE%E7%A7%91%E5%9C%A8%E7%BA%BF%E5%85%A8%E6%96%87%E6%A3%80%E7%B4%A2&btnG=%E6%90%9C%E7%B4%A2&lr="; if (CharUtil.isUtf8Url(url)) { - System.out.println(CharUtil.Utf8URLDecode(url)); + System.out.println(CharUtil.utf8urldecode(url)); } url = "http://www.baidu.com/baidu?word=%D6%D0%B9%FA%B4%F3%B0%D9%BF%C6%D4%DA%CF%DF%C8%AB%CE%C4%BC%EC%CB%F7&tn=myie2dg"; if (CharUtil.isUtf8Url(url)) { - System.out.println(CharUtil.Utf8URLDecode(url)); + System.out.println(CharUtil.utf8urldecode(url)); } } diff --git a/core/src/main/java/info/xiaomo/core/untils/DownUtil.java b/core/src/main/java/info/xiaomo/core/untils/DownUtil.java index 3770c956..3f6d64e0 100644 --- a/core/src/main/java/info/xiaomo/core/untils/DownUtil.java +++ b/core/src/main/java/info/xiaomo/core/untils/DownUtil.java @@ -10,8 +10,7 @@ import java.net.URLConnection; /** - * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo) - * + * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) * @created : 2016/12/26 13:25 */ @Slf4j @@ -64,10 +63,10 @@ public static void download(String urlString, String filePath) throws Exception // 输出的文件流 File output = new File(filePath); - if (!output.exists()){ + if (!output.exists()) { boolean res = output.mkdir(); - if (res){ - log.debug("{} 目录创建成功", filePath); + if (res) { + log.debug("{} 目录创建成功", filePath); } } diff --git a/core/src/main/java/info/xiaomo/core/untils/ExcelUtil.java b/core/src/main/java/info/xiaomo/core/untils/ExcelUtil.java index f51f794c..9a1738e3 100644 --- a/core/src/main/java/info/xiaomo/core/untils/ExcelUtil.java +++ b/core/src/main/java/info/xiaomo/core/untils/ExcelUtil.java @@ -11,6 +11,9 @@ import java.util.Date; import java.util.List; +/** + * @author : xiaomo + */ public class ExcelUtil { // // public static void main(String[] args) throws Exception { @@ -32,7 +35,7 @@ public static List> getListData(String path, int ignoreRows) throws
for (String[] aResult : result) {
List list = new ArrayList();
for (String anAResult : aResult) {
- if (!anAResult.equals("")) {
+ if (!"".equals(anAResult)) {
list.add(anAResult);
}
}
@@ -99,7 +102,7 @@ private static String[][] getData(File file, int ignoreRows)
break;
case HSSFCell.CELL_TYPE_FORMULA:
// 导入时如果为公式生成的数据则无值
- if (!cell.getStringCellValue().equals("")) {
+ if (!"".equals(cell.getStringCellValue())) {
value = cell.getStringCellValue();
} else {
value = cell.getNumericCellValue() + "";
@@ -118,7 +121,7 @@ private static String[][] getData(File file, int ignoreRows)
value = "";
}
}
- if (columnIndex == 0 && value.trim().equals("")) {
+ if (columnIndex == 0 && "".equals(value.trim())) {
break;
}
values[columnIndex] = rightTrim(value);
diff --git a/core/src/main/java/info/xiaomo/core/untils/FileUtil.java b/core/src/main/java/info/xiaomo/core/untils/FileUtil.java
index f9ebcefd..d0297bf5 100644
--- a/core/src/main/java/info/xiaomo/core/untils/FileUtil.java
+++ b/core/src/main/java/info/xiaomo/core/untils/FileUtil.java
@@ -15,6 +15,7 @@
* 所有方法都是静态方法,不需要生成此类的实例,
* 为避免生成此类的实例,构造方法被申明为private类型的。
*
+ * @author : xiaomo
* @since 1.0
*/
@@ -510,7 +511,8 @@ public static boolean pathValidate(String path) {
for (String anArraypath : arraypath) {
tmppath += "/" + anArraypath;
File d = new File(tmppath.substring(1));
- if (!d.exists()) { //检查Sub目录是否存在
+ //检查Sub目录是否存在
+ if (!d.exists()) {
System.out.println(tmppath.substring(1));
if (!d.mkdir()) {
return false;
@@ -542,7 +544,8 @@ public static boolean genModuleTpl(String path, String modulecontent) throws IOE
return false;
}
}
- FileWriter fw = new FileWriter(path); //建立FileWriter对象,并实例化fw
+ //建立FileWriter对象,并实例化fw
+ FileWriter fw = new FileWriter(path);
//将字符串写入文件
fw.write(modulecontent);
fw.close();
@@ -552,30 +555,34 @@ public static boolean genModuleTpl(String path, String modulecontent) throws IOE
/**
* 获取图片文件的扩展名(发布系统专用)
*
- * @param pic_path 为图片名称加上前面的路径不包括扩展名
+ * @param picPath 为图片名称加上前面的路径不包括扩展名
* @return 图片的扩展名
* @since 1.0
*/
- public static String getPicExtendName(String pic_path) {
- pic_path = getUNIXfilePath(pic_path);
- String pic_extend = "";
- if (isFileExist(pic_path + ".gif")) {
- pic_extend = ".gif";
+ public static String getPicExtendName(String picPath) {
+ picPath = getUNIXfilePath(picPath);
+ String picExtend = "";
+ String gif = ".gif";
+ if (isFileExist(picPath + gif)) {
+ picExtend = gif;
}
- if (isFileExist(pic_path + ".jpeg")) {
- pic_extend = ".jpeg";
+ String jpeg = ".jpeg";
+ if (isFileExist(picPath + jpeg)) {
+ picExtend = jpeg;
}
- if (isFileExist(pic_path + ".jpg")) {
- pic_extend = ".jpg";
+ String jpg = ".jpg";
+ if (isFileExist(picPath + jpg)) {
+ picExtend = jpg;
}
- if (isFileExist(pic_path + ".png")) {
- pic_extend = ".png";
+ String png = ".png";
+ if (isFileExist(picPath + png)) {
+ picExtend = png;
}
- return pic_extend; //返回图片扩展名
+ //返回图片扩展名
+ return picExtend;
}
- //拷贝文件
- public static boolean CopyFile(File in, File out) throws Exception {
+ public static boolean copyFile(File in, File out) throws Exception {
try {
FileInputStream fis = new FileInputStream(in);
FileOutputStream fos = new FileOutputStream(out);
@@ -593,12 +600,11 @@ public static boolean CopyFile(File in, File out) throws Exception {
}
}
- //拷贝文件
- public static boolean CopyFile(String infile, String outfile) throws Exception {
+ public static boolean copyFile(String infile, String outfile) throws Exception {
try {
File in = new File(infile);
File out = new File(outfile);
- return CopyFile(in, out);
+ return copyFile(in, out);
} catch (IOException ie) {
ie.printStackTrace();
return false;
@@ -612,7 +618,7 @@ public static boolean CopyFile(String infile, String outfile) throws Exception {
* @param in data source
* @param out data destination
* @throws IOException in an input or output error occurs
- * @since ostermillerutils 1.00.00
+ * @since orientals 1.00.00
*/
private static void copy(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
@@ -638,7 +644,7 @@ private static void list(List list, File file,
}
}
if (file.isDirectory()) {
- File files[] = file.listFiles();
+ File[] files = file.listFiles();
for (File file1 : files != null ? files : new File[0]) {
list(list, file1, filter);
}
@@ -821,23 +827,18 @@ public static FileConst getType(String filePath) throws IOException {
}
public static String getNewFileName(String fileName, String email) {
- String FileType = FileUtil.getFileType(fileName);
+ String fileType = FileUtil.getFileType(fileName);
String newName = email.split(SymbolConst.AT)[0];
- return (TimeUtil.getDateNow(TimeUtil.DATE_FORMAT_STRING) + SymbolConst.HENGXIAN + newName + SymbolConst.DIAN + FileType).toLowerCase();
+ return (TimeUtil.getDateNow(TimeUtil.DATE_FORMAT_STRING) + SymbolConst.HENGXIAN + newName + SymbolConst.DIAN + fileType).toLowerCase();
}
public static boolean isImage(String imageName) {
String fileType = FileUtil.getFileType(imageName);
- return !(fileType.equals("bmp") || fileType.equals("BMP")
- || fileType.equals("jpg") || fileType.equals("JPG")
- || fileType.equals("jpeg") || fileType.equals("JPEG")
- || fileType.equals("git") || fileType.equals("GIF")
- || fileType.equals("png") || fileType.equals("PNG"));
- }
-
- public static void main(String args[]) throws Exception {
- System.out.println(TimeUtil.getDateNow(TimeUtil.DATE_FORMAT_STRING));
- System.out.println(getType("E:\\oscchina\\xiaomoBlogJava\\core\\src\\main\\java\\info\\xiaomo\\core\\constant\\GenderConst.java"));
+ return !("bmp".equals(fileType) || "BMP".equals(fileType)
+ || "jpg".equals(fileType) || "JPG".equals(fileType)
+ || "jpeg".equals(fileType) || "JPEG".equals(fileType)
+ || "git".equals(fileType) || "GIF".equals(fileType)
+ || "png".equals(fileType) || "PNG".equals(fileType));
}
}
diff --git a/core/src/main/java/info/xiaomo/core/untils/HtmlUtil.java b/core/src/main/java/info/xiaomo/core/untils/HtmlUtil.java
index d76370f1..975e56ac 100644
--- a/core/src/main/java/info/xiaomo/core/untils/HtmlUtil.java
+++ b/core/src/main/java/info/xiaomo/core/untils/HtmlUtil.java
@@ -7,9 +7,9 @@
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
* Today the best performance as tomorrow newest starter!
- * Created by IntelliJ IDEA.
*
- * author: xiaomo
+ *
+ * @author : xiaomo
* github: https://github.com/syoubaku
* email: xiaomo@xiamoo.info
* QQ_NO: 83387856
@@ -47,26 +47,28 @@ public static boolean containsHTMLTag(String str) {
*/
public static String htmlEncode(String strSrc) {
- if (strSrc == null)
+ if (strSrc == null) {
return "";
- char[] arr_cSrc = strSrc.toCharArray();
- StringBuilder buf = new StringBuilder(arr_cSrc.length);
+ }
+ char[] arrCsrc = strSrc.toCharArray();
+ StringBuilder buf = new StringBuilder(arrCsrc.length);
char ch;
- for (char anArr_cSrc : arr_cSrc) {
- ch = anArr_cSrc;
+ for (char anArrCSrc : arrCsrc) {
+ ch = anArrCSrc;
- if (ch == '<') + if (ch == '<') { buf.append("<"); - else if (ch == '>')
+ } else if (ch == '>') {
buf.append(">");
- else if (ch == '"')
+ } else if (ch == '"') {
buf.append(""");
- else if (ch == '\'')
+ } else if (ch == '\'') {
buf.append("'");
- else if (ch == '&')
+ } else if (ch == '&') {
buf.append("&");
- else
+ } else {
buf.append(ch);
+ }
}
return buf.toString();
@@ -83,30 +85,32 @@ else if (ch == '&')
*/
public static String htmlEncode(String strSrc, int quotes) {
- if (strSrc == null)
+ if (strSrc == null) {
return "";
+ }
if (quotes == 0) {
return htmlEncode(strSrc);
}
- char[] arr_cSrc = strSrc.toCharArray();
- StringBuilder buf = new StringBuilder(arr_cSrc.length);
+ char[] arrCsrc = strSrc.toCharArray();
+ StringBuilder buf = new StringBuilder(arrCsrc.length);
char ch;
- for (int i = 0; i < arr_cSrc.length; i++) { - ch = arr_cSrc[i]; - if (ch == '<') + for (int i = 0; i < arrCsrc.length; i++) { + ch = arrCsrc[i]; + if (ch == '<') { buf.append("<"); - else if (ch == '>')
+ } else if (ch == '>') {
buf.append(">");
- else if (ch == '"' && quotes == 1)
+ } else if (ch == '"' && quotes == 1) {
buf.append(""");
- else if (ch == '\'' && quotes == 2)
+ } else if (ch == '\'' && quotes == 2) {
buf.append("'");
- else if (ch == '&')
+ } else if (ch == '&') {
buf.append("&");
- else
+ } else {
buf.append(ch);
+ }
}
return buf.toString();
@@ -120,8 +124,9 @@ else if (ch == '&')
* @since 1.0
*/
public static String htmlDecode(String strSrc) {
- if (strSrc == null)
+ if (strSrc == null) {
return "";
+ }
strSrc = strSrc.replaceAll("<", "<"); strSrc = strSrc.replaceAll(">", ">");
strSrc = strSrc.replaceAll(""", "\"");
@@ -137,23 +142,29 @@ public static String htmlDecode(String strSrc) {
* @return string
*/
public static String delHTMLTag(String htmlStr) {
- String regEx_script = "
-