Run time error, why?

I have next run time error (string index out of range: -2) when running below code. Why?
String singleLine=" ";
int endTableIndex=0;
for( int j=1; j<=3; j++ )
for( int i=0; i<100; i++ )
if( text.charAt(i) == 'x' )
if( text.charAt(i+1) == 'x' )
singleLine = text.substring(endTableIndex, i);
endTableIndex = i+2;
System.out.println( singleLine );
Message was edited by:
aditm

1) Please use code tags. You've posted here before so by now, you should know the rules. Without tags, your code is difficult to read, so most will not bother to read it.
2) What defines the limit -- length -- or size of your "array" of characters in your string, text?
3) Use this limit above rather than some arbitary or magic number like "100" in your for loop. Be careful when you look at charAt(i + 1). This may make you go out of range if you don't set your limit with care.

Similar Messages

  • Virtual call run time error why? what is this?

    I constantly am getting a notification on my desktop reg: virtual call run time error' WHY??? what on earth is this 'virtual call' WHY ??? am i getting these notifications considering i do not have ANYTHING resembling a 'virtual call' app, add on or anything else on my mozilla

    http://support.microsoft.com/kb/125749
    it's a MS problem... and applies to visual C++ which is used in Mozilla for Windows.
    but is VCPP2005 and 2008, meanwhile Firefox doesn't use them anymore... replaced with VCPP10... as far as i know.
    Which version of Firefox are you using?
    Maybe you use older version Firefox or have some other program which uses that library.
    Try update to newer version...

  • Why getting "Run-time error 2046 the command or action 'GoToRecord' isn't available now"

    Hello,
    I'm running this on Form Load:
    Private Sub Form_Load()DoCmd.GoToRecord , , acNewRec
    End Sub
    when I'm in the office connected to the LAN, the database opens without any error but when
    I'm working remote through a VPN, I get this error:
    Run-time error 2046 the command or action 'GoToRecord' isn't available now.
    I'm wondering if this is related to a speed issue and more importantly, how to fix it?
    Thanks,

    Make absolutely sure the query behind the form is updateable and the form allows edits
    Use the following code with the forms On Open event:
    DoCmd.ShowAllRecords
    DoCmd.GoToRecord , , acNewRec
    See if that helps. Have no clue why it would work in one environment but not another.

  • When i put an artist in the search box it crashes . I get a run time error.  Why?

    When I put an artist into the search box  of the itunes store my computer gives me a run time error and says itunes has stopped working.  Windows will notify you with a solution.  They never notify me . I can play my music library with no problem but lately when I listen to music samples from the itunes store  I constantly get a rebuffering notice.  Now I can't even get that far  My internet speed is fine.  I checked with my carrier.  I am thinking I may need to reinstall itunes completely but do I have to back up my library? Or is it in the itunes cloud? 

    The subscript error I get does obviously relate to the array, but I know in advance how much data will be transfered, 500 data points of a trace and I have DIM the array just prior to the transfer code, in the same subroutine. Also I have attemped to make the transfer a for next loop and it I get the same error at the start of the loop? The has to be another cause of this problem.

  • Xml Publisher  run time error '5148'

    Dear
    I am using XML publisher to convert data in excel from the oracle,so first i have generated data in xml by report builder and open xml file in Word document through >template builder >data > load xml data,it's find but i use insert menu and select all field then it give message which i have mentioned below,
    run time error '5148'
    The number must be between 1 to 63
    I think, is it column limitation because i have done this activity later but right now i have added more column so may be that's why it is showing the error but my client need to show data in excel,so how i can fulfill this requirement,is there any other solution ?
    Please help on this regard. thanks in advance.

    Just for future poor souls who may be pulling their hair out over the same issue, I eventually got to the bottom of this cryptic error message.
    Do not try to import all your fields at once if your group has over 63 of them, as it will fail.
    If you use the Insert Table option, and try to put all the fields in at once, it will give you a more meaningful message, and the one it SHOULD have given you in the first place, which is "A table cannot contain more than 63 columns".
    So - Import them, a few at a time. Then move them all into one group and you're good to go.

  • Run-time error SAPSQL_ARRAY_INSERT_DUPREC occurred

    When creating a new SyncBo (T51) instance after syncing eventually MI Clients shows the following message:
    [20070315 01:28:14:343] E [MI/Sync ] Received exception info code 10 and detailed message "Exception while callSync: The ABAP/4 Open SQL arrayinsert results in duplicate database records. records in the data base."
    In sm21 shows message:
    AB0 Run-time error "SAPSQL_ARRAY_INSERT_DUPREC" occurred
    AB1 > Short dump "070316 205056 sapnw ELDA " generated
    Looking for SAPSQL_ARRAY_INSERT_DUPREC error in SAP Note we found the note 817849 (Runtime error SAPSQL_ARRAY_INSERT_DUPREC occurs during sync).
    We have downloaded and applied this note in Backend as note requires and ALL prerequisites of this note. Also we have upgraded to SP19 and Kernel to 155 (part 1 and 2). But problem continues and the client that happened this problem does not work any more, all new SyncBO instances created goes to MEREP_MON as Waiting status.
    The dump on duplicate record is happening when the user is synchronizing and when a record is getting inserted to table merep_10100.
    The solution /workaround could be to do a client reset for those devicesand test again and see if it is happening, but error returns happening after this.
    When this happen SyncBo instance keeps on Waiting status (MEREP_MON). We couldn't understand why this happen suddenly and then no more new SyncBo could be created, all goes to Waiting status. Reprocess (ShiftF5) or start handler (Shift10) does not take any effect.
    Best Regards,
    Rogério

    Hi Ajith
    I am getting the same error and below is the error message from ST22. The only change is I am using for MTR application and the sync fails for the 2nd time when synched for patches for the MTR application. As it is generic sync, could you please advice to get rid of the problem.
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
      neither
    caught nor passed along using a RAISING clause, in the procedure
      "LOG_INSERT_DB" "(FORM)"
    Since the caller of the procedure could not have expected this exception
      to occur, the running program was terminated.
    The reason for the exception is:
    If you use an ABAP/4 Open SQL array insert to insert a record in
    the database and that record already exists with the same key,
    this results in a termination.
    (With an ABAP/4 Open SQL single record insert in the same error
    situation, processing does not terminate, but SY-SUBRC is set to 4.)
    Thanks, Raj

  • Throws Run time error at runtime.

    Hi freinds,
    I've downloaded special jar file and placed in "C:\j2sdk1.4.2_11\jre\lib\ext".
    I've used one of the IO class from this jar file in my Candies.java class.
    When i going to compile it from command prompt it compiles dine but at run time while running following command ,
    D:\TP>javac Candies.java
    D:\TP>java Candies
    Exception in thread "main" java.lang.NoClassDefFoundError: ncst/pgdst/IOException
    When i compile and run this code with IDE 'JCreator' it works fine.
    Why the same application throws run time error at command prompt?
    How could i resolve this issue ?
    Note:I've also set classpath to "C:\j2sdk1.4.2_11\jre\lib\ext\." .
    Regards,
    Sachin Warang.

    If i placed the jar file some where else how could
    used it in my source file?To use a class in your source code, you just import its package and make sure the jar is on the classpath, nothing else is necessary.
    I'm stick to command prompt as i want include the
    input file(which contains big input) at run time
    using the command
    D:\TP>java Candies < input
    Is it possible with any IDE to include such text file
    at run time , if so how could i do this?All IDEs let their users specify parameters for programs they start from within the IDE. See doc of your IDE. (But people here don't recommend IDEs for beginners ;)
    But why it compiles fine and giving me Error at run
    time if it is not set in the classpath?Looks like it is because that class is not used directly in your code but your code calls another class that uses that missing class.
    I've also change the classpath to
    "C:\j2sdk1.4.2_11\jre\lib\ext\pgdst.jar\." still the
    problem exist , why is it so as i'm giving the actual
    path now?You still don't specify the exact jar! E.g: C:\j2sdk1.4.2_11\jre\lib\ext\pgdst.jar\aa.jar
    Hope it helps...

  • Run time error in adobe reader X 10.1.

    Hi Adobe Team,
    I have an application bulid on powerbulider which is capable of extracting the pdf files.we have deployed it in citrix server,My problem is While opening some of the pdf files from my application I am getting a run-time error
    "Runtime Error!
    Program C..
    This application has requested the Runtime to terminate it in an unusual way.  Please contact the application's support team for more information."
    We have checked in our application and found no errors,I would like your assistance in these Issue?
    Note:The error comes up not with all pdf files and even it is in random based.
    I am using adobe reader X 10.1.2 to view the files.
    your input will be apprecieted,
    Thanks in advance
    Sagar

    Hi,
    we have tried with 10.1.3 but no go,we didn't find any error's in log in our application that is why we are insisting you.I hope this appers to be the some technical problem from adobe.
    Thanks and Regards,
    sagar

  • Run-time Error '432'  in WAD

    Hi Experts,
    While opening a web template in web application designer, I am getting following error,
    Run-time Error '432' :
    File name or class name not found during automated operation.
    If i press ok, exist from WAD.
    I have uninstalled the GUI and installed SAP GUI 6.4 with the latest patch, still getting the error.
    It would be a great help if you could provide a solution for this.
    Thanks,
    Kaushik

    We are talking about a small .dll.
    No need of installing the OS again. I will say, ask your Windows administrator to look for it. He might look for it on MSDN or may be he will contact Microsoft for it.
    Most probably it might be 10 minutes job.
    Why don't You look for runtime error 432 in microsoft(MSDN) website.
    and even if you reinstall Windows XP, I guess it won't resolve the issue. there are couple of issues I heard with XP and SAP applications.
    Tnks
    Message was edited by:
            Keerti Vemulapalli

  • JList run time errors when removing items from list

    Hi there
    I am having trouble removing items from a JList. For a While it was working fine and now it outputs runtime errors everytime samething gets removed from the lsit
    Here is the code
    //declare
    public class Consumertab1gui extends JPanel implements ActionListener
         public static JList conList = null;
         private static DefaultListModel model = null;
    // Create a list with some items
    model = new DefaultListModel();
    conList = new JList(model);
    //set the size of cells in the list with the length of the string
    conList.setPrototypeCellValue("Lenght 1234567890");
    conList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    conList.addListSelectionListener(new ValueReporter());
    //set a scroll onto the list
    JScrollPane conScroll = new JScrollPane(conList);
    add(conScroll,c);
    //when the button gets pressed to drop the selected item the following code is called
    private void dropConsumer()
    int selItem=0;
    componentsV.comVRemove(conList.getSelectedValue().toString());
    selItem=conList.getSelectedIndex();
    System.out.println("No:"+(model.getSize()-1));
    System.out.println("S:"+selItem);
    remConList(selItem);
    dropCon.setEnabled(false);
    //which in turns calls this
    public void remConList(int pos)
         model.remove(pos);
    when the model.remove(pos) code is executed the following runtime errors are given:
    java.lang.NullPointerException
    at Consumertab1gui$ValueReporter.valueChanged(Consumertab1gui.java:197)
    at javax.swing.JList.fireSelectionValueChanged(JList.java:1321)
    at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1335)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
    at javax.swing.DefaultListSelectionModel.removeIndexInterval(DefaultListSelectionModel.java:546)
    at javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(BasicListUI.java:1561)
    at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:160)
    at javax.swing.DefaultListModel.remove(DefaultListModel.java:478)
    at Consumertab1gui.remConList(Consumertab1gui.java:38)
    at Consumertab1gui.dropConsumer(Consumertab1gui.java:58)
    at Consumertab1gui.actionPerformed(Consumertab1gui.java:46)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    can anyone spot any mistakes in the code or suggest possible resons as to why these run time errors occur?
    Thanks
    alexis

    java.lang.NullPointerException
    at Consumertab1gui$ValueReporter.valueChanged(Consumertab1gui.java:197)The NullPointerException occurs at line 197, in the valueChanged method of your ValueReporter inner class. I have looked through your post several times but I don't see where you posted that method. Anyway, that is where you should look.
    PC&#178;

  • Run time error running Vision Builder AI inspection from TestStand

    Hello,
    I have TestStand 3.1 and Vision Builder for AI v2.6.1.
    I would like to run from TestStand a Vision Builder Program or steps. For to achieve that, I have followed the instructions on Application Note 215, Running a Vision Builder AI Inspection from TestStand.
    After installation, the option in TestStand InsertStep>NI Vision Builder AI>Inspection works properly.
    But when try to execute a step with that inspection, and whatever operation of that one, the result is the following error:
    Run-Time Error
       Details: Error executing substep 'Post'.
    An error occurred calling 'ExecuteStep' in '_NIVBAITestStandSteps' of 'NIVBAITestStandAPI'.
       Error Code: -2147417851; User defined code. Possible System Error: The server sent an exception.
      At this point really I don´t know what to do, and I don't find any extra help apart of application note.
      I will appreciate some suggestion.
    Gonzalo.

    Hello,
    I've found some more information that may help.  Since these TestStand steps are simply call a DLL with an exported ActiveX API, path issues may exist.  In fact, the overwhelming number of times this error appears, paths seems to be the case. I am not sure why the error is an indication of a path issue, but that seems to be the case.  I would recommend that you would reregister the DLL, this time in the same directory as the example sequence.  To do this:
    - Unregister the current DLL by going to Start Menu>>Run, and typing: regsvr32 /u NIVBAITestStandAPI.dll
    - Move the DLL from the system32 folder to the folder in which the example sequence is saved.
    - Reregister the DLL from the run command (regsvr32 <folder path>\NIVBAITestStandAPI.dll)
    - Restart TestStand if it is open
    I apologize for not having any concrete answers, but this one is proving tough without me being able to replicate the issue.
    crisR

  • Run Time Error 40002

    I am attempting to connect to an Oracle database on an Alpha 4100 running on openVMS from an NT 4.0 (service pak 6) machine in VB code.
    I have set up an ODBC driver DSN and have used the Oracle SQL NetEasy Configuration to set up the connection.
    Following is the code I am using to try to connect, but I get a "Run Time Error 40002" when I click ok to connect. Any help would be appreciated.
    Private Sub Command1_Click()
    Dim result As rdoResultset
    Dim cn As New rdoConnection
    Dim en As rdoEnvironment
    Set en = rdoEngine.rdoEnvironments(0)
    With en
    .CursorDriver = rdUseOdbc
    .LoginTimeout = 20
    .UserName = "aksadm"
    End With
    With cn
    .Connect = "DSN=cgl1test;UID=ak;PWD=ak;UIDDBMS=aks;PWDDBMS=ak"
    .LoginTimeout = 20
    .CursorDriver = rdUseOdbc
    .EstablishConnection
    End With
    cnEH:
    Dim er As rdoError
    Debug.Print Err, Error
    For Each er In rdoErrors
    Debug.Print er.Description, er.Number
    Next er
    Resume Next
    End Sub
    Sincerely
    Bruce Stuart

    I assume 'cgl1test' is set up as a DSN using the Oracle8 ODBC driver.
    - We ship a tool called 'ODBCTest' that lets you test new DSN's to ensure you're able to connect. If you use this tool, are you able to connect with the 'cgl1test' DSN?
    - Why do you have the parameters
    UIDDBMS=aks;PWDDBMS=ak
    in your connection string? Our ODBC driver doesn't have these options. The fact that you have two apparent user names leads me also to suspect that the login may be failing because of a bad username.
    Justin Cave
    ODBC Development

  • ABAP run time error while perform LT06 or create TO with respect to posting

    Hi SAP WM Gurus,
    System is giving ABAP run time error while perform LT06 or create TO with respect to posting change notice, below are runtime analysis details.
    >> Short dump has not been completely stored. It is too big.
    >       P_MENGA = P_MENGE.
    007940       P_UMREZ = 1.
    007950       P_UMREN = 1.
    Can you give any idea on this issue.
    Thanks and Regards,
    SHARAN.

    This part is just the place in the program where the error occured, but why the error occured is mentioned earlier in the dump.
    Maybe you have a too big number in the field and hence a field overflow, maybe you have a character instead of a number in the field.
    Read the dump from the beginning. if you dont know how to read a dump,then try to get help from any local Abaper.

  • Run time error in CJ20N: while accessing a WBS

    Dear Experts,
    I took a random WBS from PRPS table:(kindly see the screen shot of WBS id)
    I executed Cj20N for this WBS and I got the following run time error:
    The log in ABAP error says "Not all objects were locked (See lock log)" .
    Can someone help in in realizing root cause of this error.
    Thanks & Regards
    Saurabh

    Hi Maria,
    Is this happening always or just a single time ?
    For this individual WBS: YES
    Do you archive projects / WBS elements ?
    NO
    I would like to add that when I access this WBS with CJ02 I got following:
    Error when accessing file: Select PROJ, WBSNR = 00000088
    Message no. CJ898
    For this, I read SAP Note 377174 which says :
    .......The not imported WBS elements retain but can no longer be edited. When you try to call them up, the system generates message
                           CJ898 'Error when accessing file: Select PROJ, PSPNR =
    <<<internal number of the deleted project>>>".
    1. Implement the attached advance correction
    2. Change GUI status SAPLCJWB PDMV as follows:
    Call up the Menu Painter (Transaction SE41).
    Enter: Program SAPLCJWB, status PDMV; select subobject Status and press Change.
    In the menu bar, expand submenu Edit -> Object.
    Position the cursor on menu option PICK Choose and deactivate it with Extras -> Function active <-> inactive (F7).
    Activate the changed GUI status.
    I believe, If I follow this path it will resolve this error But can you please help me in understanding this logic. I am not getting step 4 and 5 of it. Why is it dependent on GUI?
    Thanks & Regards
    Saurabh

  • INI instrument driver and fatal run time errors

    Hey everyone, I'm experimenting with the INI instrument driver and running into a fatal run time error.  Here's what I know so far:
    The runtime error only happens during the very first Ini_Putxxx
    It only happens if the target INI file does not yet exist.  After the file is created with a Ini_WriteToFile, then the program will proceed with all my Put functions without any errors.
    Ideas?
    Solved!
    Go to Solution.

    Are you sure about that? I just tried calling these functions in the Interactive Execution window without errors (the destination file wasn't there before the call and has been created without errors):
    #include "inifile.h"
    static int error = 0;
    static IniText T = 0;
    T = Ini_New (0);
    Ini_PutString (T, "General", "Item 1", "Test string");
    Ini_PutInt (T, "General", "Item 2", 123);
    Ini_PutDouble (T, "General", "Item 3", Pi ());
    error = Ini_WriteToFile (T, "C:\\test.ini");
    Ini_Dispose (T);
    Ini_PutXX functions do not make any disk access, they work entirely in memory; the only functions where the instrument accesses the disk are Ini_WriteToFile and Ini_ReadFromFile. Which error are you receiving? Can you post a sample code that exhibits the error?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

Maybe you are looking for