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

FormatException from the uri #7

Closed
beautybird opened this issue May 10, 2020 · 3 comments
Closed

FormatException from the uri #7

beautybird opened this issue May 10, 2020 · 3 comments

Comments

@beautybird
Copy link

Hello,
I'm getting a FormatException , this is the uri :

      var url = 'postgres://admin:SomePass!#4@10.0.2.2:5432/the_database';

The intelliJ AVD host address is 10.0.2.2 ;

changing the 'SomePass...' to 'somePass..' gave same exception

what could be the reason and solution ?

I/flutter ( 4076): connectionPool is inital
I/flutter ( 4076): pooledConnectionsCount is : 0
E/flutter ( 4076): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Invalid port (at character 18)
postgres://admin:SomePass!#4@10.0.2.2:5432/the_database
E/flutter ( 4076): ^
E/flutter ( 4076):
E/flutter ( 4076): #0 new _Uri.notSimple. (dart:core/uri.dart:1484:11)
E/flutter ( 4076): #1 int._throwFormatException (dart:core-patch/integers_patch.dart:126:40)
E/flutter ( 4076): #2 int._parseRadix (dart:core-patch/integers_patch.dart:144:16)
E/flutter ( 4076): #3 int._parse (dart:core-patch/integers_patch.dart:102:12)
E/flutter ( 4076): #4 int.parse (dart:core-patch/integers_patch.dart:65:12)
E/flutter ( 4076): #5 new _Uri.notSimple (dart:core/uri.dart:1483:20)
E/flutter ( 4076): #6 Uri.parse (dart:core/uri.dart:1024:17)
E/flutter ( 4076): #7 new SettingsImpl.fromUri (package:postgresql2/src/postgresql_impl/settings.dart:30:17)
E/flutter ( 4076): #8 ConnectionImpl.connect (package:postgresql2/src/postgresql_impl/connection.dart:76:24)
E/flutter (

@tomyeh
Copy link
Owner

tomyeh commented May 10, 2020

I think # is not considered as valid by Uri.parse. You can validate it by calling Uri.parse directly.

@beautybird
Copy link
Author

@tomyeh ...
1- For sure 2 characters gives this exception , the '#' and '@' , avoid them.
2- using parsing in this form :

            String.fromEnvironment(String name, {String defaultValue}) 

default value is the password that has the characters ...haven't test with '#' or '@' ...

@beautybird
Copy link
Author

CORRECTION...actually the default value is not just the password....rather than the entire uri which part of it the password that has the characters.

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