PowerBuilder Classdefinition not threadsafe?

Hi,
I have an object that uses the Classdefinition variable to access the variablelist.
This functionality runs fine in single task environment (if I simple CREATE the object). But if I run it in a separate task (as SharedObject) the results are sometimes unexpected. For instance I sometimes get empty variable names or the function call or the whole application hangs.
May it be, that the access of Classdefinition is not threadsafe?
I have tested it with a simple test application (no PFC or others).

Additional information:
To avoid the problem I now use a mutex to serialize the access. It works almost good!
But now Powerbuilder crashes only sometimes at access of variablelist property:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Program Files (x86)\Sybase\PowerBuilder 12.0\PB120.EXE
R6025
- pure virtual function call
Any ideas what's the reason?

Similar Messages

  • PowerBuilder could not open application

    I'm new on Powerbuilder, I'm trying to edit an exist project it was built using Powerbuilder 7 but I have some library do not open and I get message "Could not open application 'pathmainlibrary' in 'C:\Documents and Settings\Administrator\Desktop\SAD\pathmain.pbl'"

    There could be another library missing from your library list that contains an object referenced by the application object.

  • PowerBuilder 12.5.2 question

    Does PowerBuilder 12.5.2 include any component in order to develop Mobile applications? If so which component is it?

    Hi Erika;
      PowerBuilder does not posses any web or mobility features and neither will PB v15 (either Classic or PB.Net). However, as Roland eludes to - Appeon provides both of these features for PB developers in the form of its Appeon Web and Appeon Mobile products.
    For lots of articles on Appeon, type in "Appeon" in the Search criteria area ... Great White North Technical Evangelist
    Also, check out PBTV for more Appeon information ....  PowerBuilderTV</title> <meta property="og:title" content="PowerBuilderTV"/> <me…
    HTH
    Regards ... Chris
    PS: I have a free PB/Appeon framework as well:  STD Foundation Classes | Free Development software downloads at SourceForge.net

  • XMLNode.selectNodes() threadsafe?

    Running a multi-threaded application that hits the XMLNode.selectNodes()
    right at the same time doing a node.selectNodes("*") throws null pointer exceptions.
    This does not happen in a single threaded mode. (See exception below). Also,
    the same program produces inconsistent results running in a threaded mode using
    the selectNodes extensively. It seems that the code is not threadsafe. I know that
    the inputs to the call are not null, something in the xml parser code is having a problem.
    java.lang.NullPointerException
    at oracle.xml.parser.v2.XPathStep.getSelectedNodes(XPathStep.java:383)
    at oracle.xml.parser.v2.PathExpr.getSelectedNodes(XSLNodeSetExpr.java:549)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:694)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:665)
    at oracle.xml.parser.v2.XMLNode.selectNodes(XMLNode.java:723)
    at org.oclc.util.xml.oracle.XPathUtil.selectNodes(XPathUtil.java:49)
    at org.oclc.util.xml.XSLUtil.selectNodes(XSLUtil.java(Compiled Code))
    at org.oclc.xwc.data.recordloader.AbstractOracleRecordLoader.generateTerms(AbstractOracleRecordLoader.java(Compiled Code))
    at org.oclc.xwc.data.recordloader.LoadMDATA.loadRe[i]Long postings are being truncated to ~1 kB at this time.

    Do you have any thread updating the DOM at the same time?

  • JFrame is not repainted?

    If I write any Java program which does mostly heavy I/O and want to report progress by updating a window with a record count (or use a JProgressBar), the call to update the window never happens until all the I/O has finished. If have tried using a separate thread, with higher priority, but that does not help. What am I doing wrong?

    You cannot perform long-running tasks (such as I/O) on the Event Dispatch Thread (the main GUI thread). If you do, the GUI will not be able to update itself until your task completes, as you have seen.
    The short answer is: Do your I/O in a separate Thread. javax.swing.SwingWorker was designed for this task. If you're doing stuff on a separate Thread, keep in mind that (most) all of Swing is not threadsafe, and Swing methods should be called on the Event Dispatch Thread. This can be done via SwingUtilities.invokeLater(), or by proper use of SwingWorker.
    Longer answer: read this: [Lesson: Concurrency in Swing|http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html] .
    If you believe you're following these rules and still having trouble, post an SSCCE for assistance.

  • ORA-24347 with Powerbuilder

    Found that the column alias is what causes this error when accessing views.
    Views that have been created using this method:
    select sum(col_11) total, acct_num from abc
    or
    select sum(col_11) as total, acct_num from abc
    will not work with Powerbuilder 8 at present.
    It appears that the column alias is handled somewhat different in 8i and Powerbuilder has not supported all methods.

    I have also run into a problem with this error message.
    In our case although it came to light when we upgraded to PB 8.
    Accessing a view triggered the error.
    I have found that trying to display the properties of the view in the database painter will bring up a blank messagebox and the view definition will display nothing.
    Only if you retrieve data from the same view it will cause a corruption in the connection and any other view or table will display this message ORA-24347 "Warning of a null column in an aggregate function"
    In hitting views at random through the database painter - several views were found to suffer from this problem.
    There is nothing within the SQL that can explain it.
    One of the views is no more than a straight select from a single table.

  • Help using AEWsetunsol() with PowerBuilder 7 on Nt4

    I am trying to use AEWsetunsol() with Powerbuilder 7 on WinNT 4 (sp6a) or Win2000.
    Can anyone help with regards to what we have to do in PB to get this to work?
    Please be explicit.
    Thanks in advance.
    ..Lyall

    Got it working but had to write a tpinit() wrapper in a DLL in order to get it
    to work.
    The wrapper function allocated the TPINIT buffer and populated the structure with
    appropriate usernames/passwords (none in my case) but we set the 'flags' field
    to 1 (notify by signal). [Powerbuilder does not handle structures terribly well
    I am led to understand]
    If we did not do this, the AEWsetunsol() did not work.
    The code window open is as follows :-
    // pb_SetLoginInfo() is custom written DLL function - simply
    // allocates the TPINIT buffer and populates it.
    // fields in same order as TPINIT buffer
    If (pb_SetLoginInfo("", "", "", "", 1, 0, "") < 0) Then //flag set to 1 - TPU_SIG
    indicating unsolicited notification selected by signals
         messagebox("Error", "Fail pb_SetLoginInfo()")
         return
    End If     
    // pb_tpinit() is custom written DLL function - simply calls tpinit() with the
    structure populated by pb_SetLoginInfo()
    IF ( pb_tpinit() < 0) Then //call tp_init from user defined external dll
         messagebox("Error", "Fail tpinit()")
         tpterm()
         return
    End If
    We wanted to be notified by PBM_CUSTOM68 (Powerbuilder custom event 68)
    Then, we called the AEWsetunsol as follows :-
    //start subscribing to event
    il_windowHandle = Handle(THIS)
    //set event to trigger when receive unsolicited message
    IF (AEWsetunsol(il_windowHandle, (1023+68)) < 0) Then //the (1023+68) indicates
    the event id for pbm_custom68
         messagebox("Error", "Fail AEWsetunsol()")
         tpterm()
         return
    End If
    We then setup a custom pb event to receive these events, subscribed to an event
    and off we went.
    Now, if we could only convince the Tuxedo 8 WS DLL to work with Powerbuilder (rather
    than crashing on APP exit)
    Hope this helps someone.
    ..Lyall

  • Fatal Error and NullPointerException in Oracle XML Transformer

    Hi,
    I'm building a dom tree in memory with oracle xml parser. Then I transform the dom document into a string to send xml to the client. But I get an fatal error on calling transform.
    I don't know what could be the problem, because apache and weblogic parser works, an when I create a dom document with org.w3c.dom elements and statements then the xml document can't be invalid,
    because the document implementation would throw an exception if wrong nodes or something like this should be inserted...
    I'm using oracle xml parser 9.2.0.4 for java, bea weblogic 7.0 and win2k.
    Thanks for help.
    XSL-1900: (Fatal Error) An internal error condition occurred.
    javax.xml.transform.TransformerException: XSL-1900: (Fatal Error) An internal error condition occurred.
    at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:681)
    at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:309)
    java.lang.NullPointerException
    at oracle.xml.parser.v2.XSLSAXPrintDriver.printAttributes(XSLSAXPrintDriver.java:394)
    at oracle.xml.parser.v2.XSLSAXPrintDriver.startElement(XSLSAXPrintDriver.java:322)
    at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:993)
    at oracle.xml.parser.v2.XMLNode.reportChildSAXEvents(XMLNode.java:1014)
    at oracle.xml.parser.v2.XMLDocument.reportSAXEvents(XMLDocument.java:942)
    at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:294)

    Hi,
    I'm having that problem to:
    I'm getting the following exception
    javax.xml.transform.TransformerException: XSL-1900: (Fatal Error) An internal error condition occurred.
         at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:723)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:340)
         at com.ac.mqif.control.Handler.handleLong(Handler.java:835)
         at com.ac.mqif.control.Handler.run(Handler.java:951)
    Caused by: java.lang.NullPointerException
         at oracle.xml.parser.v2.XPathStep.getSelectedNodes(XPathStep.java:380)
         at oracle.xml.parser.v2.PathExpr.getValue(XSLNodeSetExpr.java:483)
         at oracle.xml.parser.v2.XSLExprBase.getStringValue(XSLExprBase.java:363)
         at oracle.xml.parser.v2.XSLValueOf.processAction(XSLValueOf.java:99)
         at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:367)
         at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:199)
         at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:214)
         at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:207)
         at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:207)
         at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:120)
         at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:367)
         at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:199)
         at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:471)
         at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:448)
         at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:246)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:327)
         ... 2 more
    when using a stylesheet which has a template match condition of more than 1600 characters.
    The second thing is that the Oracle XML transformer is
    NOT threadsafe. I was using several threads using different templates to transform an incoming XML simultaneously but was ALWAYS getting internal XSL errors
    and Nullpointer Exceptions. I solved this by synchronizing the transformation, but I don't like it.
    I'm using the following versions on Windows XP:
    Oracle IDE: 9.0.3.10.35
    Business Components Version: 9.0.3.10.7
    SCM Support Version: 9.0.3.9.4
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
    Thanx,
    Ellcrys

  • 3 seconds for web service to call another web service

    Greetings All,
    I am curious as to why a PowerBuilder WebService, written in PB12.5, calling any other webservice (PowerBuilder or otherwise), takes 3 seconds to connect.
    Our PowerBuilder webservices, when called either from external sources, or from internal applications, connect almost instantly, and execute quickly. But if we have a webservice, that then tries to call any other webservice, that call takes 3 seconds (minimum time) to call.
    Example:
    Application -> Webservice to send an email (PB12.5) – sub-second response time
    Application -> webservice (PB12.5) -> Webservice to send an email (PB12.5) – The webservice to webservice call takes 3 seconds. The email webservice is the same webservice in both cases.
    PowerBuilder webservices are dot net webservices. (Deployed as .net, not written as .net).
    Thanks for any insights!!
    Paul

    Hello Paul,
    If you have a valid S-user id, you can follow these steps to get the PowerBuilder Release Notes:
    Go to https://support.sap.com
    In the "Search for SAP Notes, Knowledge Base Articles and more", enter keywords "PowerBuilder release notes"
    Currently, you should get 12 hits, such as "PowerBuilder and InfoMaker 12.5 SP02 PL06 (build 5652) Release Notes Information"
    Click the link and you will see the bug list in this SAP note
    HTH
    Jacob

  • IKM file to file (java) error

    Hi Team,
    I am using IKM file to file (java) to laod the data and am getting the following error at compile step. Please help me out here.
    com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: Error during task interpretation.
    Task: 2
    java.lang.Exception: BeanShell script error: Sourced file: inline evaluation of: ``out.print("OdiOutFile \"-FILE=") ; out.print(snpRef.getSchemaName("CT_Sample", " . . . '' : Unary operation "+" inappropriate for object : at Line: 178 : in file: inline evaluation of: `` /* This function is used to replace at code generation time the column names in . . . '' : + ");" ) ;
    BSF info: Create transformer at line: 0 column: columnNo
    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:485)
    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:711)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``out.print("OdiOutFile \"-FILE=") ; out.print(snpRef.getSchemaName("CT_Sample", " . . . '' : Unary operation "+" inappropriate for object : at Line: 178 : in file: inline evaluation of: `` /* This function is used to replace at code generation time the column names in . . . '' : + ");" ) ;
    BSF info: Create transformer at line: 0 column: columnNo
    at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
    at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:471)
    ... 11 more
    Text: OdiOutFile "-FILE=<?=snpRef.getSchemaName("CT_Sample", "W") ?>/<?= getOdiClassName() ?>.java"
    import java.io.BufferedWriter;
    import java.io.BufferedReader;
    import java.io.Reader;
    import java.io.FileReader;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.io.FileOutputStream;
    import java.io.OutputStreamWriter;
    import java.io.FileWriter;
    import java.io.File;
    import java.io.IOException;
    import java.io.FilenameFilter;
    import java.util.Scanner;
    import java.util.HashMap;
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    import java.lang.String;
    import java.lang.StringBuilder;
    import java.lang.RuntimeException;
    import java.text.ParseException;
    import java.text.ParsePosition;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.text.DecimalFormat;
    import java.text.DecimalFormatSymbols;
    import java.math.BigDecimal;
    public class <?= getOdiClassName() ?> {
    /* Number of threads that are to be run in parallel */
    static int NB_THREADS = 1;
      BufferedWriter pBufferedWriter;
    BufferedWriter pBufferedLogWriter;
    BufferedWriter pBufferedBadWriter;
    int nbError;
    int nbErrorInPrevFiles;
    int nbLine;
    int nbTotalLine;
    int nbWarning;
    int nbFiles;
    int nbFilter;
    int nbFilterInPrevFiles;
    int nbHeader;
    int nbInserted;
    boolean doWeContinueBatch = true;
    boolean maxErrorReach = false;
    //boolean warning = false;
    //String warning_txt ="";
    Date debut = new Date();
    Date end =  new Date();
    static int maxError=0;
      * @param pBufferedWriter
      * @param pBufferedLogWriter
      * @param pBufferedBadWriter
      * @param nbError
      * @param nbLine
      * @throws IOException
    public <?= getOdiClassName() ?>(String targF,String logF,String badF) throws IOException {
      super();
      this.pBufferedWriter = new BufferedWriter(new FileWriter(targF, false));
      this.pBufferedLogWriter = new BufferedWriter(new FileWriter(logF, false ));
      this.pBufferedBadWriter = new BufferedWriter(new FileWriter(badF, false )); 
      pBufferedLogWriter.append("Oracle Data Integrator * File to File:\nCopyright (c) Oracle Corporation.  All rights reserved.");
      pBufferedLogWriter.append("\n\nNumber of threads: "+NB_THREADS);
      pBufferedLogWriter.append("\n\nDiscardmax: 1");
      pBufferedLogWriter.append("\n\nOutputFile:\t\t"+targF+"\nBAD file:\t\t"+badF+"\n");
      this.nbError = 0;
      this.nbErrorInPrevFiles = 0;
      this.nbLine = 0;
      this.nbTotalLine=0;
      this.nbWarning=0;
      this.nbFiles=0;
      this.nbHeader=0;
      this.nbFilter=0;
      this.nbFilterInPrevFiles = 0;
      this.nbInserted=0;
    /* A simple object used to synchronize the reads of the source file and avoid overlap between the various threads */
    static Object lock = new Object();
    HashMap<Object, BigDecimal> sequenceMap = new HashMap<Object, BigDecimal>();
    HashMap<Object, BigDecimal> counterMap = new HashMap<Object, BigDecimal>();;
    public boolean getDoWeContinueBatch()
      return doWeContinueBatch;
    public void addInserted()
      synchronized(lock) {
       nbInserted+=1;
    public void addWarning()
      synchronized(lock) {
       nbWarning+=1;
    public void addFilter()
      synchronized(lock) {
       nbFilter+=1;
    public BigDecimal getCounter(Object pFieldValue, long pStartValue) {
      if (counterMap.containsKey(pFieldValue)) {
       return counterMap.get(pFieldValue);
      } else {
       counterMap.put(pFieldValue, new BigDecimal(pStartValue));
       return counterMap.get(pFieldValue);
    public BigDecimal incrementCounter(Object pFieldValue, long pStartValue) {
      if (counterMap.containsKey(pFieldValue)) {
       counterMap.put(pFieldValue, counterMap.get(pFieldValue).add(BigDecimal.ONE));
       return counterMap.get(pFieldValue);
      } else {
       counterMap.put(pFieldValue, new BigDecimal(pStartValue));
       return counterMap.get(pFieldValue);
    public BigDecimal smartSequence(Object pField, Object pValue, long pStartValue) {
      if (pField.equals(pValue)) {
       return incrementCounter(pValue, pStartValue);
      } else {
       return getCounter(pValue, pStartValue);
    public BigDecimal smartSequence(Object pField, Object pValue) {
      return smartSequence(pField, pValue, 0);
    public BigDecimal normalSequence(Object pSequenceName, long pStartValue) {
      if (sequenceMap.containsKey(pSequenceName)) {
       synchronized(sequenceMap.get(pSequenceName)) {
        sequenceMap.put(pSequenceName, sequenceMap.get(pSequenceName).add(BigDecimal.ONE));
        return sequenceMap.get(pSequenceName);
      } else {
       synchronized (sequenceMap) {
        sequenceMap.put(pSequenceName, new BigDecimal(pStartValue));
        return sequenceMap.get(pSequenceName);
    public BigDecimal normalSequence(Object pSequenceName) {
      return normalSequence(pSequenceName, 0);
    /* Utility class used for String processing */
    class OdiStringUtils {
      /* This method is used to write Input String into the StringBuilder that contains the target row and pad with spaces if necessary */
      public void pad(StringBuilder pStringBuilder, String pString, int pLength) {
       pStringBuilder.append(pString);
       for (int i=0;i<pLength-pString.length();i++) {
        pStringBuilder.append(' ');
    /* This class is the formatter for Strings that are to be written to the target file */
    class OdiStringFormatOUT{
      OdiStringUtils myStringUtils;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      String xString;
      private void check(Warning Odiwarn) throws Exception
       if (xString.length() > colBytes)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+xString+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+xString+" Value too long\n");
         xString="";
         return;  
        if (xString.length() ==0)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : is mandatory\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : is mandatory\n");
      public OdiStringFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,int pColBytes, OdiStringUtils pStringUtils) {
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = pColBytes;
      public void format(String pString, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       xString=pString;
       this.check(Odiwarn);
       pStringBuilder.append(xString);
    /* This class is the formatter for Strings that are to be read from the source file */
    class OdiStringFormatIN{
      OdiStringUtils myStringUtils;
      String odiColname;
      String colNullIfErr;
      public OdiStringFormatIN(OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname=pColname;
       colNullIfErr=pColNullIfErr;
      public String parse(String pString,Warning Odiwarn) {
       return pString;
    /* This class is the formatter for Numbers that are to be written to the target file.
    Note that some more format() functions should be added to fully support all the possible datatypes (int, etc.) */
    class OdiNumberFormatOUT{
      OdiStringUtils myStringUtils;
      DecimalFormat internalParser;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      private void check(Number pNumber,Warning Odiwarn) throws Exception
       if (pNumber == null && colMandatory=="1" )
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" is  mandatory\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" is  mandatory\n");
       private void check(double pDouble,Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+pDouble+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+pDouble+" Value too long\n");
       private void check(long pLong,Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+pLong+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+pLong+" Value too long\n");
      public OdiNumberFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,int pColBytes, OdiStringUtils pStringUtils) {
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = pColBytes;
       if (colDecSep == null) {
        colDecSep = ".";
       if (colDecSep.length() != 1) {
        colDecSep = ".";
       DecimalFormatSymbols mySymbols = new DecimalFormatSymbols();
       mySymbols.setDecimalSeparator(colDecSep.charAt(0));
       internalParser = new DecimalFormat("#.#", mySymbols);
       internalParser.setParseBigDecimal(true);
      public void format(Number pNumber, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pNumber,Odiwarn);
       if (pNumber == null) {
        return;
       pStringBuilder.append(internalParser.format(pNumber));
      public void format(double pDouble, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pDouble,Odiwarn);
       pStringBuilder.append(internalParser.format(pDouble));
      public void format(long pLong, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pLong,Odiwarn);
       pStringBuilder.append(internalParser.format(pLong));
    /* This class is the formatter for Numbers that are to be read from the source file. */
    class OdiNumberFormatIN{
      OdiStringUtils myStringUtils;
      DecimalFormat internalParser;
      ParsePosition internalParsePosition;
      String odiColname;
      String colNullIfErr;
      public OdiNumberFormatIN(String pDecimalSeparator, OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname=pColname;
       colNullIfErr=pColNullIfErr;
       if (pDecimalSeparator == null) {
        pDecimalSeparator = ".";
       if (pDecimalSeparator.length() != 1) {
        pDecimalSeparator = ".";
       DecimalFormatSymbols mySymbols = new DecimalFormatSymbols();
       mySymbols.setDecimalSeparator(pDecimalSeparator.charAt(0));
       internalParser = new DecimalFormat("#.#", mySymbols);
       internalParser.setParseBigDecimal(true);
       internalParsePosition = new ParsePosition(0);
      /* This function returns null in case an Exception occurs during the parsing of the String as a Number */
      public Number parse(String pString, Warning Odiwarn) throws Exception {
       internalParsePosition.setIndex(0);
       Number x= internalParser.parse(pString.trim(), internalParsePosition);
       if ((pString.trim().length()>internalParsePosition.getIndex()))
       { x=null;
        if (colNullIfErr=="0"){
        throw new Exception (odiColname+" "+pString.trim()+" Invalid number\n");
        if (colNullIfErr=="1")
         Odiwarn.AddWarn(odiColname+": "+pString.trim()+" Invalid number");
       return x;
    /* This class is the formatter for Dates that are to be read from the source file */
    class OdiDateFormatIN{
      OdiStringUtils myStringUtils;
      SimpleDateFormat internalParser;
      ParsePosition internalParsePosition;
      String odiColname;
      String colNullIfErr;
      String localPattern="";
      public OdiDateFormatIN(String pPattern, OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname = pColname;
       colNullIfErr=pColNullIfErr;
       if (pPattern == null) {
        localPattern = "dd/MM/yyyy";
       } else localPattern=pPattern;
       //internalParser = new SimpleDateFormat(pPattern);
       //internalParsePosition = new ParsePosition(0);
      /* This method returns null if an error occurs when parsing the String as a date */
      public Date parse(String pString, Warning Odiwarn) throws Exception {
       internalParser = new SimpleDateFormat(localPattern);
       internalParsePosition = new ParsePosition(0);
       internalParsePosition.setIndex(0);
       internalParser.setLenient(false);
       Date x= internalParser.parse(pString.trim(),internalParsePosition);
       //trace("this is bad file");
       if (internalParsePosition.getErrorIndex() > -1 && pString.length()>0 )
       { x=null;
        if (colNullIfErr=="1") {
         Odiwarn.AddWarn(odiColname+": "+pString.trim()+" Invalid date");
        if (colNullIfErr=="0") {
        throw new Exception (odiColname+" "+pString.trim()+" Invalid date\n");
       return x;
    /* This class is the formatter for Dates that are to be written to the target file */
    class OdiDateFormatOUT{
      OdiStringUtils myStringUtils;
      SimpleDateFormat internalParser;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      Date xDate;
       private void check(Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+xDate+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+xDate+" Value too long\n");
      public OdiDateFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,OdiStringUtils pStringUtils)
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = 0;
       if (colFormat == null) {
        colFormat = "dd/MM/yyyy";
       internalParser = new SimpleDateFormat(colFormat);
      public void format(Date pDate, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       xDate=pDate;
       this.check(Odiwarn);
       if (xDate != null) {
        pStringBuilder.append(internalParser.format(xDate));
    class Warning
    boolean warning;
    String warntext;
    int currentLine;
    int nbWarn;
    public Warning ()
      warning=false;
      warntext="";
    public void New (int i)
      warning=false;
      warntext="";
      currentLine=i;
      nbWarn=0;
    public void AddWarn (String txt)
        if (warning) {
        warntext=warntext+"\n"+txt;
         } else {
        warntext=warntext+"\n"+txt;
      warning=true;
      nbWarn+=1;
    /* This class contains the code of the Thread that reads a line from the source file, processes a line and writes the output to the Target */
    class OdiFileTransformer extends Thread {
      OdiStringUtils myStringUtils= new OdiStringUtils();
      Scanner myScanner;
      Warning Odiwarn=new Warning();
      <?
        createInputFormaters();
        createOutputFormaters();
      ?>
      String tmpString;
       String[] srcCols;
      <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C1;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C2;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C3;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C4;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C5;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C6;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C7;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C8;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C9;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C10;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C11;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C12;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C13;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C14;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C15;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C16;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C17;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C18;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C19;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C20;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C21;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C22;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C23;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C24;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C25;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C26;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C27;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C28;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C29;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C30;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C31;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C32;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C33;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C34;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C35;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C36;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C37;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C38;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C39;
      String srcRecordSeparator;
      String trgRecordSeparator;
      String trgLineSeparator;
      StringBuilder myStringBuilder;
      public OdiFileTransformer(Scanner pScanner){
       super();
       myScanner = pScanner;
       tmpString = null;
       this.setName("OdiFileTransformer");
        srcCols = new String[1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1];
       srcRecordSeparator = Pattern.quote(",");
       trgRecordSeparator = ",";
       trgLineSeparator = "\n";
       myStringBuilder = new StringBuilder();
      public void run() {
      boolean bad = false;
      try {
       while (doWeContinueBatch){
        /* The calls to the Scanner need to be synchronized manually as it is not threadsafe */
        synchronized(lock) {
         if (myScanner.hasNext()) {
          tmpString=myScanner.next();
          nbLine+=1;
         } else {
          return;
        bad = false;
        Odiwarn.New(nbLine);
        try {
        srcCols = tmpString.split(srcRecordSeparator);
        /* The Filters are generated as if Statements that go to the next row to process if any condition is false */
        /* We start the processing of the line by clearing the StringBuilder */
        myStringBuilder.setLength(0);
        <? createInputFormaters("CTCL.C1"); ?><? createInputFormaters("CTCL.C2"); ?><? createInputFormaters("CTCL.C3"); ?><? createInputFormaters("CTCL.C4"); ?><? createInputFormaters("CTCL.C5"); ?><? createInputFormaters("CTCL.C6"); ?><? createInputFormaters("CTCL.C7"); ?><? createInputFormaters("CTCL.C8"); ?><? createInputFormaters("CTCL.C9"); ?><? createInputFormaters("CTCL.C10"); ?><? createInputFormaters("CTCL.C11"); ?><? createInputFormaters("CTCL.C12"); ?><? createInputFormaters("CTCL.C13"); ?><? createInputFormaters("CTCL.C14"); ?><? createInputFormaters("CTCL.C15"); ?><? createInputFormaters("CTCL.C16"); ?><? createInputFormaters("CTCL.C17"); ?><? createInputFormaters("CTCL.C18"); ?><? createInputFormaters("CTCL.C19"); ?><? createInputFormaters("CTCL.C20"); ?><? createInputFormaters("CTCL.C21"); ?><? createInputFormaters("CTCL.C22"); ?><? createInputFormaters("CTCL.C23"); ?><? createInputFormaters("CTCL.C24"); ?><? createInputFormaters("CTCL.C25"); ?><? createInputFormaters("CTCL.C26"); ?><? createInputFormaters("CTCL.C27"); ?><? createInputFormaters("CTCL.C28"); ?><? createInputFormaters("CTCL.C29"); ?><? createInputFormaters("CTCL.C30"); ?><? createInputFormaters("CTCL.C31"); ?><? createInputFormaters("CTCL.C32"); ?><? createInputFormaters("CTCL.C33"); ?><? createInputFormaters("CTCL.C34"); ?><? createInputFormaters("CTCL.C35"); ?><? createInputFormaters("CTCL.C36"); ?><? createInputFormaters("CTCL.C37"); ?><? createInputFormaters("CTCL.C38"); ?><? createInputFormaters("CTCL.C39"); ?>
        <?= replaceMappings("outC1Formatter.format(CTCL.C1,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC2Formatter.format(CTCL.C2,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC3Formatter.format(CTCL.C3,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC4Formatter.format(CTCL.C4,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC5Formatter.format(CTCL.C5,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC6Formatter.format(CTCL.C6,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC7Formatter.format(CTCL.C7,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC8Formatter.format(CTCL.C8,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC9Formatter.format(CTCL.C9,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC10Formatter.format(CTCL.C10,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC11Formatter.format(CTCL.C11,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC12Formatter.format(CTCL.C12,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC13Formatter.format(CTCL.C13,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC14Formatter.format(CTCL.C14,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC15Formatter.format(CTCL.C15,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC16Formatter.format(CTCL.C16,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC17Formatter.format(CTCL.C17,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC18Formatter.format(CTCL.C18,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC19Formatter.format(CTCL.C19,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC20Formatter.format(CTCL.C20,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC21Formatter.format(CTCL.C21,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC22Formatter.format(CTCL.C22,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC23Formatter.format(CTCL.C23,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC24Formatter.format(CTCL.C24,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC25Formatter.format(CTCL.C25,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC26Formatter.format(CTCL.C26,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC27Formatter.format(CTCL.C27,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC28Formatter.format(CTCL.C28,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC29Formatter.format(CTCL.C29,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC30Formatter.format(CTCL.C30,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC31Formatter.format(CTCL.C31,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC32Formatter.format(CTCL.C32,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC33Formatter.format(CTCL.C33,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC34Formatter.format(CTCL.C34,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC35Formatter.format(CTCL.C35,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC36Formatter.format(CTCL.C36,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC37Formatter.format(CTCL.C37,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC38Formatter.format(CTCL.C38,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC39Formatter.format(CTCL.C39,myStringBuilder,Odiwarn);") ?>
        myStringBuilder.append(trgLineSeparator);
        pBufferedWriter.write(myStringBuilder.toString());
        if (Odiwarn.warning)
         pBufferedLogWriter.append("\nwarning line: "+Odiwarn.currentLine+"\t"+Odiwarn.warntext);
         addWarning();
        addInserted();
        catch (Exception e) {
         // TODO: handle exception
         pBufferedLogWriter.append("\nError line: "+nbLine+"\t"+e.getMessage());
         e.printStackTrace();
         pBufferedBadWriter.append(tmpString+"\n");
         synchronized(lock) {
          nbError+=1;
          if (nbError >=1)
           {pBufferedLogWriter.append("Maximum number of errors reached \n");
              doWeContinueBatch=false;
              maxErrorReach=true;
           return;}
      catch (Exception e) {
       throw(new RuntimeException(e.getMessage()));
    static class OdiFileFilter implements FilenameFilter {
      Pattern myPattern;
      BufferedWriter myLogWriter;
      public OdiFileFilter (String pPattern,BufferedWriter logWriter) throws IOException {
       File pWorkSchema = new File("<?=snpRef.getSchemaName("CT_Sample", "D") ?>");
       StringBuilder buffer = new StringBuilder();
       pPattern = pWorkSchema.getAbsolutePath().replace("\\", "/") + "/" + pPattern;
       myLogWriter=logWriter;
       char[] chars = pPattern.toCharArray();
       for (int i = 0; i < chars.length; ++i)    {
        buffer.append(chars[i]);
       myPattern = Pattern.compile(buffer.toString());
       myLogWriter.append("\nPattern: " + buffer.toString());
      public boolean accept(File pDir, String pName) {
       Matcher myMatcher = myPattern.matcher(pDir.getAbsolutePath().replace("\\", "/") + "/" + pName);
       System.out.println("" + myMatcher.matches() + pDir.getAbsolutePath().replace("\\", "/") + "/" + pName);
       return myMatcher.matches();
    public static void main(String[] args) throws Exception{
      LOG_FILE =
      BAD_FILE =
       String wbadfile = "<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>.bad";
       String wlogfile = "<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>.log";
      <?= getOdiClassName() ?> myIKMFileProcessing = new <?= getOdiClassName() ?>("<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>",wlogfile,wbadfile);
      File[] inputFileList;
      OdiFileFilter myFileFilter = new OdiFileFilter("<?=snpRef.getObjectShortName("L", "Pfizer_Regional_CT_costs_Aug2013_AP.csv", "CT_Sample", "D") ?>",myIKMFileProcessing.pBufferedLogWriter);
      File inputDir = new File("<?=snpRef.getSchemaName("CT_Sample", "D") ?>");
      inputFileList = inputDir.listFiles(myFileFilter);
      String s="";
      if (inputFileList.length==0) {myIKMFileProcessing.pBufferedLogWriter.append("\n\tError : Source file does not exist");}
      for (int i=0;i<inputFileList.length;i++) {
       if (myIKMFileProcessing.getDoWeContinueBatch()) {
       s=myIKMFileProcessing.processInputFile(inputFileList[i]);
      myIKMFileProcessing.pBufferedLogWriter.append(s);
      myIKMFileProcessing.pBufferedLogWriter.flush();
    public String processInputFile(File pInputFile) throws Exception {
      /* We open the source File by taking the encoder into account if needed */
       Scanner myScanner = new Scanner(new BufferedReader(new FileReader(pInputFile)));
        pBufferedLogWriter.append("\nInput file:\t\t"+pInputFile.getAbsolutePath().replace("\\", "/"));
      /* We use a Scanner as the record separator might not necessarily be \n */
      myScanner.useDelimiter("\n");
      /* We read the first lines in order to ignore them depending on the setting of the source datastore */
      for (int i=0;i < 0;i++){
       if (myScanner.hasNext()) {
        myScanner.next();
        nbLine+=1;
        nbHeader+=1;
      OdiFileTransformer[] odiFileTransformers = new OdiFileTransformer[NB_THREADS];
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i] = new OdiFileTransformer(myScanner );
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i].start();
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i].join();
      end=new Date();
        if (maxErrorReach)
        pBufferedLogWriter.append("\n\tNumber of lines read for this file:\t\t" + nbLine);
        pBufferedLogWriter.append("\n\tNumber of data lines read for this file:\t\t" + (nbLine-1) + "\n\n\n");
        pBufferedLogWriter.append("\n\tNumber of error lines read for this file:\t\t" + (nbError-nbErrorInPrevFiles));
        pBufferedLogWriter.append("\n\tNumber of data lines read and filtered out for this file:\t\t" + (nbFilter-nbFilterInPrevFiles)+"\n");
      else
         pBufferedLogWriter.append("\n\tNumber of lines for this file:\t\t" + nbLine);
         pBufferedLogWriter.append("\n\tNumber of data lines for this file:\t\t" + (nbLine-1));
         pBufferedLogWriter.append("\n\tNumber of error lines for this file:\t\t" + (nbError-nbErrorInPrevFiles));
         pBufferedLogWriter.append("\n\tNumber of data lines filtered out for this file:\t\t" + (nbFilter-nbFilterInPrevFiles)+"\n");
        nbFiles+=1;
        nbTotalLine+=nbLine;
        nbErrorInPrevFiles = nbError;
        nbFilterInPrevFiles = nbFilter;
        nbLine=0;
        String s = "\n\n\n\n************************** TOTAL FIGURES ********************************";
        s = s + "\n\t"+nbFiles+" input file(s) processed.\n";
        s = s + "\n\t"+nbTotalLine+" Rows successfully read.\n" ;
        s = s +"\t"+nbHeader+" Rows skipped (Header).\n" ;
        s = s + "\t"+nbInserted+" Rows successfully loaded.\n" ;
        s = s +"\t\t==>"+nbWarning+" Rows loaded with warning.\n" ;
        s = s +"\t"+nbError+" Rows not loaded due to data errors.\n" ;
        s = s +"\t"+nbFilter+" Rows not loaded because of filter.\n" ;
        s = s + "\n\n\n";
        s = s + "\n\tRun began on "+debut;
        s = s + "\n\tRun ended on "+end;
        //long x=   ;
        s = s + "\n\tElapsed time was:\t"+Math.abs(end.getTime() - debut.getTime())+" milliseconde";
      /* We flush the buffer for any data that has not been written on the disk yet */
      pBufferedWriter.flush();
      pBufferedLogWriter.flush();
      pBufferedBadWriter.flush();
      return s;
    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:738)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)

    This seems like a lot of code. I would suggest to compile your custom code outside of odi first to debug any syntax errors.

  • 0xC0000005 Access Violation in cvirte.dll (SetWindowsErrorMode?)

    Hello,
    We will occasionally see a crash with our CVI LabWindows based 2010 SP1 application, a 0xC0000005 Access Violation exception thrown from within cvirte.dll. The app is working primarily from a spawned thread when the crash occurs. I've been able to get it consistently on a Win7 x64 VirtualBox VM and have some data that may be of use if someone there would like to investigate.
    When I track down the location of the instruction pointer (work below) it seems to be in the "SetWindowsErrorMode()" function (at least going by the exports in DependencyWalker):
    1. The IP is 0x687B5F1C at the time of the crash.
    2. The base module address for cvirte.dll is 0x68420000, so the IP is 0x395F1C bytes into the DLL.
    3. Using DependencyWalker on cvirte.dll and sorting by entry point indicates that the IP is inside of "SetWindowsErrorMode()" at 0x003938D0, which comes before "MinimizeAllWindows()" at 0x003984B0.
    Coincidentally, this crash happens in CVI 2013 F1 as well, the offset within "SetWindowsErrorMode()" is a bit different (0x264C past entry in 2010 SP1, 0x2D0C past entry in 2013), but locally the code looks the same in my VS2010 disassembler:
    CVI2010 SP1
    *Address *Code Bytes          *Instruction
    687B5F02 89 17                mov dword ptr [edi],edx
    687B5F04 8B 48 5C             mov ecx,dword ptr [eax+5Ch]
    687B5F07 89 78 6C             mov dword ptr [eax+6Ch],edi
    687B5F0A 89 4F 04             mov dword ptr [edi+4],ecx
    687B5F0D 89 58 5C             mov dword ptr [eax+5Ch],ebx
    687B5F10 C7 40 60 00 00 00 00 mov dword ptr [eax+60h],0
    687B5F17 5E                   pop esi
    687B5F18 85 DB                test ebx,ebx
    687B5F1A 74 09                je 687B5F25
    687B5F1C 8B 13                mov edx,dword ptr [ebx] <--- CRASH
    CVI2013 F1
    *Address *Code Bytes          *Instruction
    687CA2B2 89 17                mov dword ptr [edi],edx
    687CA2B4 8B 48 5C             mov ecx,dword ptr [eax+5Ch]
    687CA2B7 89 78 6C             mov dword ptr [eax+6Ch],edi
    687CA2BA 89 4F 04             mov dword ptr [edi+4],ecx
    687CA2BD 89 58 5C             mov dword ptr [eax+5Ch],ebx
    687CA2C0 C7 40 60 00 00 00 00 mov dword ptr [eax+60h],0
    687CA2C7 5E                   pop esi
    687CA2C8 85 DB                test ebx,ebx
    687CA2CA 74 09                je 687CA2D5
    687CA2CC 8B 13                mov edx,dword ptr [ebx] <--- CRASH
    I have dump files (mini, or mini+heap) for both builds if it would help.
    This bug seems semi-similar to the thread "Is InstallPopup not threadsafe?":
    http://forums.ni.com/t5/LabWindows-CVI/Is-InstallPopup-not-threadsafe/m-p/716822/highlight/true#M359...
    Just for posterity, I'll add the data for the 2013 build. IP is 0x687CA2CC, DLL Module address is 0x68420000-0x68A28000, so offset is 0x3AA2CC. "SetWindowsErrorMode()" enters at 0x003A75C0 in this dll, and "MinimizeAllWindows()" is at 0x003ACB20.
    Thanks-
    Baker

    Hi Kelsey,
    Apologies for the long response time, I didn't receive a notification for your post.
    > What does your application do?
    Our application is used in this context to setup and run our vehicle simulations on a Windows based PC.
    > And, what is it doing at the time of the crash?
    At the time of the crash a simulation is being launched and run on another thread from the default thread pool like this:
    CmtScheduleThreadPoolFunctionAdv (DEFAULT_THREAD_POOL_HANDLE,
        sRun,
        NULL,
        THREAD_PRIORITY_NORMAL,
        NULL,
        EVENT_TP_THREAD_FUNCTION_END,
        NULL,
        RUN_IN_SCHEDULED_THREAD,
        &sThreadFuncId);
    That spawned thread will load a simulation DLL, read some data as input, run the simulation, output the results, then close the DLL.
    As I noted earlier, I couldn't get it to happen on my desktop, but I could get it on the VM when I used a very slow storage device for the I/O of the simulation (a slow thumb drive attached to the VM). My boss was seeing the issue on his virtualized PC on his Mac, typically only when he used a slower storage device as well (network storage for example).
    > When you reproduce this issue in 2010 and 2013 f1, are you using the same computer or using different machines?
    Both of these crash dumps were produced on the virtual machine as described.
    > For each dump file, which version of LabWindows/CVI were you running? You can find the version number by selecting Help»About LabWindows/CVI within LabWindows/CVI. Which version of cvirte.dll do you have? This will be located in System32 and/or SysWOW64.
    The development environment installed was CVI 2010 SP1. So the 2010 dump was just using the runtimes bundled with that installation. I then installed the 2013 F1 runtimes to see if the same issue persisted.
    It's possible I did a clean install with the 2013 F1 dev environment, I will double check this tomorrow when I have access to the virtual machine.
    Thanks for looking into this--
    Baker

  • Cannot access remote FoxPro dbf file using jdbc-odbc and system DSN

    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database. I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

    Laura Ren wrote:
    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database.What exception do you get? WebLogic is just like any other Java App. That code
    should work OK (though I have a better way)... Be warned that the JDBC ODBC
    bridge is specifically dangerous. It is not threadsafe.
    Joe
    I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

  • Application Managed Encryption - ML6020

    Any Dell ML6020 Library firmware starting with a 6 (660G in this case) -  Encryption default is "None"
    How do you change the default to Application Managed ?  I currently cannot change it from Web client.
    From the Web Client - Setup - Encryption - Partition - Configuration - at this point it stops with error message EKM is required. 
    Dell documentations says EKM is not required when using Application Managed Software for Encryption.
    BUT in order to use Application Managed software I need the Encryption set to  Application Managed, not NONE.
    This is not an issue with ML6020 firmware level 585G.GS003 - the default setting for encryption is "Application Managed"   
    What happened from 5XXX to 6XXX library firmware ?  Need level 6XXX for LTO6 tape drives

    Hi Clemens,
    in your first case, please be aware that you should not inject an entity manager into a servlet, as an <b>entity manager is not threadsafe</b>. Injecting an emf into a Servlet fine - entity manager factories are threadsafe.
    In your second case, the em is not participating in the user transaction.
    If you create the entity manager outside the user transaction, you have got to explicitly invoke <b>em.joinTransaction() </b> once the user transactgion is active:
    <b>EntityManager em = emf.createEntityManager();</b>
    Part p = new Part();
    p.setDescription("description");
    p.setName("firstPartName");
    p.setId(3L);
    <b>utx.begin();</b>
    <b>em.joinTransaction();</b>
    em.persist(p);
    utx.commit();
    em.close();
    Alternatively, you can create the em inside the user transaction:
    Part p = new Part();
    p.setDescription("description");
    p.setName("firstPartName");
    p.setId(3L);
    <b>utx.begin();
    EntityManager em = emf.createEntityManager();</b>
    em.persist(p);
    utx.commit();
    em.close();
    Best regards,
    Adrian

  • Thread-safe and performant way to return rows and then delete them

    Hi all
    I have a table containing rows to be processed by Java. These rows need to be returned to Java, then they willl be processed and sent to a JMS queue, then if that JMS operation is successful they need to be deleted from the Oracle table..
    The current method is:
    Java calls Oracle SP with 'numrows' parameter.
    Oracle SP updates that number of rows in the table with a batch ID from a sequence, and commits.
    Oracle SP returns the Batch_ID to Java.
    Java then selects * from table where batch_id = XXXX;
    Java sends messages to JMS. If JMS transaction is OK, Java deletes from table where batch_Id =xxxx and commits;
    Clearly this isn't very efficient. What I would like to do is this:
    Java calls Oracle SP with 'numrows' parameter
    Oracle SP returns that many rows in a cursor and deletes them from the table simultaneously. Oracle SP does not open a new transaction - transaction is controlled from JAva.
    Java writes to JMS. If JMS is OK, Java commits its DB transaction and thus the rows are deleted.
    Therefore there's only a single DML operation - a DELETE.
    The trouble is, this is not threadsafe - if I have two Java threads calling the Oracle SP, then thread #2 may return rows that thread #1 already got - because thread#1 has not yet committed its delete, and thread#2 can select those rows. Thread#2 will then lock waiting to delete them until thread#1 has finished its delete, then thread#2 will get "0 rows deleted". But Java will stlil have been sent those rows.
    How can I engineer this method to be as efficient as possible while still being threadsafe? The key problem I'm having is that the DELETE operation doesn't prevent the rows being SELECTed by other threads - if there was a way to DELETE without committing but also immediately make those rows unavailable to other threads, that would work I think.
    Any help much appreciated
    Tom

    Hi Tom,
    You forgot to "mention" your version.
    I'm not sure, but I believe [SKIP LOCKED|http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702] is safe to use. At least in 11.1. (I have used in both 9i and 10g where it was unsupported/undocumented)
    There is of course always the boring way: A single thread.
    Regards
    Peter

  • Writing to HDF5 file timing is erratic

    Dear Community,
    I am trying to acquire and stream 10-15 megabytes / sec from a bunch of 4472 cards to an HDF5 file and I am having a problem that every once in a while, the H5Fwrite vi takes a lot of CPU time (3-10 seconds) to write a chunk to disk, during which time the backlog from the acquisition system gets too big and overflows the buffer.
    I have tried working around this by creating two loops, one of which reads data from the 4472s and puts it on a queue, while the other dequeues the data and writes it to disk.
    But I'm also wondering whether there's a way to control when the HDF5 vi's actually write to disk, and whether there are some parameters I can tune in the HDF5 libraries, such as block sizes and cache sizes
    , so that writing to disk is fast and not so "lumpy."
    I've tried using the HDF5 library functions h5Pset_cache() and h5Pset_sieve_buf_size() to change the sizes of various buffers but it doesn't seem to change anything.
    Or maybe I should just use the SFP libraries to do this instead instead of rolling my own HDF5-based vi's?
    Thanks,
    Cas
    Casimir Wierzynski
    Graduate Student, Computation and Neural Systems
    California Institute of Technology, MC 139-74
    Pasadena, CA 91125

    What hardware are you using? A 2000 era computer (Pentium III 650) should be able to sustain 10MBytes/sec or better until you run out of disk space. A 2004 era computer (Pentium 4 2.4HT) should be able to do twice that. Both are disk speed limited. Are you using a PXI controller or a desktop machine? PXI controllers use laptop hard drives to keep power consumption down. Laptop hard drives are considerably slower than those in a typical desktop machine.
    Some general tips which may help you.
    1) Make sure all other processes are turned off. This includes screensavers, the Microsoft indexing service, virus checkers, etc. This can be tough on an NT, 2000, or XP machine, but is absolutely vital if you want to sustain high speeds.
    2) Tune your HDF5 chunk size appropriately. For Windows based systems, the optimum is 65,000 points (just a bit under the 65,525 16-bit boundary). If this chunk size gets anywhere near the 1MByte size of the normal HDF5 cache, your write speeds will take a huge hit.
    3) Tune your fetch size from the 4472s for maximum performance. I would expect this to be in the low 100s of thousands of points (that is where it is for NI high-speed digitizers). Unless you increase the HDF5 buffer size from 1MByte, you probably should keep this below about 350,000 points to avoid paging problems. Just fetch the large buffer and write the whole thing at once. The HDF5 software will chunk it to disk for you.
    4) Make sure you serialize calls to the HDF5 driver. HDF5 is NOT threadsafe under Windows (it is under Linux). This could cause serious data corruption and other wierd problems if you are taking data from multiple boards and writing to the same file in multiple loops.
    5) Check your disks to make sure you do not have a hardware problem. A dying hard drive will produce symptoms similar to these. You can get utilities from the major disk manufacturers.
    If you tried all these things and are still having problems, please reply with more information. You should be able to succeed. You may also want to check out NI-HWS, available on the latest driver CD. It uses the same HDF5 format as the SFP routines, but is far easier to use.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

Maybe you are looking for