如何获取 java 中用于 atlassian jira 的对象的值
how to get the value of an object in java which is used for attlassian jira
我在 jira 中有 getIssue()
方法,returns 一个 HashMap 作为输出。我想要 affectsVersions
对象中保存的值作为输出。但是我遇到了一个例外。 getIssue()
是一个 rpc-xml 方法
HashMap<String,String> result = (HashMap<String,String>) rpcClient.execute("jira1.getIssue", issueVector);
String ver = (String) result.get("affectsVersions");
System.out.println(ver);
输出:
Exception in thread "main" java.lang.ClassCastException:
[Ljava.lang.Object; cannot be cast to java.lang.String
affectsVersions 字段返回一个对象数组,而不是单个字符串(因为一个问题可以有多个影响版本)。
在第 2 行,您要写:
Object[] affectsVersions = (Object[])result.get("affectsVersions");
...然后根据需要遍历数组。
我在 jira 中有 getIssue()
方法,returns 一个 HashMap 作为输出。我想要 affectsVersions
对象中保存的值作为输出。但是我遇到了一个例外。 getIssue()
是一个 rpc-xml 方法
HashMap<String,String> result = (HashMap<String,String>) rpcClient.execute("jira1.getIssue", issueVector);
String ver = (String) result.get("affectsVersions");
System.out.println(ver);
输出:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.String
affectsVersions 字段返回一个对象数组,而不是单个字符串(因为一个问题可以有多个影响版本)。
在第 2 行,您要写:
Object[] affectsVersions = (Object[])result.get("affectsVersions");
...然后根据需要遍历数组。