WriteStackTrace() public static method

Writes the exception stack trace to the received stream
public static WriteStackTrace ( System throwable, System stream ) : void
throwable System Exception to obtain information from
stream System Output sream used to write to
return void
 public static void Main(System.String[] args)
 {
     if (args.Length != 1 && args.Length != 2)
     {
         System.Console.Out.WriteLine("Usage: SegmentGenerator target_dir [segment_name]");
         System.Environment.Exit(1);
     }
     try
     {
         System.Type.GetType("sun.jdbc.odbc.JdbcOdbcDriver");
         if (args.Length == 1)
         {
             makeAll(args[0], "2.4");
         }
         else
         {
             System.String          source = makeSegment(args[1], "2.4");
             System.IO.StreamWriter w      = new System.IO.StreamWriter(new System.IO.StreamWriter(args[0] + "/" + args[1] + ".java", false, System.Text.Encoding.Default).BaseStream, new System.IO.StreamWriter(args[0] + "/" + args[1] + ".java", false, System.Text.Encoding.Default).Encoding);
             w.Write(source);
             w.Flush();
             w.Close();
         }
     }
     catch (System.Exception e)
     {
         SupportClass.WriteStackTrace(e, Console.Error);
     }
 }
Beispiel #2
0
        /// <summary> Read the contents of a file and place them in
        /// a string object.
        /// *
        /// </summary>
        /// <param name="file">path to file.
        /// </param>
        /// <returns>String contents of the file.
        ///
        /// </returns>
        public static String FileContentsToString(String file)
        {
            String contents = string.Empty;

            FileInfo f = new FileInfo(file);

            bool tmpBool;

            if (File.Exists(f.FullName))
            {
                tmpBool = true;
            }
            else
            {
                tmpBool = Directory.Exists(f.FullName);
            }
            if (tmpBool)
            {
                try
                {
                    StreamReader fr       = new StreamReader(f.FullName);
                    char[]       template = new char[(int)SupportClass.FileLength(f)];
                    fr.Read((Char[])template, 0, template.Length);
                    contents = new String(template);
                    fr.Close();
                }
                catch (Exception e)
                {
                    Console.Out.WriteLine(e);
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }

            return(contents);
        }
Beispiel #3
0
        /// <summary> <p>Returns a minimal amount of data from a message string, including only the
        /// data needed to send a response to the remote system.  This includes the
        /// following fields:
        /// <ul><li>field separator</li>
        /// <li>encoding characters</li>
        /// <li>processing ID</li>
        /// <li>message control ID</li></ul>
        /// This method is intended for use when there is an error parsing a message,
        /// (so the Message object is unavailable) but an error message must be sent
        /// back to the remote system including some of the information in the inbound
        /// message.  This method parses only that required information, hopefully
        /// avoiding the condition that caused the original error.  The other
        /// fields in the returned MSH segment are empty.</p>
        /// </summary>
        public override ISegment GetCriticalResponseData(String message)
        {
            //try to get MSH segment
            int locStartMSH = message.IndexOf("MSH");

            if (locStartMSH < 0)
            {
                throw new HL7Exception("Couldn't find MSH segment in message: " + message, HL7Exception.SEGMENT_SEQUENCE_ERROR);
            }
            int locEndMSH = message.IndexOf('\r', locStartMSH + 1);

            if (locEndMSH < 0)
            {
                locEndMSH = message.Length;
            }
            String mshString = message.Substring(locStartMSH, (locEndMSH) - (locStartMSH));

            //find out what the field separator is
            char fieldSep = mshString[3];

            //get field array
            String[] fields = Split(mshString, Convert.ToString(fieldSep));

            ISegment msh = null;

            try
            {
                //parse required fields
                String   encChars      = fields[1];
                char     compSep       = encChars[0];
                String   messControlID = fields[9];
                String[] procIDComps   = Split(fields[10], Convert.ToString(compSep));

                //fill MSH segment
                String version = "2.4";                 //default
                try
                {
                    version = GetVersion(message);
                }
                catch (Exception)
                {
                    /* use the default */
                }

                msh = MakeControlMSH(version, Factory);
                Terser.Set(msh, 1, 0, 1, 1, Convert.ToString(fieldSep));
                Terser.Set(msh, 2, 0, 1, 1, encChars);
                Terser.Set(msh, 10, 0, 1, 1, messControlID);
                Terser.Set(msh, 11, 0, 1, 1, procIDComps[0]);
            }
            catch (Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
                throw new HL7Exception(
                          "Can't parse critical fields from MSH segment (" + e.GetType().FullName + ": " + e.Message + "): " + mshString,
                          HL7Exception.REQUIRED_FIELD_MISSING);
            }

            return(msh);
        }
Beispiel #4
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 2)
            {
                System.Console.Out.WriteLine("Usage: Genetibase.NuGenHL7.app.Initiator host port");
            }

            try
            {
                //set up connection to server
                System.String host = args[0];
                int           port = System.Int32.Parse(args[1]);

                Parser             parser     = new PipeParser();
                LowerLayerProtocol llp        = LowerLayerProtocol.makeLLP();
                NuGenConnection    connection = new NuGenConnection(parser, llp, new System.Net.Sockets.TcpClient(host, port));
                NuGenInitiator     initiator  = connection.Initiator;
                System.String      outText    = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";

                //get a bunch of threads to send messages
                for (int i = 0; i < 1000; i++)
                {
                    SupportClass.ThreadClass sender = new SupportClass.ThreadClass(new System.Threading.ThreadStart(new AnonymousClassRunnable(parser, outText, initiator).Run));
                    sender.Start();
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Beispiel #5
0
            public virtual void  Run()
            {
                try
                {
                    //get message ID
                    System.String ID          = MessageIDGenerator.Instance.NewID;
                    Message       out_Renamed = parser.parse(outText);
                    Terser        tOut        = new Terser(out_Renamed);
                    tOut.set_Renamed("/MSH-10", ID);

                    //send, get response
                    Message in_Renamed = initiator.sendAndReceive(out_Renamed);

                    //get ACK ID
                    Terser        tIn   = new Terser(in_Renamed);
                    System.String ackID = tIn.get_Renamed("/MSA-2");
                    if (ID.Equals(ackID))
                    {
                        System.Console.Out.WriteLine("OK - ack ID matches");
                    }
                    else
                    {
                        throw new System.SystemException("Ack ID for message " + ID + " is " + ackID);
                    }
                }
                catch (System.Exception e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
Beispiel #6
0
 public MatchesParser(System.String[] commentaries)
 {
     dateDriven = false;
     vMatches   = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     for (int i = 0; i < commentaries.Length; i++)
     {
         try
         {
             //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
             //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
             //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             System.IO.StreamReader r = new System.IO.StreamReader(commentaries[i], System.Text.Encoding.Default);
             parser.setContentHandler(this);
             parser.parse(new XmlSourceSupport(r));
         }
         //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
         catch (javax.xml.parsers.ParserConfigurationException err)
         {
             System.Console.Out.WriteLine("Error while parsing XML in " + commentaries[i] + " file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
         //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
         catch (System.Xml.XmlException err)
         {
             System.Console.Out.WriteLine("Error while parsing XML in " + commentaries[i] + " file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
         catch (System.IO.IOException err)
         {
             System.Console.Out.WriteLine("Error while reading " + commentaries[i] + ".xml file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
     }
 }
Beispiel #7
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 1)
            {
                System.Console.Error.WriteLine("Usage: DefaultApplication message_file");
                System.Environment.Exit(1);
            }

            //read test message file ...
            try
            {
                System.IO.FileInfo     messageFile = new System.IO.FileInfo(args[0]);
                System.IO.StreamReader in_Renamed  = new System.IO.StreamReader(new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).CurrentEncoding);
                int    fileLength = (int)SupportClass.FileLength(messageFile);
                char[] cbuf       = new char[fileLength];
                in_Renamed.Read(cbuf, 0, fileLength);
                System.String messageString = new System.String(cbuf);

                //parse inbound message ...
                Parser  parser    = new PipeParser();
                Message inMessage = null;
                try
                {
                    inMessage = parser.parse(messageString);
                }
                catch (NuGenHL7Exception e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Beispiel #8
0
        /// <summary> <p>Creates skeletal source code (without correct data structure but no business
        /// logic) for all segments found in the normative database.  </p>
        /// </summary>
        public static void makeAll(String baseDirectory, String version)
        {
            //make base directory
            if (!(baseDirectory.EndsWith("\\") || baseDirectory.EndsWith("/")))
            {
                baseDirectory = baseDirectory + "/";
            }
            FileInfo targetDir =
                SourceGenerator.makeDirectory(baseDirectory + PackageManager.GetVersionPackagePath(version) + "Segment");

            //get list of data types
            OleDbConnection conn = NormativeDatabase.Instance.Connection;
            String          sql  =
                "SELECT seg_code, [section] from HL7Segments, HL7Versions where HL7Segments.version_id = HL7Versions.version_id AND hl7_version = '" +
                version + "'";
            OleDbCommand temp_OleDbCommand = new OleDbCommand();

            temp_OleDbCommand.Connection  = conn;
            temp_OleDbCommand.CommandText = sql;
            OleDbDataReader rs = temp_OleDbCommand.ExecuteReader();


            ArrayList segments = new ArrayList();

            while (rs.Read())
            {
                String segName = Convert.ToString(rs[1 - 1]);
                if (Char.IsLetter(segName[0]))
                {
                    segments.Add(altSegName(segName));
                }
            }
            temp_OleDbCommand.Dispose();
            NormativeDatabase.Instance.returnConnection(conn);

            if (segments.Count == 0)
            {
                log.Warn("No version " + version + " segments found in database " + conn.Database);
            }

            for (int i = 0; i < segments.Count; i++)
            {
                try
                {
                    String seg    = (String)segments[i];
                    String source = makeSegment(seg, version);
                    using (StreamWriter w = new StreamWriter(targetDir.ToString() + @"\" + GetSpecialFilename(seg) + ".cs"))
                    {
                        w.Write(source);
                        w.Write("}");
                    }
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine("Error creating source code for all segments: " + e.Message);
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
        }
Beispiel #9
0
        /// <summary>Write a Fits Object to an external Stream.  The stream is left open.</summary>
        /// <param name="dos">A DataOutput stream</param>
        public virtual void Write(Stream os)
        {
            ArrayDataIO obs;
            bool        newOS = false;

            if (os is ArrayDataIO)
            {
                obs = (ArrayDataIO)os;
            }
            else
            {
                newOS = true;
                obs   = new BufferedDataStream(os);
            }

            BasicHDU hh;

            for (int i = 0; i < NumberOfHDUs; i += 1)
            {
                try
                {
                    hh = (BasicHDU)hduList[i];
                    hh.Write(obs);
                }
                catch (IndexOutOfRangeException e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                    throw new FitsException("Internal Error: Vector Inconsistency" + e);
                }
            }

            if (newOS)
            {
                try
                {
                    obs.Flush();
                    obs.Close();
                }
                catch (IOException)
                {
                    Console.Error.WriteLine("Warning: error closing FITS output stream");
                }
            }

            // change suggested in .99 version
            try
            {
                if (obs is BufferedFile)
                {
                    ((BufferedFile)obs).SetLength(((BufferedFile)obs).FilePointer);
                }
            }
            catch (IOException e)
            {
                System.Console.Out.WriteLine("Exception occured while Writing BufferedFile: \n\t" + e.Message);
                // Ignore problems...
            }
        }
Beispiel #10
0
 public JDFException(string message, bool bPrintStack)
     : base(message)
 {
     id = GetHashCode();
     if (bPrintStack == true)
     {
         SupportClass.WriteStackTrace(this, Console.Error);
     }
 }
Beispiel #11
0
 //UPGRADE_NOTE: Exception 'java.lang.Throwable' was converted to 'System.Exception' which has different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1100"'
 public virtual bool converterException(System.Exception t)
 {
     if (this.detailLevel > NO_DETAIL)
     {
         SupportClass.WriteStackTrace(t, pw);
         pw.Flush();
     }
     return(false);
 }
Beispiel #12
0
        internal virtual void checkInt(char code, string s, int val, string emsg)
        {
            Exception ex  = null;
            int       res = 0;

            try
            {
                switch (code)
                {
                case 'i':
                {
                    res = reader.scanInt(s);

                    break;
                }

                case 'd':
                {
                    res = (int)reader.scanDec(s);

                    break;
                }

                case 'x':
                {
                    res = (int)reader.scanHex(s);

                    break;
                }

                case 'o':
                {
                    res = (int)reader.scanOct(s);

                    break;
                }
                }
            }
            catch (Exception e)
            {
                ex = e;
            }

            checkException(ex, emsg);

            if (emsg != null)
            {
                return;
            }

            if (res != val)
            {
                Console.WriteLine("Expected '" + code + "' " + val + ", got " + res);
                SupportClass.WriteStackTrace(new System.Exception(), Console.Error);
                Environment.Exit(1);
            }
        }
Beispiel #13
0
 /// <summary> Prints the specified exception with a given label
 /// if debug mode is enabled.  This method calls
 /// <code>PrintStream.println(String)</code>,
 /// and pre-pends the <code>String</code> ">> " to the message, so
 /// taht if a program were to call (when debug mode was enabled):
 /// <code><pre>
 /// com.dalsemi.onewire.debug.Debug.debug("Some notification...", exception);
 /// </pre></code>
 /// the resulting output would look like:
 /// <code><pre>
 /// >> my label
 /// >>   OneWireIOException: Device Not Present
 /// </pre></code>
 ///
 /// </summary>
 /// <param name="lbl">the message to print out above the array
 /// </param>
 /// <param name="bytes">the byte array to print out
 /// </param>
 /// <param name="offset">the offset to start printing from the array
 /// </param>
 /// <param name="length">the number of bytes to print from the array
 /// </param>
 //UPGRADE_NOTE: Exception 'java.lang.Throwable' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
 public static void  debug(System.String lbl, System.Exception t)
 {
     if (DEBUG)
     {
         out_Renamed.WriteLine(">> " + lbl);
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         out_Renamed.WriteLine(">>    " + t.Message);
         SupportClass.WriteStackTrace(t, out_Renamed);
     }
 }
Beispiel #14
0
 protected internal virtual void write(System.IO.TextWriter stream, string prefix, string message, System.Exception t)
 {
     stream.Write(prefix);
     stream.WriteLine(message);
     if (t != null)
     {
         stream.WriteLine(t.Message);
         SupportClass.WriteStackTrace(t, stream);
     }
 }
Beispiel #15
0
        private void checkRead(int n, string s)
        {
            char[] buf  = new char[n];
            bool   pass = false;
            int    k    = 0;

            try
            {
                k = reader.Read(buf, 0, n);
            }
            catch (Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
                Environment.Exit(1);
            }

            if ((k == -1) && (s != null))
            {
                Console.WriteLine("read returns -1, expected " + s.Length);
            }
            else if (s == null)
            {
                if (k != -1)
                {
                    Console.WriteLine("read returns " + k + ", expected -1");
                }
                else
                {
                    pass = true;
                }
            }
            else if (s.Length != k)
            {
                Console.WriteLine("read returns " + k + ", expected " + s.Length);
            }
            else
            {
                string res = new string(buf, 0, k);

                if (!res.Equals(s))
                {
                    Console.WriteLine("read returns '" + res + "', expected '" + s + "'");
                }
                else
                {
                    pass = true;
                }
            }

            if (!pass)
            {
                SupportClass.WriteStackTrace(new System.Exception(), Console.Error);
                Environment.Exit(1);
            }
        }
Beispiel #16
0
        public virtual void testEmptyNamespace()
        {
            JDFDoc jdfDoc = new JDFDoc(ElementName.JDF);

            jdfDoc.write2File(sm_dirTestDataTemp + "test.jdf", 0, true);

            FileStream reader = null;

            try
            {
                reader = new FileStream(sm_dirTestDataTemp + "test.jdf", FileMode.Open);

                byte[] buf       = new byte[500];
                int    readChars = reader.Read(buf, 0, 500);

                if (readChars >= 0)
                {
                    string xml         = Encoding.Default.GetString(buf);
                    int    startPoint  = xml.IndexOf("<AuditPool>");
                    bool   namespaceOk = startPoint >= 0;

                    // Xerces 2.0.1 test.jdf contains <AuditPool xmlns="">
                    // Xerces 2.2.1 test.jdf contains <AuditPool>, which is correct

                    if (!namespaceOk)
                    {
                        string help = xml.Substring(xml.IndexOf("<AuditPool"));
                        Assert.IsTrue(namespaceOk, "This version of Apache Xerces has a namespace problem : " + help);
                    }
                }
            }
            catch (FileNotFoundException e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
            catch (IOException e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
            finally
            {
                try
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
                catch (IOException e)
                {
                    // TODO Auto-generated catch block
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
        }
 public JP2Box()
 {
     try
     {
         throw new ColorSpaceException("JP2Box empty ctor called!!");
     }
     catch (ColorSpaceException e)
     {
         SupportClass.WriteStackTrace(e, Console.Error); throw e;
     }
 }
Beispiel #18
0
 public virtual void  setPenaltyKicker(int nr)
 {
     try
     {
         this._penaltyKicker = getPlayer(nr);
     }
     catch (System.Exception err)
     {
         SupportClass.WriteStackTrace(err, Console.Error);
     }
 }
Beispiel #19
0
 //UPGRADE_NOTE: The equivalent of method 'java.lang.Throwable.printStackTrace' is not an override method. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1143'"
 public void  printStackTrace()
 {
     if (internal_Renamed is org.javarosa.core.io.StreamsUtil.DirectionalIOException)
     {
         ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)internal_Renamed).printStackTrace();
     }
     else
     {
         SupportClass.WriteStackTrace(internal_Renamed, Console.Error);
     }
 }
Beispiel #20
0
 public virtual void drawCell(PdfContentByte pcb, Graphics g2, int[] x, int[] y)
 {
     if (!this.parser_0.isMerged(this.int_0, this.int_1) || this.parser_0.isMergedFirstCell(this.int_0, this.int_1))
     {
         int num2 = this.parser_0.getColSpan(this.int_0, this.int_1, true);
         int num3 = this.parser_0.getRowSpan(this.int_0, this.int_1, true);
         this.method_3(pcb, g2, x[this.int_1 - 1] + 1, y[this.int_0 - 1] - 1, x[(this.int_1 + num2) - 1] + 1, y[(this.int_0 + num3) - 1] - 1);
         object obj2 = this.parser_0.getPropertyValue(this.int_0, this.int_1, 301);
         if (obj2 == null)
         {
             obj2 = PropertyDefine.CDT_TEXT;
         }
         int num = int.Parse(obj2.ToString());
         try
         {
             if (num == PropertyDefine.CDT_TEXT)
             {
                 object obj3 = this.parser_0.getPropertyValue(this.int_0, this.int_1, 714);
                 if ((obj3 != null) && ((int)obj3 != PropertyDefine.CLL_NONE))
                 {
                     this.drawImage(pcb, g2, this.parser_0, this.int_0, this.int_1, (float)x[this.int_1 - 1], (float)y[this.int_0 - 1], (float)(x[(this.int_1 + num2) - 1] - x[this.int_1 - 1]), (float)(y[(this.int_0 + num3) - 1] - y[this.int_0 - 1]), true);
                 }
                 else
                 {
                     this.method_4(pcb, g2, x[this.int_1 - 1], y[this.int_0 - 1], x[(this.int_1 + num2) - 1], y[(this.int_0 + num3) - 1]);
                 }
             }
             else if (num == PropertyDefine.CDT_SUBREPORT)
             {
                 object obj4 = this.parser_0.getPropertyValue(this.int_0, this.int_1, 302);
                 if (obj4 is CellSet)
                 {
                     if (this.parser_0.isCellVisible(this.int_0, this.int_1))
                     {
                         this.method_1(pcb, (CellSet)obj4, g2, x[this.int_1 - 1], y[this.int_0 - 1], x[(this.int_1 + num2) - 1] - x[this.int_1 - 1], y[(this.int_0 + num3) - 1] - y[this.int_0 - 1]);
                     }
                 }
                 else
                 {
                     this.method_4(pcb, null, x[this.int_1 - 1], y[this.int_0 - 1], x[(this.int_1 + num2) - 1], y[(this.int_0 + num3) - 1]);
                 }
             }
             else if ((!this.parser_0.isMerged(this.int_0, this.int_1) || this.parser_0.isMergedFirstCell(this.int_0, this.int_1)) && (((num == PropertyDefine.CDT_GRAPH) || (num == PropertyDefine.CDT_PIC_DB)) || (num == PropertyDefine.CDT_PIC_FILE)))
             {
                 this.drawImage(pcb, g2, this.parser_0, this.int_0, this.int_1, (float)x[this.int_1 - 1], (float)y[this.int_0 - 1], (float)(x[(this.int_1 + num2) - 1] - x[this.int_1 - 1]), (float)(y[(this.int_0 + num3) - 1] - y[this.int_0 - 1]), false);
             }
         }
         catch (Exception exception)
         {
             SupportClass.WriteStackTrace(exception, Console.Out);
         }
         this.method_2(pcb, g2, x[this.int_1 - 1], y[this.int_0 - 1], x[(this.int_1 + num2) - 1], y[(this.int_0 + num3) - 1]);
     }
 }
Beispiel #21
0
 //UPGRADE_TODO: The equivalent of method 'java.lang.Throwable.printStackTrace' is not an override method. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1143"'
 public void  printStackTrace(System.IO.StreamWriter ps)
 {
     if (this.exception == null)
     {
         SupportClass.WriteStackTrace((System.Exception) this, ps);
     }
     else
     {
         SupportClass.WriteStackTrace(exception, Console.Error);
     }
 }
Beispiel #22
0
 public void PrintStackTrace(StreamWriter ps)
 {
     if (InnerException == null)
     {
         SupportClass.WriteStackTrace(this, ps);
     }
     else
     {
         SupportClass.WriteStackTrace(InnerException, Console.Error);
     }
 }
Beispiel #23
0
 /// <summary> Print an error message.
 /// </summary>
 /// <param name="message">The message to print.
 /// </param>
 /// <param name="exception">The exception for stack tracing.
 ///
 /// </param>
 public virtual void Error(string message, ParserException exception)
 {
     if (mode != QUIET)
     {
         System.Console.Out.WriteLine("ERROR: " + message);
         if (mode == DEBUG && (exception != null))
         {
             SupportClass.WriteStackTrace(exception, Console.Error);
         }
     }
 }
Beispiel #24
0
        /// <summary> <p>Creates skeletal source code (without correct data structure but no business
        /// logic) for all segments found in the normative database.  </p>
        /// </summary>
        public static void  makeAll(System.String baseDirectory, System.String version)
        {
            //make base directory
            if (!(baseDirectory.EndsWith("\\") || baseDirectory.EndsWith("/")))
            {
                baseDirectory = baseDirectory + "/";
            }
            System.IO.FileInfo targetDir = NuGenSourceGenerator.makeDirectory(baseDirectory + NuGenSourceGenerator.getVersionPackagePath(version) + "segment");

            //get list of data types
            System.Data.OleDb.OleDbConnection conn = NuGenNormativeDatabase.Instance.Connection;
            System.Data.OleDb.OleDbCommand    stmt = SupportClass.TransactionManager.manager.CreateStatement(conn);
            System.String sql = "SELECT seg_code, section from HL7Segments, HL7Versions where HL7Segments.version_id = HL7Versions.version_id AND hl7_version = '" + version + "'";
            //System.out.println(sql);
            System.Data.OleDb.OleDbCommand temp_OleDbCommand;
            temp_OleDbCommand             = stmt;
            temp_OleDbCommand.CommandText = sql;
            System.Data.OleDb.OleDbDataReader rs = temp_OleDbCommand.ExecuteReader();

            System.Collections.ArrayList segments = new System.Collections.ArrayList();
            while (rs.Read())
            {
                System.String segName = System.Convert.ToString(rs[1 - 1]);
                if (System.Char.IsLetter(segName[0]))
                {
                    segments.Add(altSegName(segName));
                }
            }

            NuGenNormativeDatabase.Instance.returnConnection(conn);

            if (segments.Count == 0)
            {
            }

            for (int i = 0; i < segments.Count; i++)
            {
                try
                {
                    System.String          seg    = (System.String)segments[i];
                    System.String          source = makeSegment(seg, version);
                    System.IO.StreamWriter w      = new System.IO.StreamWriter(new System.IO.StreamWriter(targetDir.ToString() + "/" + seg + ".java", false, System.Text.Encoding.Default).BaseStream, new System.IO.StreamWriter(targetDir.ToString() + "/" + seg + ".java", false, System.Text.Encoding.Default).Encoding);
                    w.Write(source);
                    w.Flush();
                    w.Close();
                }
                catch (System.Exception e)
                {
                    System.Console.Error.WriteLine("Error creating source code for all segments: " + e.Message);
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
        }
Beispiel #25
0
 public static void  exception(System.String info, System.Exception e)
 {
     if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException)
     {
         ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace();
     }
     else
     {
         SupportClass.WriteStackTrace(e, Console.Error);
     }
     log("exception", (info != null?info + ": ":"") + WrappedException.printException(e));
 }
Beispiel #26
0
        public ContextSafetyTestCase() : base("ContextSafetyTestCase")
        {
            try {
                Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, org.apache.velocity.test.TemplateTestBase_Fields.FILE_RESOURCE_LOADER_PATH);

                Velocity.init();
            } catch (System.Exception e) {
                System.Console.Error.WriteLine("Cannot setup ContextSafetyTestCase!");
                SupportClass.WriteStackTrace(e, Console.Error);
                System.Environment.Exit(1);
            }
        }
 private void  output(System.String tag)
 {
     try
     {
         //UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
         out_Renamed.WriteLine(indent() + tag);
     }
     catch (System.Exception exception)
     {
         SupportClass.WriteStackTrace(exception, Console.Error);
     }
 }
Beispiel #28
0
 /// <summary> Clones this <code>IChemObject</code>, but preserves references to <code>Object</code>s.
 ///
 /// </summary>
 /// <returns>    Shallow copy of this IChemObject
 /// </returns>
 /// <seealso cref="clone">
 /// </seealso>
 public virtual System.Object shallowCopy()
 {
     System.Object copy = null;
     try
     {
         copy = base.MemberwiseClone();
     }
     catch (System.Exception e)
     {
         SupportClass.WriteStackTrace(e, System.Console.Error);
     }
     return(copy);
 }
 /// <summary> Generates source code for all data types, segments, groups, and messages.</summary>
 /// <param name="baseDirectory">the directory where source should be written
 /// </param>
 public static void  makeAll(System.String baseDirectory, System.String version)
 {
     try
     {
         DataTypeGenerator.makeAll(baseDirectory, version);
         SegmentGenerator.makeAll(baseDirectory, version);
         MessageGenerator.makeAll(baseDirectory, version);
     }
     catch (System.Exception e)
     {
         SupportClass.WriteStackTrace(e, Console.Error);
     }
 }
Beispiel #30
0
        /// <summary>  Description of the Method
        ///
        /// </summary>
        /// <param name="recordNumber">    Description of the Parameter
        /// </param>
        /// <returns>                  Description of the Return Value
        /// </returns>
        /// <exception cref="">  IOException  Description of the Exception
        /// </exception>
        //UPGRADE_NOTE: Synchronized keyword was removed from method 'read'. Lock expression was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1027"'
        public virtual System.String read(int recordNumber)
        {
            lock (this)
            {
                if (recordNumber < bufferIdx || recordNumber >= bufferIdx + 100)
                {
                    bufferIdx = (recordNumber / 100) * 100;
                    file.Seek(bufferIdx * recordSize + HEADER_SIZE, System.IO.SeekOrigin.Begin);
                    if (bufferIdx + 100 >= count)
                    {
                        SupportClass.ReadInput(file, ref bigBuffer, 0, (count - bufferIdx) * recordSize);
                    }
                    else
                    {
                        SupportClass.ReadInput(file, ref bigBuffer, 0, bigBuffer.Length);
                    }
                }
                //		long idx = (long)recordNumber * (long)recordSize + HEADER_SIZE;
                int idx = (recordNumber - bufferIdx) * recordSize;
                //		System.out.println("rn="+recordNumber+",bi="+bufferIdx+",idx="+idx+",rs="+recordSize+",bbs="+bigBuffer.length+",bs="+readBuffer.length);
                try
                {
                    Array.Copy(SupportClass.ToByteArray(bigBuffer), idx, SupportClass.ToByteArray(readBuffer), 0, recordSize);
                    //Array.Copy(SupportClass.ToByteArray((System.Array) bigBuffer), idx, SupportClass.ToByteArray((System.Array) readBuffer), 0, recordSize);
                }
                catch (System.Exception e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                    System.Console.Out.WriteLine("rn=" + recordNumber + ",bi=" + bufferIdx + ",idx=" + idx + ",rs=" + recordSize + ",bbs=" + bigBuffer.Length + ",bs=" + readBuffer.Length);
                }

                /*
                 * file.seek(idx);
                 * file.readFully(readBuffer);*/
                //		System.out.println("read id="+recordNumber+":"+(new String(readBuffer,0,recordSize)));
                for (int i = 0; i < recordSize; i++)
                {
                    if (readBuffer[i] == '^')
                    {
                        char[] tmpChar;
                        tmpChar = new char[readBuffer.Length];
                        readBuffer.CopyTo(tmpChar, 0);
                        return(new System.String(tmpChar, 0, i));
                    }
                }
                char[] tmpChar2;
                tmpChar2 = new char[readBuffer.Length];
                readBuffer.CopyTo(tmpChar2, 0);
                return(new System.String(tmpChar2, 0, recordSize - 1));
            }
        }