Skip to content

Commit 8c92016

Browse files
Guillermo de Ignacio MariGuillermo de Ignacio Mari
authored andcommitted
Tractament de valors nuls a dates SCDHPAJU #3
1 parent 85139e8 commit 8c92016

3 files changed

Lines changed: 18 additions & 30 deletions

File tree

emiservbackoffice-ws/emiservbackoffice_ws_server/src/main/java/es/caib/emiservbackoffice/ws/cedent/CedentClient.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.text.ParseException;
55
import java.text.SimpleDateFormat;
66
import java.util.Date;
7+
import java.util.logging.Level;
78
import org.slf4j.Logger;
89
import org.slf4j.LoggerFactory;
910
import org.w3c.dom.Element;
@@ -70,15 +71,22 @@ public void setStrRespuestaDatosEspecificos(String strRespuestaDatosEspecificos)
7071

7172
public abstract void peticionSincrona();
7273

73-
protected String fullDateToDate(String fullDate) throws ParseException{
74+
protected String fullDateToDate(String fullDate) {
75+
76+
if (fullDate==null) return null;
7477

7578
String strDate = fullDate;
7679
SimpleDateFormat sdfFullDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
77-
Date date = sdfFullDate.parse(fullDate);
78-
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
79-
strDate = sdfDate.format(date);
80+
Date date;
81+
try {
82+
date = sdfFullDate.parse(fullDate);
83+
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
84+
strDate = sdfDate.format(date);
85+
} catch (ParseException ex) {
86+
java.util.logging.Logger.getLogger(CedentClient.class.getName()).log(Level.SEVERE, null, ex);
87+
}
8088
return strDate;
81-
89+
8290
}
8391

8492

emiservbackoffice-ws/emiservbackoffice_ws_server/src/main/java/es/caib/emiservbackoffice/ws/cedent/SCDCPAJUv3Client.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,7 @@ private es.caib.scsp.esquemas.SCDCPAJUv3.respuesta.datosespecificos.Resultado ad
263263

264264
String fexp = res.getFechaExpedicion();
265265
String fechaExpedicion = fexp;
266-
try {
267-
fechaExpedicion = fullDateToDate(fexp);
268-
} catch (ParseException ex) {
269-
Logger.getLogger(SCDCPAJUv3Client.class.getName()).log(Level.SEVERE, null, ex);
270-
}
266+
fechaExpedicion = fullDateToDate(fexp);
271267
resultado.setFechaExpedicion(fechaExpedicion);
272268

273269

@@ -373,11 +369,7 @@ private es.caib.scsp.esquemas.SCDCPAJUv3.respuesta.datosespecificos.Resultado ad
373369

374370
String dsd = pin.getDesde();
375371
String desde = dsd;
376-
try {
377-
desde = fullDateToDate(dsd);
378-
} catch (ParseException ex) {
379-
Logger.getLogger(SCDCPAJUv3Client.class.getName()).log(Level.SEVERE, null, ex);
380-
}
372+
desde = fullDateToDate(dsd);
381373
periodoInscripcion.setDesde(desde);
382374

383375

emiservbackoffice-ws/emiservbackoffice_ws_server/src/main/java/es/caib/emiservbackoffice/ws/cedent/SCDHPAJUv3Client.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ private es.caib.scsp.esquemas.SCDHPAJUv3.respuesta.datosespecificos.Resultado ad
274274

275275
String fexp = res.getFechaExpedicion();
276276
String fechaExpedicion = fexp;
277-
try {
278-
fechaExpedicion = fullDateToDate(fexp);
279-
} catch (ParseException ex) {
280-
Logger.getLogger(SCDHPAJUv3Client.class.getName()).log(Level.SEVERE, null, ex);
281-
}
277+
fechaExpedicion = fullDateToDate(fexp);
282278
resultado.setFechaExpedicion(fechaExpedicion);
283279

284280

@@ -332,11 +328,7 @@ private es.caib.scsp.esquemas.SCDHPAJUv3.respuesta.datosespecificos.Resultado ad
332328

333329
String dsd = dom.getDesde();
334330
String desde = dsd;
335-
try {
336-
desde = fullDateToDate(dsd);
337-
} catch (ParseException ex) {
338-
Logger.getLogger(SCDHPAJUv3Client.class.getName()).log(Level.SEVERE, null, ex);
339-
}
331+
desde = fullDateToDate(dsd);
340332
domicilio.setDesde(desde);
341333

342334

@@ -411,11 +403,7 @@ private es.caib.scsp.esquemas.SCDHPAJUv3.respuesta.datosespecificos.Resultado ad
411403

412404
String hst = dom.getHasta();
413405
String hasta = hst;
414-
try {
415-
hasta = fullDateToDate(hst);
416-
} catch (ParseException ex) {
417-
Logger.getLogger(SCDHPAJUv3Client.class.getName()).log(Level.SEVERE, null, ex);
418-
}
406+
hasta = fullDateToDate(hst);
419407
domicilio.setHasta(hasta);
420408

421409

0 commit comments

Comments
 (0)