[ 
https://issues.apache.org/jira/browse/CAMEL-22028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17948156#comment-17948156
 ] 

Thomas Diesler edited comment on CAMEL-22028 at 4/29/25 2:43 PM:
-----------------------------------------------------------------

I propose an addition check at the low level export command, like this ...

{code}
    private void verifyExportFiles() throws FileNotFoundException {
        for (var fn : files) {
            if (fn.indexOf(':') < 0 || fn.startsWith("file:")) {
                if (fn.startsWith("file:")) {
                    fn = fn.substring(5);
                    if (fn.startsWith("//")) {
                        fn = fn.substring(2);
                    }
                }
                if (fn.endsWith("/*")) {
                    fn = fn.substring(0, fn.length() - 2);
                }
                if (!Paths.get(fn).toFile().exists()) {
                    throw new FileNotFoundException("Path does not exist: " + 
fn);
                }
            }
        }
    }
{code}


was (Author: tdiesler):
I prpose an addition check at the low level export command, like this ...

{code}
    private void verifyExportFiles() throws FileNotFoundException {
        for (var fn : files) {
            if (fn.indexOf(':') < 0 || fn.startsWith("file:")) {
                if (fn.startsWith("file:")) {
                    fn = fn.substring(5);
                    if (fn.startsWith("//")) {
                        fn = fn.substring(2);
                    }
                }
                if (fn.endsWith("/*")) {
                    fn = fn.substring(0, fn.length() - 2);
                }
                if (!Paths.get(fn).toFile().exists()) {
                    throw new FileNotFoundException("Path does not exist: " + 
fn);
                }
            }
        }
    }
{code}

> camel-jbang - Regression with missing routes file
> -------------------------------------------------
>
>                 Key: CAMEL-22028
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22028
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Thomas Diesler
>            Assignee: Thomas Diesler
>            Priority: Major
>             Fix For: 4.12.0
>
>
> An invalid routes file should produce: ERROR: Project export failed!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to