Issue Details (XML | Word | Printable)

Key: GROOVY-1958
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Jochen Theodorou
Reporter: Hiroki Taira
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

There's possibility that variable "encoding" is null in CompilerConfiguration.

Created: 28/Jun/07 12:02 PM   Updated: 01/Jul/07 07:17 AM
Component/s: None
Affects Version/s: 1.1-beta-2
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.txt (1 kB)

Environment: $ uname -a
CYGWIN_NT-6.0 hrk-PC 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
$ groovy -v
Groovy Version: 1.1-beta-2-SNAPSHOT JVM: 1.5.0_12-b04

Patch Submitted: Yes


 Description  « Hide
It's expected that "System.getProperty("file.encoding", "US-ASCII")" would be
executed if "System.getProperty("groovy.source.encoding")" threw an exception.
But there's possibility that "System.getProperty("groovy.source.encoding")"
returned null. So it's needed to enclose each "System.getProperty()" in
try-catch block and check the variable "encoding" before
"System.getProperty("file.encoding", "US-ASCII")" and
"setSourceEncoding(encoding)."

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou added a comment - 01/Jul/07 07:17 AM
fixed, the platform default is now used if all things fail and if someone forcefully sets then encoding to null, then US-ASCII is used (Groovy does not expect a null as encoding)