diff --git a/jacob/docs/BuildingJacobFromSource.html b/jacob/docs/BuildingJacobFromSource.html index 505d90e..efa0c8c 100644 --- a/jacob/docs/BuildingJacobFromSource.html +++ b/jacob/docs/BuildingJacobFromSource.html @@ -67,6 +67,8 @@

Development Environment

Build Process

The build process is based on ANT. You can run ANT from inside of eclipse or from the command line. +Running from inside eclipse means you don't have any installation, pathing or configuration to do. +You can just open the xml and then "run as ant" on the selected target in the "outline" pane. The ant process is driven off of a configuration file named compilation_tools.properties that describes the locations of the JDK and Microsoft C++ tools. The build.xml file in the root directory contains examples of the contents diff --git a/jacob/docs/ReleaseNotes.html b/jacob/docs/ReleaseNotes.html index 97d08ed..fee5651 100644 --- a/jacob/docs/ReleaseNotes.html +++ b/jacob/docs/ReleaseNotes.html @@ -30,6 +30,10 @@

Tracked Changes

111 (new numbers) (M3)m_pDispatch is not 0 if not attached + + 117 (new numbers) + (M4) NullPointerException injacob-1.17-M2 +     diff --git a/jacob/src/com/jacob/com/Variant.java b/jacob/src/com/jacob/com/Variant.java index 6d6280a..ba4bc1c 100644 --- a/jacob/src/com/jacob/com/Variant.java +++ b/jacob/src/com/jacob/com/Variant.java @@ -2161,6 +2161,8 @@ public short toShort() { *
  • "null" if VariantEmpty, *
  • "null" if VariantError *
  • "null" if VariantNull + *
  • "null" if Variant type didn't convert. This can happen for date + * conversions where the returned value was 0. *
  • the value if we know how to describe one of that type *
  • three question marks if can't convert * @@ -2186,7 +2188,11 @@ public String toString() { try { Object foo = toJavaObject(); // rely on java objects to do the right thing - return foo.toString(); + if (foo == null) { + return "null"; + } else { + return foo.toString(); + } } catch (NotImplementedException nie) { // some types do not generate a good description yet return "Description not available for type: " + getvt(); diff --git a/jacob/unittest/com/jacob/com/VariantTest.java b/jacob/unittest/com/jacob/com/VariantTest.java index 4012c1a..6dcedec 100644 --- a/jacob/unittest/com/jacob/com/VariantTest.java +++ b/jacob/unittest/com/jacob/com/VariantTest.java @@ -253,6 +253,32 @@ public void testToStringDoesNotConvert() { } } + /** + * Exercise ToString special cases + */ + public void testToStringEmptyValues() { + Variant v; + // create an empty variant + v = new Variant(); + // check date per + v.changeType(Variant.VariantDate); + assertEquals("null", v.toString()); + v.putDate(new Date()); + assertNotNull(v.toString()); + assertFalse("null".equals(v.toString())); + + v.changeType(Variant.VariantInt); + v.putInt(1); + + assertEquals("1", v.toString()); + v.changeType(Variant.VariantEmpty); + assertEquals("null", v.toString()); + v.changeType(Variant.VariantNull); + assertEquals("null", v.toString()); + v.changeType(Variant.VariantError); + assertEquals("null", v.toString()); + } + /** * Verify that booleans can be released. Part of the suite that checks all * types. @@ -465,12 +491,12 @@ public void testDecimalConversion() { new BigDecimal(i), v.getDecimal()); v.changeType(Variant.VariantFloat); // now see if a float conversion would work - assertEquals("conversion to float failed " + i, new Float(i), v - .getFloat()); + assertEquals("conversion to float failed " + i, new Float(i), + v.getFloat()); // now convert it back to decimal for reassignment v.changeType(Variant.VariantDecimal); - assertTrue("Failed conversion of type back to Decimal " + i, v - .getvt() == Variant.VariantDecimal); + assertTrue("Failed conversion of type back to Decimal " + i, + v.getvt() == Variant.VariantDecimal); } } @@ -545,9 +571,10 @@ public void testLargeDecimals() { .unscaledValue().toString(16) + " scale=: " + modifiedDecimal.scale()); System.out.println("integer piece after rounding with scale 30 is " - + VariantUtilities.roundToMSDecimal( - modifiedDecimal.setScale(30)).unscaledValue().toString( - 16) + " scale=: " + modifiedDecimal.scale()); + + VariantUtilities + .roundToMSDecimal(modifiedDecimal.setScale(30)) + .unscaledValue().toString(16) + " scale=: " + + modifiedDecimal.scale()); try { testVariant.putDecimal(VariantUtilities .roundToMSDecimal(modifiedDecimal.setScale(30))); @@ -568,9 +595,10 @@ public void testLargeDecimals() { .unscaledValue().toString(16) + " scale=: " + modifiedDecimal.scale()); System.out.println("integer piece after rounding with scale 30 is " - + VariantUtilities.roundToMSDecimal( - modifiedDecimal.setScale(30)).unscaledValue().toString( - 16) + " scale=: " + modifiedDecimal.scale()); + + VariantUtilities + .roundToMSDecimal(modifiedDecimal.setScale(30)) + .unscaledValue().toString(16) + " scale=: " + + modifiedDecimal.scale()); testVariant.putDecimal(VariantUtilities .roundToMSDecimal(modifiedDecimal.setScale(30))); System.out.println("");