Cannot convert an element for a list ton Integer

I have my list [1, 2, 999] I'm trying to change the the last element of my list by -999, I m getting an error message
int val = 999;
String s1 = (String)list.get(list.size()-1);
int s2 = Integer.parseInt(s1);
if(s2 == val)
     // Replace the value 999 by -999
     list.add(list.size(), -999);

ronisto wrote:
52 System.out.println("La position du dernier est: "+list.size());
53          
54          String s1 = (String)list.get(list.size()-1);Looks like the error is really on line 54. The error seems to be that the element in the list is an Integer, not a String. The best was to avoid this is to use generics:
List<Integer> numbers = new ArrayList<Integer>();http://java.sun.com/docs/books/tutorial/collections/index.html
http://java.sun.com/docs/books/tutorial/extra/generics/index.html

Similar Messages

  • Flat File Load Issue - Cannot convert character sets for one or more charac

    We have recently upgraded our production BW system to SPS 17 (BW SP19)
    and we have issues loading flat files (contain Chinese, Japanese and
    Korean characters) which worked fine before the upgrade. The Asian
    languages appear as invalid characters (garbled) as we can see in PSA. The Character Set
    Settings was previously set as Default Setting and it worked fine until
    the upgrade abd we referred to note 1130965 and with the code page 1100
    the load went through (without the Cannot convert character sets for one or more characters error) however the Asian language characters will appear
    as invalid characters. We tried all the code pages suggested in the note e.g.
    4102, 4103 etc on the info packages but it did not work. Note that the
    flat files are encoded in UTF-8.

    I checked lower case option for all IO
    When i checked the PSA failed log no of records processed is "0 of 0" my question is with out processing single record system is througing this error message.
    When i use same file loading from local workstation no error message
    I am thinking when  I FTP the file from AS/400 to BI Application Server(Linex) some invalid characters are adding but how can we track that invalid char?
    Gurus please share your thoughts on this I will assign full points.
    Thanks,

  • Cannot convert character sets for one or more characters Error message

    Hello,
    I am getting this error message "Cannot convert character sets for one or more characters" when i try to transfer the data from Application server file as CSV to PSA.
    Using T-code AL11
    Under SAP Directory I open my file I  can able to see all contents of my file right?
    But i can't able to see all my data because of this I am getting ths error message?
    I am loading Master data attribute
    Is there any limitation on record length?
    Please share your thought..
    Thansk

    Which length should not exceed 60.
    When i load the same file from local workstation I can able to load no error message
    Why I am getting if i load same file from application server?
    Thanks

  • Cannot convert character sets for one or more characters

    Hello,
    Issue:
    Source File:   Test.csv
    Source file dropped on application server as csv file via FTP
    Total records in csv file 102396
    I can able to load only 38,000 records after that I am getting error message  " convert character sets for one or more characters"  while loading into PSA .
    If i load same csv file from local workstation I am not getting any error message I can able to load total 102396 records.
    I am guessing while FTP the file into Application server some invalid codes adding?
    But I am FTP 7 files,  out of 7 I am unable to load only 1 file.
    Anybody have faced this kind of problem please share with me I will assign full points
    Thanks

    I checked lower case option for all IO
    When i checked the PSA failed log no of records processed is "0 of 0" my question is with out processing single record system is througing this error message.
    When i use same file loading from local workstation no error message
    I am thinking when  I FTP the file from AS/400 to BI Application Server(Linex) some invalid characters are adding but how can we track that invalid char?
    Gurus please share your thoughts on this I will assign full points.
    Thanks,

  • CANNOT convert to PDF for Adobe Acrobat 9 Pro

    Hi there,
    When I try to convert a word file to pdf, after completed process, it prompts out a txt file which only included the path of the pdf file located. However, there is no such pdf file in that location instead the txt file mentioned above.
    I couldn't understand it work fine when I just save file at local PC but remote network driver do not.
    Could you give me any advice? Thank you in advance.
    Best Regards,
    Wylie

    Hi Aandi Inston,
    It's very strange. It works again. By the way, I still want to explain my case.
    I usually select Adobe PDF printer to convert doc to pdf or just right the doc file and select "convert to pdf" from the menu.
    Actually, during converting process, there is a status bar/menu showing the process. When it is compeleted, the status bar/menu closed itself.
    Finally, a txt file prompt out. It contains the path of pdf file stored.
    However, there is no such pdf created.
    I guess there maybe a problem for not using Adobe installation login account. ????

  • Java 1.5 - Each Element of a List Cannot Be An Array?

    I plan to create a List and each element of this List is a String Array.
    First, I declared a List:
         private static List<String> recursiveTextArray = new ArrayList<String>();And I want to build this List by adding one Array at a time:
    recursiveTextArray.add( title );where
    private String[] title;
    title = new Array(3);I got syntax error saying: "The method add(String) in the type List<String> is not applicable for the arguments (String[]).
    I cannot figure out what the compiler is complaining about. How do I fix the problem? Thanks in advance.

    I think that I have some idea about what is going on. Because Array is an object, I should:
    private static List<Object> recursiveTextArray = new ArrayList<Object>();But the Java statement shown right above has a syntax error: "Syntax error on token ";", , expected"
    I have no clue why there is such a syntax error.

  • Report Painter - cannot hide an element selected for the drill-down report

    Dear Experts
    I am using report painter to modify a report by trying to hide a row but getting the following error.
    You cannot hide an element that you selected for the drill-down list
    Message no. K7186
    Diagnosis
    You cannot hide elements that have already been selected for the drill-d
    System Response
    The function was canceled.
    Procedure
    Deselect the relevant row or column from the drill-down list.
    It says to deselect the relevant row from the drill-down list, but not able to find out how do i do it.
    kindly please help me to solve it
    thanks in advance
    Suresh

    Hi,
    If you are asking me whether i am trying to hide the row in the report painter form or in the output of the report, then, yes i am trying it in the report painter.
    I copied this standard form  '0SAPRATIO-01' for Cash Flow statements-Indirect method(tcode FSI5) and trying to modify the copied one. I tried to hide an existing row but it gave me the above message.
    any help?
    Suresh
    Edited by: rasuresh on Aug 10, 2010 12:44 PM

  • My lap top with   Adobe Premiere Elements 8 had a hard drive crash and I cannot find the download for it?

    My laptops hard drive crashed and I lost this program.  I still have the serial number but cannot find the download for it.

    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5.6| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Could someone please advise on my current problem? Apparantly I can no longer download tones to my phone or account to be used as such since the tones are being downloaded as songs that cannot be transferred or placed in the tones area for the phone...

    Could someone please advise on my current problem? Apparantly I can no longer download tones to my phone or account to be used as such since the tones are being downloaded as songs that cannot be transferred or placed in the tones area for the phone or in iTunes. Prior to the last update, this was always an option. I have also noticed that the Ringtones and Alert Tones are not showing up in my recent purchases as well to allow for me to place them back on my phone and there for require for them to be purchased again... Any help would be greatly appreciated!

    I've discovered that all tones purchased will be downloaded as ringtones, BUT they can be utilized as tones and assigned as alert tones on the iPhone...

  • I recently signed up for a one month trial of adobe pro.  I logged in.  I cannot convert a single page of PDF file to word or Excel with this trial.  I just get the request to sign up for a year.  What good is the trial if I can't try it?

    I recently signed up for a one month trial of adobe pro.  I logged in.  I cannot convert a single page of PDF file to word or Excel with this trial.  I just get the request to sign up for a year.  What good is the trial if I can't try it?

    Hey vcomfort6,
    Please ensure that you are using Adobe Acrobat and not Reader to convert PDF file to word or excel.
    Could you tell me whether it is a scanned document? Does this happen with all PDFs or any specific one?
    Do you get any error message? What exactly happens when you try doing the same?
    Hope to hear from you.
    Regards,
    Anubha

  • 1:N mapping for ZALEAUD01: Cannot produce target element /ns:0Messages

    Hi,
    I am working on a scenario where my sender MT is ZALEAUD01 (idoc occurance 1..1) and receiver MT is a xml file (Root Node occurance 1..1). I want to generate the number of files based on the occurance of a particular node (E1STATE). I am using a multi-mapping here by changing the occurance of the root node of Receiver xml file  to 0..unbounded in Messages tab of MM and mapping it with E1STATE
    During runtime, I am getting the Mapping error and in Trace I am getting the message: Cannot produce target element /ns0:Messages.Check xml instance is valid for source xsd and target field mapping fullfills requirement of target xsd
    Please tell me some solution
    Thanks & Regards

    Hi All,
    Thanks for your quick responses
    But I have already checked all that..
    My mapping is E1STATE----> MT_Root with the context of E1STATE as Idoc,
    I have tested the mapping in test and everything is successful.
    I know we can not test the mapping with the Idoc structure generated in sxi_monitor as its missing the /ns0: Messages and /ns0: Message1 nodes. So I have added these nodes in my xml structure while testing in IR and the mapping test is successful.
    But @ runtime as these Messages node should be generated by Xi so I feel this is where the problem is.

  • Cannot convert pdf to word - just spins and says retrievin current session status - has been doing it for days

    Cannot convert pdf to word - just spins and says retrievin current session status - has been doing it for days

    Hi da522811,
    Are you still having trouble converting files? It sounds as though you may be trying to convert via Reader, is that correct? If so, please try logging out, and then logging back in. You may need to log out via the web interface at https://cloud.acrobat.com if you don't have access to the Sign Out button in Reader.
    Please let us know how it goes.
    Best,
    Sara

  • Framework for Views - listing many elements on multiple pages

    Hi,
    is anyone aware of a framework which could be integrated in existing applications without rewriting all of the JSPs/GUIs.
    Namely, only the JSPs which lists elements - for example person names.
    Listing these entities is OK when you have like 50 - or 100 - but what do you do if you have 1000000 or more ?
    It could be like "list 50 entries every page" and if you click "next" or "back" you see the entries 51..100...
    However coding this for every JSP which has elements to list (not only person names) is a big hassle - therefor i ask if such a framework exist.
    Also i good idea instead of XXX entries per page would be to have some sort of collapse/expand mechnism, i.e. for names you would have
    A
    B
    C
    when you expand A you see all the names starting with A
    you could even do sub expands meaning under A there would be another [a..z] entry.

    You can create your own picture package, if none of the options in the PSE print window>Type of Print work for you. Just make a blank file, copy/paste your image and alt drag it to make multiple copies. You can use the move tool to position things as you want them.
    Generally speaking, though, for something like label printing, it's simplest to use PSE to create the image, then use your word processing/desktop publishing program to print the actual labels.

  • Hyperion Business Rule Error: Cannot retrieve connected root element for

    Hi,
    I am trying to open a business rule in EAS and I am recieving the following error: Cannot retrieve connected root element for Planning/Servername/Application/Database.
    I am able to connect to the application via Planning Web, but I am recieving this message when I am trying to open the business rule in eas.
    hoping if someone has come across this issue before and has been able to successfully fix it.

    Hi,
    I have 2 BRs, one is with RTP and another without RTP (basically a clacscript as BR).
    I don't have any issue with the BR without RTP.
    When I try to validate BR withRTP, validation is failing with
    Unable to run or validate this rule (ConsolidateTestRTP) against the following location: Planning/servername/appname/dbname for user abcd.
    Detail:Exception occurred. Please check your log file for details.
    2009-04-09 12:35:58,803 WARN AWT-EventQueue-0 com.hyperion.hbr.core.MetadataManagerServerRemote - Cannot retrieve connected root element for Planning/servername/appname/dbname
    Restarted RMI,Planning,EAS services. Logged into planning first and then to EAS. Still getting error
    2009-04-09 12:41:39,881 FATAL AWT-EventQueue-0 com.hyperion.hbr.client.LauncherWindow - Exception:
    With thought of may be the syntax of RTPs in BR changed, deleted RTP in the code but still BR has RTP (I mean BR has RTP and is not used in calculations), still getting error during validation. I can create new BRs and associate to outline.
    Thanks

  • How to add list-elements for DropDownListBox

    Hi
    It would be of great help if anybody suggests any proper reference material to go through the method of Adding list-elements for DropDownBoxList.
    I tried searching in BusinessCenter but in vain.

    The easiest way to achieve this is to use standard GDT code lists that include values already.
    As the GDT catalog includes about 15000 pages, you most probably will find a fitting data type there.
    If not, then you can define your own code lists by adding content to your business configuration.
    This is part of the Bonus Mgmt tutorial.
    Best regards
    Christian

Maybe you are looking for