Gradle 1.3 wrapper java.io.UnsupportedEncodingException

Just tried 1.3 via the wrapper and it fails with:

% ./gradlew clean
     FAILURE: Build aborted because of an internal error.
  * What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.
  * Try:
Run with --debug option to get additional debug info.
  * Exception is:
java.io.UnsupportedEncodingException:
  at java.lang.StringCoding.decode(StringCoding.java:190)
 at java.lang.String.<init>(String.java:416)
 at java.lang.String.<init>(String.java:481)
 at net.rubygrapefruit.platform.internal.jni.TerminfoFunctions.initTerminal(Native Method)
 at net.rubygrapefruit.platform.internal.TerminfoTerminal.init(TerminfoTerminal.java:27)
 at net.rubygrapefruit.platform.internal.WrapperTerminal.init(WrapperTerminal.java:25)
 at net.rubygrapefruit.platform.internal.AbstractTerminals.getTerminal(AbstractTerminals.java:19)
 at org.gradle.internal.nativeplatform.console.NativePlatformConsoleDetector.getConsole(NativePlatformConsoleDetector.java:42)
 at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:32)
 at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:27)
 at org.gradle.logging.internal.OutputEventRenderer.attachConsole(OutputEventRenderer.java:68)
 at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(DefaultLoggingManager.java:149)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:168)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
 at org.gradle.launcher.Main.doAction(Main.java:48)
 at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
 at org.gradle.launcher.Main.main(Main.java:39)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
 at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
 at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
 at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

can you give us more information about your environment (perhaps run “gradle -v” with a prior gradle version) ?

cheers, René

% gradle -v
  ------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------
  Gradle build time: mercoled? 12 settembre 2012 10.46.02 UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0_07 (Oracle Corporation 23.3-b01)
OS: Mac OS X 10.8.2 x86_64

I’ve created a bug for this in the gradle issue tracker. See http://issues.gradle.org/browse/GRADLE-2564 I keep you up to date about the progress.

I’m getting the following exception with Gradle 1.3 (test is a custom task in this case):

$ ./gradlew -i test

FAILURE: Build aborted because of an internal error.

* What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

* Try:
Run with --debug option to get additional debug info.

* Exception is:

net.rubygrapefruit.platform.NativeException: Could not open terminal for stdout: could not create locale

at net.rubygrapefruit.platform.internal.TerminfoTerminal.init(TerminfoTerminal.java:29)

at net.rubygrapefruit.platform.internal.WrapperTerminal.init(WrapperTerminal.java:25)

at net.rubygrapefruit.platform.internal.AbstractTerminals.getTerminal(AbstractTerminals.java:19)

at org.gradle.internal.nativeplatform.console.NativePlatformConsoleDetector.getConsole(NativePlatformConsoleDetector.java:42)

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:32)

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:27)

at org.gradle.logging.internal.OutputEventRenderer.attachConsole(OutputEventRenderer.java:68)

at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(DefaultLoggingManager.java:149)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:168)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:26)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

This reply was created from a merged topic originally titled net.rubygrapefruit.platform.NativeException: Could not open terminal for stdout: could not create locale.

Hi Evgeny, I merged your problem into this thread here. There seems to be a problem with encoding.

Thanks - BTW my terminal is UTF-8

Many thanks, Rene!

Can you give us the value of your $LANG, $LC_ALL and $LC_CTYPE environment variables?

Can you give us the value of your $LANG, $LC_ALL and $LC_CTYPE environment variables?

Also, the output of gradlew -v would be useful.

Hey guys, Adam just posted some workarounds for this issue on the gradle dev list:

Some workarounds: > * Tweak your LANG environment variable to include an encoding: e.g.

change en_AU to en_AU.UTF-8 > * Run Gradle with GRADLE_OPTS=-Dorg.gradle.native=false to disable the

new native stuff (but don’t forget to remove it after you upgrade to

Gradle 1.4). The switch has to be in GRADLE_OPTS, it won’t work if you

run gradle -Dorg.gradle.native=false or add it to your gradle.properties. > * Wait for a Gradle snapshot with a fix in the near future.

hope that helped.

Thanks Rene - using LANG=en_GB.UTF-8 solves it for me.

I have just encountered this running in an Ubuntu VM having switched from 1.0-rc-3 to 1.3. $LANG=en_US.UTF-8, and GRADLEOPTS made no diffs. Tried with 1.4 - same issue (with GRADLEOPTS removed) Reverted to 1.2 and works ok. So this still seems to be an issue in 1.4 In my case $LC_ALL and $LC_TYPE are both blank/undefined.

FAILURE: Build aborted because of an internal error.
  * What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.
  * Try:
Run with --debug option to get additional debug info.
  * Exception is:
net.rubygrapefruit.platform.NativeException: Could not open terminal for stdout: could not create locale
 at net.rubygrapefruit.platform.internal.TerminfoTerminal.init(TerminfoTerminal.java:29)
 at net.rubygrapefruit.platform.internal.WrapperTerminal.init(WrapperTerminal.java:25)
 at net.rubygrapefruit.platform.internal.AbstractTerminals.getTerminal(AbstractTerminals.java:19)
 at org.gradle.internal.nativeplatform.console.NativePlatformConsoleDetector.getConsole(NativePlatformConsoleDetector.java:42)
 at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:32)

Sorry above I had checked $LC_TYPE not $LC_CTYPE which was set to UTF-8. If I unset it in my .profile then both 1.3 and 1.4 works :slight_smile: