zoukankan      html  css  js  c++  java
  • 报错:unclosed string(idea控制台打印日志的限制)

    在调接口时,会将请求体进行加密,代码如下:

    public class DataEncrypt2Test {
        public static void main(String[] args) throws Exception {
            String pubKey = "省略不写";// 生产批次
            StringBuilder sb = new StringBuilder();
            sb.append("很长字符串1,省略不写,下同");
            sb.append("很长字符穿2");
            sb.append("很长字符串3");
            sb.append("很长字符串4");
            sb.append("很长字符串5");
            sb.append("很长字符串6");
            sb.append("很长字符串7" );
            sb.append("很长字符串8");
            sb.append("很长字符串9");
            sb.append("很长字符串10");
            sb.append("很长字符串11");
            String str = sb.toString();
            
            JSONObject json = new JSONObject();
            json.put("ycocode","09876543211234567890");
            json.put("yconame","华润制药");
            json.put("medicode","B1243253");
            json.put("mediname","当归");
            json.put("allowname","张山");
            json.put("locality","深圳");
            json.put("batchno","B345353");
            json.put("batchciid","3452352");
            json.put("prodate","2021-10-10");
            json.put("checkdate","2021-11-11");
            json.put("packgg","10/箱");
            json.put("checkname","王五");
            json.put("norm","国标");
            json.put("arts","工艺01");
            json.put("yreport",str);
            json.put("creport",str);
            json.put("updatetime","2021-12-12");
            json.put("ybatchid","1232141");
            json.put("unit","kg");
            json.put("quantity","100");
            json.put("billtype","销售出库");
            
            String encrypt = RSAUtils.encryptByPublicKey(json.toString(), pubKey);
            System.out.println("requestData===> ");
            System.out.println(encrypt);
      }
    }

    通过postman发起请求,报错:unclosed string

    原因分析:由于请求体中有两张图片,加密后字符串的长度为:1053356,由于idea控制台打印日志有限制,导致加密后在控制台打印出来的密文不完整,当去请求后台时,就会报错unclosed string.

    修改如下:

  • 相关阅读:
    linux网卡eth1如何修改为eth0
    rpm方式安装MySQL5.1.73
    quartz demo01
    chrome 搜索 jsonView
    判断是否十六进制格式字符串
    ip and port check 正则
    hadoop 遇到java.net.ConnectException: to 0.0.0.0:10020 failed on connection
    hadoop2.4.1 伪分布
    R 包
    使用pt-heartbeat检测主从复制延迟
  • 原文地址:https://www.cnblogs.com/zwh0910/p/15704972.html
Copyright © 2011-2022 走看看