Some general code-fixes found while trying out Java 9

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-05-05 12:22:31 +00:00
parent 56c5bd05e1
commit 8908412e3a
3 changed files with 47 additions and 45 deletions

View File

@ -65,7 +65,7 @@ public class KeyInfoKeySelector extends KeySelector implements KeySelectorResult
continue; continue;
} }
X509Data x509Data = (X509Data) keyInfoStructure; X509Data x509Data = (X509Data) keyInfoStructure;
List<Object> x509DataList = x509Data.getContent(); List<?> x509DataList = x509Data.getContent();
for (Object x509DataObject : x509DataList) { for (Object x509DataObject : x509DataList) {
if (!(x509DataObject instanceof X509Certificate)) { if (!(x509DataObject instanceof X509Certificate)) {
continue; continue;

View File

@ -32,6 +32,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import javax.xml.crypto.MarshalException; import javax.xml.crypto.MarshalException;
import javax.xml.crypto.XMLStructure;
import javax.xml.crypto.dom.DOMStructure; import javax.xml.crypto.dom.DOMStructure;
import javax.xml.crypto.dsig.dom.DOMSignContext; import javax.xml.crypto.dsig.dom.DOMSignContext;
import javax.xml.crypto.dsig.keyinfo.KeyInfo; import javax.xml.crypto.dsig.keyinfo.KeyInfo;
@ -77,7 +78,7 @@ public class KeyInfoSignatureFacet extends SignatureFacet {
List<Object> x509DataObjects = new ArrayList<Object>(); List<Object> x509DataObjects = new ArrayList<Object>();
X509Certificate signingCertificate = signatureConfig.getSigningCertificateChain().get(0); X509Certificate signingCertificate = signatureConfig.getSigningCertificateChain().get(0);
List<Object> keyInfoContent = new ArrayList<Object>(); List<XMLStructure> keyInfoContent = new ArrayList<XMLStructure>();
if (signatureConfig.isIncludeKeyValue()) { if (signatureConfig.isIncludeKeyValue()) {
KeyValue keyValue; KeyValue keyValue;

View File

@ -117,13 +117,13 @@ public class PPTX2PNG {
System.out.println("Processing " + file); System.out.println("Processing " + file);
} }
SlideShow<?,?> ss = SlideShowFactory.create(file, null, true); SlideShow<?,?> ss = SlideShowFactory.create(file, null, true);
List<? extends Slide<?,?>> slides = ss.getSlides(); try {
List<? extends Slide<?, ?>> slides = ss.getSlides();
Set<Integer> slidenum = slideIndexes(slides.size(), slidenumStr); Set<Integer> slidenum = slideIndexes(slides.size(), slidenumStr);
if (slidenum.isEmpty()) { if (slidenum.isEmpty()) {
usage("slidenum must be either -1 (for all) or within range: [1.."+slides.size()+"] for "+file); usage("slidenum must be either -1 (for all) or within range: [1.." + slides.size() + "] for " + file);
ss.close();
return; return;
} }
@ -131,8 +131,8 @@ public class PPTX2PNG {
int width = (int) (pgsize.width * scale); int width = (int) (pgsize.width * scale);
int height = (int) (pgsize.height * scale); int height = (int) (pgsize.height * scale);
for(Integer slideNo : slidenum) { for (Integer slideNo : slidenum) {
Slide<?,?> slide = slides.get(slideNo); Slide<?, ?> slide = slides.get(slideNo);
String title = slide.getTitle(); String title = slide.getTitle();
if (!quiet) { if (!quiet) {
System.out.println("Rendering slide " + slideNo + (title == null ? "" : ": " + title)); System.out.println("Rendering slide " + slideNo + (title == null ? "" : ": " + title));
@ -161,12 +161,13 @@ public class PPTX2PNG {
ImageIO.write(img, format, outfile); ImageIO.write(img, format, outfile);
} }
} }
} finally {
ss.close();
}
if (!quiet) { if (!quiet) {
System.out.println("Done"); System.out.println("Done");
} }
ss.close();
} }
private static Set<Integer> slideIndexes(final int slideCount, String range) { private static Set<Integer> slideIndexes(final int slideCount, String range) {