[ https://issues.apache.org/jira/browse/GROOVY-7413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jochen Theodorou updated GROOVY-7413: ------------------------------------- Labels: usertask (was: ) > String.replaceFirst - bad behavior for null objects > --------------------------------------------------- > > Key: GROOVY-7413 > URL: https://issues.apache.org/jira/browse/GROOVY-7413 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Environment: * > Reporter: Maik Igloffstein > Labels: usertask > > h3. Unit-Tests > {code} > assert "tEst" == "test".replaceFirst("e", "E"); > assert "tEst" == "test".replaceFirst("e", null); > //throws: java.lang.NullPointerException > assert "tEst" == "test".replaceFirst(null, > "E");//throws: java.lang.NullPointerException > assert "tEst" == "test".replaceFirst(null, > null);//throws: java.lang.NullPointerException > {code} > h3. Solutions > In my private opinion, throwing a null pointer exception isn't the best way > here. > possible Solutions: > * IllegalArgumentException > * no replacement - just return and do nothing -- This message was sent by Atlassian JIRA (v6.3.4#6332)