去掉sun.misc.BASE64Encoder,使用cn.hutool.core.codec.Base64代替
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
package com.yxt.common.base.config.captcha;
|
package com.yxt.common.base.config.captcha;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import sun.misc.BASE64Decoder;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -89,12 +88,12 @@ public class ImageUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BASE64Decoder decoder = new BASE64Decoder();
|
// BASE64Decoder decoder = new BASE64Decoder();
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
out = new FileOutputStream(imgFilePath);
|
out = new FileOutputStream(imgFilePath);
|
||||||
// Base64解码
|
// Base64解码
|
||||||
byte[] b = decoder.decodeBuffer(imgData);
|
byte[] b = Base64.decode(imgData);
|
||||||
for (int i = 0; i < b.length; ++i) {
|
for (int i = 0; i < b.length; ++i) {
|
||||||
// 调整异常数据
|
// 调整异常数据
|
||||||
if (b[i] < 0) {
|
if (b[i] < 0) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.yxt.common.base.config.captcha.factory.impl;
|
package com.yxt.common.base.config.captcha.factory.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import com.yxt.common.base.config.captcha.CaptchaBaseParam;
|
import com.yxt.common.base.config.captcha.CaptchaBaseParam;
|
||||||
import com.yxt.common.base.config.captcha.CaptchaException;
|
import com.yxt.common.base.config.captcha.CaptchaException;
|
||||||
import com.yxt.common.core.vo.CaptchaBaseVO;
|
import com.yxt.common.core.vo.CaptchaBaseVO;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -75,8 +75,7 @@ public abstract class AbstractCaptcha {
|
|||||||
throw new CaptchaException("ImageIO.write is error", e);
|
throw new CaptchaException("ImageIO.write is error", e);
|
||||||
}
|
}
|
||||||
byte[] bytes = baos.toByteArray();
|
byte[] bytes = baos.toByteArray();
|
||||||
BASE64Encoder encoder = new sun.misc.BASE64Encoder();
|
return Base64.encode(bytes).trim();
|
||||||
return encoder.encodeBuffer(bytes).trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJigsawUrlOrPath() {
|
public String getJigsawUrlOrPath() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.yxt.common.base.config.captcha.factory.impl;
|
package com.yxt.common.base.config.captcha.factory.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.yxt.common.base.config.captcha.CaptchaBaseParam;
|
import com.yxt.common.base.config.captcha.CaptchaBaseParam;
|
||||||
import com.yxt.common.base.config.captcha.CaptchaException;
|
import com.yxt.common.base.config.captcha.CaptchaException;
|
||||||
import com.yxt.common.core.vo.BlockPuzzleCaptchaVO;
|
import com.yxt.common.core.vo.BlockPuzzleCaptchaVO;
|
||||||
import com.yxt.common.core.vo.CaptchaBaseVO;
|
import com.yxt.common.core.vo.CaptchaBaseVO;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -87,10 +87,9 @@ public class BlockPuzzleCaptcha extends AbstractCaptcha {
|
|||||||
// 源图生成遮罩
|
// 源图生成遮罩
|
||||||
byte[] oriCopyImages = DealOriPictureByTemplate(originalImage, jigsawImage, x, 0);
|
byte[] oriCopyImages = DealOriPictureByTemplate(originalImage, jigsawImage, x, 0);
|
||||||
|
|
||||||
BASE64Encoder encoder = new sun.misc.BASE64Encoder();
|
dataVO.setOriginalImageBase64(Base64.encode(oriCopyImages));
|
||||||
dataVO.setOriginalImageBase64(encoder.encode(oriCopyImages));
|
|
||||||
dataVO.setPoint(point);
|
dataVO.setPoint(point);
|
||||||
dataVO.setJigsawImageBase64(encoder.encode(jigsawImages));
|
dataVO.setJigsawImageBase64(Base64.encode(jigsawImages));
|
||||||
return dataVO;
|
return dataVO;
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
throw new CaptchaException(e);
|
throw new CaptchaException(e);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.yxt.common.base.config.component;
|
package com.yxt.common.base.config.component;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.Dispatch;
|
import com.jacob.com.Dispatch;
|
||||||
@@ -11,7 +12,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -94,8 +94,7 @@ public class DocPdfComponent {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
BASE64Encoder encoder = new BASE64Encoder();
|
return Base64.encode(data);
|
||||||
return encoder.encode(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.yxt.common.base.utils;
|
package com.yxt.common.base.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.ComThread;
|
import com.jacob.com.ComThread;
|
||||||
import com.jacob.com.Dispatch;
|
import com.jacob.com.Dispatch;
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
import freemarker.template.Version;
|
import freemarker.template.Version;
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -73,8 +73,7 @@ public class WordUtils {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
BASE64Encoder encoder = new BASE64Encoder();
|
return Base64.encode(data);
|
||||||
return encoder.encode(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user