0

I don't understand why this assert fails. And this code output is null: println "The APP_PATH is: ${envMap.get('APP_PATH')}"

**Assertion failed:

assert envMap["APP_PATH"] == "/u/rfhmo002,none,none,none"
       |     |            |
       |     null         false
       [SERVER:rtkr6k01, APP_ID:rfhmo002,none,none,none, APP_SECGRP:rfhmo002,none,none,none, APP_PATH:/u/rfhmo002,none,none,none, APP_BANNER:y,n,n,n,
APP_ARC:retek.a, ORA_PATH:/hbtc11gR2a/HBTCDEV/app/oracle/product/11gR2a, ORA_SID:HBTC2DEV, ORA_SCHEMA:RTK , APP_BANNERX:n,y,y,n, ORA_SIDX:none
,cmsdsaks,cmsdlt, none, CNTLNOPROC:/scripts/bin,none,none,none, COPYCPCC:/oracle/lib/src,none,none,none, CPCOCX:/oracle/proc/sr
c,none,none,none, CPCOCXMQ:/oracle/proc/src,none,none,none, CPCOLCX:/oracle/lib/src,none,none,none, DRVRNOPROC:/scripts/bin,none,none,none, FCNOCX:/or
acle/sqlplus,none,none,none, MAILNOPROC:/interfaces/in,none,none,none, OBSNOPROC:NA, PKGOCXB:/oracle/sqlplus,none,none,none, PKGOCXS:/oracle/sqlplus,n
one,none,none, PRCOCX:/oracle/sqlplus,none,none,none, SCRIPTNOPROC:/scripts/bin,none,none,none, SORTNOPROC:/scripts/bin,none,none,none, SQLNOPROC:/scr
ipts/bin,none,none,none, TRGOCX:/oracle/sqlplus,none,none,none, VIEWOCX:/oracle/sqlplus,none,none,none]

        at read_table.run(read_table.groovy:30)**
Jirong Hu
  • 2,315
  • 8
  • 40
  • 63
  • Does `envMap` have string keys? `envMap.keySet()*.getClass()` – tim_yates Feb 16 '17 at 21:09
  • @tim_yates envMap.keySet()*.getClass()=class org.codehaus.groovy.runtime.GStringImpl – Jirong Hu Feb 16 '17 at 22:10
  • Works after changing to envMap.put("$line.ID".toString(), "$line.DEV".toString()) – Jirong Hu Feb 16 '17 at 22:16
  • 1
    Right, you've put GStrings in as keys for your map, and are then trying to extract things based on Strings... See http://stackoverflow.com/questions/39141245/why-map-does-not-work-for-gstring-in-groovy, http://stackoverflow.com/questions/31713359/why-are-there-different-behaviors-for-the-ways-of-addressing-gstring-keys-in-map and http://stackoverflow.com/questions/9682206/groovy-different-results-on-using-equals-and-on-a-gstringimpl – tim_yates Feb 16 '17 at 22:17
  • You don't need to convert the Values, just the keys – tim_yates Feb 16 '17 at 22:18
  • Also this section of the documentation is pertinent http://docs.groovy-lang.org/latest/html/documentation/#_gstring_and_string_hashcodes – tim_yates Feb 16 '17 at 22:19

0 Answers0