Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Method thinks string is a list - not sure why

Options
  • 05-08-2014 1:58pm
    #1
    Registered Users Posts: 5,533 ✭✭✭


    Enclosed at bottom of this are 2 methods that i call one by one. The string returned in the first is used as a parameter in the second.However i get the following error.It seems to think i am passing an array or list to the second method but i cant understand how?



    No signature of method: static com.company.product.rv.operators.ImportOperator.runImport() is applicable for argument types: (java.lang.String) values: [LTEE119-V2x160-RV-FDD-LTE01_create.xml



    public String listImportFiles(){

    cliCommandHelper.openShell()

    cliCommandHelper.execute

    "ls /cloud_network_xmls/ | grep create | egrep \"this|that\""

    String outputList = cliCommandHelper.getStdOut()

    log.debug

    "OutputList is $outputList"



    return outputList

    }





    public boolean runImport(String filesList){

    return false
    }


Comments

  • Registered Users Posts: 930 ✭✭✭aperture_nuig


    Enclosed at bottom of this are 2 methods that i call one by one. The string returned in the first is used as a parameter in the second.However i get the following error.It seems to think i am passing an array or list to the second method but i cant understand how?



    No signature of method: static com.company.product.rv.operators.ImportOperator.runImport() is applicable for argument types: (java.lang.String) values: [LTEE119-V2x160-RV-FDD-LTE01_create.xml



    public String listImportFiles(){

    cliCommandHelper.openShell()

    cliCommandHelper.execute

    "ls /cloud_network_xmls/ | grep create | egrep \"this|that\""

    String outputList = cliCommandHelper.getStdOut()

    log.debug

    "OutputList is $outputList"



    return outputList

    }





    public boolean runImport(String filesList){

    return false
    }

    Could you use the Code tags to warp your code and format it to make it easier to read? I assume this is Java?


  • Registered Users Posts: 5,533 ✭✭✭veryangryman


    Could you use the Code tags to warp your code and format it to make it easier to read? I assume this is Java?

    Figured it out, the calling program called it by static object reference rather than variable name (a simple change of capital to small o for object fixed this)

    e.g.

    Object object = new Object();
    Object.doThings()


    5 hours of my life i'll never get back. :(


  • Closed Accounts Posts: 2,537 ✭✭✭Arthur Beesley


    Include the code that calls the methods.

    Is there a static runImport method?


  • Closed Accounts Posts: 2,267 ✭✭✭h57xiucj2z946q


    Sounds like a rookie mistake. This is why giving variables meaningful names as opposed to same name as class type is important. It could have helped avoid this.

    Unrelated to thread question but why are you using shell commands to list files in a dir when this can be done via java itself ?


    More info:
    https://blogs.oracle.com/thejavatutorials/entry/pathmatcher_in_nio_2
    http://docs.oracle.com/javase/tutorial/essential/io/find.html


Advertisement