Problem with substring or println

Hi,
I have the following code, and it basically is looking for text between <title></title> tags. I use substring to grab the code between the two tags, and debugging shows it is correct. However, when I output it, my code stops and I just have whitespace.
Any suggestions?
while(((str = in.readLine()) != null) && (found == false))
     if(str.indexOf("<title>") != -1) // Title exists
          found = true;
          int titlestart=0;
          int titleend=0;
          titlestart = str.indexOf("<title>");
          titleend = str.indexOf("</title>");           
          title=str.substring(titlestart,titleend);
          out.println("Found:" + title +" Start index at:" + titlestart + " End at:"+titleend );
}

The code below works for
1. <title>foo<title>
2. <title>
foo
</title>
3. <title>foo
bar</title>
Use it if it helps...
            StringBuffer title = new StringBuffer(); 
            while (((str = in.readLine()) != null) && found == false)
                // start reading
                if (str.indexOf("<title>") != -1) // Title exists
                    boolean singleLine = false;                   
                    found = true;
                    if (str.indexOf("</title>") == -1)
                        //data between title tags span multilines.
                        //And yet there may be some data on this line eg, <title>foo...
                        title.append(str.substring(str.indexOf("<title>") + 7, str.length()));                       
                    else
                        //tag starts and ends in a single line
                        title.append(str.substring(str.indexOf("<title>") + 7, str.indexOf("</title")));
                        singleLine = true;
                    if(!singleLine)
                        do
                            str = in.readLine();
                            if (str.indexOf("</title>") == -1)
                                //if the tag doesnt end, keep on reading
                                title.append(str);
                            else
                                //if the tag ends on this line, egt all data that may be present before tag end
                                //eg ...bar</title>
                                title.append(str.substring(0, str.indexOf("</title>")));
                        while (str != null && str.indexOf("</title>") == -1);
            out.println(title);ram.

Similar Messages

  • Problem with substring in xsl file?

    Hallo,
    i have a xsl file, when using
    <xsl:value-of select="StsEdat"/> i've got 2007-05-21, that's o.k.
    when using <xsl:value-of select="substring(StsEdat,9,2)"/> the answer is blank.
    also 0,5 or so on. substring at this position delivers blank. why?
    what can it be? i'am helpless.
    any help is appreciated.

    Hi,
    I used <xsl:value-of select="substring(StartDate,9,2)"/> the answer was 21 and to 0,5 the answer was 2007. It seems that's ok!
    Try to do it and see if you have problem with substring.
    <xsl:variable name="StsEdat">2007-05-21</xsl:variable>
    <xsl:value-of select="substring($StsEdat,9,2)"/>
    or this weird way, :)
    <xsl:variable name="StsEdat">2007-05-21</xsl:variable>
    <xsl:value-of select='substring-after(substring-after($StsEdat, "-"), "-")' />
    Regards,
    Cleiton

  • Problem with SUBSTR

    En una view, al crear un campo con SUBSTR( campo, 1, 150), devuelve un campo con tamaño de 600, el correcto seria 150, cual es la causa ?

    Hi user 512674,
    Please, post your questions in English. Otherwise, only Spanish-speaking people can help you (or those who can guess what the problem is ;)
    SUBSTR(campo, 1, 150) means 150 characters. In an AL32UTF8 database, which you most probably have, this translates to 4*150=600 bytes. That is, the column must be able to store 600 bytes to be sure that it can store 150 AL32UTF8 character codes.
    View creation does not depend on the value of the session parameter NLS_LENGTH_SEMANTICS. The view columns inherit the semantics from the underlying table columns. If <campo> column is defined with character semantics the view column will be created with character semantics: ALL_TAB_COLUMNS.DATA_LENGTH will show 600 (bytes), ALL_TAB_COLUMNS.CHAR_LENGTH will show 150 (characters), ALL_TAB_COLUMNS.CHAR_USED will show 'C'. Otherwise, the view will be created with byte semantics: ALL_TAB_COLUMNS.DATA_LENGTH will show 600 (bytes), ALL_TAB_COLUMNS.CHAR_LENGTH will show 600 (characters), ALL_TAB_COLUMNS.CHAR_USED will show 'B'.
    -- Sergiusz

  • Problem with Substring

    Here's my code..
    String Varble = rs0.getString("adddate").substring(0,10);
    out.println("<td>" + stmt + "</td>");
    I've also tried this (which is the same thing just more code) Now it DOES work if I make tinydate text.
    String tinydate = rs0.getString("adddate")
    String Varble = tinydate.substring(0,10);
    out.println("<td>" + stmt + "</td>");
    Here's the Error. What am I doing wrong?
    javax.servlet.ServletException: Error: Browse.jsp - select adddate from K9Manager WHERE adddate is not NULL failed.java.sql.SQLException: [TDS Driver]No current row[TDS Driver]No current row
         

    Hard to tell what you are doing wrong, but it is nothing to do with the substring method. The message "No current row" suggests to me that you haven't called rs0.next() to move to the first row of the result set, but the error message displays your SQL, which I find strange. But maybe that's just how your JDBC driver does things.

  • Problem with SUBSTR and GROUP BY

    Hi people...
    I'm needing a little help with this case. I'm executing this SQL and got error ORA-01722. I've tried to use number columns, alias and the syntax below and always got error. My problem is the SUBSTR, without it I can run the SQL with no error.
    SQL> ED
    Gravou arquivo afiedt.buf
    1 SELECT TO_CHAR(DATA,'DD/MM') AS DATA,
    2 SUBSTR(TO_CHAR(DATA,'DAY'),1,3) AS DIA_SEM,
    3 SUM(DECODE(TIPOBAIXA,1,1,0)) AS INST,
    4 SUM(DECODE(TIPOBAIXA,1,0,1)) AS REM,
    5 SUM(DECODE(TIPOBAIXA,1,1,0))-SUM(DECODE(TIPOBAIXA,1,0,1)) AS DIFF
    6 FROM BAIXA
    7 GROUP BY TO_CHAR(DATA,'DD/MM'), TO_CHAR(DATA,'DAY')
    8* ORDER BY TO_CHAR(DATA,'DD/MM') DESC
    SQL> /
    GROUP BY TO_CHAR(DATA,'DD/MM'), TO_CHAR(DATA,'DAY')
    ERRO na linha 7:
    ORA-01722: invalid number
    Somebody has an idea of how I can solve this?
    Thanks,
    Fabiano

    SQL> create table baixa
      2  as
      3  select sysdate data, 1 tipobaixa from dual union all
      4  select sysdate - 1, 0 from dual union all
      5  select sysdate - 2, 1 from dual
      6  /
    Tabel is aangemaakt.
    SQL> SELECT TO_CHAR(DATA,'DD/MM') AS DATA
      2       , TO_CHAR(DATA,'DY') AS DIA_SEM
      3       , SUM(DECODE(TIPOBAIXA,1,1,0)) AS INST
      4       , SUM(DECODE(TIPOBAIXA,1,0,1)) AS REM
      5       , SUM(DECODE(TIPOBAIXA,1,1,0))-SUM(DECODE(TIPOBAIXA,1,0,1)) AS DIFF
      6    FROM BAIXA
      7   GROUP BY TO_CHAR(DATA,'DD/MM'), TO_CHAR(DATA,'DY')
      8   ORDER BY TO_CHAR(DATA,'DD/MM') DESC
      9  /
    GROUP BY TO_CHAR(DATA,'DD/MM'), TO_CHAR(DATA,'DY')
    FOUT in regel 7:
    .ORA-01722: invalid number
    SQL> select to_char(data,'dd/mm') as data
      2       , to_char(data,'DY') as dia_sem
      3       , sum(decode(tipobaixa,1,1,0)) as inst
      4       , sum(decode(tipobaixa,1,0,1)) as rem
      5       , sum(decode(tipobaixa,1,1,0))-sum(decode(tipobaixa,1,0,1)) as diff
      6    from baixa
      7   group by to_char(data,'dd/mm')
      8       , to_char(data,'DY')
      9   order by 1 desc
    10  /
    DATA  DI                                   INST                                    REM                           DIFF
    05/01 VR                                      1                                      0                              1
    04/01 DO                                      0                                      1                             -1
    03/01 WO                                      1                                      0                              1
    3 rijen zijn geselecteerd.Regards,
    Rob.

  • Problems with System.out.println()

    I tried writing a simple 'Hello world'-program:
    public class Test{
         public static void main(String[] args){
              System.out.println("Hello World!");
         }//main()
    }//Test
    But the text wouldn't appear in the DOS-window. The only text that showed up was the standard 'Press any key to close the window'. The program compiled without any problems, but didn't work when I tried to run it.
    Does anyone have any idea what's wrong?

    Are u sure , the main() class part is donecorrectly.
    Becuse program will compile but not run without a
    main() class.what do you mean by main() class???First of all main() is a method, not a class. The main() method the JRE recognizes and runs is the:
    public static void main(String[] params)
    If you don�t have exaclty those modifiers and receive an array of Strings parameter it will send you an runtime exception.
    Your code compiles and runs fine, the problem isn�t really System.out.print() it is something with your configuration.
    I have to rename the class to TestF. Here is the running:
    C:\cJava>javac TestF.java
    C:\cJava>java TestF
    Hello World!

  • Out.println() problems with large amount of data in jsp page

    I have this kind of code in my jsp page:
    out.clearBuffer();
    out.println(myText); // size of myText is about 300 kbThe problem is that I manage to print the whole text only sometimes. Very often happens such that the receiving page gets only the first 40 kb and then the printing stops.
    I have made such tests that I split the myText to smaller parts and out.print() them one by one:
    Vector texts = splitTextToSmallerParts(myText);
    for(int i = 0; i < texts.size(); i++) {
      out.print(text.get(i));
      out.flush();
    }This produces the same kind of result. Sometimes all parts are printed but mostly only the first parts.
    I have tried to increase the buffer size but neither that makes the printing reliable. Also I have tried with autoFlush="false" so that I flush before the buffer size gets overflowed; again same result, sometimes works sometimes don't.
    Originally I use such a system where Visual Basic in Excel calls a jsp page. However, I don't think that this matters since the same problems occur if I use a browser.
    If anyone knows something about problems with large jsp pages, I would appreciate that.

    Well, there are many ways you could do this, but it depends on what you are looking for.
    For instance, generating an Excel Spreadsheet could be quite easy:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TableTest extends HttpServlet{
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
              response.setContentType("application/xls");
              PrintWriter out = new PrintWriter(response.getOutputStream());
                    out.println("Col1\tCol2\tCol3\tCol4");
                    out.println("1\t2\t3\t4");
                    out.println("3\t1\t5\t7");
                    out.println("2\t9\t3\t3");
              out.flush();
              out.close();
    }Just try this simple code, it works just fine... I used the same approach to generate a report of 30000 rows and 40 cols (more or less 5MB), so it should do the job for you.
    Regards

  • Problem with conversion of strings like THISStr - this_str capitalization

    Problem with conversion of strings like. THISStr -> this_str
    Can anybody pass on the reverse code. I have one, but its faulty.
    public static String convertFromPolycaps(String str) {
              Pattern pattern = Pattern.compile("\\p{Upper}+");
              Matcher matcher = pattern.matcher(str);
              StringBuffer result = new StringBuffer();
              // We do manual replacement so we can change case
              boolean notFirst = false;
              int grpP = 0, grpA = 0;
              String last = "";
              String now = "";
              while (matcher.find()) {
                   grpA = matcher.end();
                   if (notFirst) {
                        now = matcher.group().substring(0).toLowerCase();
                        if (grpA - grpP > 1) {
                             matcher.appendReplacement(result, now);
                             result =
                                  new StringBuffer(
                                       result.substring(0, (result.length() - 1))
                                            + "_"
                                            + result.substring(result.length() - 1));
                        } else {
                             matcher.appendReplacement(result, "_" + now);
                   } else {
                        matcher.appendReplacement(result, matcher.group().substring(0).toLowerCase());
                        notFirst = true;
                   grpP = matcher.end();
                   ////index++;
                   last = now;
              matcher.appendTail(result);
              System.err.println(str + " : " + result.toString());
              return result.toString();
         }succesfully converts :
    AccountNmnc : account_nmnc
    CustNameJ : cust_name_j
    Resume : resume
    BeneBrCode : bene_br_code
    ApprovedPerson : approved_person
    but fails for:
    GLCode : glcode
    VISHALErrCode : vishalerr_code
    GHASUNNAcNo : ghasunnac_no

    Can anybody pass on the reverse code. I have one, but
    its faulty.Post it, I'm sure we can fix it...

  • Problems with WLST embedded in java app.

    Hi,
    I have a problem with the WLST embedded in a java app.
    I want to programatically create or reconfigure a domain from a java application. Following is a simple example of what I want to do.
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class DomainTester {
      static WLSTInterpreter interpreter = new WLSTInterpreter();
      private void processDomain() {
        if(domainExists()) {
          System.out.println("Should now UPDATE the domain");
        } else {
          System.out.println("Should now CREATE the domain");
      private boolean domainExists() {
        try {
          interpreter.exec("readDomain('d:/myDomains/newDomain')");
          return true;
        }catch(Exception e) {
          return false;
    }The output of this should be one of two possibles.
    1. If the domain exists already it should output
    "Should now UPDATE the domain"
    2. If the domain does not exist it should output
    "Should now CREATE the domain"
    However, if the domain does not exist the output is always :
    Error: readDomain() failed. Do dumpStack() to see details.
    Should now UPDATE the domain
    It never returns false from the domainExists() method therefor always states that the exec() worked.
    It seams that the exec() method does not throw ANY exceptions from the WLST commands. The catch clause is never executed and the return value from domainExists() is always true.
    None of the VERY limited number of examples using embedded WLST in java has exception or error handling in so I need to know what is the policy to detect failures in a WLST command executed in java??? i.e. How does my java application know when a command succeeds or not??
    Regards
    Steve

    Hi,
    I did some creative wrapping for the WLSTInterpreter and I now have very good programatic access to the WLST python commands.
    I will put this on dev2dev somewhere and release it into the open source community.
    Don't know the best place to put it yet, so if anybody sees this and has any good ideas please feel free to pass them on.
    Here is the wrapper class. It can be used as a direct replacement for the weblogic WLSTInterpreter. As I can't overload the actual exec() calls because I want to return a String from this call I created an exec1(String command) that will return a String and throw my WLSTException which is a RuntimeException which you can handle if you like.
    It sets up stderr and stdout streams to interpret the results both from the Python interpreter level and at the JVM level where dumpStack() just seem to do a printStackTrace(). It also calls the dumpStack() command should the result contain this in its text. If either an exception is thrown from the lower level interpreter or dumpStack() is in the response I throw my WLSTException containing this information.
    package eu.medsea.WLST;
    import java.io.ByteArrayOutputStream;
    import java.io.PrintStream;
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class WLSTInterpreterWrapper extends WLSTInterpreter {
         // For interpreter stdErr and stdOut
         private ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
         private ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
         private PrintStream stdErr = new PrintStream(baosErr);
         private PrintStream stdOut = new PrintStream(baosOut);
         // For redirecting JVM stderr/stdout when calling dumpStack()
         static PrintStream errSaveStream = System.err;
         static PrintStream outSaveStream = System.out;
         public WLSTInterpreterWrapper() {
              setErr(stdErr);
              setOut(stdOut);
         // Wrapper function for the WLSTInterpreter.exec()
         // This will throw an Exception if a failure or exception occures in
         // The WLST command or if the response containes the dumpStack() command
         public String exec1(String command) {
              String output = null;
              try {
                   output = exec2(command);
              }catch(Exception e) {
                   try {
                        synchronized(this) {
                             stdErr.flush();
                             baosErr.reset();
                             e.printStackTrace(stdErr);
                             output = baosErr.toString();
                             baosErr.reset();
                   }catch(Exception ex) {
                        output = null;
                   if(output == null) {
                        throw new WLSTException(e);
                   if(!output.contains(" dumpStack() ")) {
                        // A real exception any way
                        throw new WLSTException(output);
              if (output.length() != 0) {
                   if(output.contains(" dumpStack() ")) {
                        // redirect the JVM stderr for the durration of this next call
                        synchronized(this) {
                             System.setErr(stdErr);
                             System.setOut(stdOut);
                             String _return = exec2("dumpStack()");
                             System.setErr(errSaveStream);
                             System.setOut(outSaveStream);
                             throw new WLSTException(_return);
              return stripCRLF(output);
         private String exec2(String command) {
              // Call down to the interpreter exec method
              exec(command);
              String err = baosErr.toString();
              String out = baosOut.toString();
              if(err.length() == 0 && out.length() == 0) {
                   return "";
              baosErr.reset();
              baosOut.reset();
              StringBuffer buf = new StringBuffer("");
              if (err.length() != 0) {
                   buf.append(err);
              if (out.length() != 0) {
                   buf.append(out);
              return buf.toString();
         // Utility to remove the end of line sequences from the result if any.
         // Many of the response are terminated with either \r or \n or both and
         // some responses can contain more than one of them i.e. \n\r\n
         private String stripCRLF(String line) {
              if(line == null || line.length() == 0) {
                   return line;
              int offset = line.length();          
              while(true && offset > 0) {
                   char c = line.charAt(offset-1);
                   // Check other EOL terminators here
                   if(c == '\r' || c == '\n') {
                        offset--;
                   } else {
                        break;
              return line.substring(0, offset);
    }Next here is the WLSTException class
    package eu.medsea.WLST;
    public class WLSTException extends RuntimeException {
         private static final long serialVersionUID = 1102103857178387601L;
         public WLSTException() {
              super();
         public WLSTException(String message) {
              super(message);
         public WLSTException(Throwable t) {
              super(t);
         public WLSTException(String s, Throwable t) {
              super(s, t);
    }And here is the start of a wrapper class for so that you can use the WLST commands directly. I will flesh this out later with proper var arg capabilities as well as create a whole Exception hierarchy that better suites the calls.
    package eu.medsea.WLST;
    // Provides methods for the WLSTInterpreter
    // just to make life a little easier.
    // Also provides access to the more generic exec(...) call
    public class WLSTCommands {
         public void cd(String path) {
              exec("cd('" + path + "')");
         public void edit() {
              exec("edit()");
         public void startEdit() {
              exec("startEdit()");
         public void save() {
              exec("save()");
         public void activate() {
              exec("activate(block='true')");
         public void updateDomain() {
              exec("updateDomain()");
         public String state(String serverName) {
              return exec("state('" + serverName + "')");
         public String ls(String dir) {
              return exec("ls('" + dir + "')");
         // The generic wrapper for the interpreter exec() call
         public String exec(String command) {
              return interpreter.exec1(command);
         private WLSTInterpreterWrapper interpreter = new WLSTInterpreterWrapper();
    }Lastly here is some example code using these classes:
    its using both the exec(...) and cd(...) wrapper commands from the WLSTCommand.class shown above.
        String machineName = ...; // get name from somewhere
        try {
         exec("machine=create('" + machineName + "','Machine')");
         cd("/Machines/" + machineName + "/NodeManager/" + machineName);
         exec("set('ListenAddress','10.42.60.232')");
         exec("set('ListenPort', 5557)");
        }catch(WLSTException e) {
            // Possibly the machine object already exists so
            // lets just try to look it up.
         exec("machine=lookup('" + machineName + "','Machine')");
    ...After this call a machine object is setup that can be allocated later like so:
         exec("set('Machine',machine)");Regards
    Steve

  • Problems with Java DOM Mapping

    Hi Experts,
    as part of my diploma-thesis I have to write a java DOM-Mapping, which mapps the following incoming message:
    <mt_MappingOUT>
    <set>
    <set_Element_01>...</set_Element_01>
    <set_Element_02>... </set_Element_02>
    <set_Element_03>... </set_Element_02>
    <set_Element_10>  </set_Element_10>
    </set>
    </mt_MappingOUT>
    to the following outgoinig message:
    <mt_MappingIN>
    <TABLE>
    <item>
    <item_FIELD_01>  </item_FIELD_01>
    <item_FIELD_10>  <item_FIELD_10>
    <i/tem>
    </TABLE>
    </mt_MappingIN>
    I am not a very experienced Java-Developer. You can see my code down there, which I tried to implement according to some bloggs; unfortunately the result is not what I want to have
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class DOMMAPPING implements StreamTransformation{
         public static void main(String[] args) throws Exception
              try
                   FileInputStream fin =
                        new FileInputStream("C:/mt_MappingOut.xml");
                   FileOutputStream fout =
                        new FileOutputStream("C:/target.xml");
                   DOMMAPPING mapping = new DOMMAPPING();
                   mapping.execute(fin, fout);
              catch (Exception e)          {
                   e.printStackTrace();
    public void setParameter (Map param) {}
    public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document documentIn = null;
              DocumentBuilder builder = null;
              try {
                        builder = factory.newDocumentBuilder();
                   } catch (ParserConfigurationException e1) {
                        e1.printStackTrace();
              try {
                   Element itemNode = null;
                   NodeList[] list_f=new NodeList[10];
                   Element[] field=new Element[10];
                   documentIn = builder.parse(in);
                   Document documentOut = builder.newDocument();
                   Element rootNode = documentOut.createElementNS("urn:agrp:xi:geissseb","ns0:mt_MappingIn");
                   documentOut.appendChild(rootNode);
                   Element tableNode = documentOut.createElement("TABLE");
                   rootNode.appendChild(tableNode);
                   NodeList list_Set=documentIn.getElementsByTagName("set");
                   System.out.println(list_Set.getLength());
                   for(int j=1;j<10;j++){
                        list_f[j-1]=documentIn.getElementsByTagName("set_ELEMENT_01"+j);
                list_f[9]=documentIn.getElementsByTagName("set_ELEMENT_10");
                   //NodeList list_f01=documentIn.getElementsByTagName("f01");
                   for (int i=0;i<list_Set.getLength();i++)
                        itemNode=documentOut.createElement("item");
                        tableNode.appendChild(itemNode);
                        for(int k=0; k<10;k++){
                             Node f=list_f[k].item(i);
                             f=f.getFirstChild();
                             String str_f=f.getNodeValue();
                             Text text_f=documentOut.createTextNode(str_f);
                             field[k]=documentOut.createElement("item_FIELD_"(k1));
                             field[k].appendChild(text_f);
                             itemNode.appendChild(field[k]);
                   TransformerFactory tf = TransformerFactory.newInstance();
                   Transformer transform = tf.newTransformer();
                   transform.transform(new DOMSource(documentOut), new StreamResult(out));
                   } catch (SAXException e2) {
                        e2.printStackTrace();
                   } catch (IOException e2) {
                        e2.printStackTrace();
                   }catch (Throwable t) { throw new StreamTransformationException("error", t); }
    Unfortunately there seems to be at least one error in there because the result I get is just the following:
      <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    - <ns0:mt_MappingIn xmlns:ns0="urn:agrp:xi:geissseb">
      <TABLE />
      </ns0:mt_MappingIn>
    Below you will find my source message:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsd:schema targetNamespace="urn:agrp:xi:geissseb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:agrp:xi:geissseb">
      <xsd:element name="mt_MappingOut" type="dt_MappingOut" />
    - <xsd:complexType name="dt_MappingOut">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">a7a28830bebf11dc81aa001a4b0af224</xsd:appinfo>
      </xsd:annotation>
    - <xsd:sequence>
    - <xsd:element name="Set">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366510aeda11dcb3bb00174205b856</xsd:appinfo>
      </xsd:annotation>
    - <xsd:complexType>
    - <xsd:sequence>
    - <xsd:element name="f01" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366511aeda11dcaf2600174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_02" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366512aeda11dc84d400174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_03" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366513aeda11dcbcab00174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_04" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366514aeda11dc96a300174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_05" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366515aeda11dca77700174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_06" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366516aeda11dc8f7d00174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_07" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366517aeda11dcc24b00174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_08" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366518aeda11dc92cd00174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_09" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b366519aeda11dcc9b100174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
    - <xsd:element name="set_ELEMENT_10" type="xsd:string">
    - <xsd:annotation>
      <xsd:appinfo source="http://sap.com/xi/TextID">0b36651aaeda11dcc5a700174205b856</xsd:appinfo>
      </xsd:annotation>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
    When I had problems withe Java SAX Mapping, I got great hints in the forum. So I hope you can help me out again...
    Cheers Sebastian

    Here you go.
    Code
    package com.sap.test;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.apache.crimson.tree.TextNode;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class DomTest {
         Document documentOut = null;
         public static void main(String[] args) throws Exception
         try
         FileInputStream fin =      new FileInputStream("test.xml");
         FileOutputStream fout = new FileOutputStream("test_out.xml");
         DomTest mapping = new DomTest();
         mapping.execute(fin, fout);
         catch (Exception e) {
         e.printStackTrace();
         public void setParameter (Map param) {}
         public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         Document documentIn = null;
         DocumentBuilder builder = null;
         try {
         builder = factory.newDocumentBuilder();
         } catch (ParserConfigurationException e1) {
         e1.printStackTrace();
         try {
         Element itemNode = null;
         //NodeList[] list_f=new NodeList10;
         //Element[] field=new Element10;
         documentIn = builder.parse(in);
         documentOut = builder.newDocument();
         Element rootNode = documentOut.createElementNS("urn:agrp:xi:geissseb","ns0:mt_MappingIn");
         rootNode.setAttribute("xmlns:ns0", "urn:agrp:xi:geissseb");
         documentOut.appendChild(rootNode);
         Element tableNode = documentOut.createElement("TABLE");
         rootNode.appendChild(tableNode);
         NodeList list_Set = documentIn.getElementsByTagName("set");
         System.out.println(list_Set.getLength());
         for(int j = 0 ; j < list_Set.getLength() ;j++){
              Element setNode = (Element)list_Set.item(j);
              NodeList children = setNode.getChildNodes();
              for(int index = 0; index < children.getLength(); index++)
                   Node child = children.item(index);
                   if (child instanceof Element) {
                        Element element = (Element) child;
                        if(element.getNodeName().startsWith("set_ELEMENT"))
                             createItemFeildNode(tableNode,element);
         //list_f[9]=documentIn.getElementsByTagName("set_ELEMENT_10");
    //     NodeList list_f01=documentIn.getElementsByTagName("f01");
         /*for (int i=0;i<list_Set.getLength();i++)
         itemNode=documentOut.createElement("item");
         tableNode.appendChild(itemNode);
         for(int k=0; k<10;k++){
         Node f=list_f[k].item(i);
         f=f.getFirstChild();
         String str_f=f.getNodeValue();
         Text text_f=documentOut.createTextNode(str_f);
         field[k]=documentOut.createElement("item_FIELD_"(k1));
         field[k].appendChild(text_f);
         itemNode.appendChild(field[k]);
         TransformerFactory tf = TransformerFactory.newInstance();
         Transformer transform = tf.newTransformer();
         transform.transform(new DOMSource(documentOut), new StreamResult(out));
         transform.transform(new DOMSource(documentOut), new StreamResult(System.out));
         } catch (SAXException e2) {
         e2.printStackTrace();
         } catch (IOException e2) {
         e2.printStackTrace();
         }catch (Throwable t) { throw new StreamTransformationException("error", t); }
         private void createItemFeildNode(Element root, Element element) {
              String inName = element.getNodeName();
              int temp = inName.lastIndexOf('_');
              if (temp == -1)
                   return;
              String index = inName.substring(temp+1);
              String nodeName = "Item_FIELD_" + index;
              String nodeVal = element.getFirstChild().getNodeValue();
              Element newElement = documentOut.createElement(nodeName);
              Text txtNode = documentOut.createTextNode(nodeVal);
              newElement.appendChild(txtNode);
              root.appendChild(newElement);          
    Input
    <?xml version="1.0" encoding="UTF-8" ?>
    <mt_MappingOut xmlns="urn:agrp:xi:geissseb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:agrp:xi:geissseb file:/D:/Eclipse/workspace/SDN/test.xsd">
    <set xmlns="">
      <set_ELEMENT_01>E1</set_ELEMENT_01>
      <set_ELEMENT_02>E2</set_ELEMENT_02>
      <set_ELEMENT_03>E3</set_ELEMENT_03>
      <set_ELEMENT_04>E4</set_ELEMENT_04>
      <set_ELEMENT_05>E5</set_ELEMENT_05>
      <set_ELEMENT_06>E6</set_ELEMENT_06>
      <set_ELEMENT_07>E7</set_ELEMENT_07>
      <set_ELEMENT_08>E8</set_ELEMENT_08>
      <set_ELEMENT_09>E9</set_ELEMENT_09>
      <set_ELEMENT_10>E10</set_ELEMENT_10>
      </set>
      </mt_MappingOut>
    Output
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:mt_MappingIn xmlns:ns0="urn:agrp:xi:geissseb">
    <TABLE>
      <Item_FIELD_01>E1</Item_FIELD_01>
      <Item_FIELD_02>E2</Item_FIELD_02>
      <Item_FIELD_03>E3</Item_FIELD_03>
      <Item_FIELD_04>E4</Item_FIELD_04>
      <Item_FIELD_05>E5</Item_FIELD_05>
      <Item_FIELD_06>E6</Item_FIELD_06>
      <Item_FIELD_07>E7</Item_FIELD_07>
      <Item_FIELD_08>E8</Item_FIELD_08>
      <Item_FIELD_09>E9</Item_FIELD_09>
      <Item_FIELD_10>E10</Item_FIELD_10>
      </TABLE>
      </ns0:mt_MappingIn>

  • Little problem with Strings.

              I have an little problem with Strings, i make one comparision like this.
              String nombre="Javier";
              if( nombre.equalsIgnoreCase(output.getStringValue("CN_NOMBRESf",null)) )
              Wich output.getStringValue("CN_NOMBRESf",null) is "Javier" too, because I display
              this before and are equals.
              What I do wrong?.
              

    You are actually making your users key in things like
    "\026"? Not very user-friendly, I would say. But
    assuming that is the best way for you to get your
    input, or if it's just you doing the input, the way to
    change that 4-character string into the single
    character that Java represents by '\026', you would
    use a bit of code like this:char encoded =
    (char)Integer.parseInt(substring(inputString, 1),
    16);
    DrClap has the right idea, except '\026' is octal, not hex. So change the radix from 16 to 8. Unicode is usually represented like '\u002A'. So it looks like you want:String s = "\\077";
    System.out.println((char)Integer.parseInt(s.substring(1), 8));Now all you have to do is parse through the String and replace them, which I think shouldn't be too hard for you now :)

  • Problem with traverse method

    Hi, I am having this problem:
    I made a CustomItem, a TextField, now I overloaded the traverse method, so if the keycode is Canvas.UP or Canvas.DOWN then return false else return true.
    The problem is that when I press the left or rigth button it also returns false and not true.
    and there is another problem with traverse, before returning false or true I set a boolean and call to repaint to draw it on some way if its selected or not, the paint method is being called but it just dont draw as desired.
    protected void paint(Graphics g, int ancho, int alto) {
              System.out.println ("Dentro del paint, seleccionado="+seleccionado);
              try {
                   g.drawString(label, 0, 0, Graphics.TOP|Graphics.LEFT);
                   if (!seleccionado) {
                        g.setColor(120, 120, 120);
                   g.drawRect(0, 4, tama�oTexto+8, 25);
                   if (seleccionado) {
                        g.setColor(255, 255, 255);
                        g.fillRect(1, 5, (tama�oTexto+8-1), 23);
                   g.setColor(0, 0, 0);
                   if (!seleccionado) {
                        g.setColor(80, 80, 80);
                   g.drawString(texto, 4, 7, Graphics.TOP|Graphics.LEFT);
                   if (seleccionado) {
                        int cursorX=Font.getDefaultFont().charsWidth((texto.substring(0, idLetraActual)).toCharArray(), 0, texto.substring(0, idLetraActual).length())+4;
                        g.drawChar('|', cursorX, 7, Graphics.TOP|Graphics.LEFT);
              } catch (Exception E){
                   E.printStackTrace();
         }the traverse method set the seleccionado variable and calls to repaint but instead of being false the paint method is drawing it as true (most of times).

    I have a problem with findByxxx() method.. in
    Container managed bean.
    i have
    Collection collection =
    home.findByOwnerName("fieldValue");
    specified in my Client Program, where ownerName is the
    cmp fieldname..
    and
    public Collection findByOwnerName(String ownerName)
    throws RemoteException, FinderException
    defined in my home interface.
    i have not mentioned the findBy() method anywhere else
    (Bean class). You have to describe the query in the deployment descriptor.
    >
    Even if i have a same "fieldValue" in the database
    (Oracle), which i specified in findBy() method, iam a
    result of owner Not found, which is not the case as i
    have that owner name.
    for the same application if i use findByPrimaryKey(),
    it is working..
    Can any one please post me the solution.

  • Problem with SP with table parameters

    Hello, I have problem with stored procedure with paramater which is table type.
    I have defined my own type
    CREATE OR REPLACE TYPE STRING_LST AS TABLE OF VARCHAR2(80);
    and i have stored procedure like this
      PROCEDURE probe(outList OUT STRING_LST) IS   BEGIN     outList := STRING_LST();     outList.EXTEND();     outList(outList.LAST) := 'ONE';     outList.EXTEND();     outList(outList.LAST) := 'TWO';     outList.EXTEND();     outList(outList.LAST) := 'THREE';   END probe;
    I have java class which connects to the database and calls this procedure
    package mypackage; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Types; import java.sql.Array; public class DAO_Test { public static String toNormalString (String aa) { if (aa != null && aa.startsWith("0x")) { StringBuffer str = new StringBuffer(64); for (int i = 2; i < aa.length(); i += 2) { str.append((char) Integer.parseInt(aa.substring(i, i + 2), 16)); } return str.toString(); } else { return aa; } } public void probe ( ) { try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection("dbc:oracle:thin:@server_ip:database_name", "sa", "blahblah"); String sql = "{ CALL PROBE(?) }"; String sqlType = "STRING_LST"; CallableStatement cs = conn.prepareCall(sql); cs.registerOutParameter(1, Types.ARRAY, sqlType); cs.execute(); Array arr = cs.getArray(1); String[] values = (String[]) arr.getArray(); for (int i = 0; i < values.length; i++) { System.out.println("" + i + ": '" + toNormalString(values) + "'");
    cs.close();
    conn.close();
    } catch (SQLException e) {
    logger.error("SQLException", e);
    } catch (Exception e) {
    logger.error("Exception", e);
    public static void main (String args[]) throws SQLException {
    DAO_Test test = new DAO_Test();
    test.probe();
    Now...
    When I run this class on my local machine the result is OK nad looks like
    1: 'ONE'
    2: 'TWO'
    3: 'THREE'
    But when I copy this class on the server and run it, the result is wrong
    1: '???'
    2: '???'
    3: '???'
    Here is my environment:
    on local machine
    eclipse 3.3.1
    java 1.5 (java version compiler in eclipse is 1.4)
    on server
    oracle 9.2.0.6.0
    java 1.4.2_08
    Result from table parameters are always 3 question marks :|
    What is the problem?
    Rafał

    HI,
    I think i found the solution: nls_charset12.jar from page
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
    I have copied this jar to server lib directory and it works fine :)

  • URGENT  timout problems with bc4j

    Hello Jdev Team,
    We have a serious problem with the BC4J. The situation is as
    follows:
    We use BC4J with jsp pages an run the whole thing on a j2ee
    Container.
    We have written our own ApplicationPool class and
    ApplicationModule datatag because the users have to login
    using different credentials. The login users are db-users. The
    application release mode is reserved.
    The application crashes frequently. 2 errors occur.
    First of all we get an JBO-30003: "The application pool, {AM
    Name}, failed to checkout an application module instance."
    after the BC4J Container timeout --> messages ("BC4J HTTP
    Container was timed out" and "The binding listener for { AM
    name} was timed out")
    We haven't found a way to alter the BC4J container timeout.
    Where do we customize the timeout?
    We have tried to use the HttpSessionTimeOut variable but it
    seems to have no effect.
    I hope you can help us with this one.
    Second problem is that the J2EE Container stops functioning
    after a couple of requests.
    Even if an other browser is started (on the same or different
    machine) the Container does not respond to any request.
    We have found a Thread on technet handling this kind of problem
    but the solution doesn't work in our case.
    (the solution on technet was to put synchronized(session) around
    each JSP page)
    Now we run the application under Apache/Jserv and with the same
    Runtime packages as used in the Container and the problem
    seems to have disappeared.
    Here follows the code of the ApplicationPool class:
    The class is based on an example posted on technet
    * @author Juan Oropeza
    package be.cronos.dbwise.jbo;
    import oracle.jbo.common.ampool.ApplicationPoolImpl;
    import oracle.jbo.ApplicationModule;
    import java.util.Properties;
    public class SeperateLoginApplicationPool extends
    ApplicationPoolImpl
    private String vConnectURL;
    private String vUsername;
    private String vPassword;
    public SeperateLoginApplicationPool()
    public void setConnectInfo(String pUsername, String pPassword,
    String pConnectURL)
    this.vUsername = pUsername;
    this.vPassword = pPassword;
    this.vConnectURL = pConnectURL;
    protected void connect(ApplicationModule appModule)
    if (!appModule.getTransaction().isConnected())
    appModule.getTransaction().connect(vConnectURL ,
    vUsername, vPassword);
    //use Optimistic locking as default for all transactions
    appModule.getTransaction().setLockingMode
    (oracle.jbo.Transaction.LOCK_OPTIMISTIC);
    * checkin
    * @param appModule
    public synchronized void checkin(ApplicationModule appModule)
    // release the instance regardless of the release mode
    // this is necessary since we need a fresh instance each
    time.
    this.releaseInstance(appModule);
    this.releaseInstances();
    public void disconnect(ApplicationModule pAppModule, boolean
    pRetainState)
    super.disconnect(pAppModule, pRetainState);
    Here is the code of the applicationPool datatag:
         * @author Juan Oropeza
    * @author Ief Cuynen
    * @version 1.1
    /* Modification history
    package be.cronos.dbwise.datatags;
    import be.cronos.dbwise.jbo.SeperateLoginApplicationPool;
    import javax.servlet.jsp.tagext.TagSupport;
    import javax.servlet.jsp.JspException;
    import java.io.StringWriter;
    import java.io.PrintWriter;
    import oracle.jbo.html.jsp.ConnectionInfo;
    import oracle.jbo.common.ampool.PoolMgr;
    import oracle.jbo.common.ampool.ApplicationPool;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.html.jsp.JSPApplicationRegistry;
    import java.util.Properties;
    import java.util.Hashtable;
    import java.util.Enumeration;
    public class ApplicationModuleTag extends TagSupport
    String fApplicationName;
    String fConfigName;
    String fUsername;
    String fPassword;
    String fConnectionURL;
    String fIiopUserName;
    String fIiopPassword;
    JSPApplicationRegistry fAppRegistry;
    public ApplicationModuleTag()
    public void setId(String pAppName)
    { this.fApplicationName = pAppName; }
    public void setConfigname(String pValue)
    { this.fConfigName = pValue; }
    * doEndTag
    * @return int
    * @exception javax.servlet.jsp.JspException
    public int doEndTag() throws JspException
    try
    SeperateLoginApplicationPool pool = null;
    init();
    // Get an application module resource.
    fAppRegistry = JSPApplicationRegistry.getInstance();
    // this step will access the custom pool from the property
    file
    appRegistry.registerApplicationFromPropertyFile
    (fApplicationName);
                   // Since we don't want to use a
    PropertyFile per AM, we have written are own
    registerApplicationModule method
    this.registerApplicationModule();
    // get an instance of the pool, which is already existing
                   pool = (SeperateLoginApplicationPool)
    PoolMgr.getInstance().getPool(fApplicationName);
    // get an instance of the application module
    synchronized(pool)
    // Setup the connection information
    pool.setConnectInfo(fUsername, fPassword,
    fConnectionURL);
    // This instance will be used by the rest of the
    DataWebBeans since it&#8217;s part of the context.
                        try
                             //After the BC4J
    container timeout, this method will raise an exception
         ApplicationModule am =
    fAppRegistry.getAppModuleInstance(fApplicationName, pageContext);
                        catch(Exception e)
                             System.out.println
    ("JspRegistry has failed to get application module instance");
    setPageContextValues();
    catch(Exception ex)
    StringWriter writer = new StringWriter();
    PrintWriter prn = new PrintWriter(writer);
    ex.printStackTrace(prn);
    prn.flush();
    throw new JspException(writer.toString());
    return SKIP_BODY;
    * for internal use only
    private void init()
    fUsername = (String)pageContext.getSession().getValue
    ("username");
    fPassword = (String)pageContext.getSession().getValue
    ("password");
    fConnectionURL = (String)pageContext.getSession().getValue
    ("connectionURL");
    private void setPageContextValues()
    // place default renderers into session, these will not be
    exposed via config file
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdImageDomain_Renderer", "oracle.ord.html.OrdBui
    ldURL");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdAudioDomain_Renderer","oracle.ord.html.OrdBuil
    dURL");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdVideoDomain_Renderer","oracle.ord.html.OrdBuil
    dURL");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdVirDomain_Renderer", "oracle.ord.html.OrdBuild
    URL");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdImageDomain_EditRenderer", "oracle.ord.html.Fi
    leUploadField");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdAudioDomain_EditRenderer", "oracle.ord.html.Fi
    leUploadField");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdVideoDomain_EditRenderer", "oracle.ord.html.Fi
    leUploadField");
    pageContext.getSession().putValue
    ("oracle_ord_im_OrdVirDomain_EditRenderer", "oracle.ord.html.File
    UploadField");
    protected synchronized void registerApplicationModule()
    PoolMgr vPoolMgr = PoolMgr.getInstance();
              try
    if (!vPoolMgr.isPoolCreated(fApplicationName))
                        // Parse the ConfigName
                        String vConfigPackage =
    fConfigName.substring(0, fConfigName.lastIndexOf('.'));
    String vConfigSection = fConfigName.substring
    (fConfigName.lastIndexOf('.') + 1);
                        //Strip out the AM Class
                        vConfigPackage =
    vConfigPackage.substring(0, vConfigPackage.lastIndexOf('.'));
    Properties vProps = new Properties();
    vProps.put("ConfigName",fConfigName);
                        ApplicationPool vAppPool =
    vPoolMgr.createPool(fApplicationName,vConfigPackage,
    vConfigSection, vProps);
                        vAppPool.setUserName
    (this.fUsername);
                        vAppPool.setPassword
    (this.fPassword);
              catch (Exception ex)
                   ex.printStackTrace();
                   throw new RuntimeException(ex.toString
    * release() called after doEndTag() to reset state
    public void release()
              super.release();
              fApplicationName = null;
              fConfigName = null;
              fUsername = null;
              fPassword = null;
              fConnectionURL = null;
              fIiopUserName = null;
              fIiopPassword = null;
              JSPApplicationRegistry fAppRegistry = null;
    Another thing is that the JSPApplicationRegistry contains a bug
    (I think)
    It doesn't use the HttpSessionTimeOut variable at all (see
    following code)
    this piece of code is a Method from the
    JSPApplicationRegistry.java File taken from package
    oracle.jbo.html.jsp;
    static synchronized public void
    registerApplicationFromPropertyFile(HttpSession session, String
    sPropFileName)
    if(!mPoolManager.isPoolCreated(sPropFileName))
    registerApplicationFromPropertyFile(sPropFileName);
    if (!PropertyConstants.TRUE.equals((String)session.getValue
    (SESSION_INITIALIZED)))
    Hashtable settings = getAppSettings(sPropFileName);
    /* The timeout variable is declared here */
    int nTimeOut = 300;
    if (settings != null)
    // see if we have a setting for the session timeout
    String sTimeOut;
    /* get the HttpSessionTimeOut variable */
    if(settings.get("HttpSessionTimeOut") != null)
    sTimeOut = (String)settings.get
    ("HttpSessionTimeOut");
    if(sTimeOut != null)
    /* Put the value in the variable... and that's the last thing it
    does. nTimeOut isn't used anywhere in the class */
    nTimeOut = Integer.parseInt(sTimeOut);
    if(settings.get("ImageBase") != null)
    session.putValue("ImageBase", settings.get
    ("ImageBase"));
    else
    settings.put("ImageBase", "/webapp/images");
    session.putValue("ImageBase", "/webapp/images");
    if(settings.get("CSSURL") != null)
    session.putValue("CSSURL",settings.get("CSSURL"));
    else
    settings.put("CSSURL", "/webapp/css/oracle.css");
    session.putValue
    ("CSSURL", "/webapp/css/oracle.css");
    // place default renderers into session, these will not
    be
    // exposed via config file
    session.putValue
    ("oracle_ord_im_OrdImageDomain_Renderer", "oracle.ord.html.OrdBui
    ldURL");
    session.putValue
    ("oracle_ord_im_OrdAudioDomain_Renderer","oracle.ord.html.OrdBuil
    dURL");
    session.putValue
    ("oracle_ord_im_OrdVideoDomain_Renderer","oracle.ord.html.OrdBuil
    dURL");
    session.putValue
    ("oracle_ord_im_OrdVirDomain_Renderer", "oracle.ord.html.OrdBuild
    URL");
    session.putValue
    ("oracle_ord_im_OrdImageDomain_EditRenderer", "oracle.ord.html.F
    ileUploadField");
    session.putValue
    ("oracle_ord_im_OrdAudioDomain_EditRenderer", "oracle.ord.html.F
    ileUploadField");
    session.putValue
    ("oracle_ord_im_OrdVideoDomain_EditRenderer", "oracle.ord.html.F
    ileUploadField");
    session.putValue
    ("oracle_ord_im_OrdVirDomain_EditRenderer", "oracle.ord.html.F
    ileUploadField");
    session.putValue(SESSION_INITIALIZED,
    PropertyConstants.TRUE);
    Am I mistaken or is it a bug?
    Thank you for your fast response.
    Greetings,
    Ief Cuynen

    First of all we get an JBO-30003: "The application pool, {AM Name}, failed to checkout an application module
    instance."
    The JBO-30003 exception is thrown whenever the pool cannot
    properly create/recycle an application module. Please see the
    exception details (scan the exception stack to find the exception
    details) for more information regarding the "root" cause of the
    exception.
    We haven't found a way to alter the BC4J container timeout. Where do we customize the timeout?
    The BC4J container is timed out when the HttpSession is timed
    out. The session timeout is configurable via the web.xml file
    for the J2EE application. Your servlet container may also
    include another mechanism for setting a session timeout.
    Second problem is that the J2EE Container stops functioning after a couple of requests. Even if an other browser
    is started (on the same or different machine) the Container does
    not respond to any request. We have found a Thread on technet
    handling this kind of problem but the solution doesn't work in
    our case.
    The issue sounds like a deadlock. Please use kill -3 (Solaris)
    or ctrl-break (NT) at the java server console to print the thread
    stack trace to stdout. This will contain more information
    regarding which threads are blocked and where. If you would like
    you can send the stack trace to me via mail and I can take a look
    at it.
    The solution of synchronizing your pages with the HttpSession
    context is required only if you are using the BC4J datatags with
    HTML frames (i.e. have multi-threaded application module
    access for a given session). Please note that this solution may
    have a performance impact and should not be implemented unless
    absolutely necessary.
    Another thing is that the JSPApplicationRegistry contains a bug (I think). It doesn't use the HttpSessionTimeOut variable
    at all (see following code)
    This parameter was deprecated after 3.1. It looks like the code
    which used the parameter may have been removed prematurely.
    Sorry for the confusion. Please use the J2EE compliant
    mechanisms mentioned above to configure the session timeout in
    3.2.
    Finally, please note that JDeveloper9i includes new integrated
    features for the often requested feature of supporting different
    db users with the same application pool! Please stay tuned.

  • Problem with code-Please Help!!!

    Hey guys i have some problems with the following code:
    1. I have to do a stutter and reverse of an array [ 2 4 ] and it should return [ 4 4 2 2 ]. I wrote the code and i get [ 2 2 4 4]. How can this be fixed?
    public class Part1
         public static void main(String[] args)
              int[] values = {2, 4};     
              stutterAndReverse(values);
         public static int[] stutterAndReverse(int[] values)
              //Stutter
              System.out.print("[ ");
              for (int i = 0; i < values.length; i++)
                   for(int j = values.length-1; j >=0; j--)
                        System.out.print(values[i] + " ");
              System.out.print("] ");
              return values;
    2. This one takes the array and returns the even numbers to the left and odds to the right. It works with the code i have so far but the odds on the right should be in order. For example an array of 6 gives the output [2, 4, 6, 5, 3, 1]. Mine gives [2, 4, 6, 1, 5, 3]. How can i fix this???
    public class Part2
         public static void main(String[] args)
              int[] arr = new int[6];
              for(int i = 0; i < arr.length; i++)
              arr[i] = i + 1 ;
              printArray(arr);
              arr = evensToLeft(arr);
              //arr = oddsToRight(arr);
              System.out.println("Evens to the Left");
              printArray(arr);               
         public static void printArray(int[] arr)
              System.out.print("[");
              for(int i = 0; i < arr.length; i++)
                   System.out.print(arr);
                   if(i < arr.length-1)
                   System.out.print(", ");
                   System.out.println("]");
         public static int[] makeArray(int n)
              int[] arr = new int[6];
              return arr;          
         public static int[] evensToLeft(int[] arr)
              int split = 0;
              for(int i = 0; i < arr.length; i++)
                   if(arr[i]%2==0) //even
                        swap(arr,i,split);
                        split++;
                   return arr;
         public static void swap(int[] arr, int n1, int n2)
              int temp = arr[n1];
              arr[n1] = arr[n2];
              arr[n2] = temp;
    Thank you for your time i really appreciate it.

    now i'm more confused than ever...:(This'll probably make it worse :)
    class Testing
      public Testing()
        String[] values1 = {"2","4"};
        System.out.println(java.util.Arrays.asList(values1));
        System.out.println(java.util.Arrays.asList(stutterAndReverse(values1)));
        String[] values2 = {"1","2","3","4","5","6","7","9","11"};
        System.out.println(java.util.Arrays.asList(values2));
        System.out.println(java.util.Arrays.asList(evensOdds(values2)));
      public String[] stutterAndReverse(String[] arr)
        String[] temp = new String[arr.length * 2];
        for(int x = 0; x < temp.length; x++)
          temp[temp.length - 1 -x] = arr[x/2];
        return temp;
      public String[] evensOdds(String[] arr)
        StringBuffer evens = new StringBuffer();
        StringBuffer odds = new StringBuffer();
        for(int x = 0; x < arr.length; x++)
          if(Integer.parseInt(arr[x]) % 2 == 0) evens.append(","+arr[x]);
          else odds.insert(0,","+arr[x]);
        return (evens.toString().substring(1)+odds.toString()).split(",");
      public static void main(String[] args){new Testing();}
    }

Maybe you are looking for

  • Error: Cannot open project file

    Does that error message mean I am trying to open a project file that was created with a version of FCP that is later than what I operate with? Also, where did the FCP FAQ section go? PowerMac G4 desky 867MHz 1GB RAM   Mac OS X (10.2.x)   FCP 3.0.4

  • Error while running adlnkoh.sh. Please check logfile

    Hi All, i got this error while cloning i ran perl adcfgclone.pl dbTechStack on db tier Starting ORACLE_HOME relinking... Instantiating adlnkoh.sh Starting relink of ORACLE_HOME - RDBMS Adding execute permission to : /erpapp/prod/proddb/10.2.0/appsuti

  • Cannot connect ipod shuffle 2nd gen to Vista

    Hi, can't seem to find an answer to this situation on this forum, plugging in ipod causes Vista to start searching for drivers that it does not find, iTunes 7.4 popped one window suggesting the device be reset, but window disappeared never to return.

  • Reg payment..

    hi friends,              in <b>cash sales</b> i want to know the payment details, reg one sales order how much pending and how much paid, i want to display that details, so where can i get the payment details reg one SO.

  • How to run JprogressBar to view uploading status?

    i know the file size and the current time but didnot finde the byte transfer rate. i am using these libraries import cz.dhl.ftp.Ftp; import cz.dhl.ftp.FtpConnect; import cz.dhl.ftp.FtpFile; import cz.dhl.io.CoFile; import cz.dhl.io.CoLoad; import cz.