Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sas - DescribePropertySoftwareDetail bug #454

Open
polluxsky opened this issue Jul 31, 2020 · 1 comment
Open

sas - DescribePropertySoftwareDetail bug #454

polluxsky opened this issue Jul 31, 2020 · 1 comment

Comments

@polluxsky
Copy link

polluxsky commented Jul 31, 2020

_

  • 产品和接口: SAS(云安全中心态势感知) SDK version:1.1.1 DescribePropertySoftwareDetail 接口
  • 平台:任意平台
  • 最小代码:
    由 OpenAPI Explorer自动生成
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;
import java.util.*;
import com.aliyuncs.sas.model.v20181203.*;

public class DescribePropertySoftwareDetail {

    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessKeyId>", "<accessSecret>");
        IAcsClient client = new DefaultAcsClient(profile);

        DescribePropertySoftwareDetailRequest request = new DescribePropertySoftwareDetailRequest();
        request.setRegionId("cn-hangzhou");
        request.setRemark("xxx");
        request.setName("docker");

        try {
            DescribePropertySoftwareDetailResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }

    }
}

报错如下:
Exception in thread "main" java.lang.NumberFormatException: For input string: "2020-06-30T13:24Z"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Long.parseLong(Long.java:692)
at java.base/java.lang.Long.valueOf(Long.java:1144)
at com.aliyuncs.transform.UnmarshallerContext.longValue(UnmarshallerContext.java:31)
at com.aliyuncs.sas.transform.v20181203.DescribePropertySoftwareDetailResponseUnmarshaller.unmarshall(DescribePropertySoftwareDetailResponseUnmarshaller.java:46)
at com.aliyuncs.sas.model.v20181203.DescribePropertySoftwareDetailResponse.getInstance(DescribePropertySoftwareDetailResponse.java:226)
at com.aliyuncs.sas.model.v20181203.DescribePropertySoftwareDetailResponse.getInstance(DescribePropertySoftwareDetailResponse.java:26)
at com.aliyuncs.DefaultAcsClient.readResponse(DefaultAcsClient.java:364)
at com.aliyuncs.DefaultAcsClient.parseAcsResponse(DefaultAcsClient.java:201)
at com.aliyuncs.DefaultAcsClient.getAcsResponse(DefaultAcsClient.java:117)
at com.company.Main.main(Main.java:151)
_

经查看 SDK com.aliyuncs.sas.model.v20181203 DescribePropertySoftwareDetailResponse 类定义

 public static class PropertySoftware {
        private String name;
        private String path;
        private String instanceName;
        private String ip;
        **private Long create;**
        private Long createTimestamp;
        private String installTime;
        private String version;
        private String uuid;
        private String instanceId;
        private String intranetIp;
        private String internetIp;

其中 create 为 Long,但通过 OpenAPI Explorer 测试结果来看返回的数据如下
"Propertys": [
{
"Path": "/etc/docker",
"InstanceName": "数据脱敏",
"Uuid": "数据脱敏",
"InternetIp": "",
"InstallTime": "2019-08-30 04:00:54",
"Version": "1.13.1",
"InstanceId": "数据脱敏",
"Create": "2020-06-30T13:24Z",
"Ip": "数据脱敏",
"CreateTimestamp": 1593494653000,
"IntranetIp": "数据脱敏",
"Name": "docker"
},

可以看到 Create 返回的是一个字符串形式的UTC时间,导致 DescribePropertySoftwareDetailResponse 数据类型转换出错。

@atptro
Copy link
Contributor

atptro commented Aug 10, 2020

谢谢提出宝贵的问题,已经反映给SAS的开发,如有反馈会第一时间通知您

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants