This project is read-only.

Error, Unexpected exeption: Invalid URI: Invalid port specified

Nov 20, 2014 at 4:29 PM
Edited Nov 20, 2014 at 4:35 PM
I have 2 Keepass v1.x databases, which work perfectly with Keepass on my Windows systems and it worked with KeepassDroid on my Android Phone.
However, I had to change from an Andoid Phone to a Windows Phone (with 8.1) because of my work.

So I downloaded and installed Keepass V2.x for Windows, created a new database and imported the v1.x database into this new one.
I did this for both databases separately and they seem to work perfectly with Keepass V2.x

Then I downloaded and installed Winkee v2014.1028.1146.4053 on my Nokia Lumia 925 Windows Phone (running 8.1).
I copied both databases and the corresponding key files, via USB, to my phone.

On my phone I open Winkee, select the database I want to open, select the key file for this database and enter the password.
This works just fine but only for one of the databases.
When I try to open the other database in exactly the same way, I get an error stating:
Error, Unexpected exception: Invalid URI: Invalid port specified

I tried creating a new database and importing the old one several times and with several different options, but I always get this error with the same database.
I also tried creating a new database without the use of a key file, but this doesn't work either.
So I'm guessing there is something in the old database that is causing this error? Or could it be something else?

I tried searching the Keepass Wiki and fora, the Codeplex sites for Winkee and Google, but I can't find this specific error or any similar error.
Can someone tell me if they encountered a similar error? Or know a way how to fix this?

If there's any more info needed just let me know please.


Other than this problem with one of my databases, Winkee works just great!
So thanx for this great project.

regards,
Thasaidon
Nov 21, 2014 at 9:05 AM
Hello and thank you for contacting us, we will do our best to track this issue down.

It definitely looks like there is data in the second database that WinKee is having issues with. I have an idea of what could be wrong in this instance, will investigate and report back. It might take a while, though, since real life obligations are currently piling up. I will update this thread as soon as I have some new information.
Nov 21, 2014 at 10:31 AM
Hi Mar3ek,

Thanx for replying so quickly.
I understand your busy, it's the same for me ;)
So if there is anything I can help you with or test, just let me know.

Since the error is about an "invalid URI" and an "invalid port", I was thinking it might be a specific value inside one of the "URL:" values inside the database?
I'll try to look into this and let you know.

Keep up the great work!

regards,
Thasaidon
Nov 21, 2014 at 1:13 PM
Hi Mar3ek,

I found the problem.

Because I suspected it could be a problem in one of the "URL:" values, I looked at all the entries in my database that had any kind of value in this entry field.

From all those entries I looked to see if any were "weird" or malformed and changes them to regular http:// or https:// links.
I also removed all non-"http://" and non-"https://" data values in the URL: fields.
And now the database works!

So yes, it was a problem in one (or more) of the "URL:" entries in my database.
I tried to trace back which one(s) gave the problem and what values they contained, but so far no luck.

If I find out, I'll let you know.

regards,
Thasaidon
Nov 22, 2014 at 9:15 AM
That was exactly my idea of what might be wrong. Thank you for confirming it so quickly, I will write a small patch that should fix this for everyone else similarly affected. I should be able to push the patch to the store by tomorrow evening (Central European Time).

Again, thanks for the help with diagnosing this and glad to hear it's resolved for you. If you have any more questions/ideas/problem, please don't hesitate to contact me.
Nov 22, 2014 at 9:53 AM
Well, this is strange. I scoured the code for places that might cause the issue and came up empty-handed. The only place I use URL parsing is safeguarded against this type of issues, so for now, I have no idea where the problem is occurring. That means the patch will have to wait. It would be a great help if you could send the in-application error report, that would contain all the information I need. If you have the original 1.x database from Android, you could just create a new 2.x and replicate the original behavior.

Then again, since the issue is already resolved for you, this is low-priority. I haven't seen any similar errors so far, so I assume this is a rather exotic problem. If you happen to discover anything more, please let me know, I will fix this as soon as I can.

Thanks again.
Nov 22, 2014 at 4:22 PM
No, thank YOU! for this great app ;-) L0L.

I'll re-import my v1 database into a v2 one, and will try to figure out which datastring in the URL: field was causing the problem.
But like you said, it's working now so there is no rush, and I have to edit a lot of entries (it's a big database).
But I'll let you know if I find the malicious code ;-)

Thanx again for this great app and your support.

Thasaidon.
Nov 23, 2014 at 10:34 AM
If I undefrstand it correctly, you try to open a DB, enter password, key file and the application fails to decrypt and displays a message stating as much. If that's the case, that message box should contain a "report" button. Pressing this, you can send the exception stack trace (in case you are a non-programmer, that's an information stating where and what went wrong exactly).

That would be the best and most convenient way to resolve this for the both of us - you won't have to edit entries one by one and I won't have to work as much on replicating the problem on my test databases :)
Nov 23, 2014 at 11:24 AM
I looked at how to send an error report, but I take is this option isn't manually available? But is only provided by the app if something goes wrong?

The problem is, I only get the error and have an option to "close" the message.
I do have several e-mail account configured on my phone, but there is no option to send any report.

I open Winkee, select the database, select the key file and enter the password.
Then a message pops up with this text:

Error

Unexpected exception: Invalid URI: Invalid
port specified.

[close]


That's it.
So unless there is another way to debug this, the only option is to eliminate each data entry in the URI: field and see which one caused the error.
Nov 23, 2014 at 11:33 PM
Ah, I see. That is most likely a blunder on my part, of course there should be a report button in this case. Looks like I will be pushing 1.2.0.2 into the store soon. Thanks for clearing this up, will update this thread when I the modification comes online in the store. Until then, there is no point in you trying to replicate the issue manually :)

Will let you know.
Nov 24, 2014 at 3:43 PM
Thanx.
I'll automatically receive e-mails when a reply is posted here, so I'll keep an eye on my mailbox ;-)

Thanx again.
Nov 24, 2014 at 8:07 PM
Ok, the updated version, WinKee 1.2.0.2, just passed certification and is being rolled out to the users. The update should be available to you within the next 24 hours, depending on your region.
Nov 25, 2014 at 6:38 AM
I just updated the app, and this time I get the option to send a report.
You should have it in your mail.
I also forwarded it to myself and had a loot at it, but since I'm not familiar with coding, I can't make heads or tail of it ;-)
I hope it means anything to you.
Nov 25, 2014 at 10:46 AM
Yes, I got the report, thanks. On the other hand, this actually looks like a different issue from the original one. Did the error message in the app still state

Unexpected exception: Invalid URI: Invalid port specified.

Because if not, this error seems to be unrelated. The exception trace looks more like an invalid password. BUT - there has been an issue affecting a very small portion of users that causes exactly this error even when the password is right. I haven't been able to track that one down in some time.

So, please verify that the password and key file were entered correctly and try decrypting again - and use Report to send me the error traces, please.

I realize this is shaping up to be a little more complex than anticipated and I greatly appreciate your involvement. There is no rush to fix this, take the steps on your own time :)
Nov 25, 2014 at 12:56 PM
I'm not sure what happened.
I re-converted the v1 database to a v2, put it on my phone and opened it.
now I get a completely different "report" than the one before.

Anyway, it's in your mail again ;-)

If there is anything at all I can do for you, just let me know.
Nov 25, 2014 at 2:22 PM
Thank you, got the mail, got the issue. I think I know how to finally fix this. But since I can't exactly replicate this, would you mind if I published a WinKee in a beta channel and you testing it from there? That way I don't need to release an update for all users (second update in two days - that would put people off).

I haven't used the beta channel so far - I'll set it up if you are willing to try it and we'll continue the debugging in there.

(Participating in beta would work like this: you'd need to send me your Microsoft account email address [over mail, not here, obviously], I'd add you among my beta testers and when the beta app becomes available, I'd send you a link. You will have to open that link on you Windows Phone - the Store should take care of the rest.)
Nov 25, 2014 at 2:53 PM
No problem, sign me up! ;)

I've send you a personal message through this board.
Nov 25, 2014 at 5:49 PM
Ok, the beta is online. I'll send the link over email. Just navigate to the link using your phone and the Store application should automatically take you to installation. Let me know if the beta version fixed the invalid URI issue or not.
Nov 26, 2014 at 7:18 PM
I just pushed another update into the beta channel - 1.2.0.4 BETA. This version completely changes how page navigation is performed between decryption and entry list, which should hopefully fix the initial issue. It might take a few hours for the update to propagate into the store. When it does, please test the new build at you convenience :)