Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4741

VerifyError: Expecting to find integer on stack

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8-rc-3
    • 1.8-rc-4
    • Compiler
    • None

    Description

      Hi, I have the same issue as in GROOVY-4587.

      For the inputs

      [0.0], [], [], [543]
      

      the function-code below does throw an Exception which can be fixed by changing

      if (ReWK < 0) {
      

      to

      if (((int)ReWK) < 0) {
      

      Seems like a bug to me or am I doing it wrong? Various other inputs run fine.

      Gesamtbetrag,Direktabzug,Prozent,Einzelbetrag->                                                               
      
      def int ReWK = 0
      def arrAbzWK = []; 
      
      Gesamtbetrag.eachWithIndex {
                                                                  
      	it, index ->                                                                                                          
         
      	if(Gesamtbetrag[index] > 0){ 
      
      		                                               
              	if(Prozent[index] != 0 && Prozent[index] != null) {  
      			ReWK = Math.ceil( Gesamtbetrag[index] * (100 - Prozent[index]) / 100 ) 
      
      		} else if (Direktabzug[index] > 0 ) {           
               
      			ReWK = Math.ceil( Gesamtbetrag[index] - Direktabzug[index] )    
               
      			if (ReWK < 0) { 
      				ReWK = 0
      			}                                     
      
               	} 
                      else if (Einzelbetrag[index] > 0) { 
      			ReWK = Math.ceil( Einzelbetrag[index] )                                                                           		
      		} else {			
      			ReWK = 0	
      		}                                                                                     
         	}                                                                                  
                                                                                                                 
         	arrAbzWK.add(ReWK)    
                                                                                     
      }
      
      return arrAbzWK 
      

      Attachments

        1. gmaven-1.3.tgz
          2.43 MB
          David Hansmann
        2. test.groovy
          0.9 kB
          David Hansmann

        Activity

          People

            blackdrag Jochen Theodorou
            dhansmann David Hansmann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: