Archive for the 'Java' Category

Published by Adam Myatt on 02 Feb 2009

Sun Releases Java 6 Update 12 (JDK 1.6.0.12)

Sun has release the Java 6 Update 12 JDk. The following are some of the updates and bugs fixed:

64-Bit Browser Support for Java Plugin and Java Webstart

This release supports the New Java Plugin and Java Webstart on AMD64 architecture, on Windows platforms. A Java offline installer (JRE and JDK) is provided.
Note, if you use 32-bit and 64-bit browsers interchangeably, you will need to install both 32-bit and 64-bit JREs in order to have Java Plug-In for both browsers.

JavaFX

Improved application startup and runtime performance are provided.

Windows Server 2008 Support

As of this release, Windows Server 2008 is supported.

Performance Improvements

Performance improvements have been made in the following areas:
Graphics performance improvements for:
Anti-aliasing drawing and filing
Non-anti-aliasing transformed rectangles and single wide lines
Java Webstart startup time  

Bug fixes are listed in the following table.

BugId Category Subcategory Description
  6757316 hotspot compiler1 load_constant() produces a wrong long constant, with high a low words swapped
6758445 hotspot compiler1 loop heads that are exception entry points can crash during count_edges/mark_loops
  6767587 hotspot compiler1 missing call to make_not_entrant after deoptimizing for patching volatiles
  6741642 hotspot compiler2 bad enum definition in ciTypeFlow.hpp
  6722112 hotspot garbage_collector CMS: Incorrect encoding of overflown object arrays during concurrent precleaning
  6722116 hotspot garbage_collector CMS: Incorrect overflow handling when using parallel concurrent marking
  6739357 hotspot garbage_collector CMS: Switch off CMSPrecleanRefLists1 until 6722113 can be fixed
  6653214 hotspot monitoring_management MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes
  6671882 hotspot runtime_system memory access after free in solaris/vm/os_solaris.cpp
  6382377 idl orb incorrect Exception is given to interceptor
  6614558 idl serialization jmx interop JDK5 – JDK6 issue when calling getMBeanInfo
  6746334 java char_encodings SingleByteDecoder can be significantly faster
  6359283 java classes_2d PrinterJob.pageDialog() ret. incorrect PageFormat when non-default printer used
  6638533 java classes_2d Layout should not apply shaping to precomposed arabic presentation form glyphs.
  6653384 java classes_2d Variable “initialized” in class CUPSPrinter is static by mistake
  6708580 java classes_2d Java applications slow when EXA enabled
  6749060 java classes_2d LCD AA text rendered incorrectly when destination is non opaque (sw pipeline only)
  6751616 java classes_2d outline for underline in TextLayout with underline is off rasterized underline
  6751621 java classes_2d TextLayout.getBounds() doesn’t account for strike through
6758179 java classes_2d D3D: AlphaComposite is applied incorrectly for uncached opaque BufferedImage
  6766342 java classes_2d Improve performance of Ductus rasterizer
  6772137 java classes_2d D3D: Dragging the scroll bar of a JScrollPane containing a JTree causes incorrect red
  6775317 java classes_2d Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
  4811096 java classes_awt Allow limited mixing of heavy and lightweight components
  6519005 java classes_awt regression: Selection the item on the choice don’t work properly in vista ultimate.
  6552803 java classes_awt the moveToFront causes Heavyweight components to be removed.
  6589530 java classes_awt HW/LW mixing code incorrectly handles insertion of components with the setComponentZOrder() method
  6637655 java classes_awt Mixing of heavyweight/lightweight components does not wrk with GlassPane childre
  6707023 java classes_awt Chinese Characters in JTextPane Cause Pane to Hang
  6714829 java classes_awt REGRESSION: Wrong modal dialog activated after child closed, causes freeze
  6749517 java classes_awt Request to enhance the 6u10 Security Warning appearance
  6750920 java classes_awt Window transparency throws IAE if called before pack or setSize
  6765065 java classes_awt Security Warning needs better icons
  6776839 java classes_awt AWTUtilities.setWindowOpaque() causes a stack overflow on X11
6779066 java classes_awt Untrusted window cannot receive input focus by clicking its taskbar button after deiconification
  6784816 java classes_awt Remove AWT tree lock from Container methods: getComponent, getComponents, getComponentCount
  6786210 java classes_awt Deadlock occurs when handling mouseLeave on XToolkit
  6774170 java classes_management LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
  6720866 java classes_net Slow performance using HttpURLConnection for upload
  6721619 java classes_net Java Web Start 1.6.0 shows intermittent https communication breakdown
  6763219 java classes_security XMLDSig XPath Filter 2 Transform subtract filter is broken
  6764553 java classes_security com.sun.org.apache.xml.internal.security.utils.IdResolver is not thread safe
  6491619 java classes_swing No mouse events from titlebar in JRootPane of JFrame
  6510999 java classes_swing Selection in a JList with both scrollbars visible jumps on arrowkey-down
  6581899 java classes_swing JTextField & JTextArea – Poor performance with JRE 1.5.0_08
  6624717 java classes_swing Corrupted combo box, GTK L&F, Ubuntu 7.10
  6699856 java classes_swing Creating text in a JTextPane using Chinese text causes undesired behavior
  6726866 java classes_swing Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
  6735259 java classes_swing NPE at WindowsComboBoxUI$XPComboBoxButton.getState(WindowsComboBoxUI.java:408)
  6742850 java classes_swing Antialiasing for GTK L&F should be turned on by default if there is no embedded bitmap.
  6768387 java classes_swing REGRESSION: JTable no longer serializable
4823811 java classes_text [Fmt-Da] SimpleDateFormat patterns don’t allow embedding of some literal punctuation
  6683975 java classes_text [fmt-da] Regression: Java 6 returns English DateFormatPatterns for Thai locale
  6743394 java classes_util_i18n (tz) tzmappings must be updated for Windows
  6783139 java classes_util_i18n (tz) Windows time zone mapping table needs to be updated for KB955839
  6599383 java classes_util_jarzip Unable to open zip files more than 2GB in size
  6541476 java imageio PNG imageio plugin incorrectly handles iTXt chunk
  6478142 java install Java Update continues even after the new posted update is pulled out
  6656032 java install Java AutoUpdate: Refresh cached information from xml file, before showing the bubble & installation
  6718336 java install kernel jre uninstallation interrupted with java setup – close applications dialog
  6747473 java install REGRESSION:Installing 64bit JDK, an error message shows when begin the JRE installer
  6758907 java install Online install is STATIC if patches are not created for 6u10 and all lesser versions
  6759889 java install Need to create Auto Update for Java FX v1.5
  6763365 java install Update mentions of JavaFX in JRE install panels to reflect new JavaFX brand/logo
  6764967 java install Java JRE 1.6u10 installer failed with error 1606 when using “/qb!” switchm
  6767867 java install Need to combine command line and XML options for non-AU iftw execution
  6767961 java install jxpiinstall.exe does not use the correct method for ping
  6779985 java install JRE install when PendingFileRenameOperations is set, Error 1606 or JavaFX preload is not run
  6541350 java localization TimeZone display names localization
6645271 java localization Wrong date format for Croatian (hr) locale
  6708417 java localization On Chinese OS Applet string is appearing in English
  6745048 java localization Unnecessary surfix “(O)” in JFileChooser open button text
  6757517 java localization “close applications” dialog sounds funny for German
  6754672 java monitoring java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory
  6695609 java sunservicetags wmic is called on every method call of RegistrationData.loadFromXML
  6750389 java sunservicetags The cpuManufactorer does not correctly recognized for Solaris 10
  6712190 java_deployment configuration Java Web Start behaves differently on Windows Terminal Server wrt file “deployment.config”
  6775019 java_deployment configuration Java Control Panel Plugin/Webstart JRE dialog issues in 6u12 b02
  6757907 java_deployment download deployJava.js should by default disable codebase lookups
  6759336 java_deployment download uninstalling application should not remove resources in extensions.
  6764338 java_deployment download when “Range” header is present in HTTP request, we should not cache the request
  6770763 java_deployment download Add Install Stat (pings) for JavaFX installs
  6699715 java_deployment general JDK6: Authentication dialogue always offers to “Save this password in password list” on Windows
  6750054 java_deployment general Java control panel can’t be launched in true 64bit JRE on 64bit OS
  6751232 java_deployment general java kernel installer should not display UI while javafx preload
  6763387 java_deployment general Java Control Panel’s title bar and tabs are jutted out of the desktop
  6767447 java_deployment general Java Control Panel icon issues on Windows XP 64 bit and Win2003 64bit
  6786318 java_deployment general MemoryCache leaks memory on repetative requests for the same resource
  6791247 java_deployment general jfx pings should be sent to sunjfxinstallstat report suite
  6680990 java_deployment jkernel Different UI of “Unable to connect to the Internet” dialog
  6690159 java_deployment jkernel Pressing Cancel on Additional Download causing application to close
  6770742 java_plugin doc No default JDK version for IE7 on Win Vista after 6u10
  6674383 java_plugin ocx Problems running applets in the Hyper Text Appllication (HTA) from windows
  6643769 java_plugin other Applet main windows steals focus on Popup windows which is running Applet.
  6784894 java_plugin other Regression: applets loaded from local disk can not access co-located resources
  4802695 java_plugin plugin Support 64-bit Java Plug-in and Java webstart on Windows/Linux on AMD64
  6632182 java_plugin plugin In case of IE, “About Java Technology” frame goes background when opened from system tray
  6749040 java_plugin plugin Runtime settings are not applied in classic Plug-In with “-rc2″ version string
  6712099 java_plugin plugin2 JRE install clears out all existing Java Runtime parameters for older JRE’s
  6723525 java_plugin plugin2 DnD “Desktop Integration Warning” doesn’t occur until browser window is closed/changed
  6740227 java_plugin plugin2 DnD: file associations don’t work for dragged out applets
  6745455 java_plugin plugin2 Firefox extensions using Java don’t work with new Java Plug-In
  6749180 java_plugin plugin2 Specification of jnlp.* system properties does not cause required applet relaunch
  6750726 java_plugin plugin2 Java Plug-In must support MIME type specification in object tag in IE
6753380 java_plugin plugin2 lazy package and parts does not work in jnlp applets with new plugin
  6753665 java_plugin plugin2 Applet.stop() not called when launching dragged applet from desktop
  6757906 java_plugin plugin2 Update LiveConnect-related documentation and tests
  6761033 java_plugin plugin2 Use NPAPI for Mac OS X port of new Java Plug-In
  6761680 java_plugin plugin2 NullPointerException thrown when dragging applets out of browser with virtualized X11 guest OSs
  6764266 java_plugin plugin2 Modal dialog from JavaScript called by JSObject causes IE freeze
  6764345 java_plugin plugin2 cannot launch dragged applets offline
  6764974 java_plugin plugin2 Plugin2: casts a ClassNotFoundException instead of a NoClassDefFoundError
  6767160 java_plugin plugin2 New plugin does not pick up jre installed by DT
  6768120 java_plugin plugin2 Initialization of document base not working on Safari on Mac OS X
  6769610 java_plugin plugin2 When running java plugin 1.6.0_10 with earlier version of JRE first line of console is wrong.
  6769840 java_plugin plugin2 Replace orange “Java logo” animation
  6770420 java_plugin plugin2 environment variables ‘_java_options’ and ‘java_tool_options’ are disregarded
  6770422 java_plugin plugin2 HTMLTextAreaElement non-functional in plug-in2
  6771026 java_plugin plugin2 Plugin2 crashes on applets in XHTML/XML files
  6771315 java_plugin plugin2 Error in implementation of Document.createDocumentFragment, createTextNode and createComment
6773313 java_plugin plugin2 Mac OS X port crashes with latest WebKit nightly
  6783125 java_plugin plugin2 Plugin2: DND shortcut launch throw exceptions if applet JNLP href has no codebase
  6790708 java_plugin plugin2 crossdomain.xml broken in Java 6 update 12ea b02/b03
  6791692 java_plugin plugin2 applet under next geneneration plug-in fails with exception
  6672643 javawebstart general Java Web Start 1.5 lost the possibility to adjust proxy settings independently from Java Plugin
  6744907 javawebstart general Java WebStart should not create any Swing/AWT objects on warm start
  6766037 javawebstart general Signed jar gives SecurityException: host syntax error in crossdomain.xml
  6772645 javawebstart general dragged-out FX applet can’t be relaunched even with main=false set in JNLP file
  6775919 javawebstart general javaws -silent is broken for apps with extensions (like javafx)
  6696175 javawebstart jnlp_file javaws not recognizing properties which contains % character
  6740193 javawebstart jnlp_file bug in Java Webstart Caching when using large argument list on resource href.
  6772138 javawebstart jnlp_file Can not change splash image if jnlp href is not set.
  6741349 javawebstart other Regression: NullPointerException in com.sun.javaws.security.SigningInfo.verifyAllEntriesSign
  6750401 jce pkcs11_csp SSL stress test with GF leads to 32 bit max process size in less than 5 minutes,with PCKS11 provider
  6592586 jmx classes RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr
6696028 jmx classes JMXServiceURL like service:jmx:rmi:///jndi/iiop:// should be rejected by the RMI conn provider.
  6697180 jmx classes JMX query results in java.io.IOException: Illegal state – also a deadlock can also be seen
  6728126 jsse runtime Parsing Extensions in Client Hello message is done in a wrong way
  6745052 jsse runtime SSLServerSocket file descriptor leak
  6766775 jsse runtime X509 certificate hostname checking is broken in JDK1.6.0_10

Published by Adam Myatt on 16 Dec 2008

Sun Releases Java 6 Update 11 (JDK 1.6.0.11)

BugId Category Subcategory Description
  6732194 hotspot compiler2 Data corruption dependent on -server/-client/-Xbatch
  4486841 java char_encodings UTF-8 decoder should adhere to corrigendum to Unicode 3.0.1
  6359722 java classes_2d Uncatchable recursive NullPointerException at sun.font.TrueTypeFont.open()
  6757527 java classes_2d D3D: serious rendering issues on Nvidia boards with driver version 178.13 on Vista
  6743433 java classes_awt IM candidate window is not shown until window is deactivated and reactivated again
  6754779 java classes_security Add Camerfirma root certificates to the JDK
  6768559 java classes_security Add t-systems root CA certificate (Deutsche Telekom Root CA 2) to the JRE
  6684401 java classes_swing JTree isExpanded should not call itself recursively
  6684952 java classes_swing Exception occurred on JFileChooser in Applet
  6764308 java classes_util_i18n (tz) Support tzdata2008i
  6487638 java classes_util_logging Calling LogManager.addLogger() and Logger.getLogger() cause deadlock
  6751643 java debugger ThreadReference.ownedMonitors() can return null
  6757796 java install Silent installs of the JRE don’t accept license agreement and shouldn’t download JavaFX Ext Jars
  6729677 java_plugin compatibility popcap- applet games fail to load
  6738770 java_plugin plugin2 REGRESSION:JSException throws when use LiveConnect javascript facility to navigate HTML elements
  6760921 java_plugin plugin2 Browser hang while reloading LiveConnect conformance tests on Unix platforms
  6761053 java_plugin plugin2 Desktop shortcuts for dragged applets from HTTPS servers do not relaunch and can not be customized
  6768136 java_plugin plugin2 Malformed 404s cause breakage of Java/JavaScript bridge and browser hangs

Published by Adam Myatt on 25 Jul 2008

Sun Releases Java 6 Update 7 (JDK 1.6.0.07)


BugId Category Subcategory Description
6511756 hotspot jvmpi forte_is_valid_method() should call CollectedHeap::is_in_reserved() rather than is_in()
6671051 java

classes_lang (process) Runtime.exec() hangs if signalled during fork/exec
6652375 java classes_security Add replacement GlobalSign Root CA to JDK
6696605 java

classes_security

Add Secom root certificates to the JDK
6656050 java classes_security

Add AOL Root CA #2 to JDK
6679340 java classes_util_i18n (tz) Support tzdata2008b
6685178 java monitoring

REGRESSION: NPE in ConnectorBootstrap when Agent.getManagementProperties() returns null.

6643315 java sunservicetags Product Registration Info button in the Windows JDK installer should use default browser

6656520 java_plugin misc Loading cacerts file from running JRE directory (JRE 1.4.2)
6567254 java_plugin ns6 Stack stomp in CSecureJNIEnv
6674757 java_plugin plugin Firefox hang upon first applet launch with Windows OEM builds of Java
6709297 javawebstart other Wonderland does not install via webstart with 6u10 b21 or later

6620632

jaxp stax DTD event is missing entity and notation information

Published by Adam Myatt on 09 May 2008

Smashmouth Rocks JavaOne 2008

The band Smashmouth played a private concert at the JavaOne 2008 “After Dark” party held Thursday night in Yerba Buena Gardens outside the Moscone Center.

The evening was filled was some great music and food. Check out these pics and videos…

Continue Reading »

Published by Adam Myatt on 07 May 2008

Javadoc Analyzer in NetBeans 6.1

NetBeans 5.5 contained a useful tool called the ‘Javadoc Auto Comment’ feature. With the heavy rewrite of the NetBeans internals in version 6.0, the auto comment tool as we knew it was stripped out. This was down with some howling and protests, but at least there was a good reason (and not simply for the heck of it).

Quoted from NetBeans Wiki:

‘We have intended to replace the AC tool for a long time due to its archaic UI and a weak linkage to the editor, where users usually want to edit source code. Changes in the Java model in NetBeans 6.0 forced us to drop the tool immediately and start to implement particular features that will replace the tool as resources permit. So NetBeans 6.0 contains basic editor hints to create or fix javadoc, and the long-awaited ability to generate javadoc skeleton on /** + <Enter> in the open editor as the first step. Of course, the Javadoc Search and the Show Javadoc were adapted to the new model as well.’

NetBeans 6 did contain Javadoc hints and warning so on a class by class basis you could see what was missing or incomplete. NetBeans 6.1 introduced Javadoc code completion. So far so good, but it wasn’t quite as useful as the old Auto Comment tool.

I recently checked the NetBeans 6.1 update center and discovered a plugin listed called Javadoc Analyzer. I had been following several related bug posts at the NetBeans site and knew they had been working on it, but had not had time to try it out.

Download it from the update center and you’re ready to use it with no configuration.

Continue Reading »

Published by Adam Myatt on 07 May 2008

Exploring the Pavilion Floor at JavaOne 2008

The JavaOne Pavilion (basically a trade show and vendor demo space) is always an interesting experience. It’s a mix of IT geeks running around seeking out swag, vendors hawking the next great widget or framework, and interesting “attractions” littered throughout the space.

The obvious things you notice heading up the main aisle are the big sponsor vendors such as Intel, Oracle, etc.

Ever present and ready to discuss a technology…

Then there are always cool technologies on display that utilize Java in some way such as the Perrone Robotics autonomous vehicle.

Seen here are some of the electronics it runs in the trunk :

And of course, always something weird. This live action machine shot marbles through a series of pipes to test and try out real time Java technology.

And finally, and perhaps most bizarre, Intel’s oxygen bar. They touted the slogan as something similar to ‘ since oxygen is essential to life, so is Intel’ [reletive to computing life]. The picture below shows bubbling bottles of 90% oxygen with aromatherapy flavors mixed in. You were given a personal nose tube, slightly uncomfortable, but not too bad given the unique experience. If you haven’t tried it you should definitely try to stop by before the end of ther week.

After a few hours of walking the floor, gathering brochures, and scoping out specific vendors, I enjoyed I few beers and some food as part of the Pavilion Welcome Reception. I’m still amazed at how long the lines get at these things, but hey, it’s free beer at an IT conference!

Published by Adam Myatt on 01 May 2008

Sun Releases Java 6 Update 6 (JDK 1.6.0.06)

Bug fixes in JDK 1.6.0.6.

BugId Category Subcategory Description
6532373 java classes_awt xcb_xlib.c:50: xcb_xlib_unlock: Assertion ‘c->xlib.lock’ failed.
6632169 java classes_net HttpClient and HttpsClient should not try to reverse lookup IP address of a proxy server
6648816 java classes_security REGRESSION: setting -Djava.security.debug=failure result in NPE in ACC
6650748 java classes_util_i18n (tz) Java runtime doesn’t detect VET time zone correctly on Windows
6673080 java classes_util_i18n (tz) Support tzdata2008a
6676491 java sunservicetags Incorrect locale specified in the URL embedded in the register[_<locale>].html
6641731 java_deployment general The Java control panel is not showing up in the Windows Vista control panel on a AMD 64 machine
6618901 java_plugin plugin 6.0 JRE applet running on Vista limits heap to 64 MB
6648381 java_plugin plugin FontConfiguration exception preventing applets from loading
6595845 javawebstart general Java 6 JavaWebstart increases footprint by factor 2
6648395 javawebstart install JWS can’t find cache file after network crash
6672868 jax-ws other Package javax.xml.ws.wsaddressing not included in make/docs/CORE_PKGS.gmk
6578538 jce classes_crypto com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext

Published by Adam Myatt on 11 Mar 2008

Reviewing the NetBeans Unit Tests Code Coverage Plugin

The NetBeans Unit Tests Code Coverage Plugin has been around for several versions of NetBeans. It measures code coverage statistics and displays annotated & highlighted lines in the Source Editor in each class that were executed by unit tests. In a recent release of the plugin, it also provides a report that shows overall, package, and class-level statistics. This article provides a quick overview of code coverage, why it is important, and what the NetBeans Unit Tests Code Coverage Plugin provides. I’ll also cover some pros/cons of the plugin.

Overview of Code Coverage

To quote myself from Chapter 16, Using Code Coverage Tools, of my book, Pro NetBeans IDE 5.5 Enterprise Edition (Apress, March 2007) :

You know that it is important to write accurate and effective tests for your code. But how do you measure the effectiveness of your tests? In a perfect world, you would write a test for every class, every method, and every line of code. Depending on the complexity of your code base, this may be easy or extremely difficult.

How do you know when you’ve written enough tests? If you have 200 tests for your code, and they all pass, then you’re finished, right? Not necessarily. You’re finished writing tests only when you know for a fact how effective your tests are. Since testing often involves visual analysis by programmers and code-based test cases, it’s difficult to know if 100 percent of your code has been tested. This is where code coverage tools come into play.

The first and obvious benefit of using a code coverage tool is being able to measure the coverage of your test cases (and, by association, the test case effectiveness). Untested code can lead to bugs, and bugs lead to many other problems.

Code coverage tools also help you identify areas in your code that are dead or unreachable. Suppose you have written test cases for all the public methods in your code. If your code coverage tool identifies one or more methods with private-level access that have never been executed, then you may be able to remove those methods from your source code. You can then use the NetBeans Safely Delete refactoring to check the method and make sure it is not called by any other code.

A good code coverage tool not only tracks if each line in each method was executed, but also how many times each line was executed. Using this data and the knowledge of what lines were and were not executed, you can understand the flow of program functionality and rearrange code blocks accordingly.

The NetBeans Unit Tests Code Coverage Plugin does not provide access to some of the information mentioned above (such as number of times each line was executed). However, it provides enough of the basic features you will need to be quite useful. Internally, the plugin depends on the Emma code coverage library.

Code Coverage tools like Emma and Cobertura (one of my personal favorites) typically work by instrumenting classes (inserting extra byte codes).  The instrumented classes are then executed instead of the original un-instrumented classes. The inserted byte codes in the instrumented classes then collect different bits of data and deposit them in a file for later analysis.

Getting Started

As of the official release of NetBeans 6.1 Beta, the update centers contained a slightly older version of the code coverage plugin. I would suggest going to the official NetBeans code coverage plugin site and download it using the prominently displayed button labeled “Download Code Coverage Plugin”.

Use the Plugins Manager to install the NBM file. Go to the Downloaded tab and click the Add Plugins button. Accept the license, click Next a few times, and you should be all set.

Once installed, you need to activate code coverage on a per-project basis. For this article, I have a standard J2SE Java Library project. In the Projects window, right-click the project name, and you should see a Coverage submenu. It contains the following options :

    Activate Coverage Collection: When clicked activates code coverage collection for the selected project. This will also generate the file nbproject/coverage.properties and coverage/emmascript.xml, which are covered below.

    Deactivate Coverage Collection: When clicked deactivates code coverage collection.

    Show Project Coverage Statistics: When clicked displays a tab in the Source Editor showing the accumulated statistics collected by the plugin for the selected project.

 Files Generated By Activating Coverage Collection

As previously mentioned, several files are generated by activating coverage collection.

The nbproject.properties file contains several parameters used by the plugin such as :

    coverage.activity=ON
    project.type=java
    coverage.templateFile=coverage/template.emma
    coverage.coverageFile=coverage/coverage.emma

The first parameter obviously indicates whether the coverage collection is active or inactive. The second parameter identifies the type of NetBeans project, and the last 2 parameters identify the paths to specific files used by the plugin.

The coverage/emmascript.xml file contains Ant targets for executing the instrumentation of the project class files.

<?xml version=”1.0″ encoding=”UTF-8″?>
<project basedir=”.” default=”echoit” name=”Coverage Tasks”>

    <target name=”echoit” description=”test target”>
        <echo message=”Test succeeded.”/>
    </target>     
    
    <target name=”instr” description=”Instrumenting jars”>
        <echo message=”Instrumenting started.”/>
       
        <java classname=”emma” fork=”true”>           
            <classpath >
                <pathelement location=”${emma}”/>
            </classpath>
            <arg line=”instr -verbose -m overwrite -cp ‘${jarfiles}’ -outdir ‘${output.dir}’ -outfile ‘${output.dir}/template.emma’”/>
        </java>
        <echo message=”Instrumenting done.”/>
    </target>
    
</project>

 The instr target runs the main emma class passing it several arguments to overwrite the application JAR file with a JAR file of the project’s instrumented classes.

Creating Sample Code

First, create a simple Java Class like this :

public class StringUtils {

    public static String tryIntToString(int numLoops) {

        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < numLoops; i++) {
                sb.append(String.valueOf(i));
        }
        return sb.toString();
    }
}

 It is basically a ‘hello world’ class that takes in a counter variable, numLoops, instantiates a StringBuffer, and loops appending an int converted to a String into the StringBuffer. The method then returns the value of the StringBuffer.

To test this method, create a JUnit test. Right-click the class listing in the Projects window and select Tools >> Create JUnit Tests (or press Control+Shift+U). Select your preferred JUnit version (4.x in this case) and the various other JUnit settings you are prompted for. Once created, I implement a basic test case for the StringUtils class passing in a value and setting the expected return.

public class StringUtilsTest {

    public StringUtilsTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    @Test
    public void testTryIntToString() {
        System.out.println(“tryIntToString03″);
       
        int numLoops = 10000;

        String result = StringUtils.tryIntToString(numLoops);

        int expectedResult = 38890;
       
        assertEquals(expectedResult, result.length());
    }
}

Continue Reading »

Published by Adam Myatt on 04 Mar 2008

Sun Releases Java 6 Update 5 (JDK 1.6.0.05)

Bug Fixes

This release contains fixes for one or more security vulnerabilities.
For more information, please see Sun Alerts
233321,
233322,
233323,
233324,
233325,
233326, and
233327.

Other bug fixes are listed in the following table.

BugId Category Subcategory Description
6647251 java classes_security Add DigiCert root CA certs to JDK
6647254 java classes_security Add TrustCenter root CA certificates to the JDK
6651160 java classes_security Add AOL root CA certs to JDK
6624769 java classes_util_i18n (tz) Support tzdata2007i
6646197 java classes_util_i18n (tz) Support tzdata2007k
6637304 java install Obsolete XPIs and replace them with new jinstall.exe to cover Java Stat’s xpi and jxpi metrics.
6622366 java sunservicetags JDK Product Registration Support

Published by Adam Myatt on 03 Mar 2008

Sun Release JDK 1.5 Update 15 (JDK 1.5.0.15)

Bug fixes are listed in the following table.

BugId Category Subcategory Description
6587132 hotspot compiler2 Code changes behavior when compiled
6317397 hotspot runtime_system Hard hangs in concurrent code on Solaris and Linux
6633265 java classes_2d KCMS crash due to heap buffer out-of-bounds write with para-type curves
6633278 java classes_2d KCMS crash due heap-based buffer overflow parsing curv-type curves
6660717 java classes_2d KCMS crash due to heap buffer out-of-bounds write with para-type curves
6629657 java classes_awt provide raw key code from underlying system without changing API.
6632169 java classes_net HttpClient and HttpsClient should not try to reverse lookup IP address of a proxy server
6647251 java classes_security Add DigiCert root CA certs to JDK
6647254 java classes_security Add TrustCenter root CA certificates to the JDK
6651160 java classes_security Add AOL root CA certs to JDK
6624769 java classes_util_i18n (tz) Support tzdata2007i
6646197 java classes_util_i18n (tz) Support tzdata2007k
6374379 java classes_util_jarzip ZipFile class cannot open zip files with long filenames
6423026 java classes_util_jarzip Java.util.zip doesn’t allow more than 2036 zip files to be concurrently open on Windows
6609756 java_deployment security Buffer Overflow in Java ActiveX component
6608712 java_plugin applet_spec Bypassing the same origin policy in Java with crafted names
6568419 java_plugin misc initial_focus flag not working when an applet is compiled with 1.4 and run with 1.5
6593309 java_plugin misc applet focus issue with button after minimizing an maximizing
6631506 java_plugin plugin REG : Unable to launch an applet on MZ using 6u4
6634129 java_plugin plugin jar protocol allows LiveConnect code to connect to any port on localhost
6623233 javawebstart general arbitary code execution using java web start
6605184 javawebstart jnlp_file [ZDI-CAN-234] Security Vulnerability in XML UTF8 character encoding in JNLP files
6660121 javawebstart jnlp_file Encoding values in JNLP files can cause buffer overflow
6588002 jaxp other XSLTProcessorApplet still allows reading from forbidden URLs
6616825 jmx classes JMX query returns no value in 1.0 compatibility mode – deserialization bug in readObject()

Next »