leehaut opened a new issue, #8650:
URL: https://github.com/apache/hop/issues/8650

   ### Apache Hop version?
   
   2.20.0-SNAPSHOT
   
   ### Java version?
   
   jdk 21
   
   ### Operating system
   
   Windows
   
   ### What happened?
   
   ### What happened?
   
   Adding a project from existing sources fails on OK with:
   
   <img width="500" height="262" alt="Image" 
src="https://github.com/user-attachments/assets/18603b21-ce34-4034-977b-c214e7c37d9e";
 />
   
   ```text
   org.apache.hop.core.exception.HopException:
   Project 'hop_demo' cannot reference 'default' as parent project because we 
are going to create a circular reference!
   
        at 
org.apache.hop.projects.project.ProjectDialog.ok(ProjectDialog.java:893)
        at 
org.apache.hop.projects.gui.ProjectsGuiPlugin.addProjectFromExistingSourcesInternal(ProjectsGuiPlugin.java:1176)
   ```
   
   There is no real cycle. `hop_demo` is a new project whose parent is the 
standard parent `default`, and `default` has no parent.
   
   This worked before #8583. That change added an 
`equalsIgnoreCase(oriProjectName)` check so a rename can still detect a cycle 
against the old name. A new project has an empty original name, and the shipped 
`default` project stores `"parentProjectName": ""`. `"".equalsIgnoreCase("")` 
is true, so the dialog treats “no parent” as a cycle.
   
   ### Steps to reproduce
   
   1. Start Hop GUI with the standard `default` project registered as the 
standard parent project.
   2. Confirm `config/projects/default/project-config.json` contains 
`"parentProjectName": ""`.
   3. Project toolbar → Add → Add project from existing sources.
   4. Set the name to `hop_demo` and a valid home folder. Leave the parent as 
`default`.
   5. Click OK.
   
   ### Expected
   
   The project is created with parent `default`. An empty `parentProjectName` 
means “no parent” and must not be treated as a circular reference.
   
   A real cycle must still be rejected, including after a rename: if project A 
is renamed and its parent’s parent is still the old name of A, OK should fail.
   
   ### Cause
   
   `ProjectDialog.ok` after #8583:
   
   ```java
   String grandParentName = parentPrj.getParentProjectName();
   if (grandParentName != null
       && (grandParentName.equalsIgnoreCase(projectName)
           || grandParentName.equalsIgnoreCase(oriProjectName)))
   ```
   
   For a new project, `oriProjectName` is `""` (`new ProjectConfig("", ...)` in 
`ProjectsGuiPlugin.addProjectFromExistingSourcesInternal`). The default project 
config has `"parentProjectName": ""`. Both are non-null, so the second 
comparison matches.
   
   Before #8583 the check was only `parentProjectName.equals(projectName)`, 
which does not match `""` against `hop_demo`.
   
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to