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.

Similar Messages

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Bug in Java

    Hi Guys ,
    i found a bug in java when doing this calculation..
    double a = 1741;
           double b = 81.1;
           double c = 0;
           double temp = (a-b-c);
           System.out.println("temp = "+temp);  //1659.9
           double total = (double)temp/1000;   //BUG HERE
           System.out.println("Res = "+total);  //1.6599000000000002I wonder if u guys get the same value as mine using above calculation.
    if i change the double b = 81.2 i works fine..

    I have good news and bad news for you. To end on a high note we'll leave the good news for last.
    The bad news is that you are the 6,137,215th person to report this "bug" yet Sun will not be fixing it.
    The good news is that the bad news doesn't matter because... <drumroll please/>.....
    It is NOT a bug. The only bug here is your lack of understanding floating point arithmetic. I refer you to the following article http://docs.sun.com/source/806-3568/ncg_goldberg.html

  • 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.)

  • Any way to comment or watch a bug for Java???

    Hello!
    AFAIK, at bugs.sun.com it isn't possible to comment on bugs, watch them or vote for them anymore.
    I found out there's now https://bugs.openjdk.java.net but I can't find any way to register.
    So, how the hell I can follow the progress on bugs? Or add additional information if I have?
    It's unbelievable that in 2013 we are still unable to have a decent bug reporting system for the JDK/JRE!!!!!
    Mauro.
    P.S.: I know this might not be the best section for this kind of question, but I couldn't find anything better in these forums...

    Other than physically looking for it, sorry, no.

  • A bug of java plugin

    If you uncheck cache enabled option on "Java Applet Cache Viewer" from Java Console, you will find JavaPlugin not sending "Accept-Encoding" HTTP head to web server any more. So the plugin cannot load *.jar.pack.gz from server.
    I think this is a bug. Do you think so?
    I found this problem under JRE 1.5.06 and IE/Firefox enviroment.
    Pls send any question about this to [email protected] Thanks.

    Yes, it looks like a bug in Java 5 (1.5.0_xx).
    The problem does not exists in Java 6 though. Have you tried Java 6 ?
    Also, in the upcoming new 6u10 consumer release, there is a new feature that allows you to use pack200 compressed JAR with java web start or java plugin, without any server side requirements (you don't need to run a servlet anymore!):
    https://jdk6.dev.java.net/testProperty.html
    You can download 6u10 early access builds here: http://download.java.net/jdk6/binaries/
    Thomas Ng
    Java Deployment Team

  • [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

  • Bug in java.awt.geom.Line2D?

    The method,
    public static double ptLineDistSq(double X1,
                                      double Y1,
                                      double X2,
                                      double Y2,
                                      double PX,
                                      double PY)calculates the squared distance between a line segment and a point.
    If however you pass in a line segment of zero length (X1=X2, Y1=Y2), the method performs a div by zero, which causes NaN to be returned.
    I believe this is a bug, as the method makes no exceptions to valid input, also mathmatically the distance from a point to a line segment still has a value even if the line segment has a zero length.
    A simple sanity check at the start of the method would fix it,
    if(X1==X2 && Y1==Y2) return (X1-PX)*(X1-PX)+(Y1-PY)*(Y1-PY);

    Yeah, im already working around it (i've actually just stolen their code, and switched it all from doubles to floats :D - it isn't a serious app. just a problem I encountered when answering a question in this Thread http://forum.java.sun.com/thread.jsp?forum=406&thread=420363&start=30&range=15&tstart=0&trange=15)
    I was realy just posting here for confirmation that it is a bug, before I reported it.

  • Bug In Java 5 Date/Calendar Timezone Implementation (possibly 6 also)

    Hey All,
    Really been scratching my head over a date issue I've observed for a while now in relation to TimeZone handling in java.
    It first manifested itself as strange behaviour in my Default TimeZone "Europe/Dublin" (ie. GMT with DST)
    e.g:
    System.setProperty("user.timezone", "Europe/Dublin");
    Date epoch=new Date(0);
    System.out.println("Epoch:"+epoch);
    yields:
    Epoch:Thu Jan 01 01:00:00 GMT 1970
    1AM (BUG???????)
    If I set the TZone above to GMT it outputs correctly as
    Epoch:Thu Jan 01 00:00:00 GMT 1970
    As there is no offset from GMT I can only think that DST is being handled incorrectly around the epoch. (even though it is not in DST on Jan 1st)
    So I wrote the following test using calendars to test my theory.
              System.setProperty("user.timezone", "UTC");
              Calendar test=Calendar.getInstance(); //will use the user.timezone
              Calendar test2=Calendar.getInstance(TimeZone.getTimeZone("Europe/Dublin"));
              for (int year=1965;(year<=1975);year++){
                   test.clear();test2.clear();
                   test.set(year, 0, 1, 0, 0, 0);
                   test2.set(year, 0, 1, 0, 0, 0);
                   System.out.println("UTC:"+ test.getTime()+ " --- EU/Dub:"+test2.getTime());
    Which yields the following interestingly inconsistent output (BUG?????)
    UTC:Fri Jan 01 00:00:00 UTC 1965 --- EU/Dub:Fri Jan 01 00:00:00 UTC 1965
    UTC:Sat Jan 01 00:00:00 UTC 1966 --- EU/Dub:Sat Jan 01 00:00:00 UTC 1966
    UTC:Sun Jan 01 00:00:00 UTC 1967 --- EU/Dub:Sun Jan 01 00:00:00 UTC 1967
    UTC:Mon Jan 01 00:00:00 UTC 1968 --- EU/Dub:Mon Jan 01 00:00:00 UTC 1968
    UTC:Wed Jan 01 00:00:00 UTC 1969 --- EU/Dub:Tue Dec 31 23:00:00 UTC 1968
    UTC:Thu Jan 01 00:00:00 UTC 1970 --- EU/Dub:Wed Dec 31 23:00:00 UTC 1969
    UTC:Fri Jan 01 00:00:00 UTC 1971 --- EU/Dub:Thu Dec 31 23:00:00 UTC 1970
    UTC:Sat Jan 01 00:00:00 UTC 1972 --- EU/Dub:Sat Jan 01 00:00:00 UTC 1972
    UTC:Mon Jan 01 00:00:00 UTC 1973 --- EU/Dub:Mon Jan 01 00:00:00 UTC 1973
    UTC:Tue Jan 01 00:00:00 UTC 1974 --- EU/Dub:Tue Jan 01 00:00:00 UTC 1974
    UTC:Wed Jan 01 00:00:00 UTC 1975 --- EU/Dub:Wed Jan 01 00:00:00 UTC 1975
    Strange - ehh? 1969->1971 all have issues with the Jan 1st date!!!!
    In fact theres issues for every day that DST is not in operation on these years... (BUG????)
    I'm part of a project that will be handling data from all Timezones and as such we have chosen
    to use UTC as our server time. We are now quite concerned what other bugs/strange behaviours
    lurk beneath the surface of the java implementation.
    Note we have tested various JDK's and they seem to be consistently inconsistent!
    If anyone can confrim this bug/issue or shed any light it would be most appreciated,
    G.

    miniman wrote:
    As there is no offset from GMT I can only think that DST is being handled incorrectly around the epoch. (even though it is not in DST on Jan 1st)Well, in the UK, DST was in effect on 1970 Jan 01. I wouldn't be surprised to find that the same applied in Ireland.

  • Bug in Java objects not serializable

    I plan to use the latest version TopLink 10.1.3.1.0 with Oracle Database 10g (10.2.x).
    Do I still have to use the “Type Conversion” mapping as I had to do in order to address the reported non-serializable bug exiting in TopLink (9.0.4.5). See the link for the bug description:
    http://www.oracle.com/technology/documentation/1012_solaris/relnotes.1012/relnotes/toplink.htm#CEGEBDEG
    My Java object instance variable is defined as java.sql.Timestamp and the corresponding data type on the Oracle DB is defined as TIMESTAMP(6). Can I use the direct-to-field mapping from now on with new TopLink 10.1.3.1.0 without the serializable issue? If I still have to use the Type Conversion mapping, please help provide some detail about the mapping.
    Many thanks for any help.

    From what I can understand from your reply, I can use the direct-to-field mapping for Java class attribute of java.sql.Timestamp to the Oracle DB 10.2.x data type of TIMESTAMP(6) without any issue of not serializable. Please confirm. Many thanks!
    By the way, I am having the same issue (Java objects not serializable) with Oracle DB 10.1.x when I use the direct-to-field mapping. It seems to me that this is more than the Oracle 9i JDBC driver.
    If I have to do this with TopLink 10.1.3.1.0 + Oracle 10.2.x, I plan to use the Type Conversion with:
    Java class attribute: java.sql.Timestamp
    DB data type: oracle.sql.TIMESTAMP
    Is this the proper way to do it? Please confirm.

  • A possible bug in Java 5.

    import java.util.*;
    public class Test {  
       public static void append(List list) {
          list.add("abcd");
       public static void main(String[] args) {
          List <Integer>list = new ArrayList<Integer>();
          append(list);
    9:   System.out.println(list.get(0));                                      // Print out abcd normally
    10: Object obj = list.get(0);                   
    11: System.out.println(obj.getClass().getName());                // This line is fine and output java.lang.String
    12: System.out.println(list.get(0).getClass().getName());       // This line throws ClassCastException          
    }Look at the above code. list is defined to be a list with only Integer type, but the append method add a string inside with no exception. So line 9 print out abcd normally. When we check the data type of the first element of list, line 10 and 11 gives the correct type java.lang.String. However, if we use line 12 which combines line 10 and 11 to a single line, the system will throw java.lang.ClassCastException. Then we check all the methods in line 12 in Java API and find that no method throws ClassCastxception. I think this could be a bug in Sun Java group. Can anybody explain this?

    Yupei wrote:
    I never said it will not compile. You code can also be compiled correctly. But it will throw ClassCastException during the run time.Which is good.
    Again, for this code, I intensively abuse generic type of List. The ClassCastException during the run time is reasonable. My issue is, since in Java API, no methods throws ClassCastException, why this code throws such an exception?The generated bytecode includes a checkcast instruction on line 12.
    Should the Java group needs to modify their code to fix this problem? Because line 12 is a combination of line 10 and line 11, they should be equivalent. But one is good and the other throws exception, this does not make any sense to me.I don't know that it is a problem. My guess is this:
    With this line
    Object obj = list.get(0);there's no checkcast, because type inference tells the compiler that we are expecting get() to return an object.
    But with this line
    System.out.println(list.get(0).getClass().getName());there is a checkcast. It's a List<Integer>, and we're not telling it to treat it as an obejct. I'm not sure of the details of type inference, so I don't know if this specific behavior is intended. However, if there is a problem, it's certainly not that throwing the CCE is wrong.

  • BUG: Oracle Java Compiler bug with anonymous inner classes in constructor

    The following code compiles and runs just fine using 1.4.2_07, 1.5.0_07 and 1.6.0_beta2 when compiling and running from the command-line.
    It does not run when compiling from JDeveloper 10.1.3.36.73 (which uses the ojc.jar).
    When compiled from JDeveloper, the JRE (both the embedded one or the external 1.5.0_07 one) reports the following error:
    java.lang.VerifyError: (class: com/ids/arithmeticexpr/Scanner, method: <init> signature: (Ljava/io/Reader;)V) Expecting to find object/array on
    stack
    Here's the code:
    /** lexical analyzer for arithmetic expressions.
    Fixes the lookahead problem for TT_EOL.
    public class Scanner extends StreamTokenizer
    /** kludge: pushes an anonymous Reader which inserts
    a space after each newline.
    public Scanner( Reader r )
    super( new FilterReader( new BufferedReader( r ) )
    protected boolean addSpace; // kludge to add space after \n
    public int read() throws IOException
    int ch = addSpace ? ' ' : in.read();
    addSpace = ch == '\n';
    return ch;
    public static void main( String[] args )
    Scanner scanner = new Scanner( new StringReader("1+2") ); // !!!
    Removing the (implicit) reference to 'this' in the call to super() by passing an instance of a static inner class 'Kludge' instead of the anonymous subclass of FilterReader fixes the error. The code will then run even when compiled with ojc. There seems to be a bug in ojc concerning references to the partially constructed object (a bug which which is not present in the reference compilers.)
    -- Sebastian

    Thanks Sebastian, I filed a bug for OJC, and I'll look at the Javac bug. Either way, OJC should either give an error or create correct code.
    Keimpe Bronkhorst
    JDev Team

  • Bug with Java WSDP1.3 Toolkit?

    Hi
    I used the Java WSDP1.3 toolkit to generate the stubs for the webservice
    "http://www.xmethods.net/sd/2001/BabelFishService.wsdl". After creating the stubs , I deployed them in Tomcat 4.1 to test the methods of this service. The output (SOAPException) I am getting when testing this service is
    " Error : java.rmi.RemoteException: Runtime exception; nested exception is: unexpected element type: expected={http://www.w3.org/2001/XMLSchema}QName, actual={http://www.w3.org/2001/XMLSchema}string"
    Then I used the Axis 1.1 toolkit to generate stubs for the same service and deployed the stubs in tomcat 4.1. The output (SOAPException) I am getting when testing this service is
    "Error : Our connection to the Altavista BabelFish site has been cut. This service will remain down indefinitely until an alternate translation engine can be found. We apologize for any inconvenience."
    I got the same exception as axis when tested the service with XMLSPY.
    Why JAVA WSDP1.3 is not capturing the correcting SOAP Exception?. Is it a bug in the Java WSDP1.3 SOAP toolkit?

    Any answers for the query. I face a similar bug with the same versions.

  • Possible Bug in Java Binding of BDB

    I came across a situation where I had opened a database with a unique DatabaseConfig object with an appropriate error prefix. I encountered an error on insert and got a message back from the JNI layer complaining about unsupported duplicate keys.
    This part is great. I want to know about the error. The puzzling thing was that the prefix of the error was from a different database config than the one associated with the table itself which lead to some confusion. In fact it was reporting with whatever config the last database was opened with.
    I was wondering it perhaps com.sleepycat.db.DatabaseConfig line 516
    should read:
    516 configureDatabase(db,this);
    517 db.open(txn, fileName, databaseName, type.getId(), openFlags, mode);
    as opposed to:
    516 configureDatabase(db,DEFAULT);
    517 db.open(txn, fileName, databaseName, type.getId(), openFlags, mode);
    Most likely it is more complex than that so let me know if you need additional information in order to reproduce the bug.
    Great product!
    Ciao
    Topher

    Hi Topher,
    It seems likely that the behavior is as described here:
    http://www.oracle.com/technology/documentation/berkeley-db/db/java/com/sleepycat/db/DatabaseConfig.html#setErrorPrefix(java.lang.String)
    The relevant section:
    For Database handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling EnvironmentConfig.setErrorPrefix.
    The message string is environment wide, not per database. So all error messages will have the prefix as was set in the last setErrorPrefix call.
    If that does not explain the behavior you are seeing, please clarify the issue. With at least a description of the code, preferably a sample application.
    Thanks,
    Alex Gorrod, Oracle.

Maybe you are looking for

  • Tiff's suddenly showing generic icon instead of image preview

    All of a sudden I have begun having an intermittent problem with Bridge (CS3) not displaying a preview thumbnail for a very few number (not all) TIFF files- instead I just get a thumbnail showing a TIFF logo rather than the picture itself. I would no

  • Enhancement Package Installation option missing in MOPZ

    Hello gurus, We´re faccing with a problem with maintenance optimizer procedure. I have an ECC 6.0 system installed with SPS16 and now we need to upgrade it to Eph4. When I go to Solution Manager 7.0 Ehp1 (SPS22) to transaction mopz and create a new t

  • Downloading IStore Purchases to new computer

    Updated new computer to Version 7. Plugged in Shuffle with tunes on it purchased from Istore. Forgot to authorize computer. Started download using "Check for new Purchases" form Menu. Said I wasn't authorized to put them on new computer. Finished and

  • Install the Netweaver Components 2004s

    Hi Looking for your help in 2004s installation in Windows 2003 How we are installing the Net weaver components in Netweaver 2004s?. I installed SAP XI 3.0 in SAP web As6.40 as separate component. But I would like to know how we are installing the Net

  • Selection field on Infosource

    Hi, I have this field in a Z infosource, that I need to turn it into a Selection Field, so I can use it as a filter in the Infopackage. How do I do that? I enter using SBIW, but it doesn't let me check the selection check button. any help?¿?¿? Mauric