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

JIRA returned status: Bad Request #20

Open
supermar1010 opened this issue Apr 25, 2018 · 14 comments
Open

JIRA returned status: Bad Request #20

supermar1010 opened this issue Apr 25, 2018 · 14 comments

Comments

@supermar1010
Copy link

Hi,
You program looks like its exactly the program I need for my task.
Unfortunately I can't get it to work. I downloaded the newest binary and gave it the credentials.... If I give it the right projectKey it says "JIRA returned status: Bad Request". With the wrong projectKey I get a "this key was not found in the dictionary" (or something similiar, error message is in German) do you have any idea what could be the root of this error message.
I then tried to build it myself, but the build failed with errors for "TfsTeamProjectCollectionFactory"(missing package) and "workItemStore.DestroyWorkItems(toDelete);"(no method). I then tried installing this packages( https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient/ ) but it didn't work either do you have any suggestions?

With best regards
Mario

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 25, 2018 via email

@supermar1010
Copy link
Author

supermar1010 commented Apr 25, 2018

Thanks for your answer, the behaviour is pretty strange. Now I get a KeyNotFoundException, event though I'm using the same parameters as before. Edit: The projectKey is the thing that Jira puts before every entry? So if I have a entry called GET2-344 my project key would be "GET2"? Because if I do it that way it complains about key not found

This is the log entry for the bad request:

2018-04-25 10:12:55,095 [5] INFO TicketImporter.TicketImportAgent - Preparing to import
2018-04-25 10:12:55,310 [5] INFO TicketImporter.TicketImportAgent - Validating Jira tickets against TFS
2018-04-25 10:12:58,072 [5] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - TechTalk.JiraRestClient.JiraClientException: JIRA returned status: Bad Request
   bei TechTalk.JiraRestClient.JiraClient`1.AssertStatus(IRestResponse response, HttpStatusCode status)
   bei TechTalk.JiraRestClient.JiraClient`1.<EnumerateIssuesInternal>d__25.MoveNext()
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei TicketImporter.JiraProject.<Tickets>d__18.MoveNext()
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)
2018-04-25 10:12:58,079 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - TechTalk.JiraRestClient.JiraClientException: JIRA returned status: Bad Request
   bei TechTalk.JiraRestClient.JiraClient`1.AssertStatus(IRestResponse response, HttpStatusCode status)
   bei TechTalk.JiraRestClient.JiraClient`1.<EnumerateIssuesInternal>d__25.MoveNext()
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei TicketImporter.JiraProject.<Tickets>d__18.MoveNext()
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)

This one for key not found:


2018-04-25 10:00:18,237 [8] INFO TicketImporter.TicketImportAgent - Preparing to import
2018-04-25 10:00:18,419 [8] INFO TicketImporter.TicketImportAgent - Validating Jira tickets against TFS
2018-04-25 10:01:48,475 [8] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: Der angegebene Schl�ssel war nicht im W�rterbuch angegeben.
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   bei TicketImporter.TfsPriorityMap.get_Item(String lookUp)
   bei TicketImporter.TfsProject.toWorkItem(Ticket toImport)
   bei TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure)
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)
2018-04-25 10:01:48,475 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: Der angegebene Schl�ssel war nicht im W�rterbuch angegeben.
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   bei TicketImporter.TfsPriorityMap.get_Item(String lookUp)
   bei TicketImporter.TfsProject.toWorkItem(Ticket toImport)
   bei TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure)
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)
2018-04-25 10:02:15,627 [9] INFO TicketImporter.TicketImportAgent - Preparing to import
2018-04-25 10:02:15,897 [9] INFO TicketImporter.TicketImportAgent - Validating Jira tickets against TFS
2018-04-25 10:03:45,652 [9] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: Der angegebene Schl�ssel war nicht im W�rterbuch angegeben.
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   bei TicketImporter.TfsPriorityMap.get_Item(String lookUp)
   bei TicketImporter.TfsProject.toWorkItem(Ticket toImport)
   bei TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure)
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)
2018-04-25 10:03:45,653 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: Der angegebene Schl�ssel war nicht im W�rterbuch angegeben.
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   bei TicketImporter.TfsPriorityMap.get_Item(String lookUp)
   bei TicketImporter.TfsProject.toWorkItem(Ticket toImport)
   bei TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure)
   bei TicketImporter.TicketImportAgent.StartImport()
   bei JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 25, 2018 via email

@supermar1010
Copy link
Author

Yeah its totally possible that my colleagues configureed custom priorities. Could you tell me where I see that. I'm a bit a Jira beginner :D
But the thing that bugs me is that it says key not found, is my understanding of the projectKeys right?
The German comes from my machine, the .Net framework uses error messages in the native language of the os.

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 25, 2018 via email

@supermar1010
Copy link
Author

Thanks for your help. I think we are getting to the root.

If I go to this URL: rest/api/2/priority I get the priorities. Apparently my colleagues set custom priorities.
But they have the following format: name: "Must have." If I put this in the xml then I get this exception because xml does not like spaces in the keys, I think? Any idea how to solve this?

2018-04-26 11:42:04,762 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Xml.XmlException: Unerwartetes Token 'next'. Erwartet wurde das Token '='. Zeile 4, Position 16.
   bei System.Xml.XmlTextReaderImpl.Throw(Exception e)
   bei System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   bei System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
   bei System.Xml.XmlTextReaderImpl.ParseAttributes()
   bei System.Xml.XmlTextReaderImpl.ParseElement()
   bei System.Xml.XmlTextReaderImpl.ParseElementContent()
   bei System.Xml.XmlTextReaderImpl.Read()
   bei System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   bei System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   bei System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o)
   bei System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
   bei System.Xml.Linq.XElement.Load(String uri, LoadOptions options)
   bei TicketImporter.SettingsStore.Load(String key)
   bei TicketImporter.TfsUsers..ctor(TfsProject tfsProject)
   bei TicketImporter.TfsProject..ctor(String serverUri, String project)
   bei JiraToTfs.Presenter.JiraToTfsPresenter.tfsConnect_DoWork(Object sender, DoWorkEventArgs arguments)

@supermar1010
Copy link
Author

It seems to work right now. I've modified the source to take my custom priorities, but its rather a hack than a fix, so I won't commit it right now.
The problem is if you have priorities with spaces the xml parser fails, so I had to hardcode these values. Now the advanced settings don't work anymore, because its not finding the "Field" entry anymore. But I think I don't need the advanced settings right now

@supermar1010
Copy link
Author

Another question :D
Where can I find the tasks in TFS that were created by JiraToTFS?. I can't find it in any of the sprints?

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 26, 2018 via email

@supermar1010
Copy link
Author

supermar1010 commented Apr 26, 2018

The report says:
Tasks : 280
Product Backlog Items : 2
Bugs : 51

In the csv there are a lot of numbers :D but without a format at least it looks like that for me.
This is a part of it:
230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262
Do you remember which sprint it assigns the tasks to? Because I can't find any of the tasks

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 26, 2018 via email

@KilskyreMan
Copy link
Owner

KilskyreMan commented Apr 26, 2018 via email

@supermar1010
Copy link
Author

I finally resolved my issues :)
I will edit the wiki later and add a few of my findings, like how you mask spaces...

@KilskyreMan
Copy link
Owner

KilskyreMan commented May 3, 2018 via email

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