Potential leak & value stored to .. never read - messages

hi!
I am using the static analyzer to test my code. There are some messages I dont understand. The file is uploaded here (http://www.learnclip.com/iPhoneDev/leak1.png) but I will also post the code below.
There are three "lacks" in my code;
1.
"The value stored to jsonDict is never read during initialisation.."
-> I am using and therefore reading from it, but for sure, not during its initialisation process. therefore, i dont really understand this message..
jsonDict valueForKey:@"ok"
2.
The static analyzer complains about a potential leack of my jsonDict. But i am releasing it.
3.
If I am releasing it, the analyzer complains about an incorrect decrease..why?
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSLog(@"didReceiveData: WriteConnection");
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [[NSDictionary alloc] init];
JSONArray * jsonArray = [[JSONArray alloc] init];
jsonDict = [jsonArray getDictionaryFromJSONString:responseString];
if([jsonDict valueForKey:@"ok"] == NULL){
[self alertMessageNotSend];
}else{
[self alertMessageSend];
[jsonArray release];
[jsonDict release];
[responseString release];
[self stopAnimatingActivityIndicatorView];

hi!
I am using the static analyzer to test my code. There are some messages I dont understand. The file is uploaded here (http://www.learnclip.com/iPhoneDev/leak1.png) but I will also post the code below.
There are three "lacks" in my code;
1.
"The value stored to jsonDict is never read during initialisation.."
-> I am using and therefore reading from it, but for sure, not during its initialisation process. therefore, i dont really understand this message..
jsonDict valueForKey:@"ok"
2.
The static analyzer complains about a potential leack of my jsonDict. But i am releasing it.
3.
If I am releasing it, the analyzer complains about an incorrect decrease..why?
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSLog(@"didReceiveData: WriteConnection");
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [[NSDictionary alloc] init];
JSONArray * jsonArray = [[JSONArray alloc] init];
jsonDict = [jsonArray getDictionaryFromJSONString:responseString];
if([jsonDict valueForKey:@"ok"] == NULL){
[self alertMessageNotSend];
}else{
[self alertMessageSend];
[jsonArray release];
[jsonDict release];
[responseString release];
[self stopAnimatingActivityIndicatorView];

Similar Messages

  • How do I remove PDF messages stored on Adobe Reader XI?

    How do I remove  PDF files stored on Adobe Reader XI?

    On a Windows system use the Windows Explorer to delete the files.

  • Where is OID departmentnumber value stored

    Hi All,
    In the DAS utility, or in Portal when editing your profile/credentials, there is a place for department. Where is this value stored in the ODS schema?
    For example, First name is stored in ct_givenname. Last Name is stored in ct_sn.. etc.
    Anyone know where department is stored? One would think there should be a ct_departmentnumber table.
    Any thoughts would be greatly appreciated.
    Rob

    Rob,
    departmentnumber is per default a non indexed (non cataloged) attribute thus you don't have a separate ct_departmentnumber table. You need to create a catalog for departmentnumber via catalog.sh.
    BTW: We discourage from accessing the DB schema and NEVER write into any OID DB table.
    regards,
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Variable never read

    I have the following code in my editor:
    <jsp:useBean id="now" class="java.util.Date"/>
    <fmt:formatDate value="${now}" type="DATE" pattern="yyyy/MM/dd"/>
    <p>The time/date is now <c:out value="${now}" /></p>I am using Rational Application Developer and get an error for the useBean tag above:
    The local variable now is never read.
    Any thing else I need to do to fix this?

    The attribute scope is irrelevant.
    The error message is coming from the local scriptlet variable declared by the jsp:useBean tag.
    This:
    <jsp:useBean id="now" class="java.util.Date" scope="page"/>
    <fmt:formatDate value="${now}" type="DATE" pattern="yyyy/MM/dd"/>Would translate into code approximately equivalent to the following
    java.util.Date now = new java.util.Date();
    pageContext.setAttribute("now", now);
    SImpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
    out.println(sdf.format((java.util.Date)pageContext.findAttribute("now")));Note that it declares a scriptlet variable - which is what the compiler is complaining about.
    You could shut the compiler up by including a line such as
    <% now.getTime(); %>
    But thats just nasty.
    Much better to just the compiler to ignore this issue in JSPs

  • How can i get the value stored in the session object using its sessionid

    how can i get the value stored in the session object using its sessionid by running stand alone java application

    myforum wrote:
    how can i get the value stored in the session object using its sessionid by running stand alone java applicationThis does not seem to make sense! You need at least to give a lot more detail of what you are doing.

  • Analysing waveform for digital values stored in a file

    i have certain digitals values obtained in a file in .txt format.
    i have to obtain a waveform by giving the input as these digital values in that file.
    I have programmed for array input manually.
    But the waveform analysis should be made such that it do analyze automatically by taking the values stored in the file.
    The values are stored as like follows-
    0.00159
    0.01432
    0.01654
    0.15432
    etc
    Give me a module to do this task.

    Use the Read from Spreadsheet file and then just connect it to a waveform chart. This will do what you need. Post back.

  • IMAP-Mail sender adapter handling with read messages in mailbox

    Hi,
    (PI 7.0)
    we have a "funny" situation:
    We are using imap-mail-sender adapter polling a mailbox.
    Sometimes there are read messages in mailbox so the adapter cannot read these messages.
    When we sort all read messages and we mark e.g. the second message in list as not read, the adapter polls fetch the first (already read) message and afterwards the not-read message and afterwards no other message is read.
    I think this behaviour is wrong because pi should not handle an already read meassage.
    Does anybody know this problem?
    Or is it a problem of the mail-server (Exchange 2003)?
    Thanx and regards
    Wolfgang

    Hi,
    thanx for your answer.
    The default behaviour of imap is "only fetching unread message" (s. FAQ of mail adapter)...
    The mail sender channel with IMAP4 fetches only the unread messages from the specified mail box in the order they are stored. Therefore, please make sure that you have some unread messages in the top of the list (if ordered by most recent on top). After a polling cycle, you can look at the status of this channel at the adapter's monitor. This should show any error if the messages are not processed correctly. Once the messages are read but not processed correctly, they remain in the mail box but are not read in the subsequent polling cycle. You must correct the problem and delete these messages using your mail client program or reset them as unread so that they can be resend.
    In our example the adapter fetchs read messages too (till the first unread one)  - and this is wrong (i think so!?).
    But I dont know if its a MS-Exchange problem.
    Regards
    Wolfgang
    Edited by: Wolfgang Hummel on Oct 7, 2009 12:20 PM
    Edited by: Wolfgang Hummel on Oct 7, 2009 12:21 PM

  • Access values stored in 2D Array in HashMap

    Hi everyone i would like to know how to access values stored in a 2D array inside a HashMap
    Here is a drawing representation of the map.
    So to get the KEYS I just have to execute this code:
    this.allPeople = personInterests.keySet();But how can I get acces to the actual values inside the 2D Array?
    My goal is to create a treeSet and store all the elements of the first array in it, then look at the second array if any new elements are detected add them to the treeset, then third array and so on.
    I tried this code:
    Object[] bands = personInterests.values().toArray();
         for( int i=0; i<bands.length; i++)
              this.allBands.add(bands.toString());
    }But this.allBands.add(bands[i].toString())seems to be the problem, Dealing with a 2D array, this code only return a string representation of the Arrays and not a string representation of their elements.
    Using my logic I tried to execute:
       this.allBands.add(bands[0][i].toString());But i get a ARRAY REQUIRED BUT JAVA.LANG.OBJECT FOUND
    I really don't know the way to go.
    Thanks to anyone that will help.
    Regards, Damien.
    Edited by: Fir3blast on Mar 3, 2010 5:27 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You'll just need to cast the object to the correct type. This is nothing to do with HashMap at all. If you don't know what that means then your google keywords are "java cast tutorial".

  • Reading message from inbox

    I want to write a J2ME application which will read message from inbox.i used the following code to open fileconnection with inbox
    FileConnection filecon = (FileConnection)
    Connector.open("file:///c:/system/mail/directory");
    I am using Nokia 6610i.I am getting the following error:"The requested protocol does not exist file:///c:/system/mail/directory"
    Can anyone help me out?

    Hi
    If you want to be able to store data and then retrieve it, the you can use RMS, but if you want to get data already stored on your phone then you need the FileConnection API. There is no work around this as far as I know.
    Mihai

  • How to Open URL value stored in a variable in JSP

    Hi all,
    I want to know how i can use value of a string variable in a JSP as url to open.
    <% String abc="some url value" ; %>
    then i want to open abc as URL in JSP
    Please suggest something on this.
    any help in advance will be highly appreciated.
    thanks,
    savdeep.

    thanks rahul but,
    I want to open the URL in
    <% String URLvariable="abc.htm" ; %>
    <% out.println("< a href=URLvariable>"+rs.getString("Some JSP value")+"</a>"); %>
    please suggest how should i open the above URL value stored in JSP variable.
    any help will be highly appreciated.
    thanks,
    savdeep.

  • How to Print all values stored in an Associative array

    DB version:10gR2
    There can be multiple results(multiple rows) for the below query. So, i'll have to declare the variables v_sid_serial, v_orauser, v_objectname,v_objecttype as associative arrays.
    SELECT l.session_id||','||v.serial# sid_serial, l.ORACLE_USERNAME,o.object_name,o.object_type,
           into v_sid_serial, v_orauser, v_objectname,v_objecttype
    FROM dba_objects o, v$locked_object l, v$session v
    WHERE o.object_id = l.object_id
          and l.SESSION_ID=v.sid;But I want to store the results from the above query in flat file. I want the result set to look like
    SID_SERIAL      ORA_USER               OBJECT_NAME           
    742,32914    SCOTT                        EMP
    873,49832    HR                           EMPLOYEES
    893,9437     mytestschema                 emp_dtls
    .            .How can i print the values in Associative arrays in the above manner so that i can spool the result set to a flat file?
    Edited by: user10373231 on Sep 29, 2008 5:19 AM

    user10373231 wrote:
    is there any way to print all values stored in an Associative arrayPrint to where?
    You could use DBMS_OUTPUT to get the output on the screen within SQL*Plus.
    You could also output (pipe) the data from PL/SQL using a pipelined function that you select from SQL. An example of a pipelined function...
    SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
      2  ( col1   VARCHAR2(10),
      3    col2   VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      3    v_obj myrec := myrec(NULL,NULL);
      4  BEGIN
      5    LOOP
      6      EXIT WHEN v_str IS NULL;
      7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
      8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
      9      IF INSTR(v_str,',')>0 THEN
    10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
    11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
    12      ELSE
    13        v_obj.col2 := v_str;
    14        v_str := NULL;
    15      END IF;
    16      PIPE ROW (v_obj);
    17    END LOOP;
    18    RETURN;
    19  END;
    20  /
    Function created.
    SQL>
    SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
    Table created.
    SQL>
    SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
    3 rows created.
    SQL>
    SQL> select * from mytab;
    COL1       COL2
    1          2
    2          3
    4          5... which you can easily adapt to output whatever data you want e.g. you could loop through your associative array and pipe out the values within it.

  • OpenESB: read message from Normalized Message Router

    Good morning,
    I have to build a simple Business Monitor System.
    I use NetBeans 6.5, Glassfish v2 with OpenESB.
    My Question is:
    there is a way to read messages exchanged between two different application (for example my CASA application and Salesforce CRM wsdl)?
    Obviously all application are attached to the ESB.
    I know that all SOAP messages are transformed to Normalized Message (by Normalized Message Router) and then sent over the ESB, so I think there is a way to read all messages (but I didn't find it).
    Thanks
    Matteo

    Thank you Mark,
    I modified the test Observer a bit just to dump the message exchange. Actually it seems to work, except for a weird thing: The message count is always 0 for any message exchange I log, like there are no Normalized Messages in the MessageExchangeImpl. Am I missing something obvious? I'm just calling the toString() of the MessageExchage in the run() method of the ObserverLifeCycle class, I'd expect to see some messages sometime.
    ExchangeId: 3389965929356-12104-134580929097830184
    Pattern: http://www.w3.org/2004/08/wsdl/in-out
    Role: CONSUMER
    Consumer: Null
    Provider: Null
    Index: 1 SynchState: NONE
    EndpointLink: caMainSample,casaService1,casaPort1
    Status: ACTIVE Location: LOCAL Transaction: None
    Service: null
    Endpoint: http://enterprise.netbeans.org/bpel/MainSample/MainProcess,MainPL,servicePortTypeRole_myRole
    Operation: {http://j2ee.netbeans.org/wsdl/SubSample/service}serviceOperation
    Interface: null
    Properties Count: 0
    DeltaProperties Count: 4
    Name: com.sun.jbi.messaging.messageid
    Value: 1
    Name: com.sun.jbi.observer.receiver
    Value: sun-bpel-engine
    Name: com.sun.jbi.messaging.groupid
    Value: b0ea5c93-151c-4559-877f-e49bd6bdac35
    Name: com.sun.jbi.observer.sender
    Value: sun-http-binding
    Message Count:   0
    Thank you & regards
    M.

  • Local variable files is never read

    How do i fix an error that reads "The local variable files is never read"?

    It's a warning, not an error. Your code will still compile.
    You fix it by either getting rid of that variable, or using it. What's the point of having a variable if you never read its value?

  • How to query the comma seperated values stored in Database

    Hi,
    I have a strange scenario, I am storing the specific data as a comma seperated value in the database. I want to query the DB with the comma seperated value as a Bind variable against the comma seperated value stored in DB.
    For eg : The data stored in DB has
    Row1 - > 1,2,3,4,5,6,7,8
    Row2 - > 4,5,6,7,8,9,10
    When I pas the Bind variable as '4,8' I should get Row1 and Row2 .
    Quick help his highly appreciated.. Thanks in Advance

    Oh, and if you actually wanted the data returned rather than just the row primary keys....
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as rw, '1,2,3,4,5,6,7,8' as txt from dual union all
      2             select 2, '4,5,6,7,8,9,10' from dual union all
      3             select 3, '1,6,7,9' from dual)
      4  -- end of test data
      5      ,r as (select '4,8' as req from dual)
      6  -- end of required data
      7      ,split_t as (select rw, regexp_substr(txt, '[^,]+', 1, rn) as val
      8                   from t, (select rownum rn from dual connect by rownum <= (select max(length(regexp_replace(t.txt, '[^,]'))+1) from t))
      9                   where regexp_substr(txt, '[^,]+', 1, rn) is not null
    10                  )
    11      ,split_r as (select regexp_substr(req, '[^,]+', 1, rownum) as val
    12                   from r
    13                   connect by rownum <= length(regexp_replace(req, '[^,]'))+1
    14                  )
    15  --
    16  select distinct t.rw, t.txt
    17  from   split_t st join split_r sr on (st.val = sr.val)
    18                    join t on (t.rw = st.rw)
    19* order by 1
    SQL> /
            RW TXT
             1 1,2,3,4,5,6,7,8
             2 4,5,6,7,8,9,10
    SQL>

  • Finding the average of all the values stored in a two dimentional array

    public int avg(int[][] numbers2){
        int sum = 0;
        float avg = 0;
        for(int r = 0; r < numbers2.length; r++)
          for(int c = 0; c < numbers2[r].length; c++){
              sum += numbers2[r][c];
          }So I have this code that of course finds the sum of all the values stored in the array int[][] numbers. What I am having an issue with is finding the average of the numbers. When I attempt to use:
    avg = sum / numbers2.length; I get the sum / 3 because my array looks like:
    int[][] numbers2 = {{1, 2, 3},
                                {4, 5, 6},
                                {7, 8, 9}
                                          };Any ideas on what I should do or where I could find information on this process?

    2 dimensional arrays have 2 lengths:
    myArray.length and myArray[0].length
    The first one I believe is fixed, the second one may vary from row to row. But if you know that it won't vary, then you can just use the [0] row length.

Maybe you are looking for

  • My Time Machine keeps backing up and won't stop.

    My Time Machine keeps backing up and won't stop.  The problem started when it said I was out if space.  It is supposed to delete the oldest backup.  Now I cannot even backup at all.  It just keep going and never stops, although it really does not wor

  • Monitor shuts down 10 sec, then on 10 sec - restart needed to continue in Firefox, problem only in Firefox.

    Lately I´ve experienced annoying problems when using Firefox - and only when using Firefox - the monitor shuts down for about 10 sec, then on again for about 10 sec, in the meanwhile doing anything on the computer is REAL slow. After restart everythi

  • Payments

    Last semester I bought a membership for Photoshop on a PC and I continue receiving on my credit card payments that I don't authorize for that program, and I want to cancel the contract of this program.  And I want to know how I cancel this so the cha

  • More songs in Recent menu?

    I thought this could be set somewhere but can't find it and the manual didn't help either- is it possible? Thanks!! Nigel

  • Changing background theme on Office 2013 - too white or 2 shades of grey.

    Is there a way to choose a color other than white, light grey, or dark grey as a background scheme for MS Office 2013? If not, when will there be an update to address this issue?