If inconsistency of declaration?

Yay! Another post from me!

I have an if statement in a bean which seems to be the treatment very well when I create a java test class, but does not work correctly when the bean is called by a jsp page.

My code, let me show you it:

First of all, the test class:
package com.serco.inquire;

import java.util.*;
import java.text.*;

public class TestCollection {
          
     public static void main(String[] args) {
          IrCollection myCollection = new IrCollection();
          myCollection.setSort("none");
          myCollection.setMgrid("none");
          int endpoint = myCollection.getSize();
          for (int i=0;i<endpoint;i++) {
               InquireRecord curRec = myCollection.getCurRecords(i);
               Long milis = new Long(curRec.getSubmitDate());
               Date theDate = new Date(milis);
               Format formatter = new SimpleDateFormat("dd MMM yyyy");
               String s = formatter.format(theDate);
               System.out.println("ID: " + curRec.getID() + " | Subject: " + curRec.getSubject());
          }
     }
          
}
a snippit of the class IrCollection, which he called:
private void processSort(String datum) {
          int LastChar = datum.length()-1;
          String colName = datum.substring(0, LastChar);
          if (datum=="none") {
               this.fullSort  = " ORDER BY lastUpdated DESC";
          } else {
               if (datum.endsWith("2")) {
                    this.fullSort = " ORDER BY " + colName + " ASC";
               } else {
                    this.fullSort = " ORDER BY " + colName + " DESC";
               }
          }
     }
There is more code in another method that calls this particular method by using:
this.processSort(this.sort);
But the problem is that if (reference is 'none') part in the second code example. Given that 10 of the first class line defines the kind of member variable 'None', the processSort() method must set the Member fullSort to "LastUpdated ORDER BY DESC" variable

And if I use the class in the first sample, she does that.

HOWEVER

I have this custom tag:
<%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ attribute name="mgr" required="true" %>
<%@ attribute name="mkind" required="false" %>
<%@ attribute name="sort" required="false" %>

<c:if test="${empty mkind}">
  <c:set var="mkind" value="manager" />
</c:if>

<c:if test="${empty sort}">
  <c:set var="sort" value="none" />
</c:if>

<jsp:useBean id="irc" scope="page" class="com.serco.inquire.IrCollection">
  <jsp:setProperty name="irc" property="mgrtype" value="${mkind}" />
  <jsp:setProperty name="irc" property="sort" value="${sort}" />
  <jsp:setProperty name="irc" property="mgrid" value="${mgr}" />
</jsp:useBean>

${irc.fullsort}
Calling the .jsp file with this:
<c:set var="user" value="none" />    
<c:set var="sort" value="none" />
<inq:displayCollection>
  <jsp:attribute name="mgr">${user}</jsp:attribute>
  <jsp:attribute name="mkind">cotr</jsp:attribute>
  <jsp:attribute name="sort">${sort}</jsp:attribute>
</inq:displayCollection>
In other words, the same exact data are fed to the IrCollection bean. so I should get the same data, right?

Except that I get this:
WHERE cotr = 'none' ORDER BY no DESC
so when Java calls him, he thinks that 'none' is 'none '.
but when jsp calls him, he thinks that "none!" = 'none '.

In order to compare the States of objects, including the content of the strings, use equals(), not is. Him == operator tests if 2 references have the same value, that is, they are both point to the same object (or both are null). The Equals () method does everything what the Director of this class told it to do, but its purpose - and what he does in reasonable implementations - it must compare the States of objects. In the case of the string, it checks if the two String objects contain equal character sequences.

If == happened to return true in your test case, its because the course has led to these two references pointing to the same string object in the constant pool.

Tags: Java

Similar Questions

  • Inconsistency in Acrobat and Reader restrictions

    There is an inconsistency between the Adobe products for restrictions of document on a file that I received.  If I open it in Acrobat, it says 'None' for the security of documents, and any restrictions on the document say "authorized."  If I open it in the reader, he says always "None" for the security of the documents, but about half say the restrictions of the document (including signature) "unauthorized."  What gives?  I use the latest version of Acrobat and Reader, but I don't know what was used to generate the document.  I tried to save the document in Acrobat, but it doesn't help.

    Confusing isn't. The thing is, this isn't a tool of reporting for security. Rather, it is to tell you what you can and can't do now. Thus, the player may not change (for example). If editing is not authorized in the drive and declared as such. Other thgs can depend on to know if a file is active, signed player or whatever.

  • jQuery ui datepicker inconsistency

    I'm trying to influence the behavior of a popup datepicker in a region of interactive report and getting inconsistent results. I use v4.2.4.00.08 Apex

    I created a SORT on a table with a date column. Once created, I use Actions = > filter, then select the date column. I use generally between the operator and select the date picker icon to select dates. (I intend to make a saved filter report).

    I need to change the datepicker popup to allow the user to see more than one month at a time. With a few tries, I added this code in the Page = > Javascript = > :

    {$(document) .ready (function ()}

    change to display 3 months at a time and a sign of button to select today

    $. datepicker.setDefaults({)

    ({'numberOfMonths': 3, 'dateFormat': 'JJ-M-AA', 'showButtonPanel': true});

    });

    I go back to datepicker and successfully get 3 months in the context menu and the Panel down with close buttons and today. However, I really want that month and year like select from drop-down menus. I now make this change to the Javascript:

    {$(document) .ready (function ()}

    change to display the month and year as select in the drop-down menus

    $. datepicker.setDefaults({)

    ({'changeMonth': true, 'changeYear': true, 'dateFormat': 'JJ-M-AA', 'showButtonPanel': true});

    });

    DatePicker returned to the single month pop-up window, select no menus, but the Panel remains. My question is why is the datepicker editable with a default value, but not another? I tried the sandbox sand Apex v5 adopteur early and had the same results.

    Thank you

    Kelly

    This is because as the bodies to initialize some of the options, that are not replaced by setting global values by default. It is that changeMonth and changeYear are two of them. Same behavior for an ordinary page element, incidentally, where the selection lists are an attribute for the element and false as a default value.

    When the filter Panel is open certain HTML is retrieved on the server, and this includes the initialization of date picker:

    (function(){apex.widget.datepicker("#apexir_BETWEEN_FROM",{"buttonImage":"\u002Fi\u002Fasfdcldr.gif","buttonImageOnly":true,"buttonText":"Popup Calendar: ","showTime":false,"defaultDate":new Date(2014,9,14,07,15,52),"showOn":"button","showOtherMonths":false,"changeMonth":false,"changeYear":false},"dd-M-y","en");})();
    (function(){apex.widget.datepicker("#apexir_BETWEEN_TO",{"buttonImage":"\u002Fi\u002Fasfdcldr.gif","buttonImageOnly":true,"buttonText":"Popup Calendar: ","showTime":false,"defaultDate":new Date(2014,9,14,07,15,52),"showOn":"button","showOtherMonths":false,"changeMonth":false,"changeYear":false},"dd-M-y","en");})();
    

    As you can see, the changeMonth and changeYear set to false. Change the overall default values so will not influence these options. To do this, you need to change the option in the instance itself. Challenge with that though is that there is no check mark to know when the Panel has loaded... There are only the means hacky.

  • ORA-00932: inconsistent data types: expected - was -.

    DECLARE
    STR VARCHAR2(2000):='<SerachVal>1234</SerachVal>';
    L_OUT VARCHAR2(1000);
    BEGIN
    SELECT EXTRACTVALUE(STR,'/SerachVal') INTO L_OUT FROM DUAL;
    DBMS_OUTPUT.PUT_LINE(L_OUT);
    END;
    
    
    error:
    
    PL/SQL: ORA-00932: inconsistent datatypes: expected - got -
    PL/SQL: SQL Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    SQL> set serverout on
    SQL> DECLARE
      STR   VARCHAR2(2000):='1234';
      L_OUT VARCHAR2(1000);
    BEGIN
      SELECT EXTRACTVALUE(XMLTYPE(STR),'/SerachVal') INTO L_OUT FROM DUAL;
      DBMS_OUTPUT.PUT_LINE(L_OUT);
    END;  2    3    4    5    6    7
      8  /
    1234
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • How to declare a list of dates

    Hello

    I have a question what type is "show as text based on LOV. I put in the source section under the "Body of the Pl/SQL function" type the following pl/sql function:
    DECLARE
    X VARCHAR2 (4000);
    Y DATE ;
    BEGIN
    X := 'SELECT distinct(TO_CHAR(DATE1, ''YYYY'')) d, (TO_CHAR(DATE1, ''YYYY'')) r FROM SIVOA.EVV_'|| :p4_site ||' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM SIVOA.SITE_DEBIT_RIVIERE WHERE SITE ='''|| :p4_site ||''')
    order by d';
    EXECUTE IMMEDIATE X INTO Y;
    RETURN Y ;
    END;
    The problem is that I get an error ORA.
    ORA-00932: inconsistent data types; EXPECTED:; obtained:-

    I know I said Y as a date and that which is returned by my function is a list of dates. I don't know how to report a list of dates or anything to be returned as a lily of the values. I hope that I am clear, sorry for my English.

    Thank you for your help.

    Christian

    You must return the string SQL, not a date value:

    DECLARE
    X VARCHAR2 (4000);
    BEGIN
    X := 'SELECT distinct(TO_CHAR(DATE1, ''YYYY'')) d, (TO_CHAR(DATE1, ''YYYY'')) r
    FROM SIVOA.EVV_'|| :p4_site ||' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM
    SIVOA.SITE_DEBIT_RIVIERE WHERE SITE ='''|| :p4_site ||''')
    order by d';
    RETURN X ;
    END;

  • Why I get this error? ORA-00932: inconsistent data types

    It's my stored procedure, I created to select only the exact amount of records per page to a GridView (for ASP.NET):
    CREATE OR REPLACE
    PROCEDURE SELECT_COMMAND
    (pTable IN VARCHAR2
    , pFields IN VARCHAR2
    , pSortField IN VARCHAR2
    , pPageIndex IN NUMBER
    , pTotalRecs IN NUMBER
    , pResultSet OUT SYS_REFCURSOR
    ) AS
    BEGIN  
      EXECUTE IMMEDIATE 
      'SELECT ' || pFields || ' FROM '
      || '(SELECT '|| pFields ||', ROW_NUMBER() OVER(ORDER BY '|| pSortField ||') ROW_NUM '
      || 'FROM '|| pTable ||') WHERE ROW_NUM BETWEEN '|| to_char(pPageIndex*pTotalRecs) ||' AND '
      || to_char((pPageIndex+1)*pTotalRecs)    
      INTO pResultSet;
      -- Plus 1 to our index because GridView is a zeroth index collection
    END SELECT_COMMAND;
    I then do a test case with the following parameters:
    declare
    p_test sys_refcursor;
    begin
    select_command('v_sig_devices', '"JOB", "LINE"', '"DEVICE_ID"', 0, 10, p_test);
    end;
    But I get the following error:

    >
    Error report: ORA-00932: inconsistent data types: expected - was -.
    ORA-06512: at the 'SIM '. SELECT_COMMAND', line 10
    ORA-06512: at line 4 level
    00932 00000 - ' incompatible data types: wait %s %s got. "
    >

    At first Oracle gave me an error because the figures were not a string. Can I convert it to a string (with to_char) and Oracle is still not satisfied! Any ideas as to why this is happening?

    Thanks for any help you can provide.

    Suppose you want sth. as

    ...
    OPEN pResultSet FOR 'SELECT ' || pFields || ' FROM '
      || '(SELECT '|| pFields ||', ROW_NUMBER() OVER(ORDER BY '|| pSortField ||') ROW_NUM '
      || 'FROM '|| pTable ||') WHERE ROW_NUM BETWEEN '|| to_char(pPageIndex*pTotalRecs) ||' AND '
      || to_char((pPageIndex+1)*pTotalRecs)  ;
    ...
    
  • Error ORA-00932: inconsistent data types

    Hello world

    I'm having a small problem with the error ORA-00932: inconsistent data types. The code below is what I'm working on. The error is on line 12:
    "vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | '. vSchema |'. < table > @ < DB_LINK > '; ». This is because DDH_HOST_NM is a VARCHAR2 and DDH_SCHEMA_NR a number.

    I know what is the error and where it is but I can't work on how to solve this problem. I tried to use to_char on DDH_SCHEMA_NR but that does not.

    Anyone have an idea how I can fix this problem?

    Thank you
    N.S.N.O.

    DECLARE
    vSchema varchar2 (1000);
    vStmt varchar2 (1000);
    Version number (38);
    CURSOR c_schemas IS
    Select "< SCHEMA-NAME >" as "< scheme name >" twice;
    BEGIN
    Open c_schemas;
    LOOP
    SEEK c_schemas INTO vSchema;
    EXIT WHEN c_schemas % NOTFOUND;
    vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'. < table > @ < DB_LINK > ';
    Run immediately vStmt in version;
    dbms_output.put_line(vSchema||) e '|| Version);
    END LOOP;
    CLOSE C_schemas;
    END;

    The problem is that you choose 2 columns in a single variable?

    vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'.

    @';
    Run immediately vStmt in version ;

    This must be either

    vStmt: = ' select DDH_SCHEMA_NR from ' | vSchema |'.

    @';
    Run immediately vStmt in version;

    or

    vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'.

    @';
    Run immediately vStmt in vHostNm, version;

    where vHostNm should set as a variable too.

  • iOS 10 Mail: moving Messages, inconsistent behavior when you tapoterez folder icon

    iPhone 6, iOS 10

    I see inconsistent behavior when I try to move a message in Mail from in the message.

    In previous versions of iOS, during playback of an e-mail message, I could tap the icon of the folder at the bottom of the messages, and which would lead to the top of the hierarchy of the folders for the email of the message account. From there on, it was just a matter of tapping on the file I want to move the message to, and he settled there the message and look back to the Inbox display (or the folder view I moved this message of).

    In iOS 10, when I hit this folder icon, two things happen: it happens the same thing I described above, or sometimes, rather than see the hierarchy of folders, I see three buttons slide up from the bottom of the screen. The top button allows me to move the message directly to a folder in my account called 'Action' I created (I don't know why he chose this particular file to the default value for this button - maybe because it is first in alphabetical order of all my folders created by the user), the second button says "Another mailbox" and when it takes me to the hierarchy of the mailbox as described above, and the third button is a Cancel button.

    I can't understand what dictates which of those two things happening. I tried again and again on a bunch of different messages. Some do happen, some do the other thing happens, and sometimes I'll have a different behavior in the message even if I try again later.

    I prefer the old way. But I could get used to the new way, if I could at least choose what default folder appears in the first box.

    Anyone else seeing this?

    Someone knows how to change the default folder in the first box of this new process?

    Thank you!

    I seem to have solved the problem on my own. I went to settings > Mail, and in the "Threading" section, I have disabled "Complete Threads."

  • Inconsistent results Spotlight

    I've known inconsistent results of Spotlight with OS X servers for a year or so now. I worked on that with Yosemite and El Capitan.

    What is happening is that Spotlight does not see inside some files scattered in various actions. The problem is consistent if the search of a customer attached or on the server itself. It has many, many of these records.

    I deleted it. Index files V100-focus on volumes several times with the following process:

    sudo mdutil - a-i off

    sudo rm - rfv. Spotlight-V100 (I run on each volume)

    sudo mdutil - a-i on

    sudo mdutil - Ea

    However after letting the Spotlight re-indexing it does not fix things.

    I think next reset the ACL on the volume where the data is stored. I first want to make sure that what I'm doing, that's enough:

    sudo chmod-r/path/to/volume n

    Then set the permissions for the shares as it should.

    Suggestions or comments?

    You happen to have the system during a rebuild Spotlight log tail?  If Yes, have you seen errors, files or records which failed to index, or all mdworker default processes?  The system log can provide valuable data as to why Spotlight does not complete.

    Then, if you are going to strip the ACL, you will also remove user _spotlight.  This system is essential for the proper functioning of the projector.  Make sure that when you go to spread your new ACLs that account _Spotlight is listed as an ACE inherited.  All files and folders on your part must contain this account from the ACL table service.

    And finally, don't forget to watch the POSIX permissions.  If you have restrictive permissions POSIX, you may have implemented a condition in which the mdworker process simply can not cross your data structure.  Search for files located at 700 or files located at 600.  Perhaps considered using the propagation process to restore all the POSIX permissions standard umask.

    I hope this helps.

    Reid

    Apple Consultants Network

    Author - "El Capitan Server - Foundation Services.

    Author - "El Capitan Server - Collaboration & control»

    Author - "El Capitan Server - Advanced Services '.

    : IBooks exclusively available in Apple store

  • How can I get rid of your invasive UN firefox like declaring your independence tab?

    Since I upgrade, two tabs open, a declarant declare your independence. I think it's very Microsoftish for this force on people and I can't put my tab back to what I want. I like firefox but it's completely unacceptable. Remove or I'll go to chrome

    Hello nvyguy, this is just a temporary redesign of the homepage for the occasion and will disappear in a few days again in any case. If you don't like it you can change the home page to any other site of your choice: How to set the home page

  • How can I reactivate my iPhone after declaring, he lost and deleted from my ipad

    How can I reactivate my iPhone after declaring, he lost and deleted from my ipad?

    See "how to disable or cancel lost mode?  here:

    If your iPhone, iPad or iPod touch is lost or stolen - Apple supports

    If erase you your device, which is different from the lost mode, and you must read and understand the information on having cleared your device in the same article.

  • customization of the google search and the new inconsistency of tabs

    1. is there a way to customize the google search bar to the effect of doing this and this addons?

    2. I dislike the inconsistency of FF3 when it comes to opening new tabs: CTRL + T opens a new tab to the very good, while clicking on a link or search in the menu shortcut opens the new tab next to the tab that is currently open. There should be a way to make the FF to work one way or the other.

    1. you can change the google.xml file in the program folder files \searchplugins\ to match one of these two XML files search plugins.

    2. which changed in Firefox 3.6 to fix a Bug which was introduced some time - ago "related" URL opens to the right of the tab being viewed, others open on the far right. Many of us did not like that and we have disabled this feature.

    Type of topic: config in the URL bar and press ENTER.

    If you see the warning, you can confirm that you want to access this page.

    Filter = browser.tabs.insertRelatedAfterCurrent

    Double-click the preference to change the false value

  • Tecra M5 does not record the date and time - battery RTC or CMOS checksum is inconsistent

    My Tecra M5 PTM50E reverend new does not record the date and time. I loaded RTC battery for 8 hours when electricity is on in the said user's manual. I don't know where is the problem. The BIOS settings are respect after power is on.

    When I change any value in the BIOS, the changes are saved properly but date & time system restored to their value 01/01/2000, 00:00 every time when I get out of turning off more of 2-3 min. Message "RTC battery is low or CMOS checksum is inconsistent.

    Press [F1] to set Date/time"does not appear when I power on the computer. Any suggestions?

    Hi guys

    Usually this problem appears only if the CMOS (real time clock) battery is empty or corrupted.
    The real time clock battery powers the internal clock in real time and calendar. It also maintains the system configuration. If the RTC battery is completely discharged, the system loses these data and the real-time clock. In this case, the message RTC battery is low or CMOS checksum is inconsistent appears.

    So I see only two possibilities:
    Either you will charge the battery for real-time clock, or you ask the technician for replacement.

    Generally, the battery must be completely charged after 8-9 hoers but try to connect the laptop to the power adapter for a long time.
    If it will not help solve the problem if you contact the ASP for the RTC battery replacement.

  • Any ideas how to fix this code error: declaration of property not valid css to *.

    My mac guard getting hung up on some websites here, that's what appears on the Console error: declaration of property not valid css to the * and then cl css and about 4 numbers.

    Any ideas what's happening?

    Poorly coded Web page. What site?

  • I was using my MacBook today and it crashed and the dock turned silv, I restarted the mac and it was always the same, then I loaded the disk utility and checked the disk and it says disk is fine. It flashes inconsistently gray and the dock turned

    I was using my MacBook today and it crashed and the dock turned silver, I restarted the mac and it was always the same, then I loaded the disk utility and checked the disk and it says disk is fine. It flashes inconsistently gray and the dock has transformed money! I tried to restore Mac OS and then also the same!
    OS El Capitan

    This can help:

    Reboot safe mode (it is a slow process):

    -stop of the mac

    -Start up the mac in shift, press and hold until you see appear it to progress bar, so you can let go

    -When everything started, connect

    -Once connected, stop the mac once again, nothing else is necessary.

    -restart normally.

    Lex

    PS: This clears all system caches.

Maybe you are looking for