Recursive problem

Hello !
I have a problem and can solve it.
I am calling within a Function Module a badi and calling the same Function Module
again within this badi beacuse I need it. And now I have big recursive loop with no ending.
How can I process to avoid this circultance ?
Regards
Erdem Sas

More like:
FORM recursion
  USING a
  CHANGING b.
* Use a to get next b
* If it's what you want.
*   Exit.
* Else.
*   perform recursion
*     using b
*     changing c
ENDFORM.                               " recursion
Rob
Edited by: Rob Burbank on Nov 3, 2008 2:33 PM
Since this is referenced in the Coffee Corner, I cleaned it up

Similar Messages

  • Recursion Problem with custom realms built on EJB's

    Hello there,
    We have developed a web-app which uses authentication on a derivative of
    RDBMSRealm, except that instead of RDBMSDelegate we have created our
    'EJBDelegate' to do all of our database dirtywork. Unfortunately there
    appears to be a problem that after a certain length of time some
    security check happens in the EJB layer, which calls getUser(), which
    calls the EJB layer, and I am stuck in an infinite recursive loop.
    Ideal solution - I disable security for the EJB's entirely as we view
    web-app level security as sufficient.
    Any ideas on where I might find such a setting?
    Thanks much,
    Daniel Wabyick
    Server Applications Engineer
    Fluid, Inc.
    http://www.fluid.com

    Hi Tony,
    i got the same problem as described on :
    Use of "displaytag" on WebAS 6.4
    Did you already found a solution how to deal with this displaytag-tld problem?
    hope to hear from you. thx in advance,
    lars

  • Recursive Problems

    While trying to figure out if the recursive definition in java is innermost, outermost, ...
    I stumbled upon a problem. Why is it that running "return eval(x--, eval(x , y));" or running "return eval(x - 1, eval(x , y));" yeilds different results. Please try running one and then the other before replying. I'm well aware or the fact that x-- is an autodecrementation and x - 1 doesn't store the value into x, but my reursive calls take care of that.
    If there is an easier way to determine Java's recursive definition please let me know.
    public class RecurF
         public RecurF()
              System.out.println(eval(1, 1));
         public int eval(int x, int y)
              System.out.print(x + " other ");
              if(x == 0)
                   return x;
              System.out.print(x + " ");
              return eval(x--, eval(x , y));
              //return eval(x - 1, eval(x , y));
         public static void main(String [] arg)
              RecurF test = new RecurF();
    }

    I stumbled upon a problem. Why is it that running
    "return eval(x--, eval(x , y));" or running "return
    eval(x - 1, eval(x , y));" yeilds different results.First of all, the expression
      eval(x--, eval(x , y))has undefined semantics, because you are modifying x inside the expression. The compiler is free to generate code that evaluates the second parameter before the first parameter, or the other way around.
    This is true for any language, and Java does not enforce a particular order of evaluation of arguments, or even the order of evaluation and calling (i.e. the compiler is free to do something like:
      t1 = x--;
      t2 = y;
      t3 = x;
      t4 = eval(t2,t3);
      eval(t1,t4);If you have variable modification side-effects in an expression, you need to make sure that you don't use any of the affected variables more than once in the same statement (because the sequence point is the statement boundary).

  • SQL recursion problem in custom groups table

    hi all,
    Consider the following seemingly simple table structure ( with sample rows ) :
    PERMISSION_ID P_ID DESCRIPTION DESIGNATION
    ============= ==== =========== =======
    1776 Null Z-ENGINEERING 88888
    1860 Null Z-LABORATORY 88888
    1909 Null Z-RESEARCH 88888
    1902 Null Z-PLANT 88888
    1905 Null Z-SOFTWARE DESIGN 88888
    1903 Null Z-BLANKET 88888
    1904 Null Z-OFFICE 88888
    40000 1909 James Gosling 67890
    40001 1909 Edgar Codd 21135
    40002 1904 Alan Turing 85542
    40003 1909 Z-SOFTWARE DESIGN 88888
    40004 1905 Dennis Ritchie 12111
    40005 1909 Z-OFFICE 88888
    40006 1776 Brian Kernighan 84251
    40007 1904 Z-ENGINEERING 88888
    Explanation of table structure :
    (1) All rows with P_ID = {Null} are the root groups, and they all have a uniform DESIGNATION of 88888.
    (2) All rows that starts with 40000 are memberships; under these memberships scheme, a root group can become a member of another root group, cascaded, which means that root groups can be members of another root group or they can be members of multiple root groups ( and cascaded even ), as long as the cascade do not end up in a circular reference, or an endless cycle. The idea here is so that the memberships for both groups and human members can be chained.
    (3) Both root groups and human memberships are stored in the same table above, using rules (1) & (2) as the logic.
    (4) No additional table may be added to this table in order to implement rules (1), (2), & (3); columns may be added, though.
    (5) Use only plain SQL statements ( SELECT, CONNECT BY, PRIOR, NOCYCLES, etc ... ); PL/SQL, functions, and procedures are strongly discouraged.
    Desired output of the query is as follows :
    The SELECT query should return a list of all human members which belongs to a specific root group. Using the example table above, the initial query should have the following intended result set:
    (start with p_id = 1909) -- 1909 is root group Z-RESEARCH
    PERMISSION MEMBERS
    ========== =======
    40000 James Gosling
    40001 Edgar Codd
    40003 Z-SOFTWARE DESIGN
    40005 Z-OFFICE
    However, Z-SOFTWARE DESIGN has it's own member , Dennis Ritchie, so the updated result set should be :
    PERMISSION MEMBERS
    ========== =======
    40000 James Gosling
    40001 Edgar Codd
    40004 Dennis Ritche
    40005 Z-OFFICE
    Same is true for Z-OFFICE, but it's member is another root group, Z-ENGINEERING, whose member is Brian Kernighan, thus the final result set list would be as follows, which is the final intended list :
    PERMISSION MEMBERS
    ========== =======
    40000 James Gosling
    40001 Edgar Codd
    40004 Dennis Ritche
    40002 Alan Turing
    40006 Brian Kernighan
    The problem now would be, how to generate the final intended list using the table scheme illustrated above, with no additional tables, but possible additional columns, using Oracle's SELECT ... START WITH ... CONNECT BY PRIOR ?
    Any theoretical advice is greatly appreciated; even our consulting firm cannot solve this problem. Coming here to the Oracle Forums itself is a last resort. Perhaps someone here can take a gander at this seemingly simple problem. Fact is, solving this problem has lots of applications, one of which is the ability to mimic Outlook's nested distribution groups list.
    Thank you so much for your time.

    Ok, first time back at a database, here my 2 cent.
    I use the with-clause to simulate your sample-data, i have also added the master-reference-column i suggested. Just restrict the result to the group you want to. (i only put the id's in the query)
    WITH DATA AS (SELECT 1776 PERMISSION_ID, TO_NUMBER(NULL) P_ID, TO_NUMBER(NULL) MASTER_PERMISSION_ID, 'Z-ENGINEERING' DESCRIPTION,  88888 DESIGNATION FROM DUAL
                  UNION ALL
                  SELECT 1860, Null, Null, 'Z-LABORATORY', 88888 FROM DUAL
                  UNION ALL
                  SELECT 1909, Null, Null, 'Z-RESEARCH', 88888 FROM DUAL
                  UNION ALL
                  SELECT 1902, Null, Null, 'Z-PLANT' ,88888 FROM DUAL
                  UNION ALL
                  SELECT 1905, Null, Null, 'Z-SOFTWARE DESIGN', 88888 FROM DUAL
                  UNION ALL
                  SELECT 1903, Null, Null, 'Z-BLANKET', 88888 FROM DUAL
                  UNION ALL
                  SELECT 1904, Null, Null, 'Z-OFFICE', 88888 FROM DUAL
                  UNION ALL
                  SELECT 40000, 1909, Null, 'James Gosling', 67890 FROM DUAL
                  UNION ALL
                  SELECT 40001, 1909, Null, 'Edgar Codd', 21135  FROM DUAL
                  UNION ALL
                  SELECT 40002, 1904, Null, 'Alan Turing', 85542 FROM DUAL
                  UNION ALL
                  SELECT 40003, 1909, 1905, 'Z-SOFTWARE DESIGN', 88888 FROM DUAL
                  UNION ALL
                  SELECT 40004, 1905, Null, 'Dennis Ritchie', 12111 FROM DUAL
                  UNION ALL
                  SELECT 40005, 1909, 1904, 'Z-OFFICE', 88888 FROM DUAL
                  UNION ALL
                  SELECT 40006, 1776, Null, 'Brian Kernighan', 84251  FROM DUAL
                  UNION ALL
                  SELECT 40007, 1904, 1776, 'Z-ENGINEERING', 88888  FROM DUAL
    SELECT GROUP_REFERENCE,
           THE_USERS.PERMISSION_ID,
           USER_NAME,
           FROM_GROUP
      FROM (SELECT PERMISSION_ID,
                   DESCRIPTION FROM_GROUP,
                   CONNECT_BY_ROOT(PERMISSION_ID) GROUP_REFERENCE
              FROM (SELECT PERMISSION_ID, TO_NUMBER(NULL) P_MASTER, DESCRIPTION
                      FROM DATA
                     WHERE DESIGNATION=88888
                       AND P_ID IS NULL
                    UNION ALL
                    SELECT MASTER_PERMISSION_ID PERMISSION_ID,  P_ID P_MASTER, DESCRIPTION
                      FROM DATA
                     WHERE DESIGNATION=88888
                       AND P_ID IS NOT NULL       
            CONNECT BY PRIOR PERMISSION_ID=P_MASTER
            START WITH P_MASTER IS NULL
           ) THE_GROUPS,
           (SELECT P_ID PERMISSION_REFERENCE,
                   PERMISSION_ID,
                   DESCRIPTION USER_NAME
              FROM DATA
             WHERE MASTER_PERMISSION_ID IS NULL
               AND P_ID IS NOT NULL
           ) THE_USERS
    WHERE THE_GROUPS.PERMISSION_ID=THE_USERS.PERMISSION_REFERENCE

  • XSLT concat() problem.

    Help guys, this XSLT is getting me down!
    Im quite simply trying to take a string, and replace tabs with 4 non-breaking space characters.
    Can someone please explain to me why the following template doesnt work? It should take in a string, perform the replacement in a recursive fashion, and finally print it out.
    Any help is greatly appreciated.
    Cheers,
    Lee.
         <xsl:template name="substitute">
              <xsl:param name="string" />
              <xsl:param name="from" select="'&#9;'" />
              <xsl:param name="to">
                   &#160;&#160;&#160;&#160;
              </xsl:param>
              <xsl:choose>
                   <xsl:when test="contains($string, $from)">                    
                        <xsl:call-template name="substitute">                         
                             <xsl:with-param name="string" select="concat(substring-before($string, $from), $to, substring-after($string, $from))" />
                             <xsl:with-param name="from" select="$from" />
                             <xsl:with-param name="to" select="$to" />
                        </xsl:call-template>
                   </xsl:when>
              <xsl:otherwise>
                   NO MORE SUBSTITUTION REQUIRED - FINAL STRING IS : <xsl:value-of select="$string"/>
              </xsl:otherwise>
              </xsl:choose>
         </xsl:template>

    Help guys, this XSLT is getting me down!
    Im quite simply trying to take a string, and replace
    tabs with 4 non-breaking space characters.
    Can someone please explain to me why the following
    template doesnt work? It should take in a string,
    perform the replacement in a recursive fashion, and
    finally print it out.
    Any help is greatly appreciated.
    Cheers,
    Lee.
         <xsl:template name="substitute">
              <xsl:param name="string" />
              <xsl:param name="from" select="'     '" />
              <xsl:param name="to">
                   ����
              </xsl:param>
              <xsl:choose>
                   <xsl:when test="contains($string, $from)">                    
                        <xsl:call-template name="substitute">                         
    <xsl:with-param name="string"
    ing" select="concat(substring-before($string, $from),
    $to, substring-after($string, $from))" />
                             <xsl:with-param name="from" select="$from" />
                             <xsl:with-param name="to" select="$to" />
                        </xsl:call-template>
                   </xsl:when>
              <xsl:otherwise>
    NO MORE SUBSTITUTION REQUIRED - FINAL STRING IS :
    : <xsl:value-of select="$string"/>
              </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
    It is not concat() problem, it is a recursion problem -- too many recursive calls.
    I wouldn't recommand using recursion in XSL, yeah, it works, but you can't increase the stack size without restarting the JVM...
    anyway, you can use translate function to do replacing, also you can call a java extension method to do string replacement. it is cleaner anyway and more efficient anyway.

  • JDom Recursion Bugging me!!

    Developers,
    5 dukes for the correct anwer. I asked my manager and he couldnt figure this out so here goes. A simple recursion problem - or so you might think.
    JDom only allows one level deep serach for a tag name - no problem - so i wrote a recursive method which looks for a tag no matter how many levels deep. Here is the code
    public void getParentNode(Element element) {
         if(element.getName().equals("content")){
              System.out.println("RETURNED");
                       return  parentElement ;
         List content = element.getContent();
         Iterator iterator = content.iterator();
         while (iterator.hasNext()) {
              Object o = iterator.next();
              if (o instanceof Element) {
                   Element child = (Element) o;
                   return (getParentNode(child));
    return null;
    }I watched this in the debugger and it kept hitting the retrun null and also retrun the 'parentElement'. The tag is DEFINITEL in the xml file.
    I have no idea what to do - I am thinking or ripping out all the JDom references and using Xceres DOM - but this will be a pain.
    What have i done wrong?
    Thanks.

    Instaed of iterating over the nodes select the node with an xpath expression.
    import org.jdom.xpath.*;
    File xmlDocument;
    SAXBuilder saxBuilder=new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    org.jdom.Document jdomDocument=saxBuilder.build(xmlDocument);
    org.jdom.Attribute contentNode=(XPath.selectSingleNode(jdomDocument,"//content");

  • Recursion issue

    I am experiencing an issue with recursive use of a method which needs to append string each time boolean hasNext is true.
    However in debug mode I detect the block if (hasNext) is being accessed even if the hasNext = false.
    So to temporarily fix the problem instead of
                   if (hasMaster){
                        standardizedPath.append(toBeAdded);
    I am using
                   if (hasMaster){
                        // FIXME enters the block even if hasMaster is false
                        // temporary solution
                        String toBeAdded = getStandardizedPath(next, filteredPaths);
                        if (!standardizedPath.toString().contains(toBeAdded)){
                             standardizedPath.append(toBeAdded);
    which although works, but the cause still remains unclear to me
    Any clue what is done wrongly here:
         private static String getPreparedJavaStatement(
                   List<String> givenPaths, String objName) {
              StringBuffer javaStatement = new StringBuffer();
              String next = "";
              List <String> filteredPaths = new ArrayList();
              for (String path : givenPaths){
                   // split pattern "dependent,master,dependency"
                   String [] paths = path.split(",");
                   String dependent = paths[0];
                   String master = paths[1];
                   String dependency = paths[2];
                   if (dependent.equals(objName)){
                        javaStatement.append((master + "_" + dependency).toLowerCase());
                        next = master; // next start for the chain
                   } else {
                        filteredPaths.add(path);
              // next the chain of getters should be appended recursively
              standardizedPath = new StringBuffer();
              boolean hasMaster = false;
              for (String path : filteredPaths){
                   String dependent = path.split(",")[0];
                   if (next.equals(dependent)){
                        hasMaster = true;
              if (hasMaster){
                   javaStatement.append(getStandardizedPath(next, filteredPaths));
              System.out.println(javaStatement);
              return javaStatement.toString();
         static StringBuffer standardizedPath;
         static String nextMaster;
         // recursively constructs the java getters chain to the propagated master
         private static String getStandardizedPath(
                   String next, List<String> filteredPaths ) {
                   Iterator it = filteredPaths.iterator();
                   while (it.hasNext()){
                        String path = (String) it.next();
                        String [] paths = path.split(",");
                        String dependent = paths[0];
                        nextMaster = paths[1];
                        String dependency = paths[2];
                        if(dependent.equals(next)){
                             if (dependency.contains("_")){
                                  if (!dependency.equals(nextMaster)) {
                                       dependency = nextMaster + "_" + dependency;
                             standardizedPath.append(".get"
                                       + PropertyUtils.standardizeForCG(dependency) + "()");
                             next = nextMaster;
                   boolean hasMaster = false;
                   for (String path : filteredPaths){
                        String dependent = path.split(",")[0];
                        if (next.equals(dependent)){
                             hasMaster = true;
                   if (hasMaster){
                        // FIXME enters the block even if hasMaster is false
                        // temporary solution
                        String toBeAdded = getStandardizedPath(next, filteredPaths);
                        if (!standardizedPath.toString().contains(toBeAdded)){
                             standardizedPath.append(toBeAdded);
              return standardizedPath.toString();
         }

    OK! Got you! And thanks for caring to answer :)
    Not even gonna read the unformatted code, but i the fix is based on the incorrect assumption that you're entering an if block when the condition is false, then the "fix" is wrong. Actually i didn't mean to enter the block when the condition is false, what I really need is when the condition false is detected to break the loop and return,
    but it doesn't. Couldn't just trace why after return the debugger enters the if block, but this time with hasMaster = true, which I didn't want.
    I suppose some stupid loop or recursion problem. Anyway, will figure out after refreshing the mind.
    In any case, if one cares to have a look here is the formatted code:
         private static String getPreparedJavaStatement(
                   List<String> givenPaths, String objName) {
              StringBuffer javaStatement = new StringBuffer();
              String next = "";
              List <String> filteredPaths = new ArrayList();
              for (String path : givenPaths){
                   // split pattern "dependent,master,dependency"
                   // and filter out the direct master object variable
                   // from the masters of direct masters if any
                   String [] paths = path.split(",");
                   String dependent = paths[0];
                   String master = paths[1];
                   String dependency = paths[2];
                   if (dependent.equals(objName)){
                        javaStatement.append((master + "_" + dependency).toLowerCase());
                        next = master; // next start for the chain
                   } else {
                        filteredPaths.add(path);
              // check if master has master(s)
              standardizedPath = new StringBuffer();
              boolean hasMaster = false;
              for (String path : filteredPaths){
                   String dependent = path.split(",")[0];
                   if (next.equals(dependent)){
                        hasMaster = true;
              if (hasMaster){
                   // here the chain of getters (CGStandardized) should be appended recursively
                   javaStatement.append(getStandardizedPath(next, filteredPaths));
              System.out.println(javaStatement);
              return javaStatement.toString();
         static StringBuffer standardizedPath;
         static String nextMaster;
         // recursively constructs the java getters chain to the propagated master
         private static String getStandardizedPath(
                   String next, List<String> filteredPaths ) {
                   Iterator it = filteredPaths.iterator();
                   while (it.hasNext()){
                        String path = (String) it.next();
                        String [] paths = path.split(",");
                        String dependent = paths[0];
                        nextMaster = paths[1];
                        String dependency = paths[2];
                        if(dependent.equals(next)){
                             // if appropriate dependency detected
                             if (dependency.contains("_")){
                                  if (!dependency.equals(nextMaster)) { // has named dependency
                                       dependency = nextMaster + "_" + dependency;
                             // no named dependency, can further proceed to direct master via getter
                             standardizedPath.append(".get"
                                       + PropertyUtils.standardizeForCG(dependency) + "()");
                             next = nextMaster;
                   boolean hasMaster = false;
                   for (String path : filteredPaths){
                        String dependent = path.split(",")[0];
                        if (next.equals(dependent)){
                             hasMaster = true;
                   if (hasMaster){
                        // FIXME issue with appending path more than once
                        // temporary solution
                        String toBeAdded = getStandardizedPath(next, filteredPaths);
                        if (!standardizedPath.toString().contains(toBeAdded)){
                             standardizedPath.append(toBeAdded);
              return standardizedPath.toString();
         }

  • Recursive StackOverFlow in Java client aplication

    Hi,
    We run into this recursive stackoverflow problem in our Swing + AWT + BWT client application. We could not pin point what GUI action caused this stackoverflow problem yet. We are currently trying to reset the stack size, see if we can find out the beginning of the stack trace, hope it will show what action caused this. At the mean time, can someone please shed some lights here on what was going on, and how to solve the problem? Thanks in advance.
    -Zihong
    OS: windows XP
    JDK: 1.5.0_08
    The exception stack trace is:
    java.lang.StackOverflowError
    at java.util.Hashtable.put(Hashtable.java:401)
    at sun.java2d.Disposer.add(Disposer.java:101)
    at sun.java2d.Disposer.addRecord(Disposer.java:69)
    at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
    at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:448)
    at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:316)
    at sun.awt.Win32GraphicsConfig.createSurfaceData(Win32GraphicsConfig.java:357)
    at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:332)
    at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:313)
    at sun.awt.windows.WComponentPeer.displayChanged(WComponentPeer.java:372)
    at sun.awt.windows.WCanvasPeer.displayChanged(WCanvasPeer.java:48)
    at sun.awt.windows.WPanelPeer.displayChanged(WPanelPeer.java:142)
    at sun.awt.windows.WPanelPeer.recursiveDisplayChanged(WPanelPeer.java:130)
    at sun.awt.windows.WPanelPeer.displayChanged(WPanelPeer.java:145)
    at sun.awt.windows.WPanelPeer.recursiveDisplayChanged(WPanelPeer.java:130)
    at sun.awt.windows.WPanelPeer.displayChanged(WPanelPeer.java:145)
    at sun.awt.windows.WPanelPeer.recursiveDisplayChanged(WPanelPeer.java:130)
    at sun.awt.windows.WPanelPeer.displayChanged(WPanelPeer.java:145)
    at sun.awt.windows.WPanelPeer.recursiveDisplayChanged(WPanelPeer.java:130)
    at sun.awt.windows.WPanelPeer.displayChanged(WPanelPeer.java:145)
    ...

    When we increased the stack trace limit to infinite (-XX:MaxJavaStackTraceDepth=0), we found the cause for this recursive problem:
         at sun.awt.windows.WPanelPeer.recursiveDisplayChanged(Unknown Source)
         at sun.awt.windows.WPanelPeer.displayChanged(Unknown Source)
         at sun.awt.windows.WWindowPeer.displayChanged(Unknown Source)
         at sun.awt.SunDisplayChanger.notifyListeners(Unknown Source)
         at sun.awt.Win32GraphicsDevice.displayChanged(Unknown Source)
         at sun.awt.Win32GraphicsEnvironment.displayChanged(Unknown Source)
         at sun.awt.windows.WToolkit$4.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0"
    We suspect this occured when users was using windows XP remote desktop to access the client machine that ran the client application, which caused the windows resolution to change, so the call to Win32GraphicsEnvironment.displayChanged. The display change caused infinite loop of recursive calls.
    That seems to be a bug in Sun's java implementation.

  • Assigning a java value(filepath) to a javascript variable

    I have a JSP where I have a java variable(obtained from session) which is nothing but a filepath(say C:\superb.xpdl). When I try to use the variable in javascript using var scriptVar = "<%= sessionVar %>";, the sessionVar value i.e. the filepath is getting modified (like C:superb.xpdl). Slashes are interpredted in a different way(\t for tab, \n for new line etc.,) How to get the filepath with no modifications while assigning to javascript variable? will encoding(using escape()) and decoding help?

    unfortunately you need to double up the slashes
    maybe this will work
    scriptVar = "<%= sessionVar.replaceAll("\\", "\\\\") %>";
    or maybe it will cause a infinite recursion problem (i'm too lazy to try it)

  • Infinite loop error after using Java Sun Tutorial for Learning Swing

    I have been attempting to create a GUI following Sun's learning swing by example (example two): http://java.sun.com/docs/books/tutorial/uiswing/learn/example2.html
    In particular, the following lines were used almost word-for-word to avoid a non-static method call problem:
    SwingApplication app = new SwingApplication();
    Component contents = app.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);I believe that I am accidentally creating a new instance of the gui class repeatedly (since it shows new GUI's constantly and then crashes my computer), possibly because I am creating an instance in the main class, but creating another instance in the GUI itself. I am not sure how to avoid this, given that the tutorials I have seen do not deal with having a main class as well as the GUI. I have googled (a nice new verb) this problem and have been through the rest of the swing by example tutorials, although I am sure I am simply missing a website that details this problem. Any pointers on websites to study to avoid this problem would be appreciated.
    Thanks for your time-
    Danielle
    /** GUI for MicroMerger program
    * Created July/06 at IARC
    *@ author Danielle
    package micromerger;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.swing.JFileChooser;
    import java.lang.Object;
    public class MGui
         private static File inputFile1, inputFile2;
         private static File sfile1, sfile2;
         private static String file1Name, file2Name;
         private String currFile1, currFile2;
         private JButton enterFile1, enterFile2;
         private JLabel enterLabel1, enterLabel2;
         private static MGui app;
         public MGui()
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        System.out.println("About to run create GUI method");
                        app = new MGui();
                        System.out.println("declared a new MGui....");
                        createAndShowGUI();
         //initialize look and feel of program
         private static void initLookAndFeel() {
            String lookAndFeel = null;
         lookAndFeel = UIManager.getSystemLookAndFeelClassName();
         try
              UIManager.setLookAndFeel(lookAndFeel);
         catch (ClassNotFoundException e) {
                    System.err.println("Couldn't find class for specified look and feel:"
                                       + lookAndFeel);
                    System.err.println("Did you include the L&F library in the class path?");
                    System.err.println("Using the default look and feel.");
                } catch (UnsupportedLookAndFeelException e) {
                    System.err.println("Can't use the specified look and feel ("
                                       + lookAndFeel
                                       + ") on this platform.");
                    System.err.println("Using the default look and feel.");
                } catch (Exception e) {
                    System.err.println("Couldn't get specified look and feel ("
                                       + lookAndFeel
                                       + "), for some reason.");
                    System.err.println("Using the default look and feel.");
                    e.printStackTrace();
         // Make Components--
         private Component createLeftComponents()
              // Make panel-- grid layout
         JPanel pane = new JPanel(new GridLayout(0,1));
            //Add label
            JLabel welcomeLabel = new JLabel("Welcome to MicroMerger.  Please Enter your files.");
            pane.add(welcomeLabel);
         //Add buttons to enter files:
         enterFile1 = new JButton("Please click to enter the first file.");
         enterFile1.addActionListener(new enterFile1Action());
         pane.add(enterFile1);
         enterLabel1 = new JLabel("");
         pane.add(enterLabel1);
         enterFile2 = new JButton("Please click to enter the second file.");
         enterFile2.addActionListener(new enterFile2Action());
         pane.add(enterFile2);
         enterLabel2 = new JLabel("");
         pane.add(enterLabel2);
         return pane;
         /** Make GUI:
         private static void createAndShowGUI()
         System.out.println("Creating a gui...");
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("MicroMerger");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Add stuff to the frame
         //MGui app = new MGui();
         Component leftContents = app.createLeftComponents();
         frame.getContentPane().add(leftContents, BorderLayout.WEST);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
    private class enterFile1Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile1 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file1Name = inputFile1.getName();
                   enterLabel1.setText(file1Name);
    private class enterFile2Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile2 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file2Name = inputFile2.getName();
                   enterLabel2.setText(file2Name);
    } // end classAnd now the main class:
    * Main.java
    * Created on June 13, 2006, 2:29 PM
    * @author Danielle
    package micromerger;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Main
        /** Creates a new instance of Main */
        public Main()
         * @param args the command line arguments
        public static void main(String[] args)
            MGui mainScreen = new MGui();
            //mainScreen.setVisible(true);
            /**Starting to get file choices and moving them into GPR Handler:
             System.out.println("into main method");
         String file1Name = new String("");
             file1Name = MGui.get1Name();
         System.out.println("good so far- have MGui.get1Name()");
        }// end main(String[] args)
    }// end class Main

    um, yeah, you definitely have a recursion problem, that's going to create an infinite loop. you will eventually end up an out of memory error, if you don't first get the OS telling you you have too many windows. interestingly, because you are deferring execution, you won't get a stack overflow error, which you expect in an infinite recursion.
    lets examine why this is happening:
    in main, you call new MGui().
    new MGui() creates a runnable object which will be run on the event dispatch thread. That method ALSO calls new MGui(), which in turn ALSO creates a new object which will be run on the event dispatch thead. That obejct ALSO calls new MGui(), which ...
    well, hopefully you get the picture.
    you should never unconditionally call a method from within itself. that code that you have put in the constructor for MGui should REALLY be in the main method, and the first time you create the MGui in the main method as it currently exists is unnecessary.
    here's what you do: get rid of the MGui constructor altogether. since it is the implicit constructor anyway, if it doesn't do anything, you don't need to provide it.
    now, your main method should actually look like this:
    public static void main( String [] args ) {
      SwingUtilities.invokeLater( new Runnable() {
        public void run() {
          MGui app = new MGui();
          app.createAndShowGUI();
    }// end mainyou could also declare app and call the constructor before creating the Runnable, as many prefer, because you would have access to it from outside of the Runnable object. The catch there, though, is that app would need to be declared final.
    - Adam

  • ITunes nickname already in use - error

    When I sign on to Apple online (such as this support site) it shows my correct public nickname.  However, when I try to change my nickname in the iTunes for Windows software client, I get an error that my nickname is already being used.  I am singed into iTunes store with the same Apple ID that I am signed into this support site.  How do I correct my nickname in iTunes Store?

    23-Apr-200702:40 PM
    yadda wrote:
    If I do that reset, are the only thing I am going to lose contacts, photos, docs etc or will it do something more major? I am getting that error and want a quick fix. I don't mind reentering phone numbers etc, but don't want to lose/reset anything complicated.
    thanks for any replies
    I'm not sure exactly what you will lose, but Nokia does have the Backup application within PC Suite which can make a backup of your phone before you wipe it which you can then restore back to your phone after you wiped it. However there is a possibility that it could restore the very lock file you just wiped .. which would then become a recursive problem ...
    You can download PC Suite here :
    here : http://www.nokia.co.uk/A4144905
    Regards,
    Edward

  • N73 Web already in use error

    When attempting to open the web browser, I get a message saying web already in use when no other browser or data session is up.
    Anyone know why this would be?

    23-Apr-200702:40 PM
    yadda wrote:
    If I do that reset, are the only thing I am going to lose contacts, photos, docs etc or will it do something more major? I am getting that error and want a quick fix. I don't mind reentering phone numbers etc, but don't want to lose/reset anything complicated.
    thanks for any replies
    I'm not sure exactly what you will lose, but Nokia does have the Backup application within PC Suite which can make a backup of your phone before you wipe it which you can then restore back to your phone after you wiped it. However there is a possibility that it could restore the very lock file you just wiped .. which would then become a recursive problem ...
    You can download PC Suite here :
    here : http://www.nokia.co.uk/A4144905
    Regards,
    Edward

  • PC Suite & Nokia N95 Backup/Restore

    My N95 doesn't seem to want to do a Backup let alone restore...
    Keeps hanging at 66% backup when it hits 'phone specific' stuff - the last one on the list.
    I have the most recent PC Suite - has anyone else suffered from this problem?
    Yup, life sure moves pretty fast...

    Out of interest do you get any type of error message when PC Suite is attempting to backup your Messages ? Also - give it some time to back up - I've left it for a good 20 minutes just to see whether it times out or comes back with any specific error message.
    I experienced a similar issue and it was down to having to reinstall the MMS Sync component of PC Suite.
    Two things I would try are :
    1) As a previous poster recommended - just try backing up to the memory card to see whether this works OK or not. Not being able to do so would indicate it's not a PC Suite related issue and localised to the phone itself.
    2) Try reinstall PC Suite functionality on the phone itself. With the N95 connected to your PC, load up PC Suite (the main program which gives an overview of all the applications that collectively comprise of PC Suite), then goto the Help Menu and choose "Reinstall PC Suite support on your phone" - then try backing up again.
    If both of these steps fail, I'd recomend wiping your phone to a factory reset condition (although your memory card should NOT be affected if you follow the link below - but to be safe I'd take it out nevertheless !). The only problem with this solution is that it leaves you in the recursive problem of having to wipe a phone you want to take a backup of (!). Hopefully however, you won't have to do this ...
    To reset your phone, follow the instructions in this link :
    /discussions/board/message?board.id=smartphones&message.id=4007
    However please be aware that doing so will wipe ALL the data from your phone such as information in your calendar, contacts and so on.
    In order to save your data you can use the PC Suite application to save and restore the data from your phone - this software can be found here :
    http://www.nokia.com/pcsuite
    If this doesn't work then it's likely you have a hardware fault and you should approach your local Nokia Service Centre to get your phone fixed.
    Hope this helps.
    Please let me know how you get on.
    Regards,
    Edward

  • EJB lookup returned stub from a different classloader.

    I've written an EJB for doing authenitcation. This EJB is accessed by an security-mbean (BEA's login module).
    - The EJB is deployed in an EAR.
    - The EJB-stubs are extracted and is included as part of the MBEAN Jar.
    When I hit a webapp causing the EJB lookup to occur, the stub object returned is created by the webapp's classloader. This cause a ClassCastException when trying to cast the returned home interface into the home interface of the MBEAN's classloader.
    Note that all this is happening on the same BEA server running WLS8.1.
    I don't want to put the EJB jar on the system classpath so I can redeploy the EJB, the Application's EAR and the MBEAN to a cluster.
    -alex

    Robert Greig <[email protected]> wrote:
    Thanks for responding to my question, which newsgroup is more appropriate for
    my line of question?
    But before I move this thread, I would like to add:
    I've already handled the recursion problem on top of the ejb-lookup before JNDI
    becomes avaliable (while doing server startup) problem.
    The advantage with the EJB model is this. By changing the host/port configuration,
    I can switch between a local-authentication server or a remote provide authentication
    server network configuration.
    If I were to include the necessary classes in the mbean JAR from our application,
    there maybe resources issues since I now have 2 classloaders loading my server-portion
    of classes. Not sure how that will workout with resources and all. This model
    has the disadvantage of any classes I have in the mbean JAR will require updates
    outside my EAR. This wroks against the EAR deployment model.
    -alex
    Alex Cheung wrote:
    I've written an EJB for doing authenitcation. This EJB is accessedby an security-mbean (BEA's login module).
    - The EJB is deployed in an EAR.
    - The EJB-stubs are extracted and is included as part of the MBEANJar.
    This isn't a good approach. You are pretty much stuffed mainly for the
    reasons you outline.
    Also note that if you continue to go down this road you will have to
    handle the potential recursion (i.e accessing an EJB will invoke a
    security call to your provider!).
    Why do you need to implement this as an EJB? The main advantages of EJBs
    are security and container managed transactions neither of which is
    relevant here surely?
    Robert

  • N73 Web already in use

    hello. my friend of mine has just bought a N73 and from a while, when he wants to use the Web application (Web Mini Map Browser) it says "Web already in use!". but the other web application works. can you tell what problem he has? can he download from the internet the Web application and reinstall it?
    PS: Nokia 6288 supports the Web Mini Map Browser?
    Thank you!

    23-Apr-200702:40 PM
    yadda wrote:
    If I do that reset, are the only thing I am going to lose contacts, photos, docs etc or will it do something more major? I am getting that error and want a quick fix. I don't mind reentering phone numbers etc, but don't want to lose/reset anything complicated.
    thanks for any replies
    I'm not sure exactly what you will lose, but Nokia does have the Backup application within PC Suite which can make a backup of your phone before you wipe it which you can then restore back to your phone after you wiped it. However there is a possibility that it could restore the very lock file you just wiped .. which would then become a recursive problem ...
    You can download PC Suite here :
    here : http://www.nokia.co.uk/A4144905
    Regards,
    Edward

Maybe you are looking for