本文整理了Java中eu.europa.esig.dss.utils.Utils.isStringNotEmpty()
方法的一些代码示例,展示了Utils.isStringNotEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isStringNotEmpty()
方法的具体详情如下:
包路径:eu.europa.esig.dss.utils.Utils
类名称:Utils
方法名:isStringNotEmpty
暂无
代码示例来源:origin: esig/dss
@Override
protected String getAdditionalInfo() {
if (Utils.isStringNotEmpty(serviceStatusStr)) {
Object[] params = new Object[] { serviceStatusStr };
return MessageFormat.format(AdditionalInfo.TRUSTED_SERVICE_STATUS, params);
}
return null;
}
代码示例来源:origin: esig/dss
@Override
protected String getAdditionalInfo() {
if (Utils.isStringNotEmpty(pseudo)) {
Object[] params = new Object[] { pseudo };
return MessageFormat.format(AdditionalInfo.PSEUDO, params);
}
return null;
}
代码示例来源:origin: esig/dss
@Override
protected String getAdditionalInfo() {
if (Utils.isStringNotEmpty(serviceTypeStr)) {
Object[] params = new Object[] { serviceTypeStr };
return MessageFormat.format(AdditionalInfo.TRUSTED_SERVICE_TYPE, params);
}
return null;
}
代码示例来源:origin: esig/dss
private KeyStore loadKeyStore(String path, String type, String passwordStr) throws IOException, GeneralSecurityException {
if (Utils.isStringNotEmpty(path)) {
try (InputStream is = new FileInputStream(path)) {
KeyStore ks = KeyStore.getInstance(type);
final char[] password = passwordStr != null ? passwordStr.toCharArray() : null;
ks.load(is, password);
return ks;
}
} else {
return null;
}
}
代码示例来源:origin: esig/dss
@Override
public String getPseudo(CertificateWrapper certificate) {
for (PseudoStrategy strategy : STRATEGIES) {
String pseudo = strategy.getPseudo(certificate);
if (Utils.isStringNotEmpty(pseudo)) {
return pseudo;
}
}
return null;
}
代码示例来源:origin: esig/dss
protected byte[] readHttpResponse(final CloseableHttpResponse httpResponse) throws IOException {
final StatusLine statusLine = httpResponse.getStatusLine();
final int statusCode = statusLine.getStatusCode();
final String reasonPhrase = statusLine.getReasonPhrase();
if (!acceptedHttpStatus.contains(statusCode)) {
String reason = Utils.isStringNotEmpty(reasonPhrase) ? " / reason : " + reasonPhrase : "";
throw new IOException("Not acceptable HTTP Status (HTTP status code : " + statusCode + reason + ")");
}
final HttpEntity responseEntity = httpResponse.getEntity();
if (responseEntity == null) {
throw new IOException("No message entity for this response");
}
return getContent(responseEntity);
}
代码示例来源:origin: esig/dss
protected boolean processValueCheck(String value) {
List<String> expecteds = constraint.getId();
if (Utils.isStringNotEmpty(value) && Utils.isCollectionNotEmpty(expecteds)) {
if (expecteds.contains(ALL_VALUE)) {
return true;
} else if (expecteds.contains(value)) {
return true;
}
}
return false;
}
代码示例来源:origin: esig/dss
/**
* This method returns counter-signatures (not signatures)
*
* @return a set of SignatureWrapper
*/
public Set<SignatureWrapper> getAllCounterSignatures() {
Set<SignatureWrapper> signatures = new HashSet<SignatureWrapper>();
List<SignatureWrapper> mixedSignatures = getSignatures();
for (SignatureWrapper signatureWrapper : mixedSignatures) {
if (Utils.isStringNotEmpty(signatureWrapper.getParentId())) {
signatures.add(signatureWrapper);
}
}
return signatures;
}
代码示例来源:origin: esig/dss
private Date getExpirationDate(String algoToFind, List<Algo> algos, String format) {
SimpleDateFormat dateFormat = new SimpleDateFormat(Utils.isStringEmpty(format) ? DATE_FORMAT : format);
Date result = null;
for (Algo algo : algos) {
if (Utils.areStringsEqual(algoToFind, algo.getValue()) && Utils.isStringNotEmpty(algo.getDate())) {
try {
result = dateFormat.parse(algo.getDate());
} catch (Exception e) {
LOG.warn("Unable to parse date with pattern '{}' : {}", dateFormat.toPattern(), e.getMessage());
}
}
}
return result;
}
代码示例来源:origin: esig/dss
private List<String> getReadable(List<XmlOID> oids) {
if (Utils.isCollectionNotEmpty(oids)) {
List<String> result = new ArrayList<String>();
for (XmlOID xmlOID : oids) {
if (Utils.isStringNotEmpty(xmlOID.getDescription())) {
result.add(xmlOID.getDescription());
} else {
result.add(xmlOID.getValue());
}
}
return result;
}
return null;
}
代码示例来源:origin: esig/dss
@SuppressWarnings("unchecked")
private <T extends Object> T getJAXBObjectFromString(InputStream is, Class<T> clazz, String xsd) throws Exception {
JAXBContext context = JAXBContext.newInstance(clazz.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
if (Utils.isStringNotEmpty(xsd)) {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
InputStream inputStream = this.getClass().getResourceAsStream(xsd);
Source source = new StreamSource(inputStream);
Schema schema = sf.newSchema(source);
unmarshaller.setSchema(schema);
}
return (T) unmarshaller.unmarshal(is);
}
代码示例来源:origin: esig/dss
@SuppressWarnings("unchecked")
private <T extends Object> T getJAXBObjectFromString(InputStream is, Class<T> clazz, String xsd) throws Exception {
JAXBContext context = JAXBContext.newInstance(clazz.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
if (Utils.isStringNotEmpty(xsd)) {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
InputStream inputStream = this.getClass().getResourceAsStream(xsd);
Source source = new StreamSource(inputStream);
Schema schema = sf.newSchema(source);
unmarshaller.setSchema(schema);
}
return (T) unmarshaller.unmarshal(is);
}
代码示例来源:origin: esig/dss
@SuppressWarnings("unchecked")
public static <T extends Object> T getJAXBObjectFromString(InputStream is, Class<T> clazz, String xsd)
throws Exception {
JAXBContext context = JAXBContext.newInstance(clazz.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
if (Utils.isStringNotEmpty(xsd)) {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
InputStream inputStream = LoadPolicyUtils.class.getResourceAsStream(xsd);
Source source = new StreamSource(inputStream);
Schema schema = sf.newSchema(source);
unmarshaller.setSchema(schema);
}
return (T) unmarshaller.unmarshal(is);
}
代码示例来源:origin: esig/dss
private String getReadableCertificateName(String certId) {
CertificateWrapper signingCert = diagnosticData.getUsedCertificateById(certId);
if (signingCert != null) {
if (Utils.isStringNotEmpty(signingCert.getCommonName())) {
return signingCert.getCommonName();
}
if (Utils.isStringNotEmpty(signingCert.getGivenName())) {
return signingCert.getGivenName();
}
if (Utils.isStringNotEmpty(signingCert.getSurname())) {
return signingCert.getSurname();
}
if (Utils.isStringNotEmpty(signingCert.getPseudo())) {
return signingCert.getPseudo();
}
if (Utils.isStringNotEmpty(signingCert.getOrganizationName())) {
return signingCert.getOrganizationName();
}
if (Utils.isStringNotEmpty(signingCert.getOrganizationalUnit())) {
return signingCert.getOrganizationalUnit();
}
}
return "?";
}
代码示例来源:origin: esig/dss
@Test
public void isStringNotEmpty() {
assertFalse(Utils.isStringNotEmpty(""));
assertTrue(Utils.isStringNotEmpty(" "));
assertFalse(Utils.isStringNotEmpty(null));
assertTrue(Utils.isStringNotEmpty("bla"));
}
代码示例来源:origin: esig/dss
if (Utils.isStringNotEmpty(originalName)) {
int dotPosition = originalName.lastIndexOf('.');
if (dotPosition > 0) {
代码示例来源:origin: esig/dss
@Override
protected boolean process() {
String policyId = signature.getPolicyId();
if (multiValues.getId().contains(SignaturePolicy.NO_POLICY) && Utils.isStringEmpty(policyId)) {
return true;
} else if (multiValues.getId().contains(SignaturePolicy.ANY_POLICY) && Utils.isStringNotEmpty(policyId)) {
return true;
} else if (multiValues.getId().contains(SignaturePolicy.IMPLICIT_POLICY) && Utils.areStringsEqual(SignaturePolicy.IMPLICIT_POLICY, policyId)) {
return true;
}
// oids
return processValueCheck(policyId);
}
代码示例来源:origin: esig/dss
String proxyExcludedHosts = proxyProps.getExcludedHosts();
if (Utils.isStringNotEmpty(proxyUser) && Utils.isStringNotEmpty(proxyPassword)) {
AuthScope proxyAuth = new AuthScope(proxyHost, proxyPort);
UsernamePasswordCredentials proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
if (Utils.isStringNotEmpty(proxyExcludedHosts)) {
final String[] hosts = proxyExcludedHosts.split("[,; ]");
代码示例来源:origin: esig/dss
private Date extractExpirationDate(final String algorithm, CryptographicConstraint signatureCryptographicConstraint) {
AlgoExpirationDate algoExpirationDate = signatureCryptographicConstraint.getAlgoExpirationDate();
String dateFormat = DateUtils.DEFAULT_DATE_FORMAT;
if (algoExpirationDate != null) {
if (Utils.isStringNotEmpty(algoExpirationDate.getFormat())) {
dateFormat = algoExpirationDate.getFormat();
}
List<Algo> algos = algoExpirationDate.getAlgo();
String foundExpirationDate = null;
for (Algo algo : algos) {
if (Utils.areStringsEqualIgnoreCase(algo.getValue(), algorithm)) {
foundExpirationDate = algo.getDate();
}
}
if (Utils.isStringNotEmpty(foundExpirationDate)) {
return DateUtils.parseDate(dateFormat, foundExpirationDate);
}
}
return null;
}
代码示例来源:origin: esig/dss
public void extractPOE(TimestampWrapper timestamp, DiagnosticData diagnosticData) {
Date productionTime = timestamp.getProductionTime();
List<XmlTimestampedObject> timestampedObjects = timestamp.getTimestampedObjects();
if (Utils.isCollectionNotEmpty(timestampedObjects)) {
for (XmlTimestampedObject xmlTimestampedObject : timestampedObjects) {
if (Utils.isStringNotEmpty(xmlTimestampedObject.getId())) {
// SIGNATURES and TIMESTAMPS
addPOE(xmlTimestampedObject.getId(), productionTime);
} else if (TimestampedObjectType.CERTIFICATE == xmlTimestampedObject.getCategory()) {
String certificateId = getCertificateIdByDigest(xmlTimestampedObject.getDigestAlgoAndValue(), diagnosticData);
if (certificateId != null) {
addPOE(certificateId, productionTime);
}
} else if (TimestampedObjectType.REVOCATION == xmlTimestampedObject.getCategory()) {
String revocationId = getRevocationIdByDigest(xmlTimestampedObject.getDigestAlgoAndValue(), diagnosticData);
if (revocationId != null) {
addPOE(revocationId, productionTime);
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!