2 Replies Latest reply: Oct 13, 2012 2:30 AM by sabre150 RSS

    New to java and have an unexplained problem

    968088
      I found the following problem in the URLDecoder.decode function.

      Is this normal behavior of is Java really a Microsoft product where bugs are normal behavior and will not be resolved with the comment “you have to live with it” and then not be able to use the functionality.

      This is problem is all known by oracle since 2001 and what is the workaround for this problem i can't find it anywhere.

      String DecMagTitleString;
      DecMagTitleString = URLDecoder.decode("New+ScientistOctober132012", "UTF-8");     
      String index out of range: -1
      DecMagTitleString = URLDecoder.decode("New+ScientistOctober1320122", "UTF-8");     
      Works Fine

      PS : I am new to java only programming in Java for 3 Months can someone help me.

      Details :
      OS : Windows (DOS)
      Java : javac 1.7.0_03
        • 1. Re: New to java and have an unexplained problem
          rp0428
          Welcome to the forum!
          >
          This is problem is all known by oracle since 2001 and what is the workaround for this problem i can't find it anywhere.

          String DecMagTitleString;
          DecMagTitleString = URLDecoder.decode("New+ScientistOctober132012", "UTF-8");
          String index out of range: -1
          DecMagTitleString = URLDecoder.decode("New+ScientistOctober1320122", "UTF-8");
          Works Fine
          >
          What is the basis of your statement?
          >
          This is problem is all known by oracle since 2001
          >
          Post a web link or doc citation.

          Both of those examples work just fine in XP sp3 using JDK 1.6.0_22
          • 2. Re: New to java and have an unexplained problem
            sabre150
            What's the betting that the index out of range exception is nothing at all to do with URLDecoder and happens on a different line than the one indicated. I'm always fascinated when newcomers to Java jump to the conclusion that errors exhibited by their code are due to bugs in Java and are not due to bugs in their code.