Bug 701524 - mvn client should print readable error if project ID has spaces
mvn client should print readable error if project ID has spaces
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-Maven (Show other bugs)
1.3-alpha-1
All Linux
high Severity high
: ---
: 1.6-beta-1
Assigned To: Patrick Huang
Joyce Chang
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-03 01:09 EDT by Kenichi Takemura
Modified: 2014-08-04 18:03 EDT (History)
5 users (show)

See Also:
Fixed In Version: maven client 1.6.0-alpha-3-SNAPSHOT
Doc Type: Bug Fix
Doc Text:
Consequence Error message is not meaningful for end user. Fix A more detailed error message is displayed. Result When user has inadvertently put in space into project ID field (either in zanata.xml or given as command line argument), a more meaningful error message is displayed.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-21 20:58:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kenichi Takemura 2011-05-03 01:09:00 EDT
Description of problem:

mvn client can not handle Project that have spaces

Version-Release number of selected component (if applicable):
Zanata version 1.3-alpha-1 (20110330-1649). 


How reproducible:
100%

Steps to Reproduce:
1. Create a project called 'Test Publican Project' and its version is 1.0
2. mvn zanata:publican-pull -Dzanata.username=kenichi -Dzanata.key=0cd462bd76943ca3f5abae0f9b27d0d2 -Dzanata.dstDir=dest

  
Actual results:

Embedded error: java.net.URISyntaxException: Illegal character in path at index 52: http://10.64.12.214:8080/zanata/rest/projects/p/Test Publican Project/iterations/i/1.0/r

Expected results:

Normal output.

Additional info:
Comment 1 Kenichi Takemura 2011-05-03 01:39:19 EDT
... https://bugzilla.redhat.com/show_bug.cgi?id=701525#c1 should be put in here.
Comment 2 Sean Flanigan 2011-05-04 23:21:30 EDT
Quoting the above-mentioned comment:

--------------------------------------------------------------------

I have changed project name to 'Test_publican_project' replacinf ' ' by '_' but
the command still produces the same error.


mysql> select * from HProject;

| iteration   |  2 | 2011-05-03 01:16:15 | 2011-05-03 05:04:12 |          4 |
tpp1 | Test_publican_project                    | test__

                                   | Test_publican_project                    |
              0 |
+-------------+----+---------------------+---------------------+------------+------+------------------------------------------+--------------------------------------------+------------------------------------------+-----------------+
2 rows in set (0.00 sec)

--------------------------------------------------------------------


Kenichi, what's the exact error message now that you've changed the ID of the project?   I assume the URI doesn't still have a space in it?

Did you manage to create a project with a space in the ID?  We have validation to prevent that.  

If it's just the name that has a space, make sure you're not using the project name in your zanata.xml.  zanata.xml should contain the project ID, not the name.  If you're still having trouble, please attach your zanata.xml.
Comment 3 Kenichi Takemura 2011-05-05 00:17:48 EDT
Thanks for your comment. Yes my mistake. I set project name in zanata.xml
I re-tried using project id and it worked.

But again error message is not kind enough to tell user regarding troubleshooting.

If you specify wrong project id without spaces it says

Embedded error: operation returned 404 (Not Found): Project Iteration 'tpp11:1.0' not found.

This is better but with spaces it says

Embedded error: java.net.URISyntaxException: Illegal character in path at index 49:

This confuses user and looks like a system error.

Please correct error message.
Comment 4 Sean Flanigan 2011-05-05 00:25:46 EDT
The client should probably escape any IDs which are used to build URIs.  (Alternatively, it could try to validate the IDs, but it will be tricky keeping the client-side validation in sync with the server-side validation if we ever change the rules.  URI escaping should guarantee legal URIs, and when the ID is valid, escaping shouldn't change anything.)
Comment 5 Sean Flanigan 2011-09-07 00:33:31 EDT
Assigning to Scrum product owner for prioritisation.
Comment 6 Patrick Huang 2012-04-30 01:19:10 EDT
Solution: will catch URISyntaxException and produce a more meaningful error message.

Committed in master:
https://github.com/zanata/zanata-client/commit/76308576a1274917b41f0ab69816c7217107bc6d
Comment 7 Joyce Chang 2012-05-16 21:14:04 EDT
verified with maven client 1.6.0-alpha-3-SNAPSHOT
Comment 8 Patrick Huang 2012-06-05 20:20:41 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Consequence
Error message is not meaningful for end user.

Fix
A more detailed error message is displayed.

Result
When user has inadvertently put in space into project ID field (either in zanata.xml or given as command line argument), a more meaningful error message is displayed.

Note You need to log in before you can comment on or make changes to this bug.