String.contains gives exception

if(selectedReport.contains("Sales")){
               String reportModule = "Sale";
               }gives the exception09:03:56,609 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: java.lang.String.contains(Ljava/lang/CharSequence;)Z
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
...........................................What can be the reason?
Thanks and Regards,
Anees

There should be something further down that says something like "caused by" or "wrapped exception." My guess is it'll say NullPointerException and that selectedReport is null.

Similar Messages

  • How to do string contains in drools.

    hi everyone
    i'm using drools for a project and have come to a problem. in two of my rules i need to check if a string contains some characters but can't seem to do get the rules to be excepted. if anyone could help me i would be very grateful.
    thanks in advance
    mike

    Display the rules.

  • PreparedStatement in batched mode gives Exception

    Hi
    I have a problem.
    I am running PreparedStatement in batched mode, actually I am using Springs BatchSQLUpdate component.
    Now i am creating a batch of about 10000 inserts / updates. However if any single of these inserts / updates fails, it gives exception with DataIntegrityViolation, BadSQLGrammer etc.
    I am also maintaining a parallel cache of the values that I am using to bind the preparedstatements.
    So for statement 1 in the batch, i know what values are being used.
    My question is when the batch update fails, how can we identify which SQL statement, i mean which index in the batch caused the issue?
    Please help me as I am stuck and need to build some robust exception handling for PreparedStatement batch loads.
    Niki

    Niki-Nono wrote:
    The insertPreparedStatements.get() in my code returns a BatchSqlUpdate object which has already been assigned a statement and also have passed the array of object values to it.
    I have done this using batchSqlUpdate.update(objects); where objects is an array of values.
    THe code block that I executes the flush(). This throws an exception. In some cases it is a BadSQLGrammerException for cases where we try to insert alphabets in integer columns or in some cases DataIntegrityViolation where the batch has 2 sets of values with same primary key.
    The results array is null when i check the value in the catch block.
    And the flush() does not proceed with execution of the complete batch in fact it aborts when even 1 statement fails.
    I hope it is clearer now.
    However, if all the statements go through, I have seen that the results array has correct values as to how many rows were updated / inserted.
    Please let me know.OK, I really wasn't sure about what it did on flush, as there's no explicitly stated exception and nothing in the method description. The array will be null since it hasn't been set with the return value from flush since an exception was thrown.
    From what I can tell this Spring class uses, under the hood, the batch functionality from JDBC. So the particular exceptions you;re getting will have started life as SQLExceptions...which themselves will be of the BatchSQLException I mention in my first post. I'm wondering if the Spring exceptions contain the SQLException. I would hope so, and I have a vague recollection that the original is wrapped so you should be able to do something along the lines of:
    catch (DataAccessException ex)
        SQLException ex = ex.getCause();
        if (ex instanceof java.sql.BatchUpdateException)
            // Get the info from here.
    }Now, this is only a concept, and I haven't tested it or anything, but I would hope something along these lines should get you to the data you're after.

  • AMFConnection never give exception,why?

    This is my simple code
    import flex.messaging.io.amf.client.AMFConnection;
    import flex.messaging.io.amf.client.exceptions.ClientStatusException;
    public class AMFClient {   
        public AMFClient() {        
        public static void main(String[] args) {        
            AMFConnection amfConnection = new AMFConnection();
            String url = "http://192.168.0.199:9081/testApp/messagebroker/amf";       
            System.out.println("AMF Client Test");
            try
                amfConnection.connect(url);
            catch (ClientStatusException cse)
                System.out.println(cse);
                return;
    The program never give exception if I give a non-existed url,why?Please help
    Thanks
    Mark

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.0.1. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • How to find out whether the String contains chinese characters

    I need to check if the string contains chinese characters in Java. Does anyone know how to do it? thx.

    Since Java strings contain UNICODE code points, check the content against the relevant page here - http://www.unicode.org/charts/ .

  • How to parse a string containing xml data

    Hi,
    Is it possible to parse a string containing xml data into a array list?
    my string contains xml data as <blood_group>
         <choice id ='1' value='A +ve'/>
         <choice id ='2' value='B +ve'/>
             <choice id ='3' value='O +ve'/>
    </blood_group>how can i get "value" into array list?

    There are lot of Java XML parsing API's available, e.g. JAXP, DOM4J, JXPath, etc.
    Of course you can also write it yourself. Look which methods the String API offers you, e.g. substring and *indexOf.                                                                                                                                                                                                                                                                                                                                                                                                               

  • Best way to split a single string containing 2 words into word1 and word2

    Whats the best way to take a string containing 2 words and split it into 2 strings ?
    eg. "red ferrari"
    string1 "red"
    string2 "ferrari"

    If your list is always going to have exactly two words, then yes.  Otherwise it depends on your requierments.

  • Execute a string containing a PL/SQL block

    Hi,
    I would like to build a string containing a PL/SQL block and execute it dynamically. Is there way to do this.
    Note - The reason I want to this is because, based on certain table data dictionary views the declaration section of the PL/SQL block that I am building might vary
    I tried to use EXECUTE IMMEDIATE, it didn't work, pls let me know if I am missing something.
    DECLARE
    v_str VARCHAR2(1000);
    BEGIN
    v_str := 'BEGIN NULL; END';
    EXECUTE IMMEDIATE v_str;
    END;
    /

    Hi,
    Just happened to find it. EXECUTE IMMEDIATE can be used, the bug with my code was I didn't have a ; after the END statement. Corrected code is below, thanks for your time
    DECLARE
    v_str VARCHAR2(1000);
    BEGIN
    v_str := 'BEGIN NULL; END;';
    EXECUTE IMMEDIATE v_str;
    END;
    /

  • Quick string question finding if a string contains a character

    hello peeps
    is there a quick way of checking if a string contains a specific character
    e.g.
    myString="test:test";
    myString.contains(":");
    would be true
    any ideas on a quick way of doing it

    is there a contains() method in 1.4.2? i couldnt see
    it in the docsNo there isn't. But the 1.5 has a contains(CharSequence s) method.

  • Is it possible to search for strings containing spaces and special characters?

    In our RoboHelp project, there are figures with text labels such as Figure 1, Figure 3-2, etc.
    When I search for "Figure 3" I get all pages containing "Figure" and "3", even if I surround it in quotes.  Similarly, searching for "3-2" treats the '-' character as a space and searches for all pages containing '3' or '2'.
    Is there a way to search for strings containing spaces and special characters?

    In that case I think the answer is no if you are using the standard search engine. However I believe that Zoom Search does allow this type of searching. Check out this link for further information.
    http://www.grainge.org/pages/authoring/zoomsearch/zoomsearch.htm
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Evalutate a string containing a numeric expression

    I need a function which would evaluate a string containing numbers and operators like "1+1" and return 2. The function should take into account precedence and all arithmetic and logical operators
    Thanks
    Mita

    Why don't you use the JDK compiler APIs (com.sun.javac.Main class) to compile on the fly a class implementing this interface:
    public interface Evaluator {
    public double evaluate() {
    return xxx;
    where xxx is your expression?
    Obviously, you build this class' source at runtime when you get the expression as input, and after you compile it you load it with Class.ForName(), instanciate it with newIstance() and the call the "evaluate" method.
    The advantage of this approach is that you can use "automagically" every expression available in java language. And with some extra effort of text-processing, even the Math functions!!!
    Giorgio Maone

  • String contains special chars

    Hi there,
    If given string contains a special character in the first position..i need to delete the character from the string.
    please suggest a way..

    It's clunky, but try this:
    To replace special character with space.
    data:  w_val type string.
    move old_string+0(1) to w_val.
    replace first occurance of w_val in old_string with space.
    OR
    To remove it entirely
    shift old_string by 1 places left.    " Shifts string to left and drops off characters to left.
    Steve

  • Writing strings containing \0 characters into a TextField

    Hi,
    I have a string containing one or more '\0' characters. I need to write it into a TextField and, for the purpose, I use the setText method.
    What I get then is a substring containing only the characters before the first \0.
    If I use a JTextField then I am able to see all the characters but if I try to copy and paste the content of the JTextField (using CTRL-C and CTRL-V) I get again a substring terminated by the first \0.
    Could someone help me?

    Hello again,
    I wrote this program that will copy from one JTextField to another. are you trying to past to another application, if I past the string into ultraedit (text editor) I get the first word, I can't see a way around that?
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class SimpleApp extends JFrame {
    public static void main(String args[]) {
    SimpleApp aFrame = new SimpleApp();
    JTextField myTextField = new JTextField("one\0two\0three\0four\0");
    JTextField myTextField2 = new JTextField();
    public SimpleApp() {
    super("Frame");
    getContentPane().setLayout(new BorderLayout());
    setResizable(false);
    myTextField.setColumns(30);
    myTextField2.setColumns(30);
    getContentPane().add(myTextField, "Center");
    getContentPane().add(myTextField2, "South");
    pack();
    show();
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    }

  • Insert string containing '&'

    How to insert string containing '&' into a table
    INSERT INTO TBL_CHANGES_ORGANISATIES(CHANGE_MANAGEMENT_ID, SUBMITTER) VALUES ('HM0000002147848|TK0000003121328','CS CSU S\&B Change Management')

    if you're in sqlplus:
    put set define offprior to running your insert.
    if you're in Toad, either:
    put set define offbefore your insert statement, and run both in as a script
    OR
    right mouseclick on the editor and untick the "Prompt for substitution variables", and you need never worry about the & again!

  • Code to check whether a given string contains alphanumeric

    Can anyone post the Code to check whether a given string contains only alphanumeric and no special characters

    <Rule name='isAlphaNumericString'>
    <RuleArgument name='testStr'/>
    <block>
    <defvar name='counter'>
    <i>0</i>
    </defvar>
    <defvar name='splitString'>
    <while>
    <lt>
    <ref>counter</ref>
    <length>
    <ref>testStr</ref>
    </length>
    </lt>
    <append name='splitList'>
    <substr>
    <ref>testStr</ref>
    <ref>counter</ref>
    <i>1</i>
    </substr>
    </append>
    <set name='counter'>
    <add>
    <ref>counter</ref>
    <i>1</i>
    </add>
    </set>
    </while>
    <ref>splitList</ref>
    </defvar>
    <containsAll>
    <list>
    <s>A</s>
    <s>B</s>
    <s>C</s>
    <s>D</s>
    <s>E</s>
    <s>F</s>
    <s>G</s>
    <s>H</s>
    <s>I</s>
    <s>J</s>
    <s>K</s>
    <s>L</s>
    <s>M</s>
    <s>N</s>
    <s>O</s>
    <s>P</s>
    <s>Q</s>
    <s>R</s>
    <s>S</s>
    <s>T</s>
    <s>U</s>
    <s>V</s>
    <s>W</s>
    <s>X</s>
    <s>Y</s>
    <s>Z</s>
    <s>a</s>
    <s>b</s>
    <s>c</s>
    <s>d</s>
    <s>e</s>
    <s>f</s>
    <s>g</s>
    <s>h</s>
    <s>i</s>
    <s>j</s>
    <s>k</s>
    <s>l</s>
    <s>m</s>
    <s>n</s>
    <s>o</s>
    <s>p</s>
    <s>q</s>
    <s>r</s>
    <s>s</s>
    <s>t</s>
    <s>u</s>
    <s>v</s>
    <s>w</s>
    <s>x</s>
    <s>y</s>
    <s>z</s>
    <s>0</s>
    <s>1</s>
    <s>2</s>
    <s>3</s>
    <s>4</s>
    <s>5</s>
    <s>6</s>
    <s>7</s>
    <s>8</s>
    <s>9</s>
    </list>
    <ref>splitString</ref>
    </containsAll>
    </block>
    </Rule>
    It Retruns 1 if it contains only alphanumeric otherwise 0

Maybe you are looking for

  • How can I make an applet look to the current directory to read a txt file in?

    I am using a File class passing only the file name as the contructor but forte still looks in "C:\forte_jdk\forte4j\bin\Events.txt" which is not my current directory for the project. If leave it and ftp this applet to my web site I get an IOException

  • Issue with G/L Account Determimation in the sales order.

    Hi All, We have an issue while saving a sales order. The document is complete and while saving it says G/L no. missing . It allows me to save but Revenue account is not determined. Have defined new account determination table with sales area/ sales d

  • Can't add page ! (can't get started)

    When I open iWeb, I am unable to add a page, so I can't get started. The only thing that appears is: in the left hand column a red icon that says "site". I am unable to add anything? any ideas? My idisc is mounted and is telling me how much space is

  • Constantly getting kicked off wifi.

    So, I've never had an issue with wifi on my iPad until I changed my security to WEP. To fix it the first time, I just "forgot network" and signed back in with the password. I didn't have an issue for months until recently. So I tried the fix previous

  • How can I change the name of our podcasts

    In the podcst directory ours is listed as:  liberty-baptist-church-sermons/id719265104 How can I chnage that to read the real name of the program:  The Liberty Pulpit Frank Chyz Media Director Liberty Baptist Church Ellenboro, NC