• java.nio.BufferOverflowException


    Bug ID: 6526175
    Votes 0
    Synopsis Compiler throws BufferOverflowException should 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 

    题:

    在使用maven构建Java开源项目,有时候会遇到BufferOverflowException异常(异常详细信息见后面)。

    是Bug吗?

    在sun的网站上有jdk 1.4.2和jdk 1.6.0 的bug报告,其实这个问题在 jdk 1.5.0_10和jdk 1.5.0_11中也有.

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6526175

    虽然sun不认为这是一个bug,解决建议是增加heap size,就是设置环境变量,增加内存的使用参数值;经过测试,这种解决方法不能有效消除错误的产生。

    其他人是如何解决的?

    从google中找到在其他的apache的项目中出现过同样的异常,但是都没能解决。

    问题产生的原因?

    可能原因是由于字符集使用GBK、UTF-8或者UTF-16导致使用多字节存放字符,内存使用增加,堆(heap)的尺寸无法提供程序所需的空间,造成异常。更深入的分析还在进行中。

    解决方法:

    将操作系统的区域和语言选项中的区域设置为 English 即可!

    辅助的方法是在系统环境变量中增加设置: MAVEN_OPTS=-Xmx512m

  • 相关阅读:
    代码书写的细节
    php中的正则函数主要有三个-正则匹配,正则替换
    2个比较经典的PHP加密解密函数分享
    淘宝运营中的6大致命误区,你犯过么?
    30分钟教你写出10分的淘宝标题
    超全的web开发工具和资源
    转化率不好?告诉你转化飙秘诀
    帮你店铺日销千单的20个淘宝小技巧
    不刷单,中小卖家如何提升店铺流量?
    使用Flexible实现手淘H5页面的终端适配
  • 原文地址:https://www.cnblogs.com/jiahuafu/p/1767214.html
Copyright © 2020-2023  润新知