getExtendedPropertiesText() +
getCustomPropertiesText();
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
try {
partMarshallers.remove(new ContentType(contentType));
} catch (InvalidFormatException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
try {
partUnmarshallers.remove(new ContentType(contentType));
} catch (InvalidFormatException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
*/
String signatureId = signatureConfig.getPackageSignatureId();
if (!signatureId.equals(document.getDocumentElement().getAttribute("Id"))) {
- throw new RuntimeException("ds:Signature not found for @Id: " + signatureId);
+ throw new IllegalStateException("ds:Signature not found for @Id: " + signatureId);
}
/*
*/
final Element signatureNode = getDsigElement(document, "SignatureValue");
if (signatureNode == null) {
- throw new RuntimeException("preSign has to be called before postSign");
+ throw new IllegalStateException("preSign has to be called before postSign");
}
signatureNode.setTextContent(signatureValue);
RelationshipTransformService.registerDsigProvider();
CryptoFunctions.registerBouncyCastle();
} catch (Exception e) {
- throw new RuntimeException("Xml & BouncyCastle-Provider initialization failed", e);
+ throw new IllegalStateException("Xml & BouncyCastle-Provider initialization failed", e);
}
}
}
private RuntimeException providerNotFound() {
- return new RuntimeException("JRE doesn't support default xml signature provider - set jsr105Provider system property!");
+ return new IllegalStateException("JRE doesn't support default xml signature provider - set jsr105Provider system property!");
}
}
try {
keyValue = keyInfoFactory.newKeyValue(signingCertificate.getPublicKey());
} catch (KeyException e) {
- throw new RuntimeException("key exception: " + e.getMessage(), e);
+ throw new IllegalStateException("key exception: " + e.getMessage(), e);
}
keyInfoContent.add(keyValue);
}
if (nextSibling != null) {
NodeList kiNl = document.getElementsByTagNameNS(XML_DIGSIG_NS, "KeyInfo");
if (kiNl.getLength() != 1) {
- throw new RuntimeException("KeyInfo wasn't set");
+ throw new IllegalStateException("KeyInfo wasn't set");
}
nextSibling.getParentNode().insertBefore(kiNl.item(0), nextSibling);
}
SignatureConfig signatureConfig = signatureInfo.getSignatureConfig();
List<X509Certificate> chain = signatureConfig.getSigningCertificateChain();
if (chain == null || chain.isEmpty()) {
- throw new RuntimeException("no signing certificate chain available");
+ throw new IllegalStateException("no signing certificate chain available");
}
CertIDListType signingCertificates = signedSignatureProperties.addNewSigningCertificate();
CertIDType certId = signingCertificates.addNewCert();
try {
encodedCertificate = certificate.getEncoded();
} catch (CertificateEncodingException e) {
- throw new RuntimeException("certificate encoding error: "
+ throw new IllegalStateException("certificate encoding error: "
+ e.getMessage(), e);
}
DigestAlgAndValueType certDigest = certId.addNewCertDigest();
try {
this.certificateFactory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
- throw new RuntimeException("X509 JCA error: " + e.getMessage(), e);
+ throw new IllegalStateException("X509 JCA error: " + e.getMessage(), e);
}
}
crl = (X509CRL) this.certificateFactory
.generateCRL(new UnsynchronizedByteArrayInputStream(encodedCrl));
} catch (CRLException e) {
- throw new RuntimeException("CRL parse error: " + e.getMessage(), e);
+ throw new IllegalStateException("CRL parse error: " + e.getMessage(), e);
}
CRLIdentifierType crlIdentifier = crlRef.addNewCRLIdentifier();
responderId.setByName(nameStr);
}
} catch (Exception e) {
- throw new RuntimeException("OCSP decoding error: " + e.getMessage(), e);
+ throw new IllegalStateException("OCSP decoding error: " + e.getMessage(), e);
}
}
}
certificateValues.addNewEncapsulatedX509Certificate().setByteArrayValue(certificate.getEncoded());
}
} catch (CertificateEncodingException e) {
- throw new RuntimeException("certificate encoding error: " + e.getMessage(), e);
+ throw new IllegalStateException("certificate encoding error: " + e.getMessage(), e);
}
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new RuntimeException("c14n error: " + e.getMessage(), e);
+ throw new IllegalStateException("c14n error: " + e.getMessage(), e);
}
}
return integer.getPositiveValue();
}
} catch (IOException e) {
- throw new RuntimeException("I/O error: " + e.getMessage(), e);
+ throw new IllegalStateException("I/O error: " + e.getMessage(), e);
}
}
try {
timeStampToken = signatureConfig.getTspService().timeStamp(signatureInfo, c14nSignatureValueElement, revocationData);
} catch (Exception e) {
- throw new RuntimeException("error while creating a time-stamp: "
+ throw new IllegalStateException("error while creating a time-stamp: "
+ e.getMessage(), e);
}
byte[] responseBytes = response.getResponseBytes();
if (responseBytes.length == 0) {
- throw new RuntimeException("Content-Length is zero");
+ throw new IllegalStateException("Content-Length is zero");
}
// TSP response parsing and validation
LOG.atDebug().log("unaccepted policy");
}
}
- throw new RuntimeException("timestamp response status != 0: "
+ throw new IllegalStateException("timestamp response status != 0: "
+ timeStampResponse.getStatus());
}
TimeStampToken timeStampToken = timeStampResponse.getTimeStampToken();
.filter(h -> signerCertIssuer.equals(h.getIssuer())
&& signerCertSerialNumber.equals(h.getSerialNumber()))
.findFirst()
- .orElseThrow(() -> new RuntimeException("TSP response token has no signer certificate"));
+ .orElseThrow(() -> new IllegalStateException("TSP response token has no signer certificate"));
JcaX509CertificateConverter x509converter = new JcaX509CertificateConverter();
x509converter.setProvider("BC");
try {
return getPackage().getUnusedPartIndex(relationType.getDefaultFileName());
} catch (InvalidFormatException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
String importBlip(String blipId, POIXMLDocumentPart parent, POIXMLDocumentPart target) {
OPCPackage targetPackage = target.getPackagePart().getPackage();
if (targetPackage != getPackage()) {
- throw new RuntimeException("the target document part is not a child of this package");
+ throw new IllegalStateException("the target document part is not a child of this package");
}
final POIXMLDocumentPart docPart = parent.getRelationPartById(blipId).getDocumentPart();
XSLFPictureData parData;
if (docPart instanceof XSLFPictureData) {
parData = (XSLFPictureData)docPart;
} else {
- throw new RuntimeException("cannot import blip " + blipId + " - its document part is not XSLFPictureData");
+ throw new IllegalStateException("cannot import blip " + blipId + " - its document part is not XSLFPictureData");
}
final XSLFPictureData pictureData;
if (targetPackage == parent.getPackagePart().getPackage()) {
try {
fntDataIdx = ppt.getPackage().getUnusedPartIndex(fntRel.getDefaultFileName());
} catch (InvalidFormatException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
POIXMLDocumentPart.RelationPart rp = ppt.createRelationship(fntRel, XSLFFactory.getInstance(), fntDataIdx, false);
header.init(buf, 0, buf.length);
} catch (IOException e) {
// TODO: better exception class
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
}
try {
return getPart().getInputStream();
} catch (Exception e) {
- throw new RuntimeException("Failed to read image data", e);
+ throw new IllegalStateException("Failed to read image data", e);
}
}
try {
return getPart().getContentType();
} catch (InvalidFormatException e) {
- throw new RuntimeException("Failed to read package part", e);
+ throw new IllegalStateException("Failed to read package part", e);
}
}
bos = new UnsynchronizedByteArrayOutputStream();
dummy2d = new DummyGraphics2d(new PrintStream(bos, true, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
return IOUtils.toByteArray(is);
} catch (IOException e) {
// TODO: change to custom runtime exception
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
});
return embed;
sheetParser.setContentHandler(handler);
sheetParser.parse(sheetSource);
} catch (ParserConfigurationException e) {
- throw new RuntimeException("SAX parser appears to be broken - " + e.getMessage());
+ throw new IllegalStateException("SAX parser appears to be broken - " + e.getMessage());
}
}
*/
@Override
public InputStream getWorksheetXMLInputStream() throws IOException {
- throw new RuntimeException("Not supported by DeferredSXSSFSheet");
+ throw new IllegalStateException("Not supported by DeferredSXSSFSheet");
}
/**
@NotImplemented
@Override
protected SheetDataWriter createSheetDataWriter() throws IOException {
- throw new RuntimeException("Not supported by DeferredSXSSFWorkbook");
+ throw new IllegalStateException("Not supported by DeferredSXSSFWorkbook");
}
protected StreamingSheetWriter createSheetDataWriter(OutputStream out) throws IOException {
try {
sxSheet = new DeferredSXSSFSheet(this, xSheet);
} catch (IOException ioe) {
- throw new RuntimeException(ioe);
+ throw new IllegalStateException(ioe);
}
registerSheetMapping(sxSheet, xSheet);
return sxSheet;
try {
flushRows(_randomAccessWindowSize);
} catch (IOException ioe) {
- throw new RuntimeException(ioe);
+ throw new IllegalStateException(ioe);
}
}
return newRow;
@NotImplemented
@Override
public void shiftRows(int startRow, int endRow, int n) {
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
/**
@NotImplemented
@Override
public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
/**
collapseRow(row);
} else {
//expandRow(rowIndex);
- throw new RuntimeException("Unable to expand row: Not Implemented");
+ throw new IllegalStateException("Unable to expand row: Not Implemented");
}
}
// corrupted .xlsx files as rows appear multiple times in the resulting sheetX.xml files
// return _sh.setArrayFormula(formula, range);
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
/**
// corrupted .xlsx files as rows appear multiple times in the resulting sheetX.xml files
// return _sh.removeArrayFormula(cell);
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
@Override
try {
sxSheet = new SXSSFSheet(this,xSheet);
} catch (IOException ioe) {
- throw new RuntimeException(ioe);
+ throw new IllegalStateException(ioe);
}
registerSheetMapping(sxSheet,xSheet);
return sxSheet;
@Override
@NotImplemented
public Sheet cloneSheet(int sheetNum) {
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
@Override
@NotImplemented
public int linkExternalWorkbook(String name, Workbook workbook) {
- throw new RuntimeException("Not Implemented");
+ throw new IllegalStateException("Not Implemented");
}
/**
private boolean closed = false;
public StreamingSheetWriter() throws IOException {
- throw new RuntimeException("StreamingSheetWriter requires OutputStream");
+ throw new IllegalStateException("StreamingSheetWriter requires OutputStream");
}
public StreamingSheetWriter(OutputStream out) throws IOException {
@Override
public File createTempFile() throws IOException {
- throw new RuntimeException("Not supported with StreamingSheetWriter");
+ throw new IllegalStateException("Not supported with StreamingSheetWriter");
}
@Override
public Writer createWriter(File fd) throws IOException {
- throw new RuntimeException("Not supported with StreamingSheetWriter");
+ throw new IllegalStateException("Not supported with StreamingSheetWriter");
}
/**
@Override
public InputStream getWorksheetXMLInputStream() throws IOException {
- throw new RuntimeException("Not supported with StreamingSheetWriter");
+ throw new IllegalStateException("Not supported with StreamingSheetWriter");
}
@Override
}
// Not properly referenced
- throw new RuntimeException("Book not linked for filename " + bookName);
+ throw new IllegalStateException("Book not linked for filename " + bookName);
}
/* This is case-sensitive. Is that correct? */
private int findExternalLinkIndex(String bookName, List<ExternalLinksTable> tables) {
@Override
@NotImplemented
public int getExternalSheetIndex(String workbookName, String sheetName) {
- throw new RuntimeException("not implemented yet");
+ throw new IllegalStateException("not implemented yet");
}
@Override
public int getSheetIndex(String sheetName) {
if (eval instanceof ErrorEval) {
return CellValue.getError(((ErrorEval)eval).getErrorCode());
}
- throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
+ throw new IllegalStateException("Unexpected eval class (" + eval.getClass().getName() + ")");
}
/**
styleMap.put(builtIn, new XSSFBuiltinTypeStyleStyle(builtIn, styles.getExplicitTableStyle(styleName)));
}
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
try {
new XSSFSheet().write(out);
} catch (IOException e){
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
return out.toByteArray();
}
@Override
@NotImplemented
public boolean isHidden() {
- throw new RuntimeException("Not implemented yet");
+ throw new IllegalStateException("Not implemented yet");
}
@Override
@NotImplemented
public void setHidden(boolean hiddenFlag) {
- throw new RuntimeException("Not implemented yet");
+ throw new IllegalStateException("Not implemented yet");
}
@Override
public void setBorderTop(Borders border) {
CTPBdr ct = getCTPBrd(true);
if (ct == null) {
- throw new RuntimeException("invalid paragraph state");
+ throw new IllegalStateException("invalid paragraph state");
}
CTBorder pr = (ct.isSetTop()) ? ct.getTop() : ct.addNewTop();
*/
protected static void setWidthValue(String widthValue, CTTblWidth ctWidth) {
if (!widthValue.matches(REGEX_WIDTH_VALUE)) {
- throw new RuntimeException("Table width value \"" + widthValue + "\" "
+ throw new IllegalStateException("Table width value \"" + widthValue + "\" "
+ "must match regular expression \"" + REGEX_WIDTH_VALUE + "\".");
}
if (widthValue.matches("auto")) {
} else if (widthValue.matches("[0-9]+")) {
ctWidth.setW(new BigInteger(widthValue));
} else {
- throw new RuntimeException("setWidthPercentage(): Width value must be a percentage (\"33.3%\" or an integer, was \"" + widthValue + "\"");
+ throw new IllegalStateException("setWidthPercentage(): Width value must be a percentage (\"33.3%\" or an integer, was \"" + widthValue + "\"");
}
}
bOffs = new int[]{2, 1, 0};
break;
default:
- throw new RuntimeException("not yet implemented");
+ throw new IllegalStateException("not yet implemented");
}
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
) {
other.linkContinuedObject(objectData);
} else {
- throw new RuntimeException("can't find previous record for continued record");
+ throw new IllegalStateException("can't find previous record for continued record");
}
} else {
ctx.addPlusObjectTableEntry(this, getObjectId());
emb.setData(bos.toByteArray());
} catch (IOException e) {
// TODO: throw appropriate exception
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
public void setIndentLevel(short indentLevel) {
if (textPropType == TextPropType.character) {
- throw new RuntimeException("trying to set an indent on a character collection.");
+ throw new IllegalStateException("trying to set an indent on a character collection.");
}
this.indentLevel = indentLevel;
}
public OutputStream updateObjectData(final Application application, final ObjectMetaData metaData) {
final ObjectMetaData md = (application != null) ? application.getMetaData() : metaData;
if (md == null) {
- throw new RuntimeException("either application or metaData needs to be set");
+ throw new IllegalStateException("either application or metaData needs to be set");
}
// can't use UnsynchronizedByteArrayOutputStream here, because it's final
);
return rtf.getDataString();
} catch (IOException e) {
- throw new RuntimeException("Shouldn't happen", e);
+ throw new IllegalStateException("Shouldn't happen", e);
}
}
case BS_DIBPATTERN8X8:
case BS_MONOPATTERN:
case BS_PATTERN8X8:
- throw new RuntimeException("pattern not supported");
+ throw new IllegalStateException("pattern not supported");
}
return size;
}
stack[stackPnt++] = "all black";
break;
default:
- throw new RuntimeException("unknown cmd '"+c+"'.");
+ throw new IllegalStateException("unknown cmd '"+c+"'.");
}
}
if (inner != null) {
return inner;
}
- throw new RuntimeException("invalid wmf file - window records are incomplete.");
+ throw new IllegalStateException("invalid wmf file - window records are incomplete.");
}
/**
}
}
catch ( IOException e ) {
- throw new RuntimeException( e );
+ throw new IllegalStateException( e );
}
}
} catch (RuntimeException e) {
throw e;
} catch ( Exception exc ) {
- throw new RuntimeException( exc );
+ throw new IllegalStateException( exc );
}
}
break;
default:
//should never happen
- throw new RuntimeException("Invalid sprm type");
+ throw new IllegalStateException("Invalid sprm type");
}
LittleEndian.putShort(sprm, 0, instruction);
list.add(sprm);