本文介绍了使用JAVA TFS SDK无法正常更新TFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 亲爱的, 我是新来的TFS SDM并为以下错误提供输入。 问题:U pdating TFS小组负责通过java SDK无法正常工作。以下是我的代码和错误消息供您参考。 代码: Workitem workitem = workitems.getWorkItem(0); workitem.getFields()。getField("Responsible Group")。setValue("NEWGRPNAME"); workitem.getFields()。getField("Assigned To")。setValue("NEWASSIGNEE"); workitem.getFields()。getField("Resolved in Release")。setValue("123"); workitem.save(); 错误: java.lang.IllegalArgumentException:字段ID [10340]在此集合中不存在(wi = 148830,size = 19)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldCollectionImpl.newIllegalFieldIDException(FieldCollectionImpl.java:119)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldCollectionImpl.getFieldInternal(FieldCollectionImpl.java:459)     在com.microsoft.tfs.core.clients.workitem.internal.WorkItemImpl.getRuleTargetField(WorkItemImpl.java:769)     在com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.preProcessFields(RuleEngine.java:224)     在com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.fieldChanged(RuleEngine.java:196)     在com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.fieldChanged(RuleEngine.java:167)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.fireRules(FieldImpl.java:795)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:765)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:457)     在com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:389) 解决方案 我已经将我的代码修改为下面的代码并且现在正在工作所以请建议它是否正确解决。' 旧代码:(没有workitem.open()函数) Workitem workitem = workitems.getWorkItem(0); workitem.getFields()。getField("Responsible Group")。setValue("NEWGRPNAME"); workitem.getFields()。getField("Assigned To")。setValue("NEWASSIGNEE"); workitem.getFields()。getField("已解决版本")。setValue("123"); workitem.save(); 修改后的代码: ---- ------------ Workitem workitem = workite ms.getWorkItem(0); workitem.open(); workitem.getFields()。getField("Responsible Group") .setValue("NEWGRPNAME"); workitem.getFields()。getField("Assigned To")。setValue( "NEWASSIGNEE"); workitem.getFields()。getField("已解决版本")。setValue("123 "); workitem.save(); 问候, Ram Dear All,I am new to TFS SDM and provide your input for the below error.Issue: Updating TFS group Responsible through java SDK is not working. Below are the my code and error message for your reference.Code:Workitem workitem = workitems.getWorkItem(0);workitem.getFields().getField("Responsible Group").setValue("NEWGRPNAME");workitem.getFields().getField("Assigned To").setValue("NEWASSIGNEE");workitem.getFields().getField("Resolved in Release").setValue("123");workitem.save();Error:java.lang.IllegalArgumentException: field id [10340] does not exist in this collection (wi=148830,size=19)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldCollectionImpl.newIllegalFieldIDException(FieldCollectionImpl.java:119)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldCollectionImpl.getFieldInternal(FieldCollectionImpl.java:459)     at com.microsoft.tfs.core.clients.workitem.internal.WorkItemImpl.getRuleTargetField(WorkItemImpl.java:769)     at com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.preProcessFields(RuleEngine.java:224)     at com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.fieldChanged(RuleEngine.java:196)     at com.microsoft.tfs.core.clients.workitem.internal.rules.RuleEngine.fieldChanged(RuleEngine.java:167)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.fireRules(FieldImpl.java:795)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:765)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:457)     at com.microsoft.tfs.core.clients.workitem.internal.fields.FieldImpl.setValue(FieldImpl.java:389) 解决方案 I have modified my code into below and its working now so please suggest its a proper solution or not.'Old Code : (without workitem.open() function)Workitem workitem = workitems.getWorkItem(0);workitem.getFields().getField("Responsible Group").setValue("NEWGRPNAME");workitem.getFields().getField("Assigned To").setValue("NEWASSIGNEE");workitem.getFields().getField("Resolved in Release").setValue("123");workitem.save();Modified Code:----------------Workitem workitem = workitems.getWorkItem(0);workitem.open();workitem.getFields().getField("Responsible Group").setValue("NEWGRPNAME");workitem.getFields().getField("Assigned To").setValue("NEWASSIGNEE");workitem.getFields().getField("Resolved in Release").setValue("123");workitem.save();Regards,Ram 这篇关于使用JAVA TFS SDK无法正常更新TFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-01 21:30