Skip to content

Commit 3e988ff

Browse files
Adicionado Compatibilidade com Java 14+
1 parent 05e926e commit 3e988ff

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ ________________________________________________________________________________
3838

3939
# Historico de Versões
4040

41-
## v4.00.18E - SNAPSHOT - 05/04/2022 - Schemas PL.009i
41+
## v4.00.18F - SNAPSHOT - 21/04/2022 - Schemas PL.009i
4242
- Atualizado Cacert
4343
- Alteração WebService CE
4444
- Adicionado System.getProperty("file.separator") como separado de arquivos
4545
- Implementado NT 2021.004 1.20
4646
- Corrigido Consulta Cadastro MS
4747
- Alterado URL QrCode NFCe MG
4848
- Atualizado Servidro DFe Homologação
49+
- Adicionado Compatibilidade com Java 14+
50+
- Adicionado Envento Ator Interessado
4951

5052
Snapshot é a versão que se encontra em teste, só use em caso de extrema necessidade.
5153
Para usar, adicione o repositorio de Snapshot ao Maven:

src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,28 @@ public static ConfiguracoesNfe criarConfiguracoes(EstadosEnum estado, AmbienteEn
7373
ObjetoUtil.verifica(certificado).orElseThrow(() -> new IllegalArgumentException("Certificado não pode ser Nulo.")));
7474
configuracoesNfe.setPastaSchemas(pastaSchemas);
7575

76-
try {
77-
//Setando Encoding.
78-
System.setProperty("file.encoding", "UTF-8");
79-
Field charset = Charset.class.getDeclaredField("defaultCharset");
80-
charset.setAccessible(true);
81-
charset.set(null, null);
82-
} catch (NoSuchFieldException | IllegalAccessException e) {
83-
throw new CertificadoException("Erro ao setar Encoding.");
76+
/**
77+
* Para as versões Java até 11, Eu ainda ceto o Encoding por que é permitido.
78+
* Para quem trabalha com Java 12+, Aconselhasse setar o Encoding :
79+
* -Dfile.encoding="UTF-8"
80+
* -Dsun.jnu.encoding="UTF-8"
81+
*
82+
*/
83+
if(Integer.parseInt(System.getProperty("java.class.version").substring(0,2)) < 56){
84+
try {
85+
//Setando Encoding.
86+
System.setProperty("file.encoding", "UTF-8");
87+
Field charset = Charset.class.getDeclaredField("defaultCharset");
88+
charset.setAccessible(true);
89+
charset.set(null, null);
90+
} catch (NoSuchFieldException | IllegalAccessException e) {
91+
throw new CertificadoException("Erro ao setar Encoding.");
92+
}
8493
}
8594

8695
if (Logger.getLogger("").isLoggable(Level.SEVERE)) {
8796
System.err.println("####################################################################");
88-
System.err.println(" Api Java Nfe - Versão 4.00.18E-SNAPSHOT - 05/04/2022");
97+
System.err.println(" Api Java Nfe - Versão 4.00.18F-SNAPSHOT - 21/04/2022");
8998
if (Logger.getLogger("").isLoggable(Level.WARNING)) {
9099
System.err.println(" Samuel Olivera - [email protected] ");
91100
}

0 commit comments

Comments
 (0)