質問

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