Unable to return values in joptionpane

Hi all,
Im having a slight problem with some code regarding a joptionpane. With the help of some code i found on the internet (lol i know theres a lot of bad stuff out there but i thought id give it a go), im making a new object array containing my fields, and then adding these objects to the joptionpane. it seems to work ok, but i cant get back the values the user entered into the fields - for a normal joptionpane id call the getText() method. (nb this is only a small test application, so it is ok that a password is being returned for anyone to see!)
In my code below, all i can get it to do is return the objects details eg javax.swing.JTextField[,0,19,195x20,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0 etc...., and not the value the user entered!
Is this bad code for what im trying to do? what is the easiest way of returning the users password?
Thanks in advance
Torre
here is the code:
if ("changePwdPressed".equals(e.getActionCommand())){
               Object complexMsg[] = { "Current Password: ", new JTextField(10), "New Password: ", new JTextField(10), "Confirm New Password: ", new JTextField(10) };
               JOptionPane optionPane = new JOptionPane();
               optionPane.setMessage(complexMsg);
               optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
              JDialog dialog = optionPane.createDialog(this, "Change Password");
              dialog.setVisible(true);
              int i;
              for (i=0; i<complexMsg.length; i++)
              System.out.println(complexMsg);

This works, but it's ugly...
package forums;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class ComplexJDialogTest
  public static void main(String[] args) {
    try {
      System.out.println("Hello World!");
      message();
      System.out.println("Hello World!");
    } catch (Exception e) {
      e.printStackTrace();
  private static void message() {
    Object messages[] = {
        "Current Password: ", new JTextField(10)
      , "New Password: ", new JTextField(10)
      , "Confirm New Password: ", new JTextField(10)
    JOptionPane optionPane = new JOptionPane(messages, JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = optionPane.createDialog(null, "Change Password");
    dialog.setVisible(true);
    for (int i=1; i<messages.length; i+=2) {
      System.out.println(((JTextField)messages).getText());
dialog.dispose();
... I think I would prefer swmtgoet_x's solution... just create your three JTextField's (keep references to them) pass them to the JDialog, then (after user hits OK done) just access them directly.... ergo...
package forums;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class ComplexJDialogTest
  public static void main(String[] args) {
    try {
      System.out.println("Hello World!");
      message();
      System.out.println("Hello World!");
    } catch (Exception e) {
      e.printStackTrace();
  private static void message() {
    JTextField oldPassword = new JTextField(10);
    JTextField newPassword = new JTextField(10);
    JTextField newPasswordAgain = new JTextField(10);
    Object messages[] = {
        "Current Password: ", oldPassword
      , "New Password: ", newPassword
      , "Confirm New Password: ", newPasswordAgain
    JOptionPane optionPane = new JOptionPane(messages, JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = optionPane.createDialog(null, "Change Password");
    dialog.setVisible(true);
    dialog.dispose();
    System.out.println(oldPassword.getText());
    System.out.println(newPassword.getText());
    System.out.println(newPasswordAgain.getText());

Similar Messages

  • Halt code execution while awaiting a return value - like JOptionPane..

    I've been struggling with a minor annoying problem...
    I want to achive kindda the same thing as what happens when you call: String s = JOptionPane.showInputDialog(...);
    The code execution locks until a value is returned, and this is exactly what I want to be able to do with my own custom dialog/frame/whatever.
    Obviously, wait() and notify() on the calling thread won't work, so how can I achieve this optionpane gui-code-locking behaviour with my own custom gui components?
    Thx in advance !

    From JInternalFrame source:
         * Creates a new <code>EventDispatchThread</code> to dispatch events
         * from. This method returns when <code>stopModal</code> is invoked.
        synchronized void startModal() {
         /* Since all input will be blocked until this dialog is dismissed,
          * make sure its parent containers are visible first (this component
          * is tested below).  This is necessary for JApplets, because
          * because an applet normally isn't made visible until after its
          * start() method returns -- if this method is called from start(),
          * the applet will appear to hang while an invisible modal frame
          * waits for input.
         if (isVisible() && !isShowing()) {
             Container parent = this.getParent();
             while (parent != null) {
              if (parent.isVisible() == false) {
                  parent.setVisible(true);
              parent = parent.getParent();
            try {
                if (SwingUtilities.isEventDispatchThread()) {
                    EventQueue theQueue = getToolkit().getSystemEventQueue();
                    while (isVisible()) {
                        // This is essentially the body of EventDispatchThread
                        AWTEvent event = theQueue.getNextEvent();
                        Object src = event.getSource();
                        // can't call theQueue.dispatchEvent, so I pasted its body here
                        if (event instanceof ActiveEvent) {
                            ((ActiveEvent) event).dispatch();
                        } else if (src instanceof Component) {
                            ((Component) src).dispatchEvent(event);
                        } else if (src instanceof MenuComponent) {
                            ((MenuComponent) src).dispatchEvent(event);
                        } else {
                            System.err.println("unable to dispatch event: " + event);
                } else
                    while (isVisible())
                        wait();
            } catch(InterruptedException e){}
         * Stops the event dispatching loop created by a previous call to
         * <code>startModal</code>.
        synchronized void stopModal() {
            notifyAll();
        }It basically works like this:
    If this thread is not the EventDispatcher, then just use wait() and notify().
    If it is the EventDispatcher...the process the events from here while we wait for the dialog to close. Seems kind of dirty, but it works.

  • Unable to return value from LOV to the text field

    I have created the LOV and attached in the database text item. I have done the mapping to the require field in the LOV properties and I was able to show the LOV whenever reach that field by press F9 with all the records in my query. However, when I try to press enter to select one of the data in the LOV screen, the data was not return to the column which I have defined the LOV. What's wrong with this ?
    Regards,
    Lim

    Lim,
    Check is there any KEY-LIST-VAL trigger has any code. And Also check by assigning the same value to a dummy item for testing.
    Regards,
    Manu.

  • Unable to capture return values in web services api

    At the time of login to web services if my server is down ,
    it returns following error :
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1438)
            at java.lang.String.substring(String.java:1411)
    I want to capture this error so that i can try another server to login. how do i capture this error
    Another place where i want to capture the return Value is when i look for a report on the server
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
                               "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if the report is not there on the server , it returns a null handler exception.
    but if i try catching it by checking my responsehandler is null  like rh == null  it does not catch it.
    Any help will be appreciated
    thanks
    Rakesh Gupta

    Ted : i have two cases
    1)   server = server_st.nextToken();
        providerURL = "http://"server"/dswsbobje/services";
        sessConnURL = new URL(providerURL + "/session");
       Connection boConnection = new Connection(sessConnURL);
       Session boSession = new Session(boConnection);
      EnterpriseCredential boEnterpriseCredential = new    EnterpriseCredential();
                  boEnterpriseCredential.setLogin(userid);
      boEnterpriseCredential.setPassword(pwd);
      boEnterpriseCredential.setAuthType(auth);
    SessionInfo boSI = boSession.login(boEnterpriseCredential);
    I have got a list of servers running web servcies stored in my tokens. when i pass the first server name say " test:8080" and that server is down , i want to catch somewhere in the code above that it did not get the connection so that i can loop back and try with the second server say test1:8080
    This is for failover purposes.
    at present when i was trying to capture return value of boSI it  breaks giving the error
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1438)
    at java.lang.String.substring(String.java:1411)
    2nd case :
    I am geeting reports from the server and scheduling them:
    i run the following code which works fine if reports is there
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
    "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if  the  report  is not there on the server  then i should be able to catch from the response handle rh that it has got a null value.
    but rh does not return a null value 
    the code ultimately throws a null handle at the following line
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    i am not able to catch the null value there also.
    hope you got my issue.

  • Unable to see function return values in Visual Studio 2013 debugger

    Hi!
    I can't see function return values in
    Microsoft Visual Studio Ultimate 2013
    Version 12.0.31101.00 Update 4
    Microsoft .NET Framework
    Version 4.5.51650
    Installed Version: Ultimate<o:p></o:p>
    as described in  http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/27/seeing-function-return-values-in-the-debugger-in-visual-studio-2013.aspx
    So what can I do to get this functionality back?
    MsdnMezzo

    Hi MsdnMezzo,
    Reference:
    http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/27/seeing-function-return-values-in-the-debugger-in-visual-studio-2013.aspx
    If use the same sample in the above blog provided by you, how about the result? Could you debug it with the same steps? I could debug it in my side using the VS2013.
    So to make sure that whether it is your VS IDE issue, please debug it with this sample, if it works well, I doubt that we would think about your specific project and the debugging steps.
    If so, to really repro this issue, could you share us a sample with one drive? You could upload your project to one drive and share us the downloaded link in your new reply, I will download and repro this issue in my side.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Unable to retreive the return value of pl/sql function using DB Adapter

    Dear Experts,
    I am using DB Adapter in my BPEL Process. Using DB Adapter I am invoking a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I dont know how to retrieve the return value from the function. Please suggest me.
    Thanks,
    Rajesh

    Yes I am returning a value from PL/SQL function.
    Please see the code segments below,
    FUNCTION "TD_INSERT" (a TDINIT_TYPE, stops TDDETAIL_TABLE )
    RETURN VARCHAR2
    AS
    td_no Number;
    td_id Number;
    stop TDDETAILFULL_TYPE;
    length number;
    BEGIN
    insert into TD_INIT values( ----passing all the values here --------- );
    select max(tdno) into td_no from TD_INIT ;
    length := stops.count;
    for i in 1.. length loop
    stop := stops(i);
    insert into TD_DETAIL_FULL values(
    td_no, ------- );
    end loop;
    commit;
    RETURN td_no;
    END;
    Thanks,
    Rajesh

  • Unable to access values from database in login page..

    Hey all,
    Friends I have a login.jsp page and I want if i enter username and password then it will be accessed from database and after verifying the details it will open main.jsp.I made a database as "abc" and created DSN as 1st_login having table 1st_login. But the problem is that I am unable to access values from database.
    So Please help me.
    Following is my code:
    <HTML>
    <body background="a.jpg">
    <marquee>
                        <CENTER><font size="5" face="times" color="#993300"><b>Welcome to the"<U><I>XYZ</I></U>" of ABC</font></b></CENTER></marquee>
              <br>
              <br>
              <br>
              <br><br>
              <br>
         <form name="login_form">
              <CENTER><font size="4" face="times new roman">
    Username          
              <input name="username" type="text" class="inputbox" alt="username" size="20"  />
              <br>
         <br>
              Password          
              <input type="password" name="pwd" class="inputbox" size="20" alt="password" />
              <br/>
              <input type="hidden" name="option" value="login" />
              <br>
              <input type="SUBMIT" name="SUBMIT" class="button" value="Submit" onClick="return check();"> </CENTER>
              </td>
         </tr>
         <tr>
              <td>
              </form>
              </table>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection("jdbc:odbc:1st_login");
    Statement statement = connection.createStatement();
    String query = "SELECT username, password FROM 1st_login WHERE username='";
    query += request.getParameter("username") + "' AND password='";
    query += request.getParameter("password") + "';";
    ResultSet resSum = statement.executeQuery(query);
    //change: you gotta move the pointer to the first row of the result set.
    resSum.next();
    if (request.getParameter("username").equalsIgnoreCase(resSum.getString("username")) && request.getParameter("password").equalsIgnoreCase(resSum.getString("password")))
    %>
    //now it must connected to next page..
    <%
    else
    %>
    <h2>You better check your username and password!</h2>
    <%
    }catch (SQLException ex ){
    System.err.println( ex);
    }catch (Exception er){
    er.printStackTrace();
    %>
    <input type="hidden" name="op2" value="login" />
         <input type="hidden" name="lang" value="english" />
         <input type="hidden" name="return" value="/" />
         <input type="hidden" name="message" value="0" />
         <br>
              <br><br>
              <br><br>
              <br><br><br><br><br>
              <font size="2" face="arial" color="#993300">
         <p align="center"> <B>ABC &copy; PQR</B>
    </BODY>
    </HTML>
    and in this code i am getting following error
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:94: cannot find symbol_
    C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:95: cannot find symbol_
    4 errors
    C:\Project\SRS\nbproject\build-impl.xml:360: The following error occurred while executing this line:
    C:\Project\SRS\nbproject\build-impl.xml:142: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 6 seconds)

    As long as you're unable to compile Java code, please use the 'New to Java' forum. This is really trival.
    To ease writing, debugging and maintenance, I highly recommend you to write Java code in Java classes rather than JSP files. Start learning Servlets.

  • Getting Return values from RFC function call with visual basic

    Hi,
    I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
       SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
            Export parameters (to SAP):
                    - Student Name [char 10]         ==> "STUNAME"
                    - Student ID         [char 20]        ==> "STUID"
           Return values (From SAP):
                    - Results [char 10]        ==> "RESULT"
                    - Remarks [char 200]        ==> "REMARKS"
    i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
    Here's my vb code to accessing the function
            Dim R3 As Object
            Dim FBFunc As Object
            Dim returnFunc As Boolean
            Dim connected As Boolean
            R3 = CreateObject("SAP.Functions")
            R3.Connection.Client = "000"
            R3.Connection.User = "BCUSER"
            R3.Connection.Password = "minisap"
            R3.Connection.Language = "DE"
            R3.Connection.System = "dtsystem"
            R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx" 
            connected = R3.Connection.Logon(0, True)
            If connected <> True Then
                MsgBox("Unable to connect to SAP")
            End If
            FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
            FBFunc.exports("STUNAME") = "Jonny"
            FBFunc.exports("STUID") = "12345"
            returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
    thanks alot.
    Edited by: Eugene Tan on Mar 4, 2008 7:17 AM

    Hi Gregor,
    Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
    Below is the code snippet.
    Set impReturn = CHPASS_FN.Imports("RETURN")  <<=== is RETURN the standard keyword to get a                                                                                return object?
      expPassword.Value = currpass
      expNewPass.Value = newpass
      expFillRet.Value = "1"
    ''' Call change password function
      If CHPASS_FN.Call = True Then
        outFile.Write (", Called Function")
        Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return                                                               value variable names?
        outFile.WriteLine " : " & Message
      Else
        outFile.Write (", Call to function failed")
      End If
    thanks alot...all your help is very appreciated.

  • Invoke/db adapter get not the return value of a procedure

    Hi,
    I have a problem with a db adapter.
    A db adapter calls a wrapper procedure and fill data in a object type.
    the wrapper procedure call a procedure in a other schema.
    In that schema the procedure make a insert in a database table
    and give a return value(success_msg or error_msg).
    schema1.pkg_wrapper.proc1(p_in IN schema2.param1_t,p_out out schema2.param2_t)
    is
    begin
    schema2.pkg.proc1(p_in IN param1_t,p_out out param2_t)
    end;
    In one enviroment the bpel process running well in the second enviroment not.
    I had found that the bpel process write in the database and the out parameter is filled with 'ok'.
    But there ist a problem to transfer the value from the called procedure to the db adpater/invoke.
    The releases of the application server and the database a the same, also the releases of jdeveloper.
    My second problem the instance didn't comming back and the entry in the domain.log is
    <2008-04-25 12:51:48,056> <WARN> <mmerkel.collaxa.cube> <BaseCubeSessionBean::logWarning> Error while invoking bean "finder": [com.collaxa.cube.engine.core.InstanceNotFoundException: Instance not found in datasource.
    The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" from the datasource.
    Please check that the instance key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" refers to a valid instance that has been started and not removed from the process domain.
    ORABPEL-02152
    Instance not found in datasource.
    The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" from the datasource.
    Please check that the instance key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" refers to a valid instance that has been started and not removed from the process domain.
    and
    <2008-04-25 13:47:53,666> <ERROR> <mmerkel.collaxa.cube.engine> <CubeEngine::processStaleInstance> Instance 2670008 has already been marked as stale ... skipping
    <2008-04-25 13:47:53,672> <ERROR> <mmerkel.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "instance manager": [com.collaxa.cube.engine.core.InstanceStaleException: Inconsistent process guid.
    The instance "2670008" was created with process guid "MD5{ed3f0862561da5254a6cf2fd5a440500}"; the current guid for the process "bucheReo" (revision "1.0") is "MD5{0a8bf160d2ff79eabb2f4b479e876cd0}". Whenever a process is deployed on top of an existing process with the same process id and revision tag, all instances created from the previous process are marked as stale.
    If you are accessing this instance from the console, your browser may be referring to an out-of-date page; please click on the Instances tab to get the current list of active instances.
    ORABPEL-02032
    Inconsistent process guid.
    The instance "2670008" was created with process guid "MD5{ed3f0862561da5254a6cf2fd5a440500}"; the current guid for the process "bucheReo" (revision "1.0") is "MD5{0a8bf160d2ff79eabb2f4b479e876cd0}". Whenever a process is deployed on top of an existing process with the same process id and revision tag, all instances created from the previous process are marked as stale.
    If you are accessing this instance from the console, your browser may be referring to an out-of-date page; please click on the Instances tab to get the current list of active instances.
    Have anyone a idea?
    Every help is welcome?
    Thanks, Michael

    Hi,
    “You should be able to use an assign to copy an output parameter value from the BPEL variable associated with the output parameter of the stored procedure.”
    Yes, that is working well for the input variable. But that doesn’t work for the output variable in the second environment.
    The whole bpel process working well in one environment and does not in the second.
    By now I think there is any adjustment in the database or in the aplication server that we not found and that make the trouble
    What I do is that a invoke element (Invoke_WriteREOInDB) call the db adapter WriteREOInDB. My input variable WriteREOInDB_InputVariable is filled, the db adapater call a procedure and I see my data in the table. Now the procedure gives the result value ‘ok’
    In the invoke element I had the output variable WriteREOInDB_OutputVariable. In the next step I want to assign the value of WriteREOInDB_OutputVariable to my global output variable.
    But the instance didn’t coming back. In the console I get the following message:
    “Instance not found in datasource.
    The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7e0b" from the data source.”
    So I see nothing in the bpel console.
    Any idea?
    Thanks
    Michael

  • Trying to write an if statement around the return value of a CANCEL_OPTION

    I am writing a program that takes an input String using JOptionPane. The String can be made of only letters of the A-Z alphabet and the space character. I have written an error-checking loop that will pop another input box up along with an error message if any invalid character is detected. The input box has an 'ok' button and a 'cancel' button. As it is, if you hit cancel, the program crashes and you get a NullPointerException. All I want to do is place an if statement inside of the error-checking loop, immediatly after the code to pop up the second input box, that simply does System.exit() and exits the program correctly(rather than crashing) if 'cancel' is clicked.
    My attempt at such an if statement is visible in the following code(letter is a boolean variable defined earlier, and message is the input String that has already been read in):
                   letter = isValidMessage(message);
              while(!letter)
                   message = JOptionPane.showInputDialog(null, "Message must contain only A-Z, a-z, or space character...");
                            if(JOptionPane.CANCEL_OPTION > 0  //or ==0 or ==1 or ==2, nothing works//)
                                JOptionPane.showMessageDialog(null, "No valid message entered - program will terminate...");
                                System.exit(JOptionPane.CANCEL_OPTION);
                   letter = isValidMessage(message);
                    }The if statement doesn't work correctly. If you click 'cancel' when the input box comes up, the program does terminate as it is supposed to. The problem is that if I type something in the box and click 'ok', it also causes the program to terminate rather than continuing. I've tried changing the > to ==. I've tried changing 0 to 1 to 2 to -1(I really am not sure which int return value of CANCEL_OPTION corresponds to which event). I think once I got to do the exact opposite...that is to say, it would continue on with the program whether I clicked 'cancel' or 'ok'. Which is equally bad. I don't know what I'm doing wrong.
    It's probably something simple that I'm just overlooking.

    Well, here's what CANCEL_OPTION is, according to the JOptionPane class:
    /** Return value from class method if CANCEL is chosen. */
        public static final int         CANCEL_OPTION = 2;However, I believe you're going about this in the wrong way.
    With JOptionPane, whenever you show a dialog, it usually returns whatever OPTION the user chose.
    For instance,
        int choice = JOptionPane.showConfirmDialog(parentComponent, "hello");That will bring up a dialog centered on parentComponent, with a message of "hello".
    It will have the default options (YES_NO_OPTION).
    What it returns is the option the user chose.
    There are 4 possible things it can return:
    YES_OPTION, when user clicks "Yes"
    NO_OPTION, when user clicks "No"
    ERROR_OPTION, when an unforseen error occurs and the dialog closes
    CANCEL_OPTION, when the user clicks "Cancel" (if that OPTION type were being used), or if they close the dialog
    So this is how you would check for CANCEL_OPTION:
        int choice = JOptionPane.showConfirmDialog(parentComponent, "hello");
        if (choice == JOptionPane.CANCEL_OPTION) {
            // User cancelled
        else if (choice == JOptionPane.YES_OPTION) {
            // User chose yes
        // EtcSo you see, going about it like this:
    if(JOptionPane.CANCEL_OPTION > 0  //or ==0 or ==1 or ==2, nothing works//)Is really the wrong way, because you're not checking what the user DID, but just what the constant variable "CANCEL_OPTION" is.
    However, it seems as if you're in a unique situation where you don't want the OPTION chosen by the user, but an input String.
    This is all well and good, but I think this limits how you can interact with the user, as the "showInputDialog" methods return the String the user input- not the OPTION they chose, and you need to use both.
    What I've done in the past is created a simple JPanel with its own JTextField.
    I pass the JPanel in as the "message" parameter of a showConfirmDialog call, and get both the user input and their chosen OPTION based off a getText call to the JTextField and the OPTION constant returned by showConfirmDialog.
    Basically,
    JPanel promptPanel = new JPanel(new BorderLayout());
    JTextField promptField = new JTextField();
    promptPanel.add(promptField, BorderLayout.CENTER);
    int choice = JOptionPane.showConfirmDialog(parentComponent, promptPanel, "Input", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (choice == JOptionPane.OK_OPTION) {
       // User chose OK, see if invalid characters were entered
       String input = promptField.getText();
    else if (choice == JOptionPane.CANCEL_OPTION) {
       // User cancelled
    }Hope that helps.
    (note that I'm unsure if showConfirmDialog can accept OK_CANCEL_OPTION as its OPTION parameter, as it says only YES_NO_OPTION and YES_NO_CANCEL_OPTION can be used, but I seem to remember using it in the past. if OK_CANCEL_OPTION doesn't want to work, then use one of the other two and adjust your if statements accordingly)
    Cheers!
    Edited by: LukeFoss on Oct 9, 2007 10:39 PM

  • Problem loading images from a return value of a function

    hello, I write because I uin problem in loading images from a return value of a function.
    I created a database with a field "image" of type string, where I put the physical address of the image. I have written like this: {__DIR__ }foto.jpg
    Place the code, so you understand better
    function imageViewImage(): javafx.scene.image.Image {
    connetti();
    lass.forName(driverName);
    con = DriverManager.getConnection(url,user,"");
    stmt = con.createStatement();
    var richiesta:String = "SELECT image from viaggio WHERE id_viaggio=7";
    rs1 = stmt.executeQuery(richiesta);
    var result :String;
    rs1.next();
    risultato = rs1.getString("image");
    JOptionPane.showMessageDialog(null, result);
    var imagez = Image{
    url:"{result}";
    return imagez;
    The image is in the source code package
    First I connect to the database, run the query and I take the contents of the image.
    Can anyone help me?
    Is right to put in the database {__DIR__} foto.jpg or do I put only foto.jpg?

    Hello unkus_nob,
    I would rather suggest you to save only filename of that image like "foto.jpg" in database. And just concat it with the String variable containing "{__DIR__}".
    Actually the javafx compiler converts the {__DIR__} to the existing class directory path something like : "jar:file:/..../".
    var currentDir ="{__DIR__}";
    risultato = "{currentDir}{rs1.getString("immagine"})"; 
    var image = Image{
        url:risultato
    return image;--NARAYAN G.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL SELECT and Return values

    I have a simple SELECT statement in a Stored Proc that
    queries 2 tables in
    SQL Server 2000 using a join. My problem is I want to return
    values based on
    the outcome of the query eg. if a row is returned then return
    1, or return 2
    if no rows are found. I have tried various ways to implement
    this and they
    always work fine in Query Analyser but in Dreamweaver MX2004
    either return
    no return values ( or at least they are not displayed on my
    page ) or the
    return values are inconsistent. I am using a DW Command.
    I know this is DW and not my code as Query Analyser produces
    the correct
    values every time. Can anyone tell me what code I can use
    that is DW
    friendly please.
    Thanks.

    I read your note with a great degree of sympathy but no
    solutions. I was having the same trouble with access tables after 4
    years of trouble free connections. It may not be relevant but the
    solutions for my problem was a Server software SP release. Details
    are:
    Following the avalanche of hints and tips I am pleased to
    report that there is a problem with Dreamweaver MX and MX2004 when
    connecting to Access databases running on Windows Server 2003 SP1.
    Whilst it is covered in the knowledge base I note that others in
    the forum are having similar difficulties with Sequel connections
    and unable to retrieve failures.
    There is a "fix" - SP2DBFix1.0.2.mxp - for my problem and I
    cannot be alone in experiencing this.
    And just in case anyone from Adobe is reading this, you
    should have written to all your registered and paid up members
    informing us of this problem when WS2003 SP1 was released!
    Hope this helps.

  • Problem with the return value from a tablemodel after filtering

    I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
    everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
    I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
    **** This is the code to fill the jtable
    DefaultTableModel modelo=(DefaultTableModel)this.jTable1.getModel();
    while(rs.next()){
    Object[] fila= new Object[2];
    fila[0]=rs.getObject("id_categoria");
    fila[1]=rs.getObject("nombre");
    modelo.addRow(fila);
    this.jTable1.getColumnModel().removeColumn(this.jTable1.getColumnModel().getColumn(0));
    // I delete the first column because is a ID, I dont want that the user see it. the value is only for me**** this is the method to filter from the jtextfield
    private void FiltrarJtable1() {
    TableRowSorter sorter = new TableRowSorter(this.jTable1.getModel());
    sorter.setRowFilter(RowFilter.regexFilter("^"+this.jTextField1.getText().toUpperCase(), 1));
    this.jTable1.setRowSorter(sorter);
    this.jTable1.convertRowIndexToModel(0);
    }*** this is the method that return the ID (id_categoria) from the tablemodel
    private void SeleccionarRegistro(){
    if(this.jTable1.getSelectedRow()>-1){
    String str_id =this.jTable1.getModel().getValueAt(this.jTable1.getSelectedRow(),0).toString();
    int_idtoreturn=Integer.parseInt(str_id);
    this.dispose();
    }else{
    JOptionPane.showMessageDialog(this,"there are no records selected","Warning!",1);
    }Who I can solve this problem?

    m_ilio wrote:
    I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
    everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
    I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
    You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
    this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
    What you need to do is the following:
    int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
    if (selectedRow >= 0) {
        int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
        String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
    }Hope this helps.

  • MBAM Return Value 1603

    I am trying to get the database portion of MBAM setup on a member server, but it fails towards the end with an error code 1603.  I traced the log back to what I think is the initial error and it is regarding the VSSWriter.  Prior to this, everything
    looks good and actions were returning error code of 1.  After this error, it looks like files and registry values are being removed.  I am installing MBAM 2.0 on Windows Server 2008 and the database is SQL Server 2008 Standard.  I am running
    the installation as a domain administrator in an elevated Powershell window.
    This is a portion of the error log:
    RegisterVssWriter() - Registering VSS Express Writer
    RegisterVssWriter() - Exception caught, msg: Unable to load DLL 'VssWriterShim.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
    Exiting RegisterVssWriter with status: Failure
    Action ended 8:37:25: InstallExecute. Return value 3.
    MSI (s) (A8:D0) [08:37:25:207]: User policy value 'DisableRollback' is 0
    MSI (s) (A8:D0) [08:37:25:207]: Machine policy value 'DisableRollback' is 0
    MSI (s) (A8:D0) [08:37:25:217]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1161708713,LangId=1033,Platform=589824,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
    MSI (s) (A8:D0) [08:37:25:217]: Executing op: DialogInfo(Type=0,Argument=1033)
    MSI (s) (A8:D0) [08:37:25:219]: Executing op: DialogInfo(Type=1,Argument=Microsoft BitLocker Administration and Monitoring)
    MSI (s) (A8:D0) [08:37:25:220]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
    Action 8:37:25: Rollback. Rolling back action:
    Rollback: RegisterVssWriter
    MSI (s) (A8:D0) [08:37:25:224]: Executing op: ActionStart(Name=RegisterVssWriter,,)
    MSI (s) (A8:D0) [08:37:25:225]: Executing op: ProductInfo(ProductKey={D81934D7-20FC-46A9-9F2D-009961EAAA33},ProductName=Microsoft BitLocker Administration and Monitoring,PackageName=MaltaServerSystemsSetup.2.0.5301.1.msi,Language=1033,Version=33559733,Assignment=1,ObsoleteArg=0,,,PackageCode={512BA969-E4B0-4B0A-A2FF-36516BBF1524},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
    Rollback: RollbackRegisterVssWriter
    MSI (s) (A8:D0) [08:37:25:228]: Executing op: ActionStart(Name=RollbackRegisterVssWriter,,)
    MSI (s) (A8:D0) [08:37:25:230]: Executing op: CustomActionRollback(Action=RollbackRegisterVssWriter,ActionType=3393,Source=BinaryData,Target=UnregisterVssWriter,)
    MSI (s) (A8:8C) [08:37:25:297]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI22AF.tmp, Entrypoint: UnregisterVssWriter
    SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI22AF.tmp-\
    SFXCA: Binding to CLR version v2.0.50727
    Calling custom action MBAMServerCAs!Microsoft.Windows.Mdop.BitlockerManagement.SetupCAs.VssWriterInstallAction.UnregisterVssWriter
    Entering UnregisterVssWriter
    UnregisterVssWriter() - Unregistering VSS Express Writer
    UnregisterVssWriter() - Exception caught, msg: Unable to load DLL 'VssWriterShim.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
    Exiting UnregisterVssWriter with status: Failure
    Rollback: Writing system registry values
    MSI (s) (A8:D0) [08:37:26:272]: Executing op: ActionStart(Name=WriteRegistryValues,Description=Writing system registry values,Template=Key: [1], Name: [2], Value: [3])
    MSI (s) (A8:D0) [08:37:26:273]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Configuration,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:274]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:275]: Executing op: RegRemoveValue(Name=CustomerExperienceImprovementProgram,Value=#0,)
    MSI (s) (A8:D0) [08:37:26:277]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:277]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Configuration 3: 2
    MSI (s) (A8:D0) [08:37:26:278]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\Reports,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:279]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:281]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:282]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\Reports 3: 2
    MSI (s) (A8:D0) [08:37:26:283]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\ReportsDatabase,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:284]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:286]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:286]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\ReportsDatabase 3: 2
    MSI (s) (A8:D0) [08:37:26:287]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\KeyDatabase,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:288]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:290]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:290]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\KeyDatabase 3: 2
    MSI (s) (A8:D0) [08:37:26:291]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:292]: Executing op: RegRemoveValue(Name=ServicePrincipalName,Value=[~][~],)
    MSI (s) (A8:D0) [08:37:26:294]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:295]: Executing op: RegRemoveValue(Name=Topology,Value=0,)
    MSI (s) (A8:D0) [08:37:26:297]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:298]: Executing op: RegRemoveValue(Name=ReportsUrl,,)
    MSI (s) (A8:D0) [08:37:26:299]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:301]: Executing op: RegRemoveValue(Name=ReportsInstance,Value=SERVER,)
    MSI (s) (A8:D0) [08:37:26:302]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:304]: Executing op: RegRemoveValue(Name=WebList,Value=DOMAIN\SERVER$,)
    MSI (s) (A8:D0) [08:37:26:305]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:306]: Executing op: RegRemoveValue(Name=SRSUser,Value=DOMAIN\Account,)
    MSI (s) (A8:D0) [08:37:26:308]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:309]: Executing op: RegRemoveValue(Name=AuditDBLog,Value=D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\,)
    MSI (s) (A8:D0) [08:37:26:311]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:312]: Executing op: RegRemoveValue(Name=AuditDBFile,Value=D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\,)
    MSI (s) (A8:D0) [08:37:26:314]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:315]: Executing op: RegRemoveValue(Name=AuditDBName,Value=MBAM Compliance Status,)
    MSI (s) (A8:D0) [08:37:26:317]: Executing op: RegCreateKey()

    I am trying to get the database portion of MBAM setup on a member server, but it fails towards the end with an error code 1603.  I traced the log back to what I think is the initial error and it is regarding the VSSWriter.  Prior to this, everything
    looks good and actions were returning error code of 1.  After this error, it looks like files and registry values are being removed.  I am installing MBAM 2.0 on Windows Server 2008 and the database is SQL Server 2008 Standard.  I am running
    the installation as a domain administrator in an elevated Powershell window.
    This is a portion of the error log:
    RegisterVssWriter() - Registering VSS Express Writer
    RegisterVssWriter() - Exception caught, msg: Unable to load DLL 'VssWriterShim.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
    Exiting RegisterVssWriter with status: Failure
    Action ended 8:37:25: InstallExecute. Return value 3.
    MSI (s) (A8:D0) [08:37:25:207]: User policy value 'DisableRollback' is 0
    MSI (s) (A8:D0) [08:37:25:207]: Machine policy value 'DisableRollback' is 0
    MSI (s) (A8:D0) [08:37:25:217]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1161708713,LangId=1033,Platform=589824,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
    MSI (s) (A8:D0) [08:37:25:217]: Executing op: DialogInfo(Type=0,Argument=1033)
    MSI (s) (A8:D0) [08:37:25:219]: Executing op: DialogInfo(Type=1,Argument=Microsoft BitLocker Administration and Monitoring)
    MSI (s) (A8:D0) [08:37:25:220]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
    Action 8:37:25: Rollback. Rolling back action:
    Rollback: RegisterVssWriter
    MSI (s) (A8:D0) [08:37:25:224]: Executing op: ActionStart(Name=RegisterVssWriter,,)
    MSI (s) (A8:D0) [08:37:25:225]: Executing op: ProductInfo(ProductKey={D81934D7-20FC-46A9-9F2D-009961EAAA33},ProductName=Microsoft BitLocker Administration and Monitoring,PackageName=MaltaServerSystemsSetup.2.0.5301.1.msi,Language=1033,Version=33559733,Assignment=1,ObsoleteArg=0,,,PackageCode={512BA969-E4B0-4B0A-A2FF-36516BBF1524},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
    Rollback: RollbackRegisterVssWriter
    MSI (s) (A8:D0) [08:37:25:228]: Executing op: ActionStart(Name=RollbackRegisterVssWriter,,)
    MSI (s) (A8:D0) [08:37:25:230]: Executing op: CustomActionRollback(Action=RollbackRegisterVssWriter,ActionType=3393,Source=BinaryData,Target=UnregisterVssWriter,)
    MSI (s) (A8:8C) [08:37:25:297]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI22AF.tmp, Entrypoint: UnregisterVssWriter
    SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI22AF.tmp-\
    SFXCA: Binding to CLR version v2.0.50727
    Calling custom action MBAMServerCAs!Microsoft.Windows.Mdop.BitlockerManagement.SetupCAs.VssWriterInstallAction.UnregisterVssWriter
    Entering UnregisterVssWriter
    UnregisterVssWriter() - Unregistering VSS Express Writer
    UnregisterVssWriter() - Exception caught, msg: Unable to load DLL 'VssWriterShim.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
    Exiting UnregisterVssWriter with status: Failure
    Rollback: Writing system registry values
    MSI (s) (A8:D0) [08:37:26:272]: Executing op: ActionStart(Name=WriteRegistryValues,Description=Writing system registry values,Template=Key: [1], Name: [2], Value: [3])
    MSI (s) (A8:D0) [08:37:26:273]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Configuration,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:274]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:275]: Executing op: RegRemoveValue(Name=CustomerExperienceImprovementProgram,Value=#0,)
    MSI (s) (A8:D0) [08:37:26:277]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:277]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Configuration 3: 2
    MSI (s) (A8:D0) [08:37:26:278]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\Reports,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:279]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:281]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:282]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\Reports 3: 2
    MSI (s) (A8:D0) [08:37:26:283]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\ReportsDatabase,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:284]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:286]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:286]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\ReportsDatabase 3: 2
    MSI (s) (A8:D0) [08:37:26:287]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\KeyDatabase,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:288]: Executing op: RegRemoveValue(Name=Installed,Value=#1,)
    MSI (s) (A8:D0) [08:37:26:290]: Executing op: RegRemoveKey()
    MSI (s) (A8:D0) [08:37:26:290]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup\KeyDatabase 3: 2
    MSI (s) (A8:D0) [08:37:26:291]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Microsoft BitLocker Administration and Monitoring\Setup,,BinaryType=1,)
    MSI (s) (A8:D0) [08:37:26:292]: Executing op: RegRemoveValue(Name=ServicePrincipalName,Value=[~][~],)
    MSI (s) (A8:D0) [08:37:26:294]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:295]: Executing op: RegRemoveValue(Name=Topology,Value=0,)
    MSI (s) (A8:D0) [08:37:26:297]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:298]: Executing op: RegRemoveValue(Name=ReportsUrl,,)
    MSI (s) (A8:D0) [08:37:26:299]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:301]: Executing op: RegRemoveValue(Name=ReportsInstance,Value=SERVER,)
    MSI (s) (A8:D0) [08:37:26:302]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:304]: Executing op: RegRemoveValue(Name=WebList,Value=DOMAIN\SERVER$,)
    MSI (s) (A8:D0) [08:37:26:305]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:306]: Executing op: RegRemoveValue(Name=SRSUser,Value=DOMAIN\Account,)
    MSI (s) (A8:D0) [08:37:26:308]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:309]: Executing op: RegRemoveValue(Name=AuditDBLog,Value=D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\,)
    MSI (s) (A8:D0) [08:37:26:311]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:312]: Executing op: RegRemoveValue(Name=AuditDBFile,Value=D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\,)
    MSI (s) (A8:D0) [08:37:26:314]: Executing op: RegCreateKey()
    MSI (s) (A8:D0) [08:37:26:315]: Executing op: RegRemoveValue(Name=AuditDBName,Value=MBAM Compliance Status,)
    MSI (s) (A8:D0) [08:37:26:317]: Executing op: RegCreateKey()

  • Multiple return values (Bug-ID 4222792)

    I had exactly the same request for the same 3 reasons: strong type safety and code correctness verification at compile-time, code readability and ease of mantenance, performance.
    Here is what Sun replied to me:
    Autoboxing and varargs are provided as part of
    JSRs 14 and 201
    http://jcp.org/en/jsr/detail?id=14
    http://jcp.org/en/jsr/detail?id=201
    See also:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://developer.java.sun.com/developer/earlyAccess/adding_generics/index.html
    Multiple return values is covered by Bug-ID 4222792
    Typically this is done by returning an array.
    http://developer.java.sun.com/developer/bugParade/bugs/4222792.html
    That's exactly the problem: we dynamically create instances of array objects that would better fit well within the operand stack without stressing the garbage collector with temporary Array object instances (and with their backing store: 2 separate allocations that need to be recycled when it is clearly a pollution that the operand stack would clean up more efficiently)
    If you would like to engage in a discussion with the Java Language developers, the Generics forum would be a better place:
    http://forum.java.sun.com/forum.jsp?forum=316
    I know that (my report was already refering to the JSR for language extension) Generics is not what I was refering to (even if a generic could handle multiple return values, it would still be an allocated Object
    instance to pack them, i.e. just less convenient than using a static class for type safety.
    The most common case of multiple return values involve values that have known static datatypes and that should be checked with strong typesafety.
    The simple case that involves returning two ints then will require at least two object instances and will not solve the garbage collection overhead.
    Using a array of variable objects is exactly similar, except that it requires two instances for the components and one instance for the generic array container. Using extra method parameters with Integer, Byte, ... boxing objects is more efficient, but for now the only practical solution (which causes the least pollution in the VM allocator and garbage collector) is to use a custom class to store the return values in a single instance.
    This is not natural, and needlessly complexifies many interfaces.
    So to avoid this pollution, some solutions are used such as packing two ints into a long and returning a long, depacking the long after return (not quite clean but still much faster at run-time for methods that need to be used with high frequencies within the application. In some case, the only way to cut down the overhead is to inline methods within the caller code, and this does not help code maintenance by splitting the implementation into small methods (something that C++ can do very easily, both because it supports native types parameters by reference, and because it also supports inline methods).
    Finally, suppose we don't want to use tricky code, difficult to maintain, then we'll have to use boxing Object types to allow passing arguments by reference. Shamely boxed native types cannot be allocated on the operand stack as local variables, so we need to instanciate these local variables before call, and we loose the capacity to track the cases where these local variables are not really initialized by an effective call to the method that will assign them. This does not help debugging, and is against the concept of a strongly typed language like Java should be:
    Java makes lots of efforts to track uninitialized variables, but has no way to determine if an already instanciated Object instance refered in a local variable has effectively received an effective assignment because only the instanciation is kept. A typical code will then need to be written like this:
    Integer a = null;
    Integer b = null;
    if (some condition) {
    //call.method(a, b, 0, 1, "dummy input arg");
    // the method is supposed to have assigned a value to a and b,
    // but can't if a and b have not been instanciated, so we perform:
    call.method(a = new Integer(), b = new Integer(), 0, 1, "dummy input
    arg");
    // we must suppose that the method has modified (not initialized!)
    the value
    // of a and b instances.
    now.use(a.value(), b.value())
    // are we sure here that a and b have received a value????
    // the code may be detected at run-time (a null exception)
    // or completely undetected (the method() above was called but it
    // forgot to assign a value to its referenced objects a and b, in which
    // case we are calling in fact: now.use(0, 0); with the default values
    // or a and b, assigned when they were instanciated)
    Very tricky... Hard to debug. It would be much simpler if we just used:
    int a;
    int b;
    if (some condition) {
    (a, b) = call.method(0, 1, "dummy input arg");
    now.use(a, b);
    The compiler would immediately detect the case where a and b are in fact not always initialized (possible use bere initialization), and the first invoked call.method() would not have to check if its arguments are not null, it would not compile if it forgets to return two values in some code path...
    There's no need to provide extra boxing objects in the source as well as at run-time, and there's no stress added to the VM allocator or garbage collector simply because return values are only allocated on the perand stack by the caller, directly instanciated within the callee which MUST (checked at compile-time) create such instances by using the return statement to instanciate them, and the caller now just needs to use directly the variables which were referenced before call (here a and b). Clean and mean. And it allows strong typechecking as well (so this is a real help for programmers.
    Note that the signature of the method() above is:
    class call {
    (int, int) method(int, int, String) { ... }
    id est:
    class "call", member name "method", member type "(IILjava.lang.string;)II"
    This last signature means that the method can only be called by returning the value into a pair of variables of type int, or using the return value as a pair of actual arguments for another method call such as:
    call.method(call.method("dummy input arg"), "other dummy input arg")
    This is strongly typed and convenient to write and debug and very efficient at run-time...

    Can anyone give me some real-world examples where
    multiple return values aren't better captured in a
    class that logically groups those values? I can of
    course give hundreds of examples for why it's better
    to capture method arguments as multiple values instead
    of as one "logical object", but whenever I've hankered
    for multiple return values, I end up rethinking my
    strategy and rewriting my code to be better Object
    Oriented.I'd personally say you're usually right. There's almost always a O-O way of avoiding the situation.
    Sometimes though, you really do just want to return "two ints" from a function. There's no logical object you can think of to put them in. So you end up polluting the namespace:
    public class MyUsefulClass {
    public TwoInts calculateSomething(int a, int b, int c) {
    public static class TwoInts {
        //now, do I use two public int fields here, making it
        //in essence a struct?
       //or do I make my two ints private & final, which
       //requires a constructor & two getters?
      //and while I'm at it, is it worth implementing
      //equals(), how about hashCode()? clone()?
      //readResolve() ?
    }The answer to most of the questions for something as simple as "TwoInts" is usually "no: its not worth implementing those methods", but I still have to think about them.
    More to the point, the TwoInts class looks so ugly polluting the top level namespace like that, MyUsefulClass.TwoInts is public, that I don't think I've ever actually created that class. I always find some way to avoid it, even if the workaround is just as ugly.
    For myself, I'd like to see some simple pass-by-value "Tuple" type. My fear is it'd be abused as a way for lazy programmers to avoid creating objects when they should have a logical type for readability & maintainability.
    Anyone who has maintained code where someone has passed in all their arguments as (mutable!) Maps, Collections and/or Arrays and "returned" values by mutating those structures knows what a nightmare it can be. Which I suppose is an argument that cuts both ways: on the one hand you can say: "why add Tuples which would be another easy thing to abuse", on the other: "why not add Tuples, given Arrays and the Collections framework already allow bad programmers to produce unmainable mush. One more feature isn't going to make a difference either way".
    Ho hum.

Maybe you are looking for

  • Xcelsius Engage: Issue with dynamic visibilty of data in dashboard

    Hi, We have a requirement for a dashboard where data for 5 Sites need to be displayed as per 17 KPIs and 12 different rolling months. Raw sample data looks like below- SITE  KPI        ActYTD  Act(Pre Month) PlanYTD  Plan(Prev Month)  VarianceYTD Var

  • Mail 6.6 missing plug-in for PDF view, can't save to RTFD file

    Hi, I see there are some similar queries about this, but no definitive answer. I can't seem to save to RTFD file format, and my sent mail indicates a missing plug-in for where the PDF attachment should be. I did mess around with the Mail Library a bi

  • Dbms_xmlgen

    Dear Sir, dbms_xmlgen This is the predefined package which is used to generate the xml file in l0g . Is there any predefined package is there for generating the excel file . If it is there which package will help me to generate excel file through pre

  • How do I get my Ipod onto my wireless network

    My Ipad touch 2 can find my wireless network but since I updated Itunes and the Ipad software, I cannot get on my home wireless network.  The page which shows the IP address, the subnet, etc. is blank.  Any suggestions before I spend money to have Ap

  • Unable to install any android apps after upgrading to 10.3

    Hello All, Yesterday I updated my BB Z10 to 10.3.1.1865 software release and now I am not able to install any Android Apps on my Z10. I get a message as "You dont have enough Storage space available to install this app". Even a smaller app is not get