BUG: Visual J++ 6.0 May Crash When Opening a Large Java File

ID: Q194901

The information in this article applies to:

SYMPTOMS

Visual Studio may crash while attempting to open a very large Java source file, or a project that contains a very large Java source file.

CAUSE

While processing the Java source code an internal stack overflow error may occur and cause Visual Studio to crash.

RESOLUTION

This can be avoided by breaking up any overly large Java class, method, or code block into smaller parts.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

This problem happens when processing Java source code with many thousands of statements in a single block. Although programmers typically don't produce such large blocks of code, an automated process or program generator may produce code that the editor will fail to process.

Steps to Reproduce Behavior

The following program will generate a file called "BadFile.java" when run. Opening the generated file "BadFile.java" will result in a crash in Visual Studio.

   public class MakeBadFile {
     public static void main(String args[])
     {
        try
        {
          java.io.FileOutputStream stream;
          stream=new java.io.FileOutputStream("BadFile.java");
          java.io.PrintStream ps = new java.io.PrintStream(stream);
          ps.println("class BadFile {");
          ps.println("  public static void main(String args[]) {");
          for (int i=0;i<70000;i++)
            ps.println("    System.out.println("+i+");");
          ps.println("  }");
          ps.println("}");
          stream.flush();
          stream.close();
        } catch (Exception ex) {
          ex.printStackTrace();
       }
     }
   }

REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/ 
   http://support.microsoft.com/support/java/ 

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Derek R. Smith, Microsoft Corporation.

Additional query words:

Keywords          : kbide kbInternet kbVJ kbVJ600bug 
Version           : WINDOWS:6.0
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbpending

Last Reviewed: October 29, 1998