3
respostas

Aula5 - WebService OutputStream - Buffer overflow, no available space

Na aula5 quando executo o comando de getOutputStream recebo o erro abaixo, conseguem me ajudar?

try {
            URL url = new URL("https://www.caelum.com.br/mobile");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();


            connection.setRequestProperty("Content-type", "application/json");
            connection.setRequestProperty("Accept", "application/json");
            connection.setDoOutput(true);

            PrintStream output = new PrintStream(connection.getOutputStream()); ///// ERRO NESSA LINHA
            output.println(json);

            connection.connect();

            Scanner sc = new Scanner(connection.getInputStream());
            String resposta = sc.next();
            return resposta;
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
2019-02-14 23:30:39.069 32318-12093/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
    com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream
        at com.google.android.apps.gsa.staticplugins.microdetection.d.k.a(SourceFile:91)
        at com.google.android.apps.gsa.staticplugins.microdetection.d.l.run(Unknown Source:14)
        at com.google.android.libraries.gsa.runner.a.a.b(SourceFile:32)
        at com.google.android.libraries.gsa.runner.a.c.call(Unknown Source:4)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.google.android.apps.gsa.shared.util.concurrent.b.g.run(Unknown Source:4)
        at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4)
        at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
        at com.google.android.apps.gsa.shared.util.concurrent.b.i.run(SourceFile:6)
     Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
        at com.google.android.apps.gsa.speech.audio.Tee.j(SourceFile:103)
        at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2)
        at java.io.InputStream.read(InputStream.java:101)
        at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:17)
        at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at com.google.android.apps.gsa.shared.util.concurrent.b.g.run(Unknown Source:4) 
        at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) 
        at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
        at com.google.android.apps.gsa.shared.util.concurrent.b.i.run(SourceFile:6) 
3 respostas

Olá Fábio, tudo bom?

Cara, não consegui identificar nenhum problema no seu código, até testei no que desenvolvi durante o curso, e tive o resultado correto

Você pode disponibilizar sua classe completa? ou se preferir, manda o link do GitHub

Ola @Alessandro, Obrigado por responder. Eu acredito que o erro não seja no código, mas talvez alguma configuração por conta da versão, Pois usei o código do curso disponibilizado no GIT e tive o mesmo erro.

Não foi nada Fabio

Me manda o link do seu repositório, e vejo se encontro uma solução