Skip to content

Commit

Permalink
Ajustado exemplo e badges do readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
fincatto committed May 21, 2016
1 parent c6fdc8e commit a2d9089
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Nota Fiscal Eletrônica
Comunicador de nota fiscal da [fazenda](http://www.nfe.fazenda.gov.br/portal/principal.aspx).<br/>
[![Build Status](https://api.travis-ci.org/wmixvideo/nfe.png)](http://travis-ci.org/#!/wmixvideo/nfe)
[![Coverage Status](https://coveralls.io/repos/wmixvideo/nfe/badge.svg?branch=master&service=github)](https://coveralls.io/github/wmixvideo/nfe?branch=master)
[![Maven Central](https://img.shields.io/badge/maven%20central-1.1.14-blue.svg)](http://search.maven.org/#artifactdetails|com.github.wmixvideo|nfe|1.1.14|)
[![Maven Central](https://img.shields.io/badge/maven%20central-1.2.0-blue.svg)](http://search.maven.org/#artifactdetails|com.github.wmixvideo|nfe|1.2.0|)
[![Apache 2.0 License](https://img.shields.io/badge/license-apache%202.0-green.svg) ](https://github.com/wmixvideo/nfe/blob/master/LICENSE)

## Atenção
Expand Down Expand Up @@ -38,11 +38,6 @@ public class NFeConfigTeste extends NFeConfig {
private KeyStore keyStoreCertificado = null;
private KeyStore keyStoreCadeia = null;

@Override
public NFAmbiente getAmbiente() {
return NFAmbiente.HOMOLOGACAO;
}

@Override
public NFUnidadeFederativa getCUF() {
return NFUnidadeFederativa.SC;
Expand All @@ -61,15 +56,12 @@ public class NFeConfigTeste extends NFeConfig {
@Override
public KeyStore getCertificadoKeyStore() throws KeyStoreException {
if (this.keyStoreCertificado == null) {
this.keyStoreCertificado = KeyStore.getInstance("PKCS12");
try (InputStream certificadoStream = new FileInputStream("/tmp/certificado.pfx")) {
this.keyStoreCertificado = KeyStore.getInstance("PKCS12");
this.keyStoreCertificado.load(certificadoStream, this.getCertificadoSenha().toCharArray());
} catch (CertificateException e) {
throw new KeyStoreException("Erro de certificado", e);
} catch (NoSuchAlgorithmException e) {
throw new KeyStoreException("Erro de algoritmo", e);
} catch (IOException e) {
throw new KeyStoreException("Erro de IO", e);
} catch (CertificateException | NoSuchAlgorithmException | IOException e) {
this.keyStoreCadeia = null;
throw new KeyStoreException("Nao foi possibel montar o KeyStore com a cadeia de certificados", e);
}
}
return this.keyStoreCertificado;
Expand All @@ -78,15 +70,12 @@ public class NFeConfigTeste extends NFeConfig {
@Override
public KeyStore getCadeiaCertificadosKeyStore() throws KeyStoreException {
if (this.keyStoreCadeia == null) {
this.keyStoreCadeia = KeyStore.getInstance("JKS");
try (InputStream cadeia = new FileInputStream("/tmp/cadeia.jks")) {
this.keyStoreCadeia = KeyStore.getInstance("JKS");
this.keyStoreCadeia.load(cadeia, this.getCadeiaCertificadosSenha().toCharArray());
} catch (CertificateException e) {
throw new KeyStoreException("Erro de certificado", e);
} catch (NoSuchAlgorithmException e) {
throw new KeyStoreException("Erro de algoritmo", e);
} catch (IOException e) {
throw new KeyStoreException("Erro de IO", e);
} catch (CertificateException | NoSuchAlgorithmException | IOException e) {
this.keyStoreCadeia = null;
throw new KeyStoreException("Nao foi possibel montar o KeyStore com o certificado", e);
}
}
return this.keyStoreCadeia;
Expand Down

0 comments on commit a2d9089

Please sign in to comment.