Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 419602

Summary: [server] Exception when project name is a URL
Product: [ECD] Orion Reporter: Anthony Hunter <ahunter.eclipse>
Component: ServerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: john.arthorne, simon_kaegi
Version: 4.0Flags: john.arthorne: review+
simon_kaegi: review+
Target Milestone: 4.0 RC3   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Anthony Hunter CLA 2013-10-16 10:51:58 EDT
When migrating the orionhub.eclipse.org metadata, an exception was thrown when it hit a project name that was a URL (like http://orion.eclipse.org/)

Coincidentally, Ken reported that we hit this very issue today as well when creating a project using a URL for the name by mistake.
Comment 1 Anthony Hunter CLA 2013-10-16 15:50:59 EDT
I have fixed this issue in commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=ah-Bug419602&id=f11ebce1c539a36f88affef04f352ea04c8cf0f8

I now check during folder creation and file creation that it was successful and return false if not, rather than throwing a RuntimeException.

I have also added a test case testCreateProjectWithURLAsName()

The URL as a project name occurs in 12 projects out of all the projects that 19561 users have created on orionhub.eclipse.org, this is now handled in migration.

We also have those 65 users that were broken when the secure storage file was truncated on orionhub.eclipse.org, I fixed the error messaging for that case.

We finally have 38 projects where the project folder specified in the Projects.pref does not exist, fixed the error for that case.

There is one last problem to handle, that being when you name your project "workspace". There are 8 such projects on orionhub.eclipse.org. I will raise a new defect for that one.
Comment 2 John Arthorne CLA 2013-10-16 16:53:28 EDT
Your new test fails for me:

java.lang.Exception: Unexpected exception, expected<java.lang.RuntimeException> but was<java.lang.AssertionError>

This looks like it is just a problem with the test? Presumably it should fail and the assertTrue should be assertFalse, and the expected throw removed from the @Test annotation.
Comment 3 Anthony Hunter CLA 2013-10-16 20:05:17 EDT
(In reply to John Arthorne from comment #2)
> Your new test fails for me:
> 
> java.lang.Exception: Unexpected exception,
> expected<java.lang.RuntimeException> but was<java.lang.AssertionError>
> 
> This looks like it is just a problem with the test? Presumably it should
> fail and the assertTrue should be assertFalse, and the expected throw
> removed from the @Test annotation.

That is actually pretty good. The failing test is not the one I added. The test that is failing above is the older tests exercising the SimpleMetaStoreUtil. As I said below, before we threw a RuntimeException, now we just return false that the file could not be created and let the caller handle it. 

I have fixed this test in commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=ah-Bug419602&id=bd5f93bbf4f5b11e6a03c394570df2263b74c317
Comment 4 Anthony Hunter CLA 2013-10-17 16:48:58 EDT
> I have fixed this issue in commit:
> http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=ah-
> Bug419602&id=f11ebce1c539a36f88affef04f352ea04c8cf0f8

Failing test:

> I have fixed this test in commit:
> http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=ah-
> Bug419602&id=bd5f93bbf4f5b11e6a03c394570df2263b74c317