protected internal virtual IOException SeToIoe(SmbException se) { IOException ioe = se; Exception root = se.GetRootCause(); if (root is TransportException) { ioe = (TransportException)root; root = ((TransportException)ioe).GetRootCause(); } if (root is Exception) { ioe = new IOException(root.Message); ioe.InitCause(root); } return(ioe); }
/// <summary> /// Populates data in this DependencyGrammar from the character stream /// given by the Reader r. /// </summary> /// <exception cref="System.IO.IOException"/> public override void ReadData(BufferedReader @in) { string Left = "left"; int lineNum = 1; // all lines have one rule per line bool doingStop = false; for (string line = @in.ReadLine(); line != null && line.Length > 0; line = @in.ReadLine()) { try { if (line.Equals("BEGIN_STOP")) { doingStop = true; continue; } string[] fields = StringUtils.SplitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash // System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]); short distance = (short)System.Convert.ToInt32(fields[4]); IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex); IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex); IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].Equals(Left), distance); double count = double.Parse(fields[5]); if (doingStop) { ExpandStop(tempDependency, distance, count, false); } else { ExpandArg(tempDependency, distance, count); } } catch (Exception e) { IOException ioe = new IOException("Error on line " + lineNum + ": " + line); ioe.InitCause(e); throw ioe; } // System.out.println("read line " + lineNum + ": " + line); lineNum++; } }