문제

I'm creating a query using the SDK for Java.

I want to get the ID from 2 days ago until today.

String wiqlQuery = "Select ID from WorkItems where System.ChangedDate >= @Today-2";
WorkItemCollection workItems = workItemClient.query(wiqlQuery);

I've also tried with this example from the MSDN just to test clause the "WHERE" with dates:

String wiqlQuery = "Select ID from WorkItems where [System.ChangedDate] >= '1/8/06 GMT'";

I got the following message:

Exception in thread "main" java.lang.NullPointerException: timeZone must not be null

Reference: http://msdn.microsoft.com/en-us/library/bb130148%28v=vs.90%29.aspx

Could anyone help me on that?

Thanks in advance.

도움이 되었습니까?

해결책

when connecting to TFS, you need to specify the ConnectionAdvisor. When no connection advisor is specified when creating a new instance of TFSTeamProjectCollection, a DefaultConnectionAdvisor is created with a default locale and time zone. Maybe it's not setting the default locale and time zone.

However, it's best to set the timezone in the defaultConnectionAdvisor.

ConnectionAdvisor connectionAdvisor = new DefaultConnectionAdvisor(Locale.US, TimeZone.getTimeZone("UTC"));
tpc = new TFSTeamProjectCollection(URIUtils.newURI(TFS_COLLECTION_URL), credentials, connectionAdvisor);

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top