<changes>
<release version="3.9-beta1" date="2012-??-??">
+ <action dev="poi-developers" type="add">53374 - Avoid exceptions when parsing hyperlinks of type "javascript://"</action>
<action dev="poi-developers" type="add">53404 - Fixed compatibility bug with modifying xls files created by POI-3.6 and earlier</action>
<action dev="poi-developers" type="add">53979 - Support fetching properties of Numbered Lists from PPT files</action>
<action dev="poi-developers" type="add">53784 - Partial HSMF support for fixed sized properties</action>
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.io.UnsupportedEncodingException;
+import java.util.regex.Pattern;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
PACKAGE_ROOT_PART_NAME = tmpPACKAGE_ROOT_PART_NAME;
}
+ private static final Pattern missingAuthPattern = Pattern.compile("\\w+://");
+
/**
* Gets the URI for the package root.
*
value = path + "#" + encode(fragment);
}
+ if(missingAuthPattern.matcher(value).matches()){
+ value += "/";
+ }
return new URI(value);
}
"..\\Program%20Files\\AGEIA%20Technologies\\v2.3.3\\NxCooking.dll",
"file:///D:\\seva\\1981\\r810102ns.mp3",
"..\\cygwin\\home\\yegor\\dinom\\%5baccess%5d.2010-10-26.log",
- "#'Instructions (Text)'!B21"
+ "#'Instructions (Text)'!B21",
+ "javascript://"
};
for(String s : href){
try {
}
}
+ public void test53734() throws Exception {
+ URI uri = PackagingURIHelper.toURI("javascript://");
+ // POI appends a trailing slash tpo avoid "Expected authority at index 13: javascript://"
+ // https://issues.apache.org/bugzilla/show_bug.cgi?id=53734
+ assertEquals("javascript:///", uri.toASCIIString());
+ }
+
}
assertEquals("B1", l2.getCellRef());
}
+ public void test53734() {
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("53734.xlsx");
+ XSSFHyperlink link = wb.getSheetAt(0).getRow(0).getCell(0).getHyperlink();
+ assertEquals("javascript:///", link.getAddress());
+
+ wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
+ link = wb.getSheetAt(0).getRow(0).getCell(0).getHyperlink();
+ assertEquals("javascript:///", link.getAddress());
+ }
}