Is this a bug in Java for number format ?

Hi,
I found somethings strange when I trying to use NumberFormat.
Here are the sample code:
--- Sample Code start ---
import java.text.*;
public class TestNF {
public static void main(String[] args) {
double num1 = 10.5;
double num2 = 10.55;
NumberFormat nf1 = NumberFormat.getInstance();
NumberFormat nf2 = NumberFormat.getInstance();
nf1.setMinimumFractionDigits(0);
nf1.setMaximumFractionDigits(0);
nf2.setMinimumFractionDigits(1);
nf2.setMaximumFractionDigits(1);
System.out.println(nf1.format(num1));
System.out.println(nf2.format(num2));
-- Result start --
10
10.6
-- Result End --
--- Sample Code end ----
Since 10.55 is rounded up to 10.6, therefore it should be the same behavior that 10.5 is rounded up to 11.
Please correct me if I m wrong.
Version:
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)
** Added result from my sample code & java version
Thanks and Regards,
Jin Keat, Saw
Edited by: 903151 on Dec 19, 2011 4:55 PM

jverd wrote:
903151 wrote:
Since 10.55 is rounded up to 10.6, therefore it should be the same behavior that 10.5 is rounded up to 11.
Please correct me if I m wrong.And this is exactly what I get when I run your code under Java 1.6 on Windows 7.
:; java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
Also, this has nothing to do with Generics.
Hi,
Sorry for my poor English.
Do u mean by running my sample code, you got 11 instead of 10 ?
Please advise which is the correct forum/thread.
Many thanks.
Regards,
SawJK

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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Is this a bug in Safari for iOS ??

    http://www.clfsrpm.net/sample/
    The control buttons above playlist display just fine in every Android, Linux, and Windows browser I have used - including Safari for Windows.
    However they do not display properly in Safari for iOS as tested on my iPod (but they do display correctly in Opera Mini for iPod)
    Is this a bug in Safari for iOS ??

    Why was this moved to "Using iPhone" ??
    It is a question about Safari for iOS - not iPhone/iPod usage.

  • Java code number formatting

    Wonder if you could help me, I am a student and I've written an applet program for an assignment that creates an array of objects, each object has 3 elements. A string, another string, and a float. The float is multiplied with an integer in another method, and the resulting outputs a number which is the price of a "book". I need to format that result to show two decimal places, but when there is only one number I just get that number instead of the zero, for example if the result is 42.50 I just get 42.5. How do I get that last zero to show up, could you show me an example line of code for this number formatting? Thanks.
    Tyler

    Try to compile and see this piece of code.............I hope it meets ur requirement.
    import java.math.BigDecimal;
    public class Dec {
         public static void main(String s[]) {
         int decimalPlaces = 3;
         int a = 10;
         double b = 100.20000;
    BigDecimal bd = new BigDecimal(a+b);
         // Truncates the big decimal value.
         bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_DOWN);
         String string = bd.toString();
         System.out.println("ANswer"+string);
    Regards,
    Aru

  • Is this a bug in Java, or am I doing something wrong?

    I have a Vector which I want to convert to an array, so I wrote my code something like this:
    MyObject a = new MyObject("A");
    MyObject b = new MyObject("B");
    MyObject c = new MyObject("C");
    MyObject d = new MyObject("D");
    Vector v = new Vector();
    v.add(a);
    v.add(b);
    v.add(c);
    v.add(d);
    MyObject[] list = new MyObject[v.size()];
    list = (MyObject[]) v.toArray();This should work, however it gives me a ClassCastException at runtime. Of course, I found ways around it, like using
    v.toArray(list);But using the method this way does not make any sense because according to the API it is not void, but supposedly returns another array of Objects in addition to filling up the array which you pass to it.
    Does anyone know the correct way to use the toArray() method, or it's even more mysterious overloaded companion, toArray(Object[] a)?

    With regards to the Vector.toArray() method that takes an Object[] as an argument, you would normally use it this way:
    Vector vector = <whatever>; // contains only instances of MyClass
    MyClass[] array = (MyClass[])vector.toArray(new MyClass[vector.size]);While you're right that if you declare the array first and then simply pass it to the toArray() method that the array will get filled with the appropriate values. However, the array that is returned is not necessarily the array that was passed in. If the array that is passed in is shorter than the number of elements in the Vector, a new array of the same type as the one passed in is allocated and it is that array which is returned. The API only says that an array is returned, not the original one. Here is the source code for the toArray() method for you to look at:
        public synchronized Object[] toArray(Object a[]) {
            if (a.length < elementCount)
                a = (Object[])java.lang.reflect.Array.newInstance(
                                    a.getClass().getComponentType(), elementCount);
         System.arraycopy(elementData, 0, a, 0, elementCount);
            if (a.length > elementCount)
                a[elementCount] = null;
            return a;
        }Shaun

  • Couldn't read from socket error: Is this a bug in Java?

    I have been facing this grave problem for a long time now. After establishing a socket connection with some server:port say 207.123.17.20:1865, I get this error "Couldn't read from socket" as an IOException. I can neither read or send any packets to the server after receiving this error. On checking whether the socket connection is alive or not, I print socket.getAddress() and it returns me the ip of the server to which it is connected. The specification says that receiving this error means the socket was closed by the server. If it so then how I am able to print the server address after receiving this error? How can I get around this problem? Plz. help...

    watertownjordan said:
    If your computer (client) killed the connection, it should throw an error >pointing to the OS closing the connection. but what if my client app cntrl alt del while the server is waiting to here from the client.
    my client may sit idle for hours and then contact again. i want to keep their socket connected but if they cntrl alt del then i want to close the socket so the thread on the server side can be exited.
    the way i solved this was to send an "i'm still here" message to the serv in a timer every 10 seconds and set the time out on the server side to 30 seconds.
    i used a syncronized boolean variable like so:
        volatile private boolean out1busy = false;
        private synchronized boolean getOut1busy(){
         return out1busy;
        private synchronized void setOut1busy(boolean on){
         out1busy = on;
        }then in the timer i do this
            while (getOut1busy()) try { Thread.sleep(40); } catch (InterruptedException ex) {}
            setOut1busy(true);
            lobbyOut.println("-1");
            setOut1busy(false);it seems to work fine but the loop using the thread.sleep does not seem right and i know very little about this all.
    i'm basically asking the same thing as Chintan.Kanal
    Is there any way I can test whether the socket connection is alive from the server side?
    does my approach above have flaws.
    again it seems to work but i am not very Java savy lol.

  • Is this a bug of Java? Or my mind?

    Thank you all of you!
    I wrote a Filter like this:
    public class FilterDispatcherExample implements Filter{
         public void doFilter(ServletRequest request,ServletResponse response, FilterChain chain) throws java.io.IOException,ServletException{
              HttpServletRequest req=(HttpServletRequest)request;
              HttpServletResponse res=(HttpServletResponse)response;
              PrintWriter out=res.getWriter();
              String str=(String)req.getAttribute("attr");
              res.setContentType("text/html");
              out.println("<html>");
              out.println("<head>");
              out.println("<title>Filter Redirection</title>");
              out.println("</head>");
              out.println("<body>");
              out.println("FilterRedirection<br>Str: "+str);
              out.println("</body>");
              out.println("</html>");
              chain.doFilter(req,res);
    The problem is: what the str I want to display is not the String I use request.setAttribute() to set in a JSP. I have config web.xml properly. It's puzzled! Thank you!

    I think you should use, request.getParameter();

  • Uploading files containing swedish letter åäö gets ecoding corrupted in firefox for mac. Same features works fine in all other browsers. Is this a bug in firefox for mac?

    When uploading a file containing swedish letter å, ä or ö the file name is gets corupted in the filename. There are som encoding issues just for the mac version, since the file name is uploaded correctly in all other browsers on mac and all browsers in windows.

    What form does this corruption take? According to https://bugzilla.mozilla.org/show_bug.cgi?id=695995 the difference is decomposed vs precomposed Unicode forms, but that should not actually affect any Unicode-complian software. If there's a site that shows a problem here, can you point me to it?

  • Is this a bug in iPhoto for IOS?

    A picture I didn't edit appeared in the edited folder somehow. Now I'm trying to clear the folder but the photo will not delete no matter what I do. When I try to revert it to original, it's not highlighted so that's not gonna work. I know I didnt add captions so don't know what else to do. Its not being used in any other way except that i did upload it to Facebook.  This is not new it's happened before, but only to photos I've actually edited. What I ended up doing a couple of times was delete iPhoto on my IOS and reinstall it.  Seems though every time I use iPhoto this happens.

    1. Stay out of the iPhoto library. There is never a reason to be mucking around in it and doing so is dangerous and can easily corrupt your library
    2. The most common reason that photos you do not think have been edited are actually edited is having the auto rotate flag set on your camera. If you do each auto rotated photo has been edited
    LN

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

  • Java for Mac OS X 10.5 Update 2

    Software Update keeps telling me that this update is available, even after multiple "successful" installations and reboots. Any ideas why?
    $ java -version
    java version "1.5.0_16"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
    Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

    revoir wrote:
    This morning i installed "Java for Mac OS X 10.5 Update 2" on my 2x3 GHz Dual-Core Intel Xeon, running OS X 10.5.5 with all available official Spple Software updates.
    Since that update my mac freezes when any scrensaver is activated.
    Plus, i can no longer edit Google spreadsheets, neither on Safari nor on Firefox (i was able to do that before and i can still do that on a windows machine, though).
    Has anyone experienced similar phenomenons and possibly found a solution?
    I have not yet installed it. I usually wait for a while and even then I do a manual DL and install.
    I don't know about the Google thing, but I don't know what the tie-in is with your screensaver, unless you are using some Java based 3rd party SW for running it.
    The update included some security items to prevent a website from taking over your computer. While I personally don't trust Google to access my system, it's possible that Google has not make their system compatible with this new Java update.
    And finally, it's possible that there is something wrong with the update.
    You might be able to uninstall it but I would be careful and certainly make sure my backup was good.

  • HT5242 Where do I download Java for OS X Lion 2012-003?

    I've read this online article about Java for OS X Lion 2012-003, but I do not see where I can download and install it.  Any idea where it can be downloaded?

    To install software updates on OS X:  > Software Update
    If the Apple Java update is not offered, then you don't have Java installed (and Java is not installed by default on 10.7), or you're on a release of OS X prior to 10.6 (no patch available), or you're using a local Software Update Server or local Reposado server and it hasn't cached the Apple upate yet.  (And if you don't know what the Software Update Server or Reposado servers provide, then you're probably not one of those.)
    Here's the most recent Apple update on this: About the security content of Java for OS X 2012-003 and Java for Mac OS X 10.6 Update 8 (HT5247)
    This particular Java 2012-003 download apparently hasn't reached the Apple downloads servers yet, based on some of the chatter, so there's not yet a place to download it other than via Software Update.  (And that assumes you need the patch, and many folks - those without Java installed - don't need it.)

  • "the update java for os X 2012-006 can't be installed"

    I was in the Western Digital page and wanted to run java. When clicked to, the system started download "Java SE 6 runtime" from apple. At the end of download, the system shows this error: "the update java for os X 2012-006 can't be installed".
    Does anyone knows what is the pronlem and how to resolve it ?
    Kindest Regards,
    Paulo Guedes

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Select "/var/log/install.log" from the file list. Then select the messages from the last installation or update attempt, starting from the time when you initiated it. If you're not sure when that was, start over and note the time. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Java for OS X 2012-006 Problem Failed Installation

    Hi, I have this problem with my Java for OS X 2012-006. I wanted to use a Java using application, but tells me to install a new version of Java (2012-006).
    Startup runs fine but then says that the Installation Failed.
    I tried this multiple times then gave up. I searched Google and it led me to:
    http://support.apple.com/kb/HT5493
    I downloaded it, Mounted the DMG and ran the .pkg
    I agree to everything and then ran Install. Then the error "The Installation Failed" with a warning sign comes up, telling me to contact the software manufacturer.
    So i go on to the Java website, Searched up Installation Fail "Java" and then told me to Uninstall and then Re-Install.
    For Uninstalling, the files were not there. So I Ignored it.
    I then donwloaded Java 7 Update 10, but soon to be the same error as the Java OS X 2012-006 error.
    My Computer is a Late 2012 Macbook Pro 13-Inch.
    Is there any text that logs what I am doing in the installer? If you tell me where that is, i'll give it to you.
    Thanks for reading. And Please help.

    And This was when i installed Java Version 7 Update 10
    ================================================================================
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: It took 0.00 seconds to summarize the package selections.
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: -[IFDInstallController(Private) _buildInstallPlan]: location = file://localhost
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaEsse ntials.pkg
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaForO SX.pkg
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaSecu rity.pkg
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaMDNS .pkg
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Set authorization level to root for session
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Will use PK session
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Starting installation:
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Configuring volume "Mr Mac Drive"
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Preparing disk for local booted install.
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Free space on "Mr Mac Drive": 308.89 GB (308893720576 bytes).
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Create temporary directory "/var/folders/36/ym839vxx2tq9nlrgy702qm080000gn/T//Install.20666W9IFs"
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: IFPKInstallElement (4 packages)
    Dec 22 08:08:50 Jacobs-MacBook-Pro.local Installer[2066]: Using authorization level of root for IFPKInstallElement
    Dec 22 08:08:51 Jacobs-MacBook-Pro.local installd[2074]: installd: Starting
    Dec 22 08:08:51 Jacobs-MacBook-Pro.local installd[2074]: installd: uid=0, euid=0
    Dec 22 08:08:52 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: ----- Begin install -----
    Dec 22 08:08:52 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: request=PKInstallRequest <4 packages, destination=/>
    Dec 22 08:08:52 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: packages=(
                  "PKLeopardPackage <file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaEss entials.pkg>",
                  "PKLeopardPackage <file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaFor OSX.pkg>",
                  "PKLeopardPackage <file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaSec urity.pkg>",
                  "PKLeopardPackage <file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaMDN S.pkg>"
    Dec 22 08:08:53 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: Will do receipt-based obsoleting for package identifier com.apple.pkg.JavaEssentials (prefix path=/)
    Dec 22 08:08:53 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: Skipping component "com.apple.mrt.uiagent" (1.0.0-1.0.0-28000000000000-*) because the version 1.1.0-1.0.0-1100000000000000-15 is already installed at /System/Library/CoreServices/MRTAgent.app.
    Dec 22 08:08:55 Jacobs-MacBook-Pro.local installd[2074]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “JavaForOSX.pkg”." UserInfo=0x7fd8cad08660 {NSUnderlyingError=0x7fd8cad062a0 "The file couldn’t be opened because it isn’t in the correct format.", NSFilePath=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root, NSURL=file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#Ja vaEssentials.pkg, PKInstallPackageIdentifier=com.apple.pkg.JavaEssentials, NSLocalizedDescription=An error occurred while extracting files from the package “JavaForOSX.pkg”.} {
                  NSFilePath = "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root";
                  NSLocalizedDescription = "An error occurred while extracting files from the package \U201cJavaForOSX.pkg\U201d.";
                  NSURL = "file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#JavaEss entials.pkg";
                  NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=259 \"The file couldn\U2019t be opened because it isn\U2019t in the correct format.\"";
                  PKInstallPackageIdentifier = "com.apple.pkg.JavaEssentials";
    Dec 22 08:08:55 Jacobs-MacBook-Pro.local Installer[2066]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “JavaForOSX.pkg”." UserInfo=0x7ff0442ad340 {NSLocalizedDescription=An error occurred while extracting files from the package “JavaForOSX.pkg”., NSFilePath=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root, NSURL=file://localhost/Volumes/Java%20for%20OS%20X%202012-006/JavaForOSX.pkg#Ja vaEssentials.pkg, PKInstallPackageIdentifier=com.apple.pkg.JavaEssentials, NSUnderlyingError=0x7ff0442ac710 "The file couldn’t be opened because it isn’t in the correct format."}
    Dec 22 08:08:56 Jacobs-MacBook-Pro.local Installer[2066]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
    Dec 22 08:08:56 Jacobs-MacBook-Pro.local Installer[2066]: IFDInstallController 44013BF0 state = 7
    Dec 22 08:08:56 Jacobs-MacBook-Pro.local Installer[2066]: Displaying 'Install Failed' UI.
    Dec 22 08:08:56 Jacobs-MacBook-Pro.local Installer[2066]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.
    Dec 22 08:09:11 Jacobs-MacBook-Pro.local installd[2074]: installd: Exiting.
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: @(#)PROGRAM:Install  PROJECT:Install-735
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: @(#)PROGRAM:Installer  PROJECT:Installer-614
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Hardware: MacBookPro9,2 @ 2.50 GHz (x 4), 4096 MB RAM
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Running OS Build: Mac OS X 10.8.2 (12C3012)
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: TMPDIR=/var/folders/36/ym839vxx2tq9nlrgy702qm080000gn/T/
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: SHELL=/bin/bash
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: HOME=/Users/Yookobz
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: USER=Yookobz
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: LOGNAME=Yookobz
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: SSH_AUTH_SOCK=/tmp/launch-bLsLKB/Listeners
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: Apple_Ubiquity_Message=/tmp/launch-P2jcZ6/Apple_Ubiquity_Message
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: Apple_PubSub_Socket_Render=/tmp/launch-dg5Ti9/Render
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: COMMAND_MODE=unix2003
    Dec 22 08:15:38 Jacobs-MacBook-Pro.local Installer[2092]: Env: __CF_USER_TEXT_ENCODING=0x1F5:0:0
    Dec 22 08:15:39 Jacobs-MacBook-Pro.local Installer[2092]: Java 7 Update 10  Installation Log
    Dec 22 08:15:39 Jacobs-MacBook-Pro.local Installer[2092]: Opened from: /Volumes/Java 7 Update 10/Java 7 Update 10.pkg
    Dec 22 08:15:39 Jacobs-MacBook-Pro.local Installer[2092]: Product archive /Volumes/Java 7 Update 10/Java 7 Update 10.pkg trustLevel=202
    Dec 22 08:15:42 Jacobs-MacBook-Pro.local Installer[2092]: InstallerStatusNotifications plugin loaded
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local runner[2099]: Administrator authorization granted.
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: =============================================================================== =
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: User picked Standard Install
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Choices selected for installation:
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]:           Install: "Java 7 Update 10"
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]:           Install: "JavaAppletPlugin"
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]:                     Java 7 Update 10.pkg#javaappletplugin.pkg : com.oracle.jre : 1.0
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: =============================================================================== =
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: It took 0.00 seconds to summarize the package selections.
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: -[IFDInstallController(Private) _buildInstallPlan]: location = file://localhost
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Volumes/Java%207%20Update%2010/Java%207%20Update%2010.pkg#java appletplugin.pkg
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Set authorization level to root for session
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Will use PK session
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Starting installation:
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Configuring volume "Mr Mac Drive"
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Preparing disk for local booted install.
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Free space on "Mr Mac Drive": 308.89 GB (308893683712 bytes).
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Create temporary directory "/var/folders/36/ym839vxx2tq9nlrgy702qm080000gn/T//Install.2092khMnkg"
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: IFPKInstallElement (1 packages)
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local Installer[2092]: Using authorization level of root for IFPKInstallElement
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local installd[2103]: installd: Starting
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local installd[2103]: installd: uid=0, euid=0
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local installd[2103]: PackageKit: ----- Begin install -----
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local installd[2103]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
    Dec 22 08:15:49 Jacobs-MacBook-Pro.local installd[2103]: PackageKit: packages=(
                  "PKLeopardPackage <file://localhost/Volumes/Java%207%20Update%2010/Java%207%20Update%2010.pkg#jav aappletplugin.pkg>"
    Dec 22 08:15:50 Jacobs-MacBook-Pro.local installd[2103]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “Java 7 Update 10.pkg”." UserInfo=0x7fd92a4332c0 {NSUnderlyingError=0x7fd92a401060 "The file couldn’t be opened because it isn’t in the correct format.", NSFilePath=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root/Library/Internet Plug-Ins/JavaAppletPlugin.plugin, NSURL=file://localhost/Volumes/Java%207%20Update%2010/Java%207%20Update%2010.pk g#javaappletplugin.pkg, PKInstallPackageIdentifier=com.oracle.jre, NSLocalizedDescription=An error occurred while extracting files from the package “Java 7 Update 10.pkg”.} {
                  NSFilePath = "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root/Library/Internet Plug-Ins/JavaAppletPlugin.plugin";
                  NSLocalizedDescription = "An error occurred while extracting files from the package \U201cJava 7 Update 10.pkg\U201d.";
                  NSURL = "file://localhost/Volumes/Java%207%20Update%2010/Java%207%20Update%2010.pkg#jav aappletplugin.pkg";
                  NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=259 \"The file couldn\U2019t be opened because it isn\U2019t in the correct format.\"";
                  PKInstallPackageIdentifier = "com.oracle.jre";
    Dec 22 08:15:50 Jacobs-MacBook-Pro.local Installer[2092]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “Java 7 Update 10.pkg”." UserInfo=0x7ff6b90a40c0 {NSLocalizedDescription=An error occurred while extracting files from the package “Java 7 Update 10.pkg”., NSFilePath=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/PKInstallSandboxManager/1.sandbox/Root/Library/Internet Plug-Ins/JavaAppletPlugin.plugin, NSURL=file://localhost/Volumes/Java%207%20Update%2010/Java%207%20Update%2010.pk g#javaappletplugin.pkg, PKInstallPackageIdentifier=com.oracle.jre, NSUnderlyingError=0x7ff6b90a4d00 "The file couldn’t be opened because it isn’t in the correct format."}
    Dec 22 08:15:51 Jacobs-MacBook-Pro.local Installer[2092]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
    Dec 22 08:15:51 Jacobs-MacBook-Pro.local Installer[2092]: IFDInstallController B8478C30 state = 7
    Dec 22 08:15:51 Jacobs-MacBook-Pro.local Installer[2092]: Displaying 'Install Failed' UI.
    Dec 22 08:15:51 Jacobs-MacBook-Pro.local Installer[2092]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.
    D

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

Maybe you are looking for