Forum Discussion

depeche's avatar
depeche
Contributor
15 years ago

groovy.lang.MissingMethodException: No signature of method: java.lang.String.pos

Hi
    I am getting error in the groovy script if i am declaring string message as follows:


String msg = "MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01||P|2.2\r"
                + "PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r"


ERROR:

groovy.lang.MissingMethodException: No signature of method: java.lang.String.positive() is applicable for argument types: () values: [] Possible solutions: notify(), size(), tokenize()

regards,
  depeche
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Move the "+" to the first line.

    Groovy is interpreting this as 2 separate lines, thus it is trying to apply the "+" (positive operator) to a
    String on the second line and this doesn't work. Putting the operator at the end of the first line tells
    it that the line is not finished.