[ASK]Bugs of Java or Wrong Code?

Dear All,
What this is bugs of Java or me not to understand java programming, this my piece code :
String kode = txtKode.getText();
        String nama = inputNama.getText();
        String keterangan = inputKeterangan.getText();
        try {
            Connection c = KoneksiMySql.getKoneksi();
            String sql = "UPDATE UNIT SET NAMA=?, KETERANGAN=?, WKT_INPUT=now() WHERE KODE=?";
            PreparedStatement p = c.prepareStatement(sql);
            p.setString(1, nama);
            p.setString(2, keterangan);
            p.setString(3, kode);
            p.executeUpdate();
            p.close();
            JOptionPane.showMessageDialog(null, "Data Berubah",
                    "Pemberitahuan", JOptionPane.INFORMATION_MESSAGE);
        } catch(SQLException e) {
            System.out.println("Error : " + e);
            JOptionPane.showMessageDialog(null, "Proses Rubah Unit Gagal",
                    "Pesan Error", JOptionPane.ERROR_MESSAGE);      
        }finally {
        inputNama.setText(null);
        inputKeterangan.setText(null);
            btnTambah.setEnable(true);
            btnHapus.setEnabled(false);
            btnRubah.setEnabled(false);
            inputNama.requestFocus();
JOptionPane is Show and no error appears but data in database does not change, and code in block finally not executed.
i'm use jInternalFrame, first run Only 'Add Button, Search Button' enable and other button are disable, then when 'Search Button' is clicked and open other jInternalFrame and get data form database, 'Add button' Disable and 'Delete Button, Change Button' are Enable. that my piece code on Change Button ActionPerformed.
Please it's support.
Thanks,
Best & Regrads.

Cross posted
[ASK]Bugs of Java or Wrong Code?
[HELP]Bugs of Java or Wrong Code?
db

Similar Messages

  • I want to upgrade(iOS 8.1.1) iphone 4S. A code is asked. I entered my sim code... wrong. Which code do I have to use?

    I have an iphone 4S... and not enough space to make the upgrades.
    Getting started, using iTunes. My iphone asked my code. I gave in the sim code.. wrong. First wrong code... so I don't try anymore, because I'm afraid my iphone will not work anymore if I give 3 wrong codes...
    Can anybody tell me which code I have to use?

    hito1956 wrote:
    I have an iphone 4S... and not enough space to make the upgrades.
    Getting started, using iTunes. My iphone asked my code.
    What is the exact message you are getting when it asks for a code?

  • TS3274 My friend's iPad has not been used for several weeks. When I first turned it on, asked for a four digit pass code. After several wrong "guess" attempts it kept asking for more, with a note saying I cou

    It on, it asked for a four digit pass code. After several guess attempts, making me wait for an hour to try each time, I gave up. The next day, it asked me to connect to iTunes. I remain locked up with that request. I've re-booted several times and get same request.
    Advice!! Help!

    You have to reset the iPad using iTunes if you can not remember your passcode.
    http://support.apple.com/kb/ht1414

  • A bug in Java

    I would like to report a bug in Java.
    It began with the rmi tutorial on computing pi.
    I had no problem with this on a single computer but could never get it to work over the network. I posted messages on this forum and got lots of generous help, especially from Genady, but eventually I left it as an unsolved problem.
    Yesterday I came back to my local network with my current problem and had problems similar to pi. Now at least I have more experience and I could track it down. It looks like a Java bug to me.
    The hardware is: 1 router, behind which sit 2 computers: home-ilan at 192.168.2.100 and home-yona at 192.168.2.103. I have a client-server setup via rmi. If the server is on home-yona, all works OK. If the server is on home-ilan it fails. What could be the difference?
    It turns out that home-ilan (my main computer) also has the possibility to run VPN to the hospital. The VPN uses a given IP. If I need to get to the hospital, I use the VPN. If not, I don't use it.
    Yesterday I put Eclipse on home-yona and looked for the problem. It turns out to be in
    Query q1 = (Query) Naming.lookup(rmi1);I was running the query from home-yona to home-ilan. I got a valid q1 back, and I drilled down into it. One of the elements is
    ep=TCPEndpoint which has a host value.
    The host value should have been 192.168.2.100, but instead it was the value of the VPN. The packet was sent from 192.168.2.100 to 192.168.2.103 and home-yona picked up the packet correctly, but it had the wrong value of the host. When I actually made the query to rmi, it expected the result from the VPN IP, which it never got, so it timed out.
    The bug is that Naming.lookup, even though it got the packet through the LAN, gave VPN address. This would have been fine had I been querying from the hospital, but I was in fact doing a local query. The Naming.lookup doesn't differentiate, which is a bug.
    The bug is 100% reproducible. If I start the server while VPN is running, from home-yona I will always get the VPN IP. If I start the server while VPN is turned off, I will get the correct address.
    Any suggestions?
    Ilan

    If that were the only thing which was wrong, we'd be in great shape. It is then a bug of Cisco Systems who supplied the VPN. I just took the default conditions and used them. I had no idea there was any problem until I ran the RMI protocol.
    In fairness to Cisco Systems, I must say that it is unusal to say that I want a VPN connection into the hospital and at the same time make a connection over my local LAN. In fact it works for everything I happened to try up until now, but it fails for RMI (because of the static assignment).
    The amazing thing is that with all these incompatible programs is not that sometimes it fails, but that it works at all. When I look at the Control Panel, I see 2 LAN connections, my local LAN and the VPN. I suspect I would have a very similar problem if I had 2 physical LAN cards.
    The home-ilan identifies the computer and it doesn't identify the computer-lan combination.
    What the RMI wants is not the computer identification, but rather the lan card identification. At least in the Control Panel, such a thing doesn't exist.

  • Is this a bug in Java!

    int i=0;
    i=i++;
    System.out.println(i);
    What should this code print.
    I guess 1.
    But it prints 0.
    Can anyone explain the logic behind this, or is this a bug in Java.
    Thanks for your time in advance.

    What did the mackerel do to deserve that?it wrote Sun's search function !!!!!! :pPlease, a mackerel would of done a better job.
    All I can say is "JTable project", smiles.
    (Gah, Please kill me)mlk BANG BANG*
    *Post decease operator.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Please! help me with this wrong code, where is mistake

    please! help me with this wrong code, where is mistake?
    import java.util.Stack;
    public class KnightsTour {
    Vars locs[];
    private int size, max=1, d=0, board[][];
    public KnightsTour(int x,int y, int newSize)
         size=newSize;
         locs=new Vars[size*size+1];
         for(int n=1;n<=size*size;n++)
              locs[n]=new Vars();
         board=new int[size+1][size+1];
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   board[n][n2]=0;
         locs[max].x=x;
         locs[max].y=y;
         locs[max].d=1;
         board[x][y]=max;
         max++;
    class Vars{
         int x;
         int y;
         int d;
    public void GO()
         int n=0;
         while(max<=size*size)
              n++;
              d++;
              if(d>8)
                   max--;
                   board[locs[max].x][locs[max].y]=0;
                   d=locs[max].d+1;
              move();
         printBoard();
    public void move()
         int x=locs[max-1].x, y=locs[max-1].y;
         switch(d)
         case 1:x--;y-=2;break;
         case 2:x++;y-=2;break;
         case 3:x+=2;y--;break;
         case 4:x+=2;y++;break;
         case 5:x++;y+=2;break;
         case 6:x--;y+=2;break;
         case 7:x-=2;y++;break;
         case 8:x-=2;y--;break;
         //System.out.println(" X: "+x+" Y: "+y+" |"+max);
         if((x<1)||(x>size)||(y<1)||(y>size)){}
         else if(board[x][y]!=0){}
         else
              locs[max].x=x;
              locs[max].y=y;
              locs[max].d=d;
              board[x][y]=max;
              max++;
              d=0;
              //printBoard();
    public void printBoard()
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   if(board[n2][n]<10)
                        System.out.print(board[n2][n]+" ");
                   else
                        System.out.print(board[n2][n]+" ");
              System.out.println();
         //System.out.println();
         System.out.println();
         public static void main (String[]args){
              KnightsTour k = new KnightsTour(1,1,8);
         }

    public class KnightsTour {
        Vars locs[];
        private int size,  max = 1,  d = 0,  board[][];
        public static void main (String[] args) {
            KnightsTour k = new KnightsTour (1, 1, 8);
            k.GO ();
        public KnightsTour (int x, int y, int newSize) {
            size = newSize;
            locs = new Vars[size * size + 1];
            for (int n = 1; n <= size * size; n++) {
                locs[n] = new Vars ();
            board = new int[size + 1][size + 1];
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    board[n][n2] = 0;
            locs[max].x = x;
            locs[max].y = y;
            locs[max].d = 1;
            board[x][y] = max;
            max++;
        class Vars {
            int x;
            int y;
            int d;
        public void GO () {
            int n = 0;
            while (max <= size * size) {
                n++;
                d++;
                if (d > 8) {
                    max--;
                    board[locs[max].x][locs[max].y] = 0;
                    d = locs[max].d + 1;
                move ();
            printBoard ();
        public void move () {
            int x = locs[max - 1].x, y = locs[max - 1].y;
            switch (d) {
                case 1:
                    x--;
                    y -= 2;
                    break;
                case 2:
                    x++;
                    y -= 2;
                    break;
                case 3:
                    x += 2;
                    y--;
                    break;
                case 4:
                    x += 2;
                    y++;
                    break;
                case 5:
                    x++;
                    y += 2;
                    break;
                case 6:
                    x--;
                    y += 2;
                    break;
                case 7:
                    x -= 2;
                    y++;
                    break;
                case 8:
                    x -= 2;
                    y--;
                    break;
    //System.out.println(" X: "x" Y: "y" |"+max);
            if ((x < 1) || (x > size) || (y < 1) || (y > size)) {
            } else if (board[x][y] != 0) {
            } else {
                locs[max].x = x;
                locs[max].y = y;
                locs[max].d = d;
                board[x][y] = max;
                max++;
                d = 0;
    //printBoard();
        public void printBoard () {
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    if (board[n2][n] < 10) {
                        System.out.print (board[n2][n] + " ");
                    } else {
                        System.out.print (board[n2][n] + " ");
                System.out.println ();
    //System.out.println();
            System.out.println ();
    }formatting ftw.
    If you call GO () you get in an infinite loop. max gets decreased, and it loops while max is smaller then or equal to size * size. Is your looping logic correct ?

  • A possible *bug* in java jcombobox

    Hi all,
    I think i found a possible bug in java jcombobox .. i am sure some of you must have already experienced it..
    supposedly you put a jcombobox in a jpanel
    returned the panel from a method to a calling method..
    and that method adds it to another panel that it had created to a frame..
    and if this happens dynamicaly at runtime, as only after u click a button..
    meaning : without adding the combobox or the immediate parent panelto the contentpane .. directly..
    Then,
    your combox's keylistener may not catch events fired.
    .. this has happened to me many times.. and always i could only find a way out
    .. by adding the combobox to panel that is loaded during startup itself and is
    .. not returned through a method call.
    Your opinions please ?
    'Harish.

    All components in a UI are created at run-time.
    When you create your JFrame you call pack() to align and resize the UI. This validates all the components, and sets the default focus on what ever component should have the focus at start up.
    When you create components and add them as children of another component you have to validate the child and parent. This can be done by calling JComponent.validate()
    As for keylisteners not getting called, this might be fixed if you call grabFocus on the new combobox. I can't see a reason why any listener would stop working.
    For me to really understand what your talking about. I'd need to see source code reproducing this problem.

  • Bug in java arrays?

    Hi, just found this in a toy program and thought it might be a bug in the way java handles arrays... I'm working on Suse 8.0 & jdk 1.4, Red Hat 7.x/8.x with jdk 1.4 and Solaris 4 jdk 1.4:
    If you have a method like this:
        public static void resize(int[] arr, int size) {
            int[] tmp = arr;
            int iterate;
            arr = new int[size];  // disassociate tmp from arr
            iterate = size > tmp.length ? tmp.length : size;
            for(int x = 0; x < iterate; x++) {
                arr[x] = tmp[x];
        }and try to call it from another class like this:
            /* could this possibly be a bug in java??? */
            Arrays.resize(state, state.length + 1);  // make array bigger
            state[state.length - 1] = start;  // store current room in arrayI get an ArrayIndexOutOfBoundsException on the call to assign start to the last index of state, which means that the new array knows its new length, but can't assign to it.
    The solution to my problem was to return arr in the resize() method and assign the returned value to state.
    This seems to go against what its supposed to happen (that the array is rezized and the pointer just updated)
    Is this a bug in java or is it te desired behaviour?
    dave.

    But when I create the 'new' array I'm assigning the
    pointer to the place where the previous array pointer
    was... This should be completely legal. Yes, it's completely legal, but it doesn't do what you want :)
    The variable in method to which you assign a new and longer array is a different one than the pointer you have in another method.
    If you just call a function to assign values to an
    array like this:> public void update(int[]arr){
    arr[0] = 2;
    } > and then use some code to look at the array you
    passed: > int[]x = {1,2,3,4};
    update(x);
    system.out.println(x[0]);> you would expect to get 2 in the
    output. Whay should this operation be different?Because in this case you wrap the reference you change (slot 0 in the array) into another object (the array). Therefore the reference you actually change is the same as the reference you expect to change.
    If you let your resize method return the new and longer array, and assign the returned value to yor old variable, you might get a better result.
    (And System.arraycopy may be more efficient than your for loop.)

  • Generating wrong code

    hi,
    my deployment wizard generates wrong code: all custom finder methods are
    generated wrong. i checked the xxxPSJDBC.java files and i saw that the
    wizard generates the sql-statement correct but then:
    Object __WL_typeObj = __WL_fieldSQLTypes.get("null");
    i think that this is wrong! please help!
    i am developing my beans in vaj 3.02 on nt. i found another problem which
    belongs to the same topic, i guess:
    generated code like the following is ridiculous:
    java.lang.String __WL_stmt = " select id, partno, row from item where 1=0"
    --> throws the following exception when starting Weblogic server:
    java.lang.Exception: Couldn't get ResultSetMetaData to look up field types:
    thanks for your help in advance,
    martin

    here it is.
    regards,
    martin
    "Ravi Akella" <[email protected]> wrote in message
    news:[email protected]..
    Can you post DeploymentDescriptor.txt file.
    -- Ravi Akella.
    Martin Zach wrote:
    hi,
    sorry, i did not mention that i am using wls 4.5.2 with sp1.
    martin
    Ravi Akella <[email protected]> schrieb in im Newsbeitrag:
    [email protected]..
    It depends on the WL QL(Query Language). Can you post the
    weblogic-cmp-rdbms-jar.xml?
    -- Ravi Akella.
    Martin Zach wrote:
    hi,
    my deployment wizard generates wrong code: all custom finder methods
    are
    generated wrong. i checked the xxxPSJDBC.java files and i saw thatthe
    wizard generates the sql-statement correct but then:
    Object __WL_typeObj = __WL_fieldSQLTypes.get("null");
    i think that this is wrong! please help!
    i am developing my beans in vaj 3.02 on nt. i found another problemwhich
    belongs to the same topic, i guess:
    generated code like the following is ridiculous:
    java.lang.String __WL_stmt = " select id, partno, row from item
    where
    1=0"
    --> throws the following exception when starting Weblogic server:
    java.lang.Exception: Couldn't get ResultSetMetaData to look up fieldtypes:
    thanks for your help in advance,
    martin
    [UserDescriptor.txt]

  • Xjc generating wrong code

    Hi,
    I'm new to the world of JAXB/xjc so please be nice even if the question is stupid.
    When running xjc on a xml schema it generates java code that imports the class it defines in the same file (see below for example output). It declares the class PropertyType and also imports it! Strange?!?
    Any hints appreciated
    -Tim
    package com.kettler.reqstd.reqdef.definition;
    import javax.xml.bind.annotation.AccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlType;
    import com.kettler.reqstd.reqdef.definition.PropertyType;
    @XmlAccessorType(AccessType.FIELD)
    @XmlType(name = "PropertyType", propOrder = {
    "name",
    "displayName"
    public class PropertyType {
    -----------------------------------------------

    here it is.
    regards,
    martin
    "Ravi Akella" <[email protected]> wrote in message
    news:[email protected]..
    Can you post DeploymentDescriptor.txt file.
    -- Ravi Akella.
    Martin Zach wrote:
    hi,
    sorry, i did not mention that i am using wls 4.5.2 with sp1.
    martin
    Ravi Akella <[email protected]> schrieb in im Newsbeitrag:
    [email protected]..
    It depends on the WL QL(Query Language). Can you post the
    weblogic-cmp-rdbms-jar.xml?
    -- Ravi Akella.
    Martin Zach wrote:
    hi,
    my deployment wizard generates wrong code: all custom finder methods
    are
    generated wrong. i checked the xxxPSJDBC.java files and i saw thatthe
    wizard generates the sql-statement correct but then:
    Object __WL_typeObj = __WL_fieldSQLTypes.get("null");
    i think that this is wrong! please help!
    i am developing my beans in vaj 3.02 on nt. i found another problemwhich
    belongs to the same topic, i guess:
    generated code like the following is ridiculous:
    java.lang.String __WL_stmt = " select id, partno, row from item
    where
    1=0"
    --> throws the following exception when starting Weblogic server:
    java.lang.Exception: Couldn't get ResultSetMetaData to look up fieldtypes:
    thanks for your help in advance,
    martin
    [UserDescriptor.txt]

  • Was anybody asked to input a 4 letter code at the end of downloading ios7

    Was anybody asked to input a 4 letter code at the end of downloading ios7

    Hey carolinelost,
    Thanks for the question. The following article provides some solutions if you are having issues with passcode lock:
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    http://support.apple.com/kb/HT1212
    If you have never synced your device with iTunes, or you do not have access to a computer
    If you see one of following alerts, you need to erase the device:
    "iTunes could not connect to the [device] because it is locked with a passcode. You must enter your passcode on the [device] before it can be used with iTunes."
    "You haven't chosen to have [device] trust this computer"
    If you have Find My iPhone enabled, you can use Remote Wipe to erase the contents of your device. If you have been using iCloud to back up, you may be able to restore the most recent backup to reset the passcode after the device has been erased.
    Alternatively, place the device in recovery mode and restore it to erase the device:
    1. Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    2. Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to shut down.
    3. While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    4. Continue holding the Home button until you see the Connect to iTunes screen.
    5. iTunes will alert you that it has detected a device in recovery mode. Click OK, and then restore the device.
    Thanks,
    Matt M.

  • [svn:osmf:] 16206: Fix bug in inclusion of ASDoc code sample, caused by ASDoc comment.

    Revision: 16206
    Revision: 16206
    Author:   [email protected]
    Date:     2010-05-18 17:42:03 -0700 (Tue, 18 May 2010)
    Log Message:
    Fix bug in inclusion of ASDoc code sample, caused by ASDoc comment.
    Modified Paths:
        osmf/trunk/docs/examples/org/osmf/logging/ExampleLogger.as
        osmf/trunk/docs/examples/org/osmf/logging/ExampleLoggerFactory.as
        osmf/trunk/docs/examples/org/osmf/logging/LoggerExample.as

    Tks for posting the resolution, it solve my problem too.
    keywords:
    ECLIPSE SSL ERROR "could not generate secret" TOMCAT 8
    java.security.NoSuchAlgorithmException: Algorithm DiffieHellman not available
    SOLUTION, In my case: REBUILD JDK over TOMCAT 8 configuration

  • The" location svc. " on my iPhone 4S is disabled w/out me knowing ,now I have no GPS,but everything else works fine. it all happened after the latest update from Apple . The phone asks me to put a 4digit code (I don't have) to unlock the restriction on it

    Please help !
       It's been almost a month that the LOCATION SERVICE on my iphne 4S has been turned off and there's a restriction on it . Which requires a 4 digit code that I don't have and no one seeme to be able to help me on this .
    It all happened after I got the latest Apple iphone updates installed .  Just a note here, except for some photos and camera, especially the the flash for taking pictures having the mind of it's own ( wont flash most of the time even when you turn on the flash ) , ALL OTHER FUNCTIONC SEEM TO BE WORKING OK .
    I've tried backing up the phone on my computer and restoring it SEVERAL TIMES w/no success . The Apple store tried TWICE and cleared everything in my phone and we started it w/the factory settings,BUT BECAUSE I NEED TO HAVE ALL MY CONTACTS AND OTHER PERSONAL INFO'S, I HAVE TO RESTORE IT TO MY OWN  SETINGS .
    The problem is that when I restore the phone, it restores all my previous setting which PUTS EVERYTHING BACK IN TO MY PHONE THE WAY IT WAS BEFORE THE BACK UP AND KEEPS ASKING FOR THE 4 DIGIT PASS CODE AGAIN . I have no control of pick and choose what should be backed up .
    I HAVE TRIED EVERY POSSIBLE CODES THAT I COULD THINK OF AND IT KEEPS LOKING ME OUT ONE HOUR AT A TIME .
    Any one  out there can help me w/this I would be greatful to you .
    E  FARIAB

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • My iPad is asking me for a restriction pass code but I have never set one so I don't know what it is. I'm trying to reset the device because I have sold it.

    My iPad is asking me for a restriction pass code but I have never set one so I don't know what it is. I'm trying to reset the device because I have sold it.

    Try erasing the device using iCloud.com - assuming that you were using iCloud and the Find my iPhone app on the device.
    What to do before selling or giving away your iPhone, iPad, or iPod ...
    if that doesn't work, try recovery mode.
    If you can't update or restore your iOS device - Support - Apple

  • HT1222 It's asking for a 4 digit pass code don't have one that I'm aware of so what t

    It's asking for a 4 digit pass code and I'm unaware of a pass code so how do I go about updating my soft ware please help

    It's the code you use to lock/wake your iPad.

Maybe you are looking for