Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4096456

java.lang.StringBuffer.getChars() does not work according with the spec

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: mgC56079 Date: 12/02/97


      The method StringBuffer.getChars(int srcBegin, int srcEnd, char[]dst, int dstBegin)
      does not match the spec.
      The JLS v1.0 (20.13.11) says that the exception will be thrown if srcBegin > srcEnd.
      The implementation does nothig in this case.

      --- Here is the example (S.java) ---
      public class S {
        public static void main(String ar[]) {
          StringBuffer sb=new StringBuffer("String");
          char[] arr=new char[10];
          sb.getChars(1,0,arr,0); //expecting exception
        }
      }

      This test should throw an exception.

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apalanissunw Anand Palaniswamy (Inactive)
              Reporter:
              mgorshen Mikhail Gorshenev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: