Skip to content
Snippets Groups Projects
Commit 25a12892 authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

fix regression for new SOLEIL TDB oracle database, NaN do not work anymore,...

fix regression for new SOLEIL TDB oracle database, NaN do not work anymore, insert null (JIRA TANGOARCH-562)
parent 866745f7
Branches
No related tags found
No related merge requests found
...@@ -232,6 +232,7 @@ import fr.soleil.archiving.hdbtdb.api.tools.SpectrumEvent_RO; ...@@ -232,6 +232,7 @@ import fr.soleil.archiving.hdbtdb.api.tools.SpectrumEvent_RO;
import fr.soleil.archiving.hdbtdb.api.tools.SpectrumEvent_RW; import fr.soleil.archiving.hdbtdb.api.tools.SpectrumEvent_RW;
public class FileTools { public class FileTools {
private static final String NAN_VALUE = "NAN";
private final int dataFormat; private final int dataFormat;
private final int writable; private final int writable;
private String fileName; private String fileName;
...@@ -302,7 +303,7 @@ public class FileTools { ...@@ -302,7 +303,7 @@ public class FileTools {
exportFileToDB(fileName); exportFileToDB(fileName);
} }
} catch (final IOException e) { } catch (final IOException e) {
StringBuilder messageBuilder = new StringBuilder(); final StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append("ERROR !! ").append("\r\n").append("\t Origin : \t ").append("FileTools.initFile") messageBuilder.append("ERROR !! ").append("\r\n").append("\t Origin : \t ").append("FileTools.initFile")
.append("\r\n").append("\t Reason : \t ").append(e.getClass().getName()).append("\r\n") .append("\r\n").append("\t Reason : \t ").append(e.getClass().getName()).append("\r\n")
.append("\t Description : \t ").append(e.getMessage()).append("\r\n") .append("\t Description : \t ").append(e.getMessage()).append("\r\n")
...@@ -334,10 +335,13 @@ public class FileTools { ...@@ -334,10 +335,13 @@ public class FileTools {
if (isValidLine(timeStampValue)) { if (isValidLine(timeStampValue)) {
doExport(); doExport();
if (dbProxy.getDataBase().isOracle()) { if (dbProxy.getDataBase().isOracle()) {
if (readValue == null || GlobalConst.ARCHIVER_NULL_VALUE.equalsIgnoreCase(readValue.trim())) { // XXX : regression for oracle that do no more support NaN. cf JIRA SOLEIL CTRLDESK-2282
if (readValue == null || readValue.equalsIgnoreCase(NAN_VALUE)
|| GlobalConst.ARCHIVER_NULL_VALUE.equalsIgnoreCase(readValue.trim())) {
readValue = GlobalConst.ORACLE_NULL_VALUE; readValue = GlobalConst.ORACLE_NULL_VALUE;
} }
if (writeValue == null || GlobalConst.ARCHIVER_NULL_VALUE.equalsIgnoreCase(writeValue.trim())) { if (writeValue == null || writeValue.equalsIgnoreCase(NAN_VALUE)
|| GlobalConst.ARCHIVER_NULL_VALUE.equalsIgnoreCase(writeValue.trim())) {
writeValue = GlobalConst.ORACLE_NULL_VALUE; writeValue = GlobalConst.ORACLE_NULL_VALUE;
} }
if (scalarEvent.getDataType() == TangoConst.Tango_DEV_STRING) { if (scalarEvent.getDataType() == TangoConst.Tango_DEV_STRING) {
...@@ -415,7 +419,7 @@ public class FileTools { ...@@ -415,7 +419,7 @@ public class FileTools {
logger.error("IOException for " + scalarEvent.getAttributeCompleteName()); logger.error("IOException for " + scalarEvent.getAttributeCompleteName());
throw new NoRetryException("File access error", e.getClass().getName(), null, ErrSeverity.ERR, throw new NoRetryException("File access error", e.getClass().getName(), null, ErrSeverity.ERR,
e.getMessage(), "FileTools.processEventScalar", e); e.getMessage(), "FileTools.processEventScalar", e);
} catch (Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("Unknow Exception for " + scalarEvent.getAttributeCompleteName()); logger.error("Unknow Exception for " + scalarEvent.getAttributeCompleteName());
if (e instanceof ArchivingException) { if (e instanceof ArchivingException) {
...@@ -668,7 +672,7 @@ public class FileTools { ...@@ -668,7 +672,7 @@ public class FileTools {
} }
} catch (final IOException e) { } catch (final IOException e) {
StringBuilder messageBuilder = new StringBuilder(); final StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append("ERROR !! ").append("\r\n").append("\t Origin : \t ") messageBuilder.append("ERROR !! ").append("\r\n").append("\t Origin : \t ")
.append("FileTools.processEventImage").append("\r\n").append("\t Reason : \t ") .append("FileTools.processEventImage").append("\r\n").append("\t Reason : \t ")
.append(e.getClass().getName()).append("\r\n").append("\t Description : \t ") .append(e.getClass().getName()).append("\r\n").append("\t Description : \t ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment