String index out of bounds... issue regarding checking for non-integers

okay. i have been racking my brain about this for the last couple of days. i looks like everything is alright, but i keep getting string index out of bounds exception: string index out of range 1.
heres the code.
               for(int x=0; x<size; ++x)
                    count=x+1;
                    System.out.println("Please enter value #"+count+(":"));
                    numnum=console.nextLine();
                    if(Character.isDigit(numnum.charAt(x)))
                         goodInput=true;
                    if(!goodInput)
                         System.out.print("Please Enter Only Integers!");
                    else
                         values[x]=Integer.parseInt(numnum);
its probably something really stupid, but if someone can figure this out, id be most grateful.
-thanks

Be sure values contains data.
Then make sure that size = values.length
Either you don't have any data to iterate through, or the size variable is too big. So it's trying to search in parts of the array that don't exist.

Similar Messages

  • String index out of bounds?

    hi, i am writing a java program which reads in a file and then error checks it, once its done this it will output it to another file.
    It was working fine until i tried writing another method, now it keeps telling there is a string index out of bounds exception with the 'charAt' method. I have uploaded all the necessary files to compile and run the program.
    I am unsure of what the problem is so id be grateful of you would be able to check it out. If it helps i programmed and compiled this problem in netbeans 3.6.
    I uploaded it here: http://www.megaupload.com/?d=45QHZYN1
    you have to wait 45 seconds, the timer is in the right hand corner before you can begin download

    try
          {   System.out.println("2");
              Properties props   = new Properties();
              File file          = new File(System.getProperty("user.home") + File.separator + configFileName);
              BufferedInputStream bis = new BufferedInputStream(new FileInputStream (file));
              props.load(bis);
              if(bis != null)
                  bis.close();
              // Load the information from the properties file.
              String driver = (String)props.get("DB_DRIVER");
              String user    = (String)props.get("DB_USERNAME");
              String passwd  = (String)props.get("DB_PASSWORD");
              String url     = (String)props.get("DB_URL");
              conManager = ConnectionManager.getInstance(driver, user, passwd, url);
    logFilename = fileName.substring(0,fileName.lastIndexOf(".")) + ".log";
              System.out.println("log file name :: " + logFilename);
              fout = new FileOutputStream(new File(logFilename));
         catch (Exception e)
             e.printStackTrace();
      public static void main(String[] args)
        FormsRefresher formsRefresher = new FormsRefresher();
        String filename = "D:\\FCC\\FMB\\CLDUDCMT.fmb";   
        String username ="BPELDEMO";
        String pwd = "BPELDEMO";
        String url = "jdbc:oracle:thin:@PLUTO:1521:seriousim";
        String filename = args[8];
        formsRefresher.initialize(filename);
        formsRefresher.processForm(filename);
    }I am getting the error in the lines quoted bold
    This is the code and i am getting another error also along with that.
    That is Unsatisfiedlink error
    Message was edited by:
    Feroz_CG

  • String index out of bound

    Hi,
    I am getting the following error-->
    "java.lang.StringIndexOutOfBoundsException: String index out of range: 58
    at java.lang.String.charAt(String.java:444) "can anyone tell me what is the root cause of such errors and how to avoid them?
    regards,
    Anshuman

    HI All yet the problem is solved for
    java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    if(response.substring(0,1).equals("1")==false)
                                       //     if (!response.startsWith("1"))
                                                 writeLogs("Error: For "+ e4p_ConfigurationLoader.getPartnerIdName(partner_ids.get(p).toString())+" Partner id  "+partner_ids.get(p).toString()+": "+response.substring(3,response.length()));
                                                 continue;//take next file
                                                 //collect the response in file
                                            }since this code of line is aasociated witth this lines
    //check the response and get the public key
                   if(response.charAt(0)!='1')
                        String colectRes=response.substring(2,response.length());
                        unableToAdduserid=1;
                        pgpMessaging(colectRes);
                   else
                        response=response.substring(1,response.length());
                        int indexval=response.indexOf("$"); // read the user id pass from pgp import
                        if(indexval==-1)
                        else
                             String extractid=response.substring(indexval+2,response.length()-1);
                             userid=extractid;
                             updateUserid();
                        setFlagValues();
                        if(filePath.endsWith("/")==true)
                             filePath=filePath.substring(0,filePath.length()-1);
                        if(filePath.startsWith("/")==false)
                             filePath=e4p_ConfigurationLoader.relative_path+filePath;                    
                        else
                             filePath=e4p_ConfigurationLoader.relative_path+filePath.substring(1,filePath.length());
                        checkFileExist(); // check the file exist for encryption
                        if(directoryErr==0)
                             setNamePath();//no error reporting
                        //     doEncryption();
                        //     makeSuccessString();//no error reporting
                             makePublicErrorString();
                             if(userid.equals("") || userid==null)
                                  if(userIdNotmention==1)
                                  pgpMessaging("");                         
                             else
                                  doEncryption();                              
                        else
                             pgpMessaging("");
                        if(fileNotFoundErr==1)
                             pgpMessaging("");
                        if(ioExceptionErr==1)
                             pgpMessaging("");
                        if(keyErrFlag==1)
                             pgpMessaging("");
                        if(keyNotSigned==1)
                             pgpMessaging("");
                        if(fileEncrytionFlag==1)
                             pgpMessaging("");
                             updateDataBase();//update file name from txt to .asc file
                                                              //error reporting updation error
                             if(databaseUpdationErr==1)
                                  pgpMessaging("");
              }          

  • String Index out of Bounds Error in 8i

    Hi!
    My requirement is to load a java file in to oracle 8i database. My program makes use of XSL to format a XML and insert the re-done XML into 8i but the problem i am facing is, i not able to resolve the dependency between XSL file and Java class ie., during run time the Java class is not able find the XSL file which is in the same path so i am getting "File Not Found Exception".
    i tried the following statements
    "//MyXsl.xsl" and
    "MyXsl.xsl" and "MyXsl.xsl"
    within the Java file but neither of these statements worked out. I checked the JAR which i loaded into 8i it contained both the XSL file and Java file in the same path.
    So, i hard coded the XSL logic into the Java file itself as a String but i am getting the following error.
    org.apache.xalan.xslt.XSLProcessorException: String index out of range: 0
    and this is how i defined the string
    String xslDefinition = "<?xml version=\"1.0\"?>\n"+
    "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"+
    "<xsl:param name=\"pid\"></xsl:param>\n"+
    "<xsl:output method=\"xml\" omit-xml-declaration=\"yes\"/>\n"+
    " <xsl:template match=\"root\">\n"+
    " <xsl:element name=\"item\">\n"+
    "<xsl:attribute name=\"id\">\n"+
    " <xsl:value-of select=\"$pid\"/>\n"+
    "</xsl:attribute>\n"+
    "<xsl:copy-of select=\"product_name\"/>\n"+
    "<xsl:copy-of select=\"product_merchant\"/>\n"+
    "<xsl:copy-of select=\"product_price\"/>\n"+
    "<xsl:copy-of select=\"product_URL\"/>\n"+
    "<xsl:copy-of select=\"product_url\"/>\n"+
    "</xsl:element>\n"+
    "</xsl:template>\n"+
    "</xsl:stylesheet>\n";
    can anyone help me?
    thanks in advance.

    Hi.
    The Xalan processor is an Apache technology. Please ask Xalan-specific questions on the Apache mailing lists.
    Thanks.

  • New InitialContext() gets String index out of bounds

    Context ctx = null;
    ctx = new InitialContext();
    DataSource dataSource = (DataSource) ctx.lookup("jdbc/datasource");
    connection = dataSource.getConnection();
    I get:
    String index out of range: -1
    weblogic.jndi.Environment.getContext(Environment.java:308)
    weblogic.jndi.Environment.getContext(Environment.java:285)
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    javax.naming.InitialContext.init(InitialContext.java:223)
    javax.naming.InitialContext.<init>(InitialContext.java:175)
    Earlier when I had provider_url specified I didn't get this problem, but it should be working without specifing provider_url...
    And well now it doesn't work with provider_url localhost since they set -Djava.net.preferIPv4Stack=true
    Which made so it stopped listening to localhost:port...
    Does someone know a possible solution for:
    1. String index of range
    2. the preferIPv4Stack thingy, which makes the listeners to stop listening to localhost:port

    Be sure values contains data.
    Then make sure that size = values.length
    Either you don't have any data to iterate through, or the size variable is too big. So it's trying to search in parts of the array that don't exist.

  • String Index out of bound exception

    I am trying to get substring from string. I have the following
    String var = "20051221032435"
    String var2 = var.substring(0,4)+"/"+var.substring(4,2)+"/"+var.substring(6,2)However, when i tried step by step run, it showed the first part (0,4) substring
    correctly, but shows StringIndexOutofBoundException when moving to the second substring.
    Why am i getting the above exception? how can it be solved?
    basically, im just trying to convert the var to YYYY/MM/DD HH:MM:SS time format.

    The first argument is the beginning index, and the second argument is the ending index. The second argument is not the length of the substring (which is IMO more conventional, but sadly not the way it works).
    BTW, you do not need to do all of this. To parse dates use java.text.DateFormat. To extract parts of dates or manipulate them, use java.util.Calendar.
    - Saish

  • MP Error: StringIndexOutOfBoundsException: String index out of range: -1

    Hi All,
    We are using PI 7.1 EHP1, Where in we would like to see the capabilty of User-Module for Conversion of IDoc Messages Between Flat and XML Formats. Gone thru the blog (/people/sap.user72/blog/2005/07/04/get-into-the-zone - Part 2) and maintained the necessary NWA configurations and maintained the necessary module parameters (SAPRelease, SourceJRA, TargetDestination) in Sender File Adapter.
    Now the file is not been picked by file adapter upon checking the Comm Channel Monitoring below error:
    MP: exception caught with cause java.lang.StringIndexOutOfBoundsException: String index out of range -1
    Any help would be highly appreciated.
    Thanks in advance

    Hi Ramani,
    I hope you must have found a solution on this, if not then kindly consider changing your source files, as this error corresponds to only one thing: i.e. DATA Issue. You need to correct the data which you providing to the module for conversion.
    I faced this problem and corrected it by just correcting my test file.
    Regards,
    Nipun Shedhani

  • Java.lang.StringIndexOutOfBoundsException: String index out of range: 8

    Hi Friends,
    I have a search window ,in one I/P Field i entered * and kept the default max hits to display as 100 records(This can be changed).
    Now when i click on Search i get 100 records being displayed,later when i change it to 150,200 Hits i am able to get them displayed(Records).
    But when i enter value greater than 200(i had entered 220) i am getting the following exception.
    java.lang.StringIndexOutOfBoundsException: String index out of range: 8
    Can anyone please help me out to resolve this issue.
    Thanks and regards,
    Chandrashekar.

    Hello Chandrashekar,
            It looks like in  the loop of number of records, you are fetching the record and processing the string either using charAt() method or subString method or any similar method.
    But in one of the record string after 200th record is having a string which when you are processing are having length less than 8.
    Say : String s = "Correct";
    will give StringIndexOutOfBoundsException: String index out of range: 8 as the length is only 7 and you are  cheking for char at position 8.
    Just check the processing you are doing within the record loop and also the records.
    Hope this helps.

  • Error "String index out of range:6" while opening Webi fromBI java Lauchpad

    Dear All,
    I have installed BO 4.0 recently. When I open BI Java Lauch Pad URL I can see Web Intelligence under the applications list. When I click it, a pop up getting opened with message " String index out of range: 6" When I click "Details" icon in the pop up, it is showing this description.
    Detected from bootclasspath: C:
    PROGRA~1
    Java
    jre7
    lib
    deploy.jar
    Java Plug-in 10.0.0.147
    Using JRE version 1.7.0-b147 Java HotSpot(TM) Client VM
    User home directory = C:\Users\RT89363
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    I have tried this in a machine where i logged as a normal user. But when i open the same link from a machine where i logged as administrator, it is working fine.
    Could any one help me in sorting out the issue ??
    Thanks in advance.
    Regards
    Ravi.

    Hi Ravi,
    the error is due to the componet JAVA(TM) 7 which is not supported.
    Better to run JAVA 6, I'm running the update 33, you can download it from http://www.oracle.com/technetwork/java/javase/downloads/jre6-downloads-1637595.html
    Remeber to remove JAVA &
    Go to control panel --> add remove programs and remove JAVA (TM) 7.
    It will solve the problem.
    Ciao,
    Massimo

  • Curve 8310 error Unc.Exception: string index out of range: 0

    I'm getting the following error message: "Uncaught Exception: string index out of range: 0" and no way to clear that message.
    Could someone help me to fix it? Actually the only way to get BB-8310 back working is remove the battery.
    Thanks in adavance
    Solved!
    Go to Solution.

    Hi and Welcome to the Community!!
    There's pretty much no diagnosing those -- they are the equivalent of the random errors in Windows for which tracing the root cause is fruitless. Basically, these are the last out in the programming code -- some event occurred for which there is no handler in the code. The fix is a code update that handles the event...but, again, knowing what the event is is pretty much impossible. So, there are a few things to try:
    Sometimes, the code simply becomes corrupt and needs to be refreshed -- just like a reboot:
    Anytime random strange behavior or sluggishness creeps in, the first thing to do is a battery pop reboot. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    If it won't boot up cleanly, then you may need to try Safe Mode:
    KB17877 How to start a BlackBerry smartphone in safe mode
    There might be an updated code set from the carrier -- check them via this portal:
     http://na.blackberry.com/eng/support/downloads/download_sites.jsp
    The toughest possible cause is a badly behaving app. To find it, there are a couple of options. One is to see if you can read the log file:
    Go to the home screen. Hold down the "alt" key and type 'lglg'. (You will not see anything while you type).This will bring up the log file. Scroll down (probably many pages) untill you see a line that says 'uncaught execption'. Click on this line. The name of the app will be in the info. Alternative methods for bringing up the logs are in this KB:
    KB05349How to enable, access, and extract the event logs on a BlackBerry smartphone
    The other method is to remove apps one at a time, waiting a while in between (I usually recommend a week), until the problem ceases...thereby discovering the offending app. Still another method is to reload the BB OS cleanly, leaving some time between adding other apps onto the BB so as to be able to determine exactly which one is the cause.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • FRM-92100: Your connection to the server was interrupted. String index out.

    FRM-92100: Your connection to the server was interrupted. String index out of range in IAS 10g
    I am trying to access the http://<hostname>:7778/forms/frmservlet?config=default but i kept on encountering FRM-92100: Your connection to the server interrupted. This may be the result of a network error, or a failure on the Server. You will need to reestablish your session.
    Details...
    Jave Exception:
    Java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    I already performed the ff but the error still occurs
    - set networkRetries in formsweb.cfg=40
    - restart the em and opmn
    - disable my internet proxy
    My IAS 10.1.2 is installed in linux x86
    and my IE version is version 6.0
    THanks

    I believe it is something to do with Java.
    => check the version of JRE installed. Must be latest.
    => Try applying SP-2 for IE6.0
    HTH
    Regards,
    Kamesh Rastogi

  • Image Manager : upload image - error message String index out of range

    Hello,
    i'm facing an issue with the upload functionality of 'Image Manager'.
    When i upload a file, systematicaly an error message pops up :
    "error message String index out of range : - XXX"
    Where XXX is a value as large as the size of the file.
    I have the feeling that the problem may come from the installation of VC.
    Did someone encountered this issue ?
    Thank you

    Hi,
    Plz check the below link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bip/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do
    Govindu

  • Fusion Security, SearchResponse next returning array index out of bound

    I am trying to fetch all the roles under a search base and while iterating i am getting array index out of bound exception.
    SimpleSearchFilter filter=store.getSimpleSearchFilter(RoleProfile.NAME,SimpleSearchFilter.TYPE_EQUAL,null);
    String wildCardChar=filter.getWildCardChar();
    filter.setValue(wildCardChar);
    SearchParameters parameters=new SearchParameters(filter,SearchParameters.SEARCH_ROLES_ONLY) ;
    SearchResponse resp=store.searchRoles(Role.SCOPE_ANY, parameters);
    +while(resp.hasNext()){+
    Role role=(Role)resp.next();
    Can anybody kindly advise

    Hi..
    check this
    http://andrejusb.blogspot.com/2011/01/fusion-middleware-11g-security-retrieve.htmlhope this will helpful

  • SelectOne index out of bounds

    Here is my error:
    java.lang.IndexOutOfBoundsException: SelectOne submittedValue's index 2 is out of bounds. It should be between 0 and 0
    What I'm trying to do:
    There are 2 SelectOneChoice Lists that are populated dynamically with by the bean of a selectItems tag.
    I'm using adf faces 19
    1)
    <af:selectOneChoice binding="#{backing_FileManage.ddlTopic}" id="ddlTopic"
    immediate="true" simple="true" autoSubmit="true">
    <f:selectItems id="fill_TopicDdl" value="#{backing_FileManage.fill_TopicDdl}"/>
    </af:selectOneChoice>
    2)
    <af:selectOneChoice binding="#{backing_FileManage.ddlCategory}" simple="true"
    id="ddlCategory" partialTriggers="ddlTopic" autoSubmit="true">
    <f:selectItems id="fill_CategoryDdl" value="{backing_FileManage.fill_CategoryDdl}"/>
    </af:selectOneChoice>
    (1) triggers (2) which is filled by the submitted value from (1). This all works fine. When you select an item in (2) but then want to switch the value in (1), i get the above error. I've checked all the data and fill Items and they all seem to be changing with the data. I'm completely stumped as to whether this is a bug or not.
    any help at all would be greatly appreciated.
    thanks in advance,
    Allen

    Hi,
    I encountered the same issue - warning "index out of bounds". I tried this suggestion above, to reset in the ValueChangeListener, but still got the error. The reason is that I saw the log that the bean method to get the SelectOneChoice items is fired twice. One before the ValueChangeListener method, and one after the ValueChangeListener method. Hence, still got the same error as the reset in ValueChangeListener is executed after the bean method to get the SelectOneChoice items.
    Please help and advise.
    Thanks
    -Mina

  • FPM Error: An internal error occured: String index out of range -4

    Hi All,
    I have imported the SSA BP to my EP (7.0), however, when I tried to create a custom FPM view & FPM Application for my custom WD application....the system will just prompt the error message "An internal error occured: String index out of range -4".
    Can anyone advise what could be the problem? and how to resolve it?
    Thanks in advance!
    Best Regards,
    SY

    Hi,
    You are trying to call the index of the String whose length is 4., but in the code you may have called from 1 to 4.. which should be 0 to 3.
    If you can show the stack trace of the exception, we can pinpoint the code / line.
    Just check the WD code..!!
    Thanks,
    Raags

Maybe you are looking for

  • Store procedure call to fetch data in JDBC sender adapter

    Hi guys, I have to fetch data from a Oracle server through JDBC adpater. the partner has in place some store procedure that have to be used with this purpose. But al the time I try to call a store procedure I got error that variables are not binded.

  • N95 Error when updating Adobe Flash player

    On my Nokia N95, the Adobe Flash lite player got the version 2.0 built in (that version do not support Flash application ver. 8) So I tried to update the player on the Adobe web site to Flash Lite 2.1 for Symbian  and even tried to install the plug-i

  • How to dynamically resize virtualbox console (Arch within Arch setup)

    My host is Arch, and my guest is Arch.  The guest running console without X.  I got 1024x728 resolution by adding vga=772 in guest's menu.1st file.  Is there a way to dynamically resize the guest's console dimensions by dragging virtualbox's window c

  • Real activation key is inaccesible--Message on ope...

    I have changed my sim-card several days ago. When I changed back my permanent sim-card and phone has loaded, i have seen the message something like that "your activation key is inaccesible". As I use my phone for mobile internet I turned to see the f

  • Stereo Bluetooth headset

    My plantronics pulsar 590A stereo bluetooth headset does not work properly with the iPhone. It works to answer calls but does not work to listen to music. It works with all other cell phones for music. What's the deal?