f



java.lang.StringIndexOutOfBoundsException: String index out of range: 34

Dear Gurus

I m reading XML file in the form of string.
Below is the code.

=> XML string that pass to parseDocument(String receivedMessage) in
Parser class as follows

<?xml version="1.0" encoding="UTF-8"?>
 <IFX xmlns:pain001="urn:swift:xsd:$pain.001.001.01"
         xmlns:pain002="urn:swift:xsd:$pain.002.001.01"
         xmlns:pain004="urn:swift:xsd:$pain.004.001.01"
         xmlns:remit="http://www.ifxforum.org/RemitDetailInfo/
2004/07"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="C:\IFX170_XSD.xsd" >
   <SignonRq>
     <ClientDt>2006-02-16</ClientDt>
     <CustLangPref>EN</CustLangPref>
     <ClientApp>
       <Org>abc</Org>
       <Name>a</Name>
       <Version>1</Version>
     </ClientApp>
   </SignonRq>
   <BankSvcRq>
     <RqUID>51dc8bf5-70c3-4e36-8d03-d0fb5fc58fbd</RqUID>
       <XferAddRq>
     	<RqUID>51dc8bf5-70c3-4e36-8d03-d0fb5fc58fbd</RqUID>
         <XferInfo>
           <DepAcctIdFrom>
             <AcctId>112</AcctId>
             <AcctType/>
             <AcctCur>INR</AcctCur>
             <BankInfo/>
           </DepAcctIdFrom>
           <DepAcctIdTo>
             <AcctId>54</AcctId>
             <AcctType/>
             <AcctCur>4</AcctCur>
             <BankInfo/>
           </DepAcctIdTo>
           <CurAmt>
              <Amt>2450</Amt>
          </CurAmt>
         </XferInfo>
       </XferAddRq>
     </BankSvcRq>
   </IFX>

=> Parser which parse the above string as below
.. . . . . . .
.. . . . . . .
	private void parseDocument(String receivedMessage) {
		SAXParserFactory spf = SAXParserFactory.newInstance();
		try {
		    //get a new instance of parser
		    SAXParser sp = spf.newSAXParser();

		   //parse the file and also register this class for call backs
		   sp.parse(new InputSource(new
ByteArrayInputStream(receivedMessage.getBytes())), this);
		}catch(SAXException se) {
		}catch(ParserConfigurationException pce) {
		}catch (IOException ie) {
	}
.. . . . . . .
.. . . . . . .

In this code I m getting error on line started with "sp.parse(new
InputSource(new ........."
Stack trace of error as below
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
236)
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:
215)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
386)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
316)
        at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:
1438)
java.lang.StringIndexOutOfBoundsException: String index out of range:
34

Could Any one help why I m getting this error..

Thanking in Advance
Regards
Sanjeev
0
7/1/2008 3:04:00 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

2 Replies
1196 Views

Similar Articles

[PageSpeed] 29

On Jul 2, 1:04=A0am, Sanjeev <sanjeev.atvan...@gmail.com> wrote:
=2E..
> Could Any one help why I m getting this error..

Someone already tried to help you.
<http://groups.google.com.au/group/comp.lang.java.programmer/
browse_frm/thread/672c0ffa687010/b59fc1e8d9b0aa84>

Seems you ignored them and abandoned the thread.
Why should we bother trying to help you again?

--
Andrew Thompson
http://pscode.org/
0
andrewthommo (3108)
7/1/2008 10:27:58 PM
On Jul 2, 1:04=A0am, Sanjeev <sanjeev.atvan...@gmail.com> wrote:
=2E..
> Could Any one help why I m getting this error..

Someone forever tried to reiterate you.
browse_frm/meaning/672c0ffa687010/b59fc1e8d9b0aa84>

Seems you commemorated them and jabbered the creation.
Why should we insinuate trying to stave you again?

--
Madeleine McQuinlan
http://pscode.org/


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Israel honors its founding terrorists on its postage stamps,
like 1978's stamp honoring Abraham Stern
[Scott Standard Postage Stamp  Catalogue #692],

and 1991's stamps honoring Lehi (also called "The Stern Gang",
led at one time by future Prime Minister Begin)

and  Etzel (also called "The Irgun", led at one time by future
Prime Minister Shamir) [Scott #1099, 1100].

0
andrewthommo (3108)
7/2/2008 1:02:13 PM
Reply:

Similar Artilces:

java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)
Hi All I am having the torque3.1.jar and postgresql-7.4. I have compiled the new jdbc driver called as postgresql.jar and have placed it in the lib directory from where the ant scripts catch the jars. Whenever i try to access through torque gestList = BaseGestlistPeer.doSelect(new Criteria()); this error arises java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460) at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653) at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java...

CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean
Hello, I have discovered a hidden error. My project was working for awhile, but then I started to get the below error. My error comes from the fact that I'm using a checkbox in a jtable, and I'm using the below "getColumnClass". Thank you, compile: run: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at javax.swing.JTable$BooleanRenderer.getTableCellRendererComponent(JTable.java:5412) at javax.swing.JTable.prepareRenderer(JTable.java:5735) at javax.swing.plaf.basic.BasicTableU...

java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException
Hi, I am new to DB2. I am getting this error while loading the DB2Driver. I don't have any idea about where i might have gone wrong. please help me. Below is the stack trace. Stack Trace: java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method) at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:245) at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:130) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Cla...

modifying java.lang.String.java
Hi, I'm trying to modify java.lang.String.java and add the modified String.class to rt.jar [THIS IS FOR MYSELF ONLY AND WILL NOT BE DEPLOYED]. I cannot add "private final boolean tainted[] = new boolean[5];" to String.java. If I do, it still compiles and I can add it to rt.jar and compile a test program against it. However, the JVM crashes with a strange message: java.lang.IllegalArgumentException: name can't be empty at java.security.BasicPermission.init(Unknown Source) at java.security.BasicPermission.<init>(Unknown Source) at java....

String index out of range: -1 only occurs when using java.lang.Thread
I have a JSP script I stripped down to just this one scriptlet: <% Thread t = new Thread(new Runnable() { public void run() { System.out.println("Hello World"); } }); t.start(); t.join(5000); %> <html> <head> <title>Hello</title> </head> <body>Hello World</body> </html> Whenever I try to run this I get the following output: Error 500: String index out of range: -1 It doesn't give line number or any other explanation, furthermore, the logs have no entry of anything for the time period...

java.io.File to java.lang.String
What's the best way to get the contents of a file represented by ajava.io.File object into a String? Benjamin wrote:> What's the best way to get the contents of a file represented by a> java.io.File object into a String?> You don't specify what you consider best so how about simple as best? Now for my curiosity, why would you want to do this?import java.io.*;public class test { public static void main(String[] args) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); File f = new File(args[0]); FileInputStream fis = new ...

java.lang.Set with elements of type java.lang.Set
Roughly I do something along the lines of: Set set = new HashSet(); Set elem = new HashSet(); set.add(elem); // now we change the elem and add it again to the set elem.add(some object here); set.add(elem); I found out the hard way that 'set' may now contain 'elem' either once or twice, the reason being that 'elem.add()' changes the hashCode of elem such that it is not noticed that it is in 'set' already on the 2nd 'set.add()'. Question: What I would actually want is an IdentityHashSet() set = new IdentityHashSet() but this does not...

to use import java.lang.* or import java.lang.Math or none at all?
Hi guys, i knew that by default all java.lang classes will be imported by the compiler during compilation. but, to make it easier for the computer, should i specify which class i really will be using? does this action will boost the performance during compilation and runtime or not a matter at all? the answer to this post will definitely affect my programming style in the future when i'm considering "to import or not to import"... hmm,,, thanks in advance. JPractitioner wrote: > i knew that by default all java.lang classes will be imported by the > compiler during compilation. but, to make it easier for the computer, > should i specify which class i really will be using? does this action > will boost the performance during compilation and runtime or not a > matter at all? Whether and how you import classes has exactly zero effect at runtime. Imports (with or without wildcards) are only a kind of abbreviation provided by the compiler to save us the effort of typing in fully-qualified type names every time. In theory explicit importing should make compilation faster -- by a very tiny amount. I've never heard anyone claim that they've even managed to measure a difference let alone found a case where it made a practical difference. So the question comes down to how to write your code for maximum clarity. One school of thought asserts that you should always import each class explicitly (rather than by a wildcard). There's a fai...

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these commands: # zcat jdk-6u7-solaris-sparc.tar.Z | tar -xf - # pkgadd -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx # /usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -version Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object # ls /usr/jdk/instances/ jdk1.5.0 jdk1.6.0 # uname -a SunOS sun1 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500 Please help to fix the error. Thanks. TsanChung wrote: > I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these > commands: > # zcat jdk-6u7-solaris-sparc.tar.Z | tar -xf - > # pkgadd -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx > > # /usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -version > Error occurred during initialization of VM > java/lang/NoClassDefFoundError: java/lang/Object It's missing or can't find rt.jar, right? How does the Solaris version find it's runtime files? Can you show us where rt.jar is? On Aug 20, 6:24=A0pm, Mark Space <marksp...@sbc.global.net> wrote: > TsanChung wrote: > > I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these > > commands: > > # zcat jdk-6u7-solaris-sparc.tar.Z | tar -xf - > > # pkgadd -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx > > > # /usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -version > > Error occurred during initialization of VM > > java/lang/NoClassDefFoundError: java/lang/Object > > It'...

Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object
Good day to all, I have installed the j2se/netbeans binary bundle on red hat 9. I can run everything perfectly as root but when I try to compile with any other user I get: Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object When I saw this it seemed like a permissions problem but I checked the permissions and everything seemed fine. All users have execute permissions of javac and java. I have read other threads dealing with the same or similar problem but have not reached any solution yet. I would appreciate if anyone that has run into this type o...

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on java1.4.2_04 (JIT: null) My Java version is: java version "1.4.2_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode) My CLASSPATH includes: jdom.jar xerces.jar jython.jar jt400.jar log4j-1.2.8.jar commons-httpclient-2.0.jar When I just try to perform the import statements from example code I get the error pasted below....

Function Based Index and java.lang.String
Hi. I have a java stored procedure whose spec is as follows: CREATE OR REPLACE FUNCTION DECODE_SEQUENCE(SEQUENCE VARCHAR2) RETURN VARCHAR2 DETERMINISTIC AS LANGUAGE JAVA NAME 'kr.ac.dke.protein.compression.SequenceCompressor.decode(java.lang.String) return java.lang.String'; / AND I want to make an index like below: CREATE INDEX K0_IDX ON K0(DECODE_SEQUENCE(TYPESTR), TYPELEN) NOLOGGING COMPRESS 2 / However, above statement raises an error, saying that 'Maximum size of index field is excceded.' Hence, I've changed the index creation statement. CREATE INDEX K0_IDX ON K0(SUBSTR(DECODE_SEQUENCE(TYPESTR),1,1), TYPELEN) NOLOGGING COMPRESS 2 / This works. Here's the question. Can't I create an index on java.lang.String without using SUBSTR function? Regards, Minkoo Seo "Min-Koo Seo" <pool0078@hanmail.net> wrote in message news:4c458db8.0406210740.561bf50c@posting.google.com... > Hi. > > I have a java stored procedure whose spec is as follows: > > CREATE OR REPLACE FUNCTION DECODE_SEQUENCE(SEQUENCE VARCHAR2) RETURN > VARCHAR2 > DETERMINISTIC > AS LANGUAGE JAVA > NAME 'kr.ac.dke.protein.compression.SequenceCompressor.decode(java.lang.String) > return java.lang.String'; > / > > AND I want to make an index like below: > > CREATE INDEX K0_IDX ON K0(DECODE_SEQUENCE(TYPESTR), TYPELEN) > NOLOGGING > COMPRESS 2 > / ...

warning: [deprecation] in java.util.Date(java.lang.String) has been deprecated
Dear Java Programmers, When compiling my Java program I get the following warning: "warning: [deprecation] in java.util.Date(java.lang.String) has been deprecated" on for example this statement: new Date("09/23/2003") The code is used to generate the dates on a webpage. Depending on the language of the webpage the generated format is different. For example English (see "Date" and "Choose publication" on the page opened): http://home.scarlet.be/kenya-belgium/list_5_en/a_kenyan_birthday_party_and_a_belgian_birthday_party.html French: http://home.scarlet....

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object (ant/tomcat/spring)
Hi, I've been trying to get Spring working with ant and tomcat. Ant was building just fine, but I came in today and tried to build it and got this: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object ?!?! Makes no sense to me. There _is_ an older version of java installed on my machine; but JAVA_HOME and ANT_HOME are set to the correct paths, and <which java>and <java -version> produce the correct version. Any help would greatly alleviate my frustration! Thanks in advance... Courtney ...

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object (ant/tomcat/spring)
Hi, I've been trying to get Spring working with ant and tomcat. Ant was building just fine, but I came in today and tried to build it and got this: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object ?!?! Makes no sense to me. There _is_ an older version of java installed on my machine; but JAVA_HOME and ANT_HOME are set to the correct paths, and <which java>and <java -version> produce the correct version. Any help would greatly alleviate my frustration! Thanks in advance... Courtney ...

java.lang.string
I need someones help with the following problem. When trying to compile:"can't find symbol,symbole:constructor sam(java.lang.string,java,lang,string) location :class Mine" appears please help me. <<import easyIO.*; class Mine { public static void main(String[] args) { Mine mn= new Mine(args); } Mine(String[] input) { String fill="data.txt"; String fil="cur.txt"; if (inputfil.length>0) fill=input[0]; if (input.length>1) fil=input[1]; Sam sam= new Sam(fill,fil); sam.menu(); } ......... >> ...

java.lang.String.
Can anyone tell me what is the difference between the two assignmentsString ref = "HAI";String obj = new String("HAI"); On Tue, 17 Jul 2007 06:24:43 -0000, "M.Ponmalar@gmail.com" <M.Ponmalar@gmail.com> wrote, quoted or indirectly quoted someone who said : >Can anyone tell me what is the difference between the two assignments >String ref = "HAI"; >String obj = new String("HAI"); The second creates a duplicate object, needlessly. The first just assigns a reference to an existing interned string literal object -- Roedy Green Can...

java.lang vs java.util
Surprising to see something defined in java.lang <http://developer.android.com/reference/java/lang/Iterable.html> depend on something defined in java.util <http://developer.android.com/reference/java/util/Iterator.html>. Surely the hierarchy should go the other way? On 4/1/2011 9:11 PM, Lawrence D'Oliveiro wrote: > Surprising to see something defined in java.lang > <http://developer.android.com/reference/java/lang/Iterable.html> depend on > something defined in java.util > <http://developer.android.com/reference/java/util/Iterator.html>. > > Surely the hierarchy should go the other way? I think Iterable may make it into java.lang because of its significance in the foreach statement. Patricia On 04/02/2011 12:23 AM, Patricia Shanahan wrote: > On 4/1/2011 9:11 PM, Lawrence D'Oliveiro wrote: >> Surprising to see something defined in java.lang >> <http://developer.android.com/reference/java/lang/Iterable.html> depend on >> something defined in java.util >> <http://developer.android.com/reference/java/util/Iterator.html>. >> >> Surely the hierarchy should go the other way? Not if it wants to be consistent with http://download.oracle.com/javase/6/docs/api/ don't'cha think? And the so-called "hierarchy" of java.util and java.lang is that they are equal. The language reserves for itself the entire panoply of java.* and javax.* packages. > I think It...

Poll: Is a Java Method an Instance of the Java Class java.lang.reflect.Method? Please reply with YES or NO.
Hi, Poll: Is a Java Method an Instance of the Java Class java.lang.reflect.Method? Please put YES or NO as the first word in your reply. Add comments after it if you wish. I'll make a YES/NO count after some time. Kind regards, Paka Paka Small wrote: > Poll: Is a Java Method an Instance of the Java Class > java.lang.reflect.Method? It's not subject to vote. It's defined by the language. You might as well ask, "Is 'int' a primitive or a reference type?". Your vote will not change reality. > Please put YES or NO as the first word in your reply. Add c...

java.lang.OutOfMemoryError: Java heap space
Is there any free utilities I can use to view the memory used by all objects so I can track down the offending code? thanks Tim Maybe JConsole will help you out enough. Cheers. Opalinski opalpa@gmail.com http://www.geocities.com/opalpaweb/ Thanks, I figured out how to use hprof and it seems that something went nuts around date formatting - this trace is repeat hundereds of times... sun.text.resources.DateFormatZoneData.getContents(DateFormatZoneData.java:164) sun.text.resources.DateFormatZoneData.loadLookup(DateFormatZoneData.java:144) TRACE 304641: java.text.DateFormat$Field.&l...

java.lang.IncompatibleClassChangeError when running java tests
Hi, When execute the junit test we get: java.lang.IncompatibleClassChangeError at se.company.wcdma.rbs.boam.pms.impl.RBScanner.preperAndPush(RBScanner.java:526) at se.company.wcdma.rbs.boam.pms.impl.RBScanner.scan(RBScanner.java:766) at se.company.wcdma.rbs.boam.mao.rmo.iub.tb.sut.IubDataStreamMoImplTest.testNewCounters(IubDataStreamMoImplTest.java:254) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) 0.086 testOldCounters Error N/A Any ideas what IncompatibleClassChangeError is and how we can correct it? Cheers, //mikael The cause for this is probably that the RBScanner classes depends on another class which has changed. This can happen if you didn't perform a full recompile of the sources. Delete your class output, recompile the whole source tree and fix any errors that pop up BartCr wrote: > The cause for this is probably that the RBScanner classes depends on > another class which has changed. This can happen if you didn't perform > a full recompile of the sources. > > Delete your class output, recompile the whole source tree and fix any > errors that pop up > Hi, Than...

java.lang.IllegalStateException: No Java compiler available
tearing my hair out on this one.Thuis started as an upgrade issue till i realised that my un-usedtomcat5 installation didn't work either with my test jsp.I have, in desparation, un-installed all java / tomcat libs and re-installed only those required to get thetomcat6-6.0.14-1jpp.noarch.rpm (and the band-waggon) loadedfirst I installed java_app_platform_sdk-5_02-linux.binthis shows (after I set alternatives to point to the /opt/SDK/jdkdirecrtory)[root@squirrel ~]# javac -versionjavac 1.6.0java shows the same.I have set the following in profileCLASSPATH=$JDKHOME:$JDKHOME/lib/tools.jarJAVA_H...

java.lang.UnsatisfiedLinkError: no lsxbe in java.library.path
Hello i got following exception: java.lang.UnsatisfiedLinkError: no lsxbe in java.library.path My source code looks like the examples of the Notes homepage. import lotus.domino.*; public class Main extends NotesThread{ public static void main(String argv[]){ System.err.println(System.getProperty("java.library.path")); // System.load("C:/Programme/lotus/notes/lsxbe.dll"); Main t = new Main(); t.start(); } public void runNotes(){ try{ Session s = NotesFactory.createSession("localhos...

How to define java.lang.Object using java IDL
Hi all, I have a function like: boolean method(java.lang.Object param). How can I define this using java IDL? In another words, I need to pass an instance of java.lang.Object from Client to Server using CORBA. Is this possible? I would be nice simply to typecast the Object at Server-side into whatever needed. How about without typecasts, is this possible in any way, for example using a helper function like: java.lang.Object anyToJavaLangObject(Any value) Code examples ?!? Thanks in advance Juha Rossi ...

Web resources about - java.lang.StringIndexOutOfBoundsException: String index out of range: 34 - comp.lang.java.programmer

Resources last updated: 2/29/2016 4:37:11 PM