poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r720997 - in /poi/trunk/src: java/org/apache/poi/hssf/record/HyperlinkRecord.java testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java
Date Wed, 26 Nov 2008 22:00:29 GMT
Author: josh
Date: Wed Nov 26 14:00:29 2008
New Revision: 720997

URL: http://svn.apache.org/viewvc?rev=720997&view=rev
Log:
fixed NPE in HyperlinkRecord.toString()

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java?rev=720997&r1=720996&r2=720997&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java Wed Nov 26 14:00:29
2008
@@ -628,7 +628,7 @@
         if ((_linkOpts & HLINK_TARGET_FRAME) != 0) {
             buffer.append("    .targetFrame= ").append(getTargetFrame()).append("\n");
         }
-        if((_linkOpts & HLINK_URL) != 0) {
+        if((_linkOpts & HLINK_URL) != 0 && _moniker != null) {
             buffer.append("    .moniker   = ").append(_moniker.formatAsString()).append("\n");
         }
         if ((_linkOpts & HLINK_PLACE) != 0) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java?rev=720997&r1=720996&r2=720997&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java Wed Nov 26
14:00:29 2008
@@ -435,6 +435,11 @@
 		HyperlinkRecord hr = new HyperlinkRecord(in);
 		byte[] ser = hr.serialize();
 		TestcaseRecordInputStream.confirmRecordEncoding(HyperlinkRecord.sid, dataUNC, ser);
+		try {
+			hr.toString();
+		} catch (NullPointerException e) {
+			throw new AssertionFailedError("Identified bug with option URL and UNC set at same time");
+		}
 	}
 	
 	public void testGUID() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message