Java. NiO. bufferoverflowexception

Source: Internet
Author: User
Bug ID: 6526175
Votes 0
Synopsis Compiler throws bufferoverflowexception shocould say that it ran out of memory
Category Java: Compiler
Reported against  
Release fixed
State 5-cause known, Request for enhancement
Priority: 3-Medium
Related bugs
Submit date 16-feb-2007
Description
FULL PRODUCT VERSION :java version "1.6.0"Java(TM) SE Runtime Environment (build 1.6.0-b105)Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)ADDITIONAL OS VERSION INFORMATION :windows xp service pack 2A DESCRIPTION OF THE PROBLEM :i use maven to compile struts source code , it always throw  the BufferOverflowException.ERROR MESSAGES/STACK TRACES THAT OCCUR :java.nio.BufferOverflowException        at java.nio.Buffer.nextPutIndex(Buffer.java:495)        at java.nio.HeapCharBuffer.put(HeapCharBuffer.java:145)        at com.sun.tools.javac.util.DefaultFileManager.decode(DefaultFileManager.java:726)        at com.sun.tools.javac.util.DefaultFileManager.access$300(DefaultFileManager.java:72)        at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:1243)        at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:1142)        at com.sun.tools.javac.main.JavaCompiler.readSource(JavaCompiler.java:483)        at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)        at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:801)        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)        at com.sun.tools.javac.main.Main.compile(Main.java:353)        at com.sun.tools.javac.main.Main.compile(Main.java:279)        at com.sun.tools.javac.main.Main.compile(Main.java:270)        at com.sun.tools.javac.Main.compile(Main.java:87)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:400)        at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:136)        at org. customer .maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:483)        at org. customer .maven.plugin.CompilerMojo.execute(CompilerMojo.java:111)        at org. customer .maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)        at org. customer .maven.DefaultMaven.doExecute(DefaultMaven.java:322)        at org. customer .maven.DefaultMaven.execute(DefaultMaven.java:115)        at org. customer .maven.cli.MavenCli.main(MavenCli.java:256)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)REPRODUCIBILITY :This bug can be reproduced always.Posted Date : 2007-02-16 22:55:14.0
Work around
N/A
Evaluation
This is not a bug in the compiler.  The compiler runs out of memory and theresolution is to increase heap size.However, the compiler should provide better diagnostics for such problems andI have accepted this as a request for enhancement 

 

Question:

When using Maven to build a Java open-source project, bufferoverflowexceptio is sometimes encountered.N exception (see the exception details below ).

Is it a bug?

There are JDK 1.4.2 and JDK 1.6.0 bug reports on Sun's website. In fact, this issue also exists in JDK 1.5.0 _ 10 and JDK 1.5.0 _ 11.

Http://bugs.sun.com/bugdatabase/View_bug.do? Bug_id = 6526175

Although Sun does not regard this as a bug, it is recommended to increase the heap size, that is, to set environment variables and increase the memory usage parameter value. After testing, this solution cannot effectively eliminate errors.

How did others solve the problem?

I found the same exception in other Apache projects from Google, but none of them can be solved.

Why?

It may be because the character set uses GBK, UTF-8, or UTF-16 to store characters in multiple bytes, memory usage increases, and heap sizes cannot provide the space required by the program, resulting in exceptions. Further analysis is in progress.

Solution:

Set the region in the operating system and language options to English!

The auxiliary method is to add the settings in the system environment variable: maven_opts =-xmx512m

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.