Java.io.FileWriter + flush()

I am using a FileWriter within my web app to log application events. After every write I do a flush().
The problem is the writes usually don't show up in the log file until I shutdown Tomcat. If I switch from using flush() to closing + reopening the FileWriter that fixes the issue, however that seems excessive and inefficient.
I don't mind waiting a few seconds for log messages to show up, but often the messages aren't showing up 30 minutes later, and this makes my logging near useless.
Why would flush() not do what it says? Is there a better alternative than completely closing/reopening the FileWriter? I am not using BufferedWriter or anything else. I'm using FileWriter directly.
JVM: 1.6.0_05-b13

Either you found a bug in the VM and it has nothing to do with tomcat or you are making some assumptions that are leading to an incorrect analysis.
You can write a simple command line console app to confirm what flush does or does do. You should start by doing nothing but FileWriter and then use your log wrapper. Neither test should be run in tomcat.
If that fails then you have a bug. If it doesn't then it would suggest an assumption is incorrect.
Incorrect assumptions would be that you are not running the code that you think you are or that the logging process is not proceeding as you think it is.

Similar Messages

  • The contract for java.io.OutputStream.flush()

    The Javadoc for method java.io.OutputStream.flush() is
    public void flush()
               throws IOException
        Flushes this output stream and forces any buffered output bytes to be written out. The
    general contract of flush is that calling it is an indication that, if any bytes previously
    written have been buffered by the implementation of the output stream, such bytes
    should immediately be written to their intended destination.Thread http://forums.sun.com/thread.jspa?threadID=5318876&tstart=0 highlighted a problem with this contract in that there are some OutputStream such as CipherOutputStream (when using PKCS5Padding) where it does not make sense to implement to the flush() contract. In meeting this contract one would have to close the stream so that nothing else could be written after a flush. The reason for the problem is that only complete blocks of data can be written. Until one has a complete block, the bytes of an incomplete block have to be stored in the CipherOutputStream. Only when one closes a CipherOutputStream can the bytes of the incomplete block be padded to create a complete block, encrypted and then written.
    I have a similar problem with my Base64OutputStream where I can only write a multiple of 3 input bytes until I close() when I can provide appropriate padding.
    So, should one do as ghstark proposed in http://forums.sun.com/thread.jspa?threadID=5318876&tstart=0 and close() the stream when one flushes it or should one do as I currently do and only write out as much as possible without closing the stream. It would seem that one either has to break the flush() contract or break the encryption (or in my case Base64) contract.
    I would appreciate comments.

    DrClap wrote:
    Well, if it were me I would probably redefine the flush() method to only write the bytes that I was ready to write. So in your Base64 case I might be holding back one or two bytes.That is exactly what my Base64OutputStream and Sun's CipherOutputStream do.
    If challenged on that I would just say that my flush() method conformed to the contract because those bytes weren't "buffered" yet.I like the concept but any wording would have to be carefully written. I suppose that I could argue that I have not buffered any bytes that could be written so I have not buffered any bytes.

  • Java.lang.StackOverflowError in FileWriter constructor

    Hi,
    I got the following error while initializing a FileWriter object. Could anyone give me a clue of what could be the cause for this problem?
    java.lang.StackOverflowError
    at java.nio.charset.CharsetDecoder.replaceWith(CharsetDecoder.java:253)
    at java.nio.charset.CharsetDecoder.<init>(CharsetDecoder.java:180)
    at java.nio.charset.CharsetDecoder.<init>(CharsetDecoder.java:203)
    at sun.nio.cs.SingleByteDecoder.<init>(SingleByteDecoder.java:27)
    at sun.nio.cs.MS1252$Decoder.<init>(MS1252.java:49)
    at sun.nio.cs.MS1252.newDecoder(MS1252.java:39)
    at java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:305)
    at java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:261)
    at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:180)
    at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:203)
    at sun.nio.cs.SingleByteEncoder.<init>(SingleByteEncoder.java:37)
    at sun.nio.cs.MS1252$Encoder.<init>(MS1252.java:92)
    at sun.nio.cs.MS1252.newEncoder(MS1252.java:43)
    at sun.nio.cs.StreamEncoder$CharsetSE.<init>(StreamEncoder.java:288)
    at sun.nio.cs.StreamEncoder$CharsetSE.<init>(StreamEncoder.java:272)
    at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:68)
    at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:93)
    at java.io.FileWriter.<init>(FileWriter.java:70)
    Thanks in advance,
    DAve

    Dave,
    Sounds very plausible. The '.' generally means 'current directory' so there could be some substitution that's failing. If you try renaming and re-accessing the file with a more standard file name then I'd suggest it's a Java bug and you might want to review the Bugs database or raise it.
    BTW I'm unable to create files that start with a '.' on my system - lots of windows stuff starts failing. Can't you just use another naming convention?
    Dom.

  • Create XML file from java

    Hi all i am working to create a XML file using java can any one show me some sample code how to do so

    All I suggested was to insert a single line ("X.serialize(root);") into your code. Anyway, here's a ready-to-compile source code based on yours. This code utilizes the Xerces-J class library.import java.io.File;
    import java.io.FileWriter;
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    import org.w3c.dom.Element;
    public class Test {
      public static void main(String[] arguments) {
        FileWriter out;
        DocumentImpl d;
        Element root;
        XMLSerializer X;
        try {
          System.out.println(" creatin ");
          File fos = new File("xsr.xml");
          out = new FileWriter("xsr.xml");
          System.out.println("created File .." + fos.getName());
          out.flush();
          d = new DocumentImpl();
          System.out.println("create root");
          root = d.createElement("abc");
          System.out.println("creating element");
          d.insertBefore(root, null);
          //out.write(d.createAttribute(""));
          OutputFormat o = new OutputFormat(d);
          System.out.println("Output format...");
          o.setIndent(5);
          o.setIndenting(true);
          o.setDoctype("lab1.dtd", "lab1.dtd");
          o.setDoctype("name of dtd file", "name of dtd file");
          X = new XMLSerializer(o);
          X.setOutputCharStream(out);
          X.serialize(root);
          out.flush();
          out.close();
        catch (Exception e1){
          e1.printStackTrace();
    }

  • 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.

  • How to edit/modify a line of a text file using java io

    Hi every body
    I am new 2 java
    I am struck in editing a text file that ends with .dat
    I successfully added,viewed data of the *.dat file.
    but,I cannt edit,delete the lines that i need to do randomly.
    Here is the code i have written.
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.LineNumberReader;
    import java.io.RandomAccessFile;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    public class ReadWriteFile {
         String id=null;
         String name=null;
         String dept=null;
         String doj=null;
         String adrss=null;
         public void WriteFile(String Id,String Name,String Dept,String Doj,String Adrss) throws IOException{
              File f=new File("TraineeDetails.dat");
             if(!f.exists()){
             f.createNewFile();
              BufferedWriter bw=new BufferedWriter(new FileWriter("TraineeDetails.dat",true));
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              System.out.print("Enter Id : ");
              Id=br.readLine();
              System.out.print("Enter name : ");
              Name=br.readLine();
              System.out.print("Enter dept : ");
              Dept=br.readLine();
              System.out.print("Enter doj : ");
              Doj=br.readLine();
              System.out.print("Enter adrss : ");
              Adrss=br.readLine();
              bw.write(Id+"::"+Name+"::"+Dept+"::"+Doj+"::"+Adrss+":END:");
              bw.flush();
              bw.newLine();
              bw.close();
         public static void main(String[] args) throws IOException {
              ReadWriteFile rwf=new ReadWriteFile();
              String TID = null;
              String TADRSS = null;
              String TDOJ = null;
              String TNAME = null;
              String TDEPT = null;
              rwf.ReadFile(TID,TNAME,TDEPT,TDOJ,TADRSS);
         public void ReadFile(String Id1,String Name1,String Dept1,String Doj1,String Adrss1) throws IOException{
              BufferedReader br = new BufferedReader(new FileReader("TraineeDetails.dat"));
              String s;
               while((s = br.readLine())!= null)
                 // Create string tokenizer
                    StringTokenizer st =new StringTokenizer(s, "::");
                      System.out.println("----------------------------------------------");
                      System.out.println("| Trainee Id: "+st.nextToken()             +"|");
                      System.out.println("| Trainee Name: "+st.nextToken()           +"|");
                      System.out.println("| Trainee Department:"+st.nextToken()      +"|");
                      System.out.println("| Date of Joining: "+st.nextToken()        +"|");
                      System.out.println("| Trainee Address: "+st.nextToken()        +"|\n");
                      System.out.println("----------------------------------------------");
               // Close file reader
               br.close();
    }     and here is the data i have written
    Trainee.dat*
    111::jain::roads::2-2008::Blore:END:
    123::tim::service::1-2000::delhi:END:
    444::faru::civil::3-2200::sanapur:END:
    555::niv::cse::10-2000::gnagar:END:
    999::linda::mech::6-2001::tnagar:END:
    258::yansi::geo::8-2002::rtnagar:END:
    656::hari::garrage::3-1000::uttarahalli:END:
    888::muni::hr::5-2009::ernakulam:END:
    007::bond::spy::2-1972::america:END:
    0123::landy::games::6-2003::hdp:END:
    678::maddy::pumbing::4-1999::dispur:END:

    kalanidhi2u wrote:
    I want to randomly access the file
    But i cannt access itmake it RandomAccessFile... RandomAccessFile
    I edited it
    but i cannt edit the file by using itBoth of these are contradictory.

  • File transfer, read write through sockets in client server programming java

    Hello All, need help again.
    I am trying to create a Client server program, where, the Client first sends a file to Server, on accepting the file, the server generates another file(probably xml), send it to the client as a response, the client read the response xml, parse it and display some data. now I am successful sending the file to the server, but could not figure out how the server can create and send a xml file and send it to the client as response, please help. below are my codes for client and server
    Client side
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class XMLSocketC
         public static void main(String[] args) throws IOException
              //Establish a connection to socket
              Socket toServer = null;
              String host = "127.0.0.1";     
              int port = 4444;
              try
                   toServer = new Socket(host, port);
                   } catch (UnknownHostException e) {
                System.err.println("Don't know about host: localhost.");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection to host.");
                System.exit(1);
              //Send file over Socket
            //===========================================================
            BufferedInputStream fileIn = null;
              BufferedOutputStream out = null;
              // File to be send over the socket.
              File file = new File("c:/xampp/htdocs/thesis/sensorList.php");
              // Checking for the file to be sent.
              if (!file.exists())
                   System.out.println("File doesn't exist");
                   System.exit(0);
              try
                   // InputStream to read the file
                   fileIn = new BufferedInputStream(new FileInputStream(file));
              }catch(IOException eee)
                   System.out.println("Problem, kunne ikke lage fil");
              try
                   InetAddress adressen = InetAddress.getByName(host);
                   try
                        System.out.println("Establishing Socket Connection");
                        // Opening Socket
                        Socket s = new Socket(adressen, port);
                        System.out.println("Socket is clear and available.....");
                        // OutputStream to socket
                        out = new BufferedOutputStream(s.getOutputStream());
                        byte[] buffer = new byte[1024];
                        int numRead;
                        //Checking if bytes available to read to the buffer.
                        while( (numRead = fileIn.read(buffer)) >= 0)
                             // Writes bytes to Output Stream from 0 to total number of bytes
                             out.write(buffer, 0, numRead);
                        // Flush - send file
                        out.flush();
                        // close OutputStream
                        out.close();
                        // close InputStrean
                        fileIn.close();
                   }catch (IOException e)
              }catch(UnknownHostException e)
                   System.err.println(e);
            //===========================================================
            //Retrieve data from Socket.
              //BufferedReader in = new BufferedReader(new InputStreamReader(toServer.getInputStream()));
              DataInputStream in = new DataInputStream(new BufferedInputStream(toServer.getInputStream()));
              //String fromServer;
            //Read from the server and prints.
              //Receive text from server
              FileWriter fr = null;
              String frn = "xxx_response.xml";
              try {
                   fr = new FileWriter(frn);
              } catch (IOException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              try{
                   String line = in.readUTF();                    //.readLine();
                   System.out.println("Text received :" + line);
                   fr.write(line);
              } catch (IOException e){
                   System.out.println("Read failed");
                   System.exit(1);
            in.close();
            toServer.close();
    public class XMLSocketS
          public static void main(String[] args) throws IOException
              //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4444);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
              while (true)
                        try
                             clientLink = serverSocket.accept();
                           System.out.println("Server accepts");
                             BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             // close the link to client
                             clientLink.close();                         
                             // close InputStream
                             inn.close();                         
                             // flush
                             ut.flush();                         
                             // close OutputStream
                             ut.close();     
                             //Sending response to client     
                             //============================================================
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
    }

    SERVER
    import java.net.*;
    import java.io.*;
    public class XMLSocketS
          public static void main(String[] args) throws IOException
                   //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4545);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
                  try
                             clientLink = serverSocket.accept();
                         System.out.println("Server accepts the client request.....");
                         BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             ut.flush();                         
                             //Sending response to client     
                             //============================================================
                             BufferedInputStream ftoC = null;
                             BufferedOutputStream outtoC = null;
                             // File to be send over the socket.
                             File file = new File("c:/xampp/htdocs/thesis/user_registration_response.xml");
                             try
                                  // InputStream to read the file
                                   ftoC = new BufferedInputStream(new FileInputStream(file));
                             }catch(IOException eee)
                             {System.out.println("Problem reading file");}
                             // OutputStream to socket
                             outtoC = new BufferedOutputStream(clientLink.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int noRead;
                             //Checking if bytes available to read to the buffer.
                             while( (noRead = ftoC.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  outtoC.write(buffer, 0, noRead);
                             outtoC.flush();
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
          }CLIENT SIDE
    import java.io.*;
    import java.net.*;
    public class XMLSocketC
              @SuppressWarnings("deprecation")
              public static void main(String[] args)
                   // Server: "localhost" here. And port to connect is 4545.
                   String host = "127.0.0.1";          
                   int port = 4545;
                   BufferedInputStream fileIn = null;
                   BufferedOutputStream out = null;
                   // File to be send over the socket.
                   File file = new File("c:/xampp/htdocs/thesis/sensorList.xml");
                   try
                        // InputStream to read the file
                        fileIn = new BufferedInputStream(new FileInputStream(file));
                   }catch(IOException eee)
                   {System.out.println("Problem");}
                   try
                             System.out.println("Establishing Socket Connection");
                             // Opening Socket
                             Socket clientSocket = new Socket(host, port);
                             System.out.println("Socket is clear and available.....");
                             // OutputStream to socket
                             out = new BufferedOutputStream(clientSocket.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int numRead;
                             //Checking if bytes available to read to the buffer.
                             while( (numRead = fileIn.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  out.write(buffer, 0, numRead);
                             // Flush - send file
                             out.flush();
                             //=======================================
                             DataInputStream in = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));
                             BufferedWriter outf = new BufferedWriter(new FileWriter("c:/xampp/htdocs/received_from_server.txt",true));
                             String str;
                             while(!(str = in.readLine()).equals("EOF")) {     
                                  System.out.println("client : Read line -> <" + str + ">");
                                  outf.write(str);//Write out a string to the file
                                  outf.newLine();//write a new line to the file (for better format)
                                  outf.flush();
                             //=======================================
                             // close OutputStream
                             out.close();
                             // close InputStrean
                             fileIn.close();
                             // close Socket
                             clientSocket.close();
                        }catch (IOException e)
                        {System.out.println("Exception.");}
         Could you please point where am I doing the stupid mistake, client to server is working properly, but the opposite direction is not.
    Thanks

  • Java ThreadPool Example

    Some people asked at this forum: "How to write Java Threadpool?" Here is an example, which I have tested on the computer with two CPU. This example also runs well with J#.
    TPTest.java
    package demo.test;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintStream;
    import java.util.Calendar;
    import thread.util.ThreadPool;
    class ShutdownHook extends Thread {
        public void run() {
            try {
                MyRunnable.fout.flush();
                Thread.sleep(1000);
                MyRunnable.fout.close();
            catch (Exception e) {
                e.printStackTrace();
    class MyRunnable implements Runnable {
        public static File file;
        public static FileWriter fout;
         public static PrintStream out;
        static {
            try {
                file = new File(".\\ThreadPool.log");
                fout = new FileWriter(file);
                   out = System.out;
                //Uncomment the next line in J#
                //Runtime.getRuntime().runFinalizersOnExit(true);
                //Comment the next line in J#
                Runtime.getRuntime().addShutdownHook(new ShutdownHook());
            catch (IOException e) {
                e.printStackTrace();
        static int n = 0;
        int i;
        public MyRunnable(int i) {
            this.i = i;
        public void run() {
            try {
                synchronized(fout) {
                    n++;
                    fout.write("Sample No." + n + "\t" + Calendar.getInstance().getTime().getMinutes() + ":" +
                    Calendar.getInstance().getTime().getSeconds() + ":" +
                    Calendar.getInstance().get(Calendar.MILLISECOND) +  
                    ":" + "Executed: " + this + Thread.currentThread() + "\r\n");
                        out.println("Sample No." + n + "\t" + Calendar.getInstance().getTime().getMinutes() + ":" +
                    Calendar.getInstance().getTime().getSeconds() + ":" +
                    Calendar.getInstance().get(Calendar.MILLISECOND) +  
                    ":" + "Executed: " + this + Thread.currentThread());
            catch (IOException e) {
                e.printStackTrace();
            synchronized(this) {
                notify();
        public String toString() {
            return "Task No." + i;
    public class TPTest {
        public static void main(String[] args) {
            ThreadPool thp = new ThreadPool(100);
            int count = 10000;
            for (int i = 0; i < count; i++) {
                if(i == count - 1)
                    // Wait for the last Invoke
                    ThreadPool.invokeAndWait(thp, new MyRunnable(i));
                else
                    ThreadPool.invokeLater(thp, new MyRunnable(i));
            try {
                MyRunnable.fout.flush();
                MyRunnable.fout.close();
            }catch(Exception e) {
            System.exit(0);
    Queue.java
    package thread.util;
    import java.util.Enumeration;
    class NoSuchElementException extends RuntimeException {
        public NoSuchElementException() {
            super();
        public NoSuchElementException(String s) {
            super(s);
    class QueueElement {
        QueueElement next = null;
        QueueElement prev = null;
        Object obj = null;
        QueueElement(Object obj) {
            this.obj = obj;
        public String toString() {
            return "QueueElement[obj="
                + obj
                + (prev == null ? " null" : " prev")
                + (next == null ? " null" : " next")
                + "]";
    final class LIFOQueueEnumerator implements Enumeration {
        Queue queue;
        QueueElement cursor;
        LIFOQueueEnumerator(Queue q) {
            queue = q;
            cursor = q.head;
        public boolean hasMoreElements() {
            return (cursor != null);
        public Object nextElement() {
            synchronized (queue) {
                if (cursor != null) {
                    QueueElement result = cursor;
                    cursor = cursor.next;
                    return result.obj;
            throw new NoSuchElementException("NoSuchElement");
    final class FIFOQueueEnumerator implements Enumeration {
        Queue queue;
        QueueElement cursor;
        FIFOQueueEnumerator(Queue q) {
            queue = q;
            cursor = q.tail;
        public boolean hasMoreElements() {
            return (cursor != null);
        public Object nextElement() {
            synchronized (queue) {
                if (cursor != null) {
                    QueueElement result = cursor;
                    cursor = cursor.prev;
                    return result.obj;
            throw new NoSuchElementException("FIFOQueueEnumerator");
    public class Queue {
        int length = 0;
        QueueElement head = null;
        QueueElement tail = null;
        public Queue() {
        public synchronized void enqueue(Object obj) {
            QueueElement newElt = new QueueElement(obj);
            if (head == null) {
                head = newElt;
                tail = newElt;
                length = 1;
            else {
                newElt.next = head;
                head.prev = newElt;
                head = newElt;
                length++;
        public synchronized Object dequeue() {
            QueueElement elt = tail;
            tail = elt.prev;
            if (tail == null) {
                head = null;
            else {
                tail.next = null;
            length--;
            return elt.obj;
        public synchronized boolean isEmpty() {
            return (tail == null);
        public final synchronized Enumeration elements() {
            return new LIFOQueueEnumerator(this);
        public final synchronized Enumeration reverseElements() {
            return new FIFOQueueEnumerator(this);
        public synchronized void dump(String msg) {
            System.err.println(">> " + msg);
            System.err.println(
                    + length
                    + " elt(s); head = "
                    + (head == null ? "null" : (head.obj) + "")
                    + " tail = "
                    + (tail == null ? "null" : (tail.obj) + ""));
            QueueElement cursor = head;
            QueueElement last = null;
            while (cursor != null) {
                System.err.println("  " + cursor);
                last = cursor;
                cursor = cursor.next;
            if (last != tail) {
                System.err.println("  tail != last: " + tail + ", " + last);
            System.err.println("]");
    QueueException.java
    package thread.util;
    public class QueueException extends RuntimeException {
    ThreadPool.java
    package thread.util;
    * A thread pool with a bounded task queue and fixed number of worker threads.
    public class ThreadPool {
        public static ThreadPool currentThreadPool = null;
        public Queue queue;
        public ThreadPool(int threads) {
            queue = new Queue();
            /* create the worker threads */
            for (int i = 0; i < threads; ++i) {
                Thread t = new Thread(new WorkerThread(), "WorkerThread: " + (i + 1));
                t.setDaemon(true);
                t.start();
         * Queues a task to be executed by this ThreadPool. If the task queue is
         * full, the task will run in the calling thread. (Could easily be modified
         * to throw an exception instead.)
        public void doTask(Runnable task) {
            synchronized (queue) {
                queue.enqueue(task);
                queue.notify();
         * Tests if the task queue is empty.  Useful if you want to wait for all
         * queued tasks to complete before terminating your program.
        public boolean queueEmpty() {
            synchronized (queue) {
                return queue.isEmpty();
        private class WorkerThread implements Runnable {
            public void run() {
                Runnable task;
                while (true) {
                    task = null;
                    synchronized (queue) {
                        try {
                            if (queue.isEmpty()) {
                                queue.wait();
                            else {
                                task = (Runnable)queue.dequeue();
                        catch (InterruptedException e) {
                            break;
                    if (task != null) {
                        task.run();
        } /* end inner class WorkerThread */
        public static void invokeLater(ThreadPool thp, Runnable task) {
            thp.doTask(task);
        public static void invokeAndWait(ThreadPool thp, Runnable task) {
            TaskWrapper tw = new TaskWrapper(task);
            synchronized(tw.task) {
                try {
                    thp.doTask(tw);
                    tw.task.wait();
                catch (InterruptedException e) {
                tw = null;
        public static void invokeLater(Runnable task) {
            if(ThreadPool.currentThreadPool == null) {
                ThreadPool.currentThreadPool = new ThreadPool(20);
            ThreadPool.currentThreadPool.doTask(task);
        public static void invokeAndWait(Runnable task) {
            if(ThreadPool.currentThreadPool == null) {
                ThreadPool.currentThreadPool = new ThreadPool(20);
            TaskWrapper tw = new TaskWrapper(task);
            synchronized(tw.task) {
                try {
                    ThreadPool.currentThreadPool.doTask(tw);
                    tw.task.wait();
                catch (InterruptedException e) {
                tw = null;
    } /* end class ThreadPool */
    class TaskWrapper implements Runnable {
        public Runnable task;
        public TaskWrapper(Runnable task) {
            this.task = task;
        public void run() {
            synchronized(task) {
                task.run();
                task.notify();

    Thanks for the example. I was wondering how to do this.
    I am running it right now on Fedora Linux.
    When I run the demo TPTest.java
    as written
    ThreadPool thp = new ThreadPool(100);
    int count = 10000;
    I get and error at the very end of the run like this :
    Sample No.10000     32:36:289:Executed: Task No.652Thread[WorkerThread: 10,5,main]
    java.io.IOException: Stream closed
         at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:38)
         at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:151)
         at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
         at demo.test.ShutdownHook.run(TPTest.java:14)
    Is this correct behaviour?
    General this the only error I see. If I start changing the count and Threadpool size to
    other combinations, I occasionally get other errors similar to this one as well.
    java.io.IOException: Stream closed
         at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:38)
         at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:129)
         at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)
         at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)
         at java.io.Writer.write(Writer.java:126)
         at demo.test.MyRunnable.run(TPTest.java:53)
         at thread.util.ThreadPool$WorkerThread.run(ThreadPool.java:58)
         at java.lang.Thread.run(Thread.java:534)
    Is there a way to increase thread size with java on Fedora Linux (Core 3)?
    Would like to know. This example was interesting to me because I am trying to push
    the limit for load testing purposes.
    Thanks again for the example. Let me know if you have any updates to this one.

  • Q: How to access and modify xml tags using Java

    I have an xml based document that i need to access and change. For example, the code
    <section id="section1">
    <div>
    <xforms:group id="id1">
    <xforms:label id="label1">
    <l style="font-size:16pt"> something </l>
    </xforms:label>
    </xforms:group>
    </div>
    </section>
    Working with Java I need to access all the tags, select some of them that are relevant to the current device and remade the document. I thought I would read the file character by character identifying the different labels and building a tree, storing in the tree nodes the relevant information as some kind of attributes (for example, in the case of the <xforms:group id="id1"> I would name the node "xforms:group" and create an "id" attribute with value "id1"). I'm not sure if that is the most efficient way of accessing the problem (computational power might be an issue), and would appreciate some help on the subject.
    Thanks,

    this may help you..
    this is a little util i made to help me read/write files.
    using this, you are only one step away from your solutions, you only need to figure out the regex you need to run on the text of the file to make it become what you need it to become.
    though if you use non-standard encoding, you might not want to use this code..
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Arrays;
    public class ASCIIFile {
         private File file;
         private StringBuilder builder;
         public ASCIIFile(String path) throws IOException{
              file = new File(path);
              openFile();
         public ASCIIFile(File file) throws IOException{
              this.file = file;
              openFile();
         public void setNewFileName(String fileName){
              file = new File(file.getAbsolutePath(), fileName);
         public void setNewFilePath(String filePath){
              file = new File(filePath, file.getName());
         private void openFile() throws IOException{
              if(!file.exists()) file.createNewFile();
              BufferedReader read = new BufferedReader(new FileReader(file));
              String line = read.readLine();
              builder = new StringBuilder();
              while(line != null){
                   builder.append(line);
                   builder.append("\n");
                   line = read.readLine();
              read.close();
         public String getContents(){
              return builder.toString();
         public StringBuilder getStringBuilder(){
              return builder;
         public void setStringBuilder(StringBuilder b) throws IOException{
              setContents(b.toString());
         public void setContents(String contents) throws IOException{
              FileWriter writer = new FileWriter(file);
              writer.write(contents);
              writer.flush();
              writer.close();
              builder = new StringBuilder(contents);
         public static File[] getAllFilesUnderDir(String fullpath, boolean recursive) {
              ArrayList queue = new ArrayList(10);
              ArrayList matched = new ArrayList();
              File root = new File(fullpath);
              File[] files = root.listFiles();
              if (files == null || files.length == 0) {
                   return new File[] {};
              queue.addAll(Arrays.asList(files));
              for (int j = 0; j < queue.size(); j++) {
                   File child = (File) queue.get(j);
                   if (child.isDirectory() && recursive) {
                        files = child.listFiles();
                        if (files != null) {
                             queue.addAll(Arrays.asList(files));
                   } else { // child is file
                        matched.add(child);
              return (matched.size() > 0)?((File[]) matched.toArray(new File[] {})):(new File[] {});
    }

  • How to exclusively lock a file in java

    Here,
    I am trying to lock a file before finished writting data to it;
    At the mean time there is a C-language daemon is try to grep the data from the file.
    The synchronized code:
    synchronized(theFile){
    pWriter = new java.io.PrintWriter(new
    java.io.FileWriter(theFile));
    pWriter.write(fileContents);
    pWriter.flush();
    pWriter.close();

    synchronized is used to synchronize threads in the current process. A daemon is not in the same process so it will have absolutely no impact.
    Locking a file is OS dependent so you will have to craft a solution appropriate for the OS you are on. And you will probably have to use JNI to do it. Presumably your OS supports locking.

  • OBJECT DESTRUCTION IN JAVA

    import java.io.FileWriter;
    import java.io.FileReader;
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.FileOutputStream;
    import au.com.bytecode.opencsv.CSVReader;
    import au.com.bytecode.opencsv.CSVWriter;
    import java.io.IOException;
    import java.lang.ArrayIndexOutOfBoundsException;
    import java.io.File;
    public class Main {
            static void process(File iFile, File oFile) {
            FileReader input_file = null;
            CSVReader buff_input1 = null;
            BufferedReader buff_input2 = null;
            FileWriter osw_output = null;
            String line;
            String inputline;
            String[] input_record;
            String[] input2_record;
            String lat;
            String level;
        String l3;
            String l1;
            String l2;
            String app;
            String lon;
            URL myurl = null;
            int i = 0;
            try {
                input_file = new FileReader(iFile);
                buff_input1 = new CSVReader(input_file);
                osw_output = new FileWriter(oFile);
                input_record =buff_input1.readNext();
                while((input_record =buff_input1.readNext())!=null) {
                   try{
                    i = i+1;
                    //System.out.println();
                    String add1 = input_record[39];
                    String add2 = input_record[40];
                    String address = (add1+add2);
                    address = address.replaceAll("#[^ ]*"," ");
                    address = address.replaceAll("( ){2,}"," ");
                    address = address.replaceAll("P[.| ]?O[.]? BOX [0-9]*"," ");
                    address = address.replaceAll(" PH[^A-Z].*"," ");
                    address = address.replaceAll(" STE[^A-Z].*"," ");
                    address = address.replaceAll(" UNIT [^ ]*"," ");
                    address = address.replaceAll(" APT [^ ]*"," ");
                    address = address.replaceAll(" SUITE [^ ]*"," ");
                    address = address.replaceAll(" [0-9A-Za-z]* FLOOR"," ");
                    address = address.replaceAll("^[^0-9]*"," ");
                    address = address.replaceAll("-[0-9][0-9]*"," ");
                    address = address.replaceAll("( ){2,}"," ");
                    String remaining_fields = (input_record[0]+input_record[1]+input_record[2]+input_record[3]+
                            input_record[4]+input_record[5]+input_record[6]+input_record[7]+
                            input_record[8]+input_record[9]+input_record[10]+input_record[11]+input_record[12]+
                            input_record[13]+input_record[14]+input_record[15]+input_record[16]+
                            input_record[17]+input_record[18]+input_record[19]+input_record[20]+input_record[21]+
                            input_record[22]+input_record[23]+input_record[24]+input_record[25]+
                            input_record[26]+input_record[27]+input_record[28]+input_record[29]+input_record[30]+
                            input_record[31]+input_record[32]+input_record[33]+input_record[34]+
                            input_record[35]+input_record[36]+input_record[37]+input_record[38]+input_record[39]+
                            input_record[40]+input_record[41]+input_record[42]+input_record[43]+input_record[44]+
                            input_record[45]+input_record[46]+input_record[47]+input_record[48]+input_record[49]+
                            input_record[50]+input_record[51]+input_record[52]+input_record[53]+input_record[54]+
                            input_record[55]+input_record[56]+input_record[57]+input_record[58]+input_record[59]+
                            input_record[60]+input_record[61]+input_record[62]+input_record[63]+input_record[64]);
                    remaining_fields = remaining_fields.replaceAll("[^ -~]"," ");
                    //return address;
                   // address(address);
                    String city = input_record[41];
                    String state = input_record[42];
                    String zip = input_record[43];
            String complete_address = address+","+city+","+state+" "+zip;
                    myurl = new URL("http://stree1.cs.fiu.edu:88/street?street="+address+","+city+","+state+" "+zip); // This is where the problem lies, a new object is instatiated everytime the loop is executed.
                    buff_input2 = new BufferedReader(new InputStreamReader(myurl.openStream()));
                    inputline = buff_input2.readLine();
                    input2_record = inputline.split("\t");
                    l1 = input2_record[0];
                    lat = l1.substring(2);
                    l2 = input2_record[1];
                    lon = l2.substring(2);
                    //System.out.println("the lat:"+lat);
                    //System.out.println("the lon:"+lon);
                    inputline = buff_input2.readLine();
                    input2_record = inputline.split("\t");
                    l3 = input2_record[0];
            level = l3.substring(6);
                    app  = input2_record[1];
                    //System.out.println(level);
                    //System.out.println(app);
                    osw_output.append(input_record[0]+"\t"+input_record[1]+"\t"+input_record[2]+"\t"+input_record[3]+"\t"+input_record[4]+
                            "\t"+input_record[5]+"\t"+input_record[6]+"\t"+input_record[7]+
                            "\t"+input_record[8]+"\t"+input_record[9]+"\t"+input_record[10]+"\t"+input_record[11]+"\t"+input_record[12]+
                            "\t"+input_record[13]+"\t"+input_record[14]+"\t"+input_record[15]+"\t"+input_record[16]+
                            "\t"+input_record[17]+"\t"+input_record[18]+"\t"+input_record[19]+"\t"+input_record[20]+"\t"+input_record[21]+
                            "\t"+input_record[22]+"\t"+input_record[23]+"\t"+input_record[24]+"\t"+input_record[25]+
                            "\t"+input_record[26]+"\t"+input_record[27]+"\t"+input_record[28]+"\t"+input_record[29]+"\t"+input_record[30]+
                            "\t"+input_record[31]+"\t"+input_record[32]+"\t"+input_record[33]+"\t"+input_record[34]+
                            "\t"+input_record[35]+"\t"+input_record[36]+"\t"+input_record[37]+"\t"+input_record[38]+"\t"+input_record[39]+
                            "\t"+input_record[40]+"\t"+input_record[41]+"\t"+input_record[42]+"\t"+input_record[43]+"\t"+input_record[44]+
                            "\t"+input_record[45]+"\t"+input_record[46]+"\t"+input_record[47]+"\t"+input_record[48]+"\t"+input_record[49]+
                            "\t"+input_record[50]+"\t"+input_record[51]+"\t"+input_record[52]+"\t"+input_record[53]+"\t"+input_record[54]+
                            "\t"+input_record[55]+"\t"+input_record[56]+"\t"+input_record[57]+"\t"+input_record[58]+"\t"+input_record[59]+
                            "\t"+input_record[60]+"\t"+input_record[61]+"\t"+input_record[62]+"\t"+input_record[63]+"\t"+input_record[64]+
                            "\t"+lat+"\t"+lon+"\t"+level+"\t"+app);
                    osw_output.append((char)13);
                    osw_output.append((char)10);
                    buff_input2.close();
                    //System.out.println("Reached end of loop");
                   catch(ArrayIndexOutOfBoundsException e)
                       String[] s = input_record;
                System.out.println("Malformed record located at row" + s + "system ignoring record and continuing");
        finally
                 myurl = null;
             System.gc();// this is what I am using reluctantly, because when I run multiple instances of this program on different files, some processes are sitting idle. System.gc() helped me solve that problem but has made the system very slow. Is there a more efficient way of doing this?
                osw_output.flush();
                osw_output.close();
                input_file.close();
            } catch(MalformedURLException e) {
                System.out.println("IO ERROR!:"+e.getMessage());
            } catch(IOException ee) {
                System.out.println("URL ERROR!:"+ee.getMessage());
        public static void main(String[] args) {
            File iFile = new File(args[0]);
            File oFile = null;
            oFile =  new File(args[1]);
            process(iFile, oFile);
    }In the above program I am supposed to read a file and add certain contants of the file to a URL and read back those results into another file. so in the while loop each record is executed one after the other. to do this I make a new URL object everytime in the while loop. This is ok when I run the program once. but if I multiple instances of the program on different files, some java processes just sit idol. I could determine that the URL objects were creating the problem and therefore I added (the Highly unrecommended) System.gc() in my finally block, which makes the program work like I want it to but has made the system extremely slow. Is there a more efficient way someone can suggest?...thank you.

    jdkguy wrote:
    In the above program I am supposed to read a file and add certain contants of the file to a URL and read back those results into another file. so in the while loop each record is executed one after the other. to do this I make a new URL object everytime in the while loop. This is ok when I run the program once. but if I multiple instances of the program on different files, some java processes just sit idol. I could determine that the URL objects were creating the problem and therefore I added (the Highly unrecommended) System.gc() in my finally block, which makes the program work like I want it to but has made the system extremely slow. Is there a more efficient way someone can suggest?...thank you.I didn't see anything that would cause other instances to block, other than maybe not closing the CSVReader, but I doubt that's it. How did you determine that some processes were idle? Are you running a profiler?
    By the way, this:
                    String remaining_fields = (input_record[0]+input_record[1]+input_record[2]+input_record[3]+
                            input_record[4]+input_record[5]+input_record[6]+input_record[7]+
                            input_record[8]+input_record[9]+input_record[10]+input_record[11]+input_record[12]+
                            input_record[13]+input_record[14]+input_record[15]+input_record[16]+
                            input_record[17]+input_record[18]+input_record[19]+input_record[20]+input_record[21]+
                            input_record[22]+input_record[23]+input_record[24]+input_record[25]+
                            input_record[26]+input_record[27]+input_record[28]+input_record[29]+input_record[30]+
                            input_record[31]+input_record[32]+input_record[33]+input_record[34]+
                            input_record[35]+input_record[36]+input_record[37]+input_record[38]+input_record[39]+
                            input_record[40]+input_record[41]+input_record[42]+input_record[43]+input_record[44]+
                            input_record[45]+input_record[46]+input_record[47]+input_record[48]+input_record[49]+
                            input_record[50]+input_record[51]+input_record[52]+input_record[53]+input_record[54]+
                            input_record[55]+input_record[56]+input_record[57]+input_record[58]+input_record[59]+
                            input_record[60]+input_record[61]+input_record[62]+input_record[63]+input_record[64]);is horrible. There's no reason to copy and paste all those elements individually, use a loop:
    String remaining_fields = "";
    for (int i=0; i<=64; i++) {
        remaining_fields += input_record;
    }for (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '&lt;&lt;ALL FILES&gt;&gt;', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • Calling a web service through SSL via a stand alone java class

    HI,
    I am trying to call a web service through SSL via a simple stand alone java client.
    I have imported the SSL certificate in my keystore by using the keytool -import command.
    Basically I want to add a user to a group on the server. Say I add a user user 1 to group group 1 using an admin userid and password. All these values are set in an xml file which I send to the server while calling the server. I pass the web service URL, the soap action name and the xml to post as the command line arguments to the java client.
    My xml file(Add.xml) that is posted looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd = "http://www.w3.org/1999/XMLSchema"
    SOAP-ENV:encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <namesp1:modifyGroupOperation xmlns:namesp1 = "/services/modifyGroup/modifyGroupOp">
    <auth>
    <user>adminUser</user>
    <password>adminPassword</password>
    </auth>
    <operationType>ADD</operationType>
    <groupName>group1</groupName>
    <users>
    <userName>user1</userName>
    </users>
    </namesp1:modifyGroupOperation>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    I call the client as:
    java PostXML https://com.webservice.com/services/modifyGroup "/services/modifyGroup/modifyGroupOp" Add.xml
    I my client, I have set the following:
    System.setProperty("javax.net.ssl.keyStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.keyStorePassword", "password");
    System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.trustStorePassword", "password");
    But when I try to execute the java client, I get the following error:
    setting up default SSLSocketFactory
    use default SunJSSE impl class: com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl is loaded
    keyStore is : C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    keyStore type is : jks
    keyStore provider is :
    init keystore
    init keymanager of type SunX509
    trustStore is: C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    trustStore type is : jks
    trustStore provider is :
    init truststore
    adding as trusted cert:
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    instantiated an instance of class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    main, setSoTimeout(0) called
    main, setSoTimeout(0) called
    %% No cached client session
    *** ClientHello, TLSv1
    RandomCookie: GMT: .....
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 73
    main, WRITE: TLSv1 Handshake, length = 73
    [write] MD5 and SHA1 hashes: len = 98
    main, WRITE: SSLv2 client hello message, length = 98
    [Raw write]: length = 100
    [Raw read]: length = 5
    [Raw read]: length = 58
    main, READ: TLSv1 Handshake, length = 58
    *** ServerHello, TLSv1
    %% Created: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
    ** SSL_RSA_WITH_RC4_128_MD5
    [read] MD5 and SHA1 hashes: len = 58
    [Raw read]: length = 5
    [Raw read]: length = 5530
    main, READ: TLSv1 Handshake, length = 5530
    *** Certificate chain
    chain [0] = ...
    chain [1] = ...
    chain [2] = ...
    chain [3] = ...
    main, SEND TLSv1 ALERT: fatal, description = certificate_unknown
    main, WRITE: TLSv1 Alert, length = 2
    [Raw write]: length = 7
    0000: 15 03 01 00 02 02 2E .......
    main, called closeSocket()
    main, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.c
    ertpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2110)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at PostXML.main(PostXML.java:111)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find v
    alid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
    ... 18 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 23 more
    I do not know where I have gone wrong. Could someone point out my mistake.
    Thanks In advance!

    Hi jazz123,
    There's an example in the [*Java Web Services Tutorial*|http://java.sun.com/webservices/docs/2.0/tutorial/doc/] : see Chapter 1: Building Web Services with JAX-WS - A Simple JAX-WS Client.

  • Java Control Panel quit unexpectedly while using the libjvm.dylib plug-in.

    OS X Server1 0.8.4, Mac Mini (5,1), Java 7u25 (jre-7u25-macosx-x64.dmg).
    Tried removing and re-installing Java 7u25 directly from Oracle's site.  Also did a fix disk permissions, rebuilt caches, deleted java caches,  etc...  I can't simply get the Java control panel to launch.
    I have the same version running on my MacBook Air (OS X 10.8.4 w/ Java 7u25) with no issues.  Obviously something is differnet and I see a lot of complaints of various versions of Java 7 and OS X on different searches, yet no solutions.  I also tried re-installing the JavaForOSX2013-004.dmg patch, even though this shouldn't affect access to the control panel, but could block a plugin from running in the browser (which ultimately is what I'm trying to solve).
    I can't revert back to Apple's Java 6, as the Java application I'm trying to run requires Java 7.  Details of the latest crash:
    Process:         java [739]
    Path:            /usr/bin/java
    Identifier:      net.java.openjdk.cmd
    Version:         1.0 (1.0)
    Code Type:       X86-64 (Native)
    Parent Process:  bash [734]
    User ID:         501
    PlugIn Path:       /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/server/libjvm.dylib
    PlugIn Identifier: libjvm.dylib
    PlugIn Version:    ??? (1)
    Date/Time:       2013-06-28 13:49:06.800 -0400
    OS Version:      Mac OS X 10.8.4 (12E55)
    Report Version:  10
    Interval Since Last Report:          4229 sec
    Crashes Since Last Report:           -13
    Per-App Interval Since Last Report:  29 sec
    Per-App Crashes Since Last Report:   -13
    Anonymous UUID:                      989AE788-972D-C73F-D998-78290667FBE3
    Crashed Thread:  22  Java: Java2D Queue Flusher
    Exception Type:  EXC_BAD_ACCESS (SIGABRT)
    Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000003b0
    VM Regions Near 0x3b0:
    -->
        __TEXT                 000000010cf87000-000000010cf98000 [   68K] r-x/rwx SM=COW  /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
    Application Specific Information:
    abort() called
    Thread 0:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib                  0x00007fff9134a686 mach_msg_trap + 10
    1   libsystem_kernel.dylib                  0x00007fff91349c42 mach_msg + 70
    2   com.apple.CoreFoundation                0x00007fff8f004233 __CFRunLoopServiceMachPort + 195
    3   com.apple.CoreFoundation                0x00007fff8f009916 __CFRunLoopRun + 1078
    4   com.apple.CoreFoundation                0x00007fff8f0090e2 CFRunLoopRunSpecific + 290
    5   com.apple.HIToolbox                     0x00007fff8a201eb4 RunCurrentEventLoopInMode + 209
    6   com.apple.HIToolbox                     0x00007fff8a201c52 ReceiveNextEventCommon + 356
    7   com.apple.HIToolbox                     0x00007fff8a201ae3 BlockUntilNextEventMatchingListInMode + 62
    8   com.apple.AppKit                        0x00007fff8c18e533 _DPSNextEvent + 685
    9   com.apple.AppKit                        0x00007fff8c18ddf2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    10  libosxapp.dylib                         0x0000000166e70b56 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
    11  com.apple.AppKit                        0x00007fff8c1851a3 -[NSApplication run] + 517
    12  libosxapp.dylib                         0x0000000166e709b9 +[NSApplicationAWT runAWTLoopWithApp:] + 156
    13  liblwawt.dylib                          0x0000000166dca13e -[AWTStarter starter:] + 1591
    14  com.apple.Foundation                    0x00007fff8e31c5ca __NSThreadPerformPerform + 225
    15  com.apple.CoreFoundation                0x00007fff8efe6b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    16  com.apple.CoreFoundation                0x00007fff8efe6455 __CFRunLoopDoSources0 + 245
    17  com.apple.CoreFoundation                0x00007fff8f0097f5 __CFRunLoopRun + 789
    18  com.apple.CoreFoundation                0x00007fff8f0090e2 CFRunLoopRunSpecific + 290
    19  java                                    0x000000010cf8e42d CreateExecutionEnvironment + 871
    20  java                                    0x000000010cf88bdc JLI_Launch + 1952
    21  java                                    0x000000010cf8e78a main + 101
    22  java                                    0x000000010cf88434 start + 52
    Thread 1:
    0   libsystem_kernel.dylib                  0x00007fff9134c386 __semwait_signal + 10
    1   libsystem_c.dylib                       0x00007fff862a1cbd pthread_join + 847
    2   java                                    0x000000010cf8da2d ContinueInNewThread0 + 102
    3   java                                    0x000000010cf89847 ContinueInNewThread + 201
    4   java                                    0x000000010cf8d790 JVMInit + 251
    5   java                                    0x000000010cf895c5 JLI_Launch + 4489
    6   java                                    0x000000010cf8e78a main + 101
    7   java                                    0x000000010cf8e0bf apple_main + 92
    8   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    9   libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 2:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d465109 ObjectMonitor::wait(long long, bool, Thread*) + 627
    4   libjvm.dylib                            0x000000010d502407 ObjectSynchronizer::wait(Handle, long long, Thread*) + 203
    5   libjvm.dylib                            0x000000010d37b723 JVM_MonitorWait + 156
    6   ???                                     0x000000010dcc1f90 0 + 4526448528
    7   ???                                     0x000000010dcb6158 0 + 4526399832
    8   ???                                     0x000000010dcb6158 0 + 4526399832
    9   ???                                     0x000000010dcb6158 0 + 4526399832
    10  ???                                     0x000000010dcb6158 0 + 4526399832
    11  ???                                     0x000000010dcb6158 0 + 4526399832
    12  ???                                     0x000000010dcb6333 0 + 4526400307
    13  ???                                     0x000000010dcb6158 0 + 4526399832
    14  ???                                     0x000000010dcb6158 0 + 4526399832
    15  ???                                     0x000000010dcb04f7 0 + 4526376183
    16  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    17  libjvm.dylib                            0x000000010d33f390 JavaCalls::call(JavaValue*, methodHandle, JavaCallArguments*, Thread*) + 40
    18  libjvm.dylib                            0x000000010d4aec06 Reflection::invoke(instanceKlassHandle, methodHandle, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) + 2514
    19  libjvm.dylib                            0x000000010d4aeed9 Reflection::invoke_constructor(oopDesc*, objArrayHandle, Thread*) + 417
    20  libjvm.dylib                            0x000000010d373b0e JVM_NewInstanceFromConstructor + 124
    21  ???                                     0x000000010dcc1f90 0 + 4526448528
    22  ???                                     0x000000010dcb6333 0 + 4526400307
    23  ???                                     0x000000010dcb6333 0 + 4526400307
    24  ???                                     0x000000010dcb69e1 0 + 4526402017
    25  ???                                     0x000000010dcb6333 0 + 4526400307
    26  ???                                     0x000000010dcb6333 0 + 4526400307
    27  ???                                     0x000000010dcb6333 0 + 4526400307
    28  ???                                     0x000000010dcb6333 0 + 4526400307
    29  ???                                     0x000000010dcb6333 0 + 4526400307
    30  ???                                     0x000000010dcb6158 0 + 4526399832
    31  ???                                     0x000000010dcb6158 0 + 4526399832
    32  ???                                     0x000000010dcb6158 0 + 4526399832
    33  ???                                     0x000000010dcb6158 0 + 4526399832
    34  ???                                     0x000000010dcb6158 0 + 4526399832
    35  ???                                     0x000000010dcb6158 0 + 4526399832
    36  ???                                     0x000000010dcb04f7 0 + 4526376183
    37  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    38  libjvm.dylib                            0x000000010d33f390 JavaCalls::call(JavaValue*, methodHandle, JavaCallArguments*, Thread*) + 40
    39  libjvm.dylib                            0x000000010d35ae70 jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) + 219
    40  libjvm.dylib                            0x000000010d3541c8 jni_CallStaticVoidMethod + 267
    41  java                                    0x000000010cf8a17e JavaMain + 2333
    42  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    43  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 3:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    6   libjvm.dylib                            0x000000010d2d921a GCTaskManager::get_task(unsigned int) + 56
    7   libjvm.dylib                            0x000000010d2da052 GCTaskThread::run() + 338
    8   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    9   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    10  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 4:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    6   libjvm.dylib                            0x000000010d2d921a GCTaskManager::get_task(unsigned int) + 56
    7   libjvm.dylib                            0x000000010d2da052 GCTaskThread::run() + 338
    8   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    9   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    10  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 5:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    6   libjvm.dylib                            0x000000010d2d921a GCTaskManager::get_task(unsigned int) + 56
    7   libjvm.dylib                            0x000000010d2da052 GCTaskThread::run() + 338
    8   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    9   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    10  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 6:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    6   libjvm.dylib                            0x000000010d2d921a GCTaskManager::get_task(unsigned int) + 56
    7   libjvm.dylib                            0x000000010d2da052 GCTaskThread::run() + 338
    8   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    9   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    10  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 7:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46baf7 os::PlatformEvent::park(long long) + 385
    3   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    4   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    5   libjvm.dylib                            0x000000010d562b00 VMThread::loop() + 444
    6   libjvm.dylib                            0x000000010d56261b VMThread::run() + 121
    7   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    8   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    9   libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 8:: Java: Reference Handler
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d465109 ObjectMonitor::wait(long long, bool, Thread*) + 627
    4   libjvm.dylib                            0x000000010d502407 ObjectSynchronizer::wait(Handle, long long, Thread*) + 203
    5   libjvm.dylib                            0x000000010d37b723 JVM_MonitorWait + 156
    6   ???                                     0x000000010dcc1f90 0 + 4526448528
    7   ???                                     0x000000010dcb6158 0 + 4526399832
    8   ???                                     0x000000010dcb6158 0 + 4526399832
    9   ???                                     0x000000010dcb04f7 0 + 4526376183
    10  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    11  libjvm.dylib                            0x000000010d33faa2 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 258
    12  libjvm.dylib                            0x000000010d33fbdc JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
    13  libjvm.dylib                            0x000000010d376868 thread_entry(JavaThread*, Thread*) + 173
    14  libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    15  libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    16  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    17  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    18  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 9:: Java: Finalizer
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d465109 ObjectMonitor::wait(long long, bool, Thread*) + 627
    4   libjvm.dylib                            0x000000010d502407 ObjectSynchronizer::wait(Handle, long long, Thread*) + 203
    5   libjvm.dylib                            0x000000010d37b723 JVM_MonitorWait + 156
    6   ???                                     0x000000010dcc1f90 0 + 4526448528
    7   ???                                     0x000000010dcb6158 0 + 4526399832
    8   ???                                     0x000000010dcb6333 0 + 4526400307
    9   ???                                     0x000000010dcb6333 0 + 4526400307
    10  ???                                     0x000000010dcb04f7 0 + 4526376183
    11  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    12  libjvm.dylib                            0x000000010d33faa2 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 258
    13  libjvm.dylib                            0x000000010d33fbdc JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
    14  libjvm.dylib                            0x000000010d376868 thread_entry(JavaThread*, Thread*) + 173
    15  libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    16  libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    17  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    18  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    19  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 10:
    0   libsystem_kernel.dylib                  0x00007fff9134c6d6 __workq_kernreturn + 10
    1   libsystem_c.dylib                       0x00007fff86219f4c _pthread_workq_return + 25
    2   libsystem_c.dylib                       0x00007fff86219d13 _pthread_wqthread + 412
    3   libsystem_c.dylib                       0x00007fff862041d1 start_wqthread + 13
    Thread 11:: Dispatch queue: com.apple.libdispatch-manager
    0   libsystem_kernel.dylib                  0x00007fff9134cd16 kevent + 10
    1   libdispatch.dylib                       0x00007fff9181cdea _dispatch_mgr_invoke + 883
    2   libdispatch.dylib                       0x00007fff9181c9ee _dispatch_mgr_thread + 54
    Thread 12:
    0   libsystem_kernel.dylib                  0x00007fff9134c6d6 __workq_kernreturn + 10
    1   libsystem_c.dylib                       0x00007fff86219f4c _pthread_workq_return + 25
    2   libsystem_c.dylib                       0x00007fff86219d13 _pthread_wqthread + 412
    3   libsystem_c.dylib                       0x00007fff862041d1 start_wqthread + 13
    Thread 13:: Java: Signal Dispatcher
    0   libsystem_kernel.dylib                  0x00007fff9134a6c2 semaphore_wait_trap + 10
    1   libjvm.dylib                            0x000000010d46ce57 check_pending_signals(bool) + 128
    2   libjvm.dylib                            0x000000010d469994 signal_thread_entry(JavaThread*, Thread*) + 57
    3   libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    4   libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    5   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    6   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    7   libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 14:: Java: C2 CompilerThread0
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e5c6 Monitor::wait(bool, long, bool) + 222
    6   libjvm.dylib                            0x000000010d23d281 CompileQueue::get() + 153
    7   libjvm.dylib                            0x000000010d23dda2 CompileBroker::compiler_thread_loop() + 410
    8   libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    9   libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    10  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    11  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    12  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 15:: Java: C2 CompilerThread1
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e5c6 Monitor::wait(bool, long, bool) + 222
    6   libjvm.dylib                            0x000000010d23d281 CompileQueue::get() + 153
    7   libjvm.dylib                            0x000000010d23dda2 CompileBroker::compiler_thread_loop() + 410
    8   libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    9   libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    10  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    11  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    12  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 16:: Java: Service Thread
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46a98b os::PlatformEvent::park() + 173
    3   libjvm.dylib                            0x000000010d44dc10 ParkCommon(ParkEvent*, long long) + 42
    4   libjvm.dylib                            0x000000010d44e402 Monitor::IWait(Thread*, long long) + 160
    5   libjvm.dylib                            0x000000010d44e65f Monitor::wait(bool, long, bool) + 375
    6   libjvm.dylib                            0x000000010d4bd249 ServiceThread::service_thread_entry(JavaThread*, Thread*) + 109
    7   libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    8   libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    9   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    10  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    11  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 17:
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46baf7 os::PlatformEvent::park(long long) + 385
    3   libjvm.dylib                            0x000000010d532d06 WatcherThread::run() + 328
    4   libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    5   libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    6   libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 18:
    0   libsystem_kernel.dylib                  0x00007fff9134c6d6 __workq_kernreturn + 10
    1   libsystem_c.dylib                       0x00007fff86219f4c _pthread_workq_return + 25
    2   libsystem_c.dylib                       0x00007fff86219d13 _pthread_wqthread + 412
    3   libsystem_c.dylib                       0x00007fff862041d1 start_wqthread + 13
    Thread 19:
    0   libsystem_kernel.dylib                  0x00007fff9134c6d6 __workq_kernreturn + 10
    1   libsystem_c.dylib                       0x00007fff86219f4c _pthread_workq_return + 25
    2   libsystem_c.dylib                       0x00007fff86219d13 _pthread_wqthread + 412
    3   libsystem_c.dylib                       0x00007fff862041d1 start_wqthread + 13
    Thread 20:
    0   libsystem_kernel.dylib                  0x00007fff9134c6d6 __workq_kernreturn + 10
    1   libsystem_c.dylib                       0x00007fff86219f4c _pthread_workq_return + 25
    2   libsystem_c.dylib                       0x00007fff86219d13 _pthread_wqthread + 412
    3   libsystem_c.dylib                       0x00007fff862041d1 start_wqthread + 13
    Thread 21:: Java: traceMsgQueueThread
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46baf7 os::PlatformEvent::park(long long) + 385
    3   libjvm.dylib                            0x000000010d465113 ObjectMonitor::wait(long long, bool, Thread*) + 637
    4   libjvm.dylib                            0x000000010d502407 ObjectSynchronizer::wait(Handle, long long, Thread*) + 203
    5   libjvm.dylib                            0x000000010d37b723 JVM_MonitorWait + 156
    6   ???                                     0x000000010dcc1f90 0 + 4526448528
    7   ???                                     0x000000010dcb6158 0 + 4526399832
    8   ???                                     0x000000010dcb6806 0 + 4526401542
    9   ???                                     0x000000010dcb04f7 0 + 4526376183
    10  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    11  libjvm.dylib                            0x000000010d33faa2 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 258
    12  libjvm.dylib                            0x000000010d33fbdc JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
    13  libjvm.dylib                            0x000000010d376868 thread_entry(JavaThread*, Thread*) + 173
    14  libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    15  libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    16  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    17  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    18  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 22 Crashed:: Java: Java2D Queue Flusher
    0   libsystem_kernel.dylib                  0x00007fff9134c212 __pthread_kill + 10
    1   libsystem_c.dylib                       0x00007fff86218b54 pthread_kill + 90
    2   libsystem_c.dylib                       0x00007fff8625cdce abort + 143
    3   libjvm.dylib                            0x000000010d46e0d7 os::abort(bool) + 25
    4   libjvm.dylib                            0x000000010d55d020 VMError::report_and_die() + 2306
    5   libjvm.dylib                            0x000000010d46f7cb JVM_handle_bsd_signal + 1073
    6   libsystem_c.dylib                       0x00007fff8620594a _sigtramp + 26
    7   libGL.dylib                             0x00007fff911f78b5 glGetString + 15
    8   liblwawt.dylib                          0x0000000166dc069f Java_sun_java2d_opengl_OGLContext_getOGLIdString + 35
    9   ???                                     0x000000010dcc1f90 0 + 4526448528
    10  ???                                     0x000000010dcb6333 0 + 4526400307
    11  ???                                     0x000000010dcb6806 0 + 4526401542
    12  ???                                     0x000000010dcb04f7 0 + 4526376183
    13  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    14  libjvm.dylib                            0x000000010d33faa2 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 258
    15  libjvm.dylib                            0x000000010d33fbdc JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
    16  libjvm.dylib                            0x000000010d376868 thread_entry(JavaThread*, Thread*) + 173
    17  libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    18  libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    19  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    20  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    21  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 23:: Java: AWT-Shutdown
    0   libsystem_kernel.dylib                  0x00007fff9134c0fa __psynch_cvwait + 10
    1   libsystem_c.dylib                       0x00007fff8621bfe9 _pthread_cond_wait + 869
    2   libjvm.dylib                            0x000000010d46baf7 os::PlatformEvent::park(long long) + 385
    3   libjvm.dylib                            0x000000010d465113 ObjectMonitor::wait(long long, bool, Thread*) + 637
    4   libjvm.dylib                            0x000000010d502407 ObjectSynchronizer::wait(Handle, long long, Thread*) + 203
    5   libjvm.dylib                            0x000000010d37b723 JVM_MonitorWait + 156
    6   ???                                     0x000000010dcc1f90 0 + 4526448528
    7   ???                                     0x000000010dcb6158 0 + 4526399832
    8   ???                                     0x000000010dcb6806 0 + 4526401542
    9   ???                                     0x000000010dcb04f7 0 + 4526376183
    10  libjvm.dylib                            0x000000010d33f5c3 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 557
    11  libjvm.dylib                            0x000000010d33faa2 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 258
    12  libjvm.dylib                            0x000000010d33fbdc JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
    13  libjvm.dylib                            0x000000010d376868 thread_entry(JavaThread*, Thread*) + 173
    14  libjvm.dylib                            0x000000010d531bd8 JavaThread::thread_main_inner() + 134
    15  libjvm.dylib                            0x000000010d5330ca JavaThread::run() + 440
    16  libjvm.dylib                            0x000000010d46e5f9 java_start(Thread*) + 173
    17  libsystem_c.dylib                       0x00007fff862177a2 _pthread_start + 327
    18  libsystem_c.dylib                       0x00007fff862041e1 thread_start + 13
    Thread 22 crashed with X86 Thread State (64-bit):
      rax: 0x0000000000000000  rbx: 0x0000000000000006  rcx: 0x0000000166f920a8  rdx: 0x0000000000000000
      rdi: 0x0000000000009207  rsi: 0x0000000000000006  rbp: 0x0000000166f920d0  rsp: 0x0000000166f920a8
       r8: 0x00007fff74b56278   r9: 0x0000000166f92080  r10: 0x0000000020000000  r11: 0x0000000000000206
      r12: 0x000000010d8011f0  r13: 0x000000011118eca8  r14: 0x0000000166f93000  r15: 0x000000010d4716bc
      rip: 0x00007fff9134c212  rfl: 0x0000000000000206  cr2: 0x00007fff74b4fff0
    Logical CPU: 0
    Binary Images:
           0x10cf87000 -        0x10cf97fff +java (1.0 - 1.0) <147BD4EA-EA9C-301B-8C8A-D9F271391735> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
           0x10d0b5000 -        0x10d740fef +libjvm.dylib (1) <1B03A29F-0248-337E-8529-87706B48A7DE> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/server/libjvm.dylib
           0x10dc61000 -        0x10dc69fff +libverify.dylib (1) <C42EBBF2-FDE6-342B-9B75-7D91194E47C1> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libverify.dylib
           0x10dc6e000 -        0x10dc8ffef +libjava.dylib (1) <CEC400ED-E3D2-343D-8E19-587A4FF75CC2> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libjava.dylib
           0x10dca7000 -        0x10dcacfff +libzip.dylib (1) <89DD8E8C-F4A4-3E92-A2D6-CC8642447AC3> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libzip.dylib
           0x166560000 -        0x166569ff7  com.apple.java.JavaRuntimeSupport (14.8.0 - 14.8.0) <A08E8799-F5FF-3CBB-A753-FC2AF260ABEB> /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.frame work/JavaRuntimeSupport
           0x166578000 -        0x166582fff  JavaNativeFoundation (1) <F1FE02AF-1A2C-3EF7-9D1A-312FA21B51B9> /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFou ndation.framework/Versions/A/JavaNativeFoundation
           0x16658d000 -        0x166592fff  com.apple.JavaVM (14.8.0 - 14.8.0) <83C8C2AB-E99D-39FF-80B4-90A7DEB1DAFB> /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
           0x16659a000 -        0x16659ffff  JavaLaunching (1) <E89BD701-1C4E-3A44-8C32-6F81D2B53D13> /System/Library/PrivateFrameworks/JavaLaunching.framework/Versions/A/JavaLaunch ing
           0x166c40000 -        0x166cacff7 +libawt.dylib (1) <614FC193-CE14-3B85-9F8B-33F92FBD6D92> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libawt.dylib
           0x166cf0000 -        0x166db5fff +libmlib_image.dylib (1) <95F6D0B2-3A92-305F-A6AE-822BC990901B> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libmlib_image.dylib
           0x166dbc000 -        0x166e2cff7 +liblwawt.dylib (1) <8004F9F2-4EDF-3FF4-8B40-12F06C5C97FA> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/lwawt/liblwawt.dylib
           0x166e6f000 -        0x166e75fff +libosxapp.dylib (1) <19D025A3-9368-319D-AA64-EF835D78A0FF> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libosxapp.dylib
           0x166e8b000 -        0x166e8dfff  com.apple.ExceptionHandling (1.5 - 10) <47FF83ED-0C07-308C-A375-2A2189DB1056> /System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHand ling
           0x1682f6000 -        0x168300fff +libjli.dylib (1) <9792ED7A-1BD0-3D84-B551-F5DA12537016> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib
           0x168fe1000 -        0x168ff9ff7 +libdeploy.dylib (0) <7E7F2C41-877D-36FC-B982-DE5BB8F1685B> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libdeploy.dylib
           0x169007000 -        0x169010fe7  libcldcpuengine.dylib (2.2.16) <DB9678F6-7D50-384A-A961-6109B61D1607> /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libcldcpuengin e.dylib
           0x16a8f0000 -        0x16a907fff +org.andymatuschak.Sparkle (1.5 Beta 6 - 313) <9253F8F7-250B-1114-7AE9-A10A54EB2298> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Frameworks/Sparkle.framework/Versions /A/Sparkle
           0x16a920000 -        0x16a9f9ff7  libcrypto.0.9.7.dylib (106) <3E1B14DE-342B-318C-8F22-7B9CD88EE760> /usr/lib/libcrypto.0.9.7.dylib
           0x16ac56000 -        0x16ae14fff  GLEngine (8.9.2) <420E03C3-B91D-33C7-A1C4-BE60A1544971> /System/Library/Frameworks/OpenGL.framework/Resources/GLEngine.bundle/GLEngine
           0x16ae4b000 -        0x16afbbfff  libGLProgrammability.dylib (8.9.2) <83DBCC22-F711-3F9D-B622-6DE5D9DD90AE> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgramma bility.dylib
           0x16aff3000 -        0x16b3b0ff7  com.apple.driver.AppleIntelHD3000GraphicsGLDriver (8.12.47 - 8.1.2) <41C027A9-3329-340E-995A-6B66C54B7DAD> /System/Library/Extensions/AppleIntelHD3000GraphicsGLDriver.bundle/Contents/Mac OS/AppleIntelHD3000GraphicsGLDriver
           0x16b4e0000 -        0x16b4edfff  libGPUSupport.dylib (8.9.2) <0D32763C-7F3D-3FDB-9EDB-760BB7AFFA04> /System/Library/PrivateFrameworks/GPUSupport.framework/Versions/A/Libraries/lib GPUSupport.dylib
           0x16b4f4000 -        0x16b51ffff  GLRendererFloat (8.9.2) <18D6F0AD-C5F1-3E8F-89C2-89426A3D6FE4> /System/Library/Frameworks/OpenGL.framework/Resources/GLRendererFloat.bundle/GL RendererFloat
        0x7fff6cb87000 -     0x7fff6cbbb93f  dyld (210.2.3) <A40597AA-5529-3337-8C09-D8A014EB1578> /usr/lib/dyld
        0x7fff84946000 -     0x7fff84947fff  libsystem_blocks.dylib (59) <D92DCBC3-541C-37BD-AADE-ACC75A0C59C8> /usr/lib/system/libsystem_blocks.dylib
        0x7fff849e8000 -     0x7fff84a2bff7  com.apple.bom (12.0 - 192) <0BF1F2D2-3648-36B7-BE4B-551A0173209B> /System/Library/PrivateFrameworks/Bom.framework/Versions/A/Bom
        0x7fff84a2c000 -     0x7fff84aaeff7  com.apple.Heimdal (3.0 - 2.0) <C94B0C6C-1320-35A1-8143-FE252E7B2A08> /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal
        0x7fff84aaf000 -     0x7fff84ad7fff  libJPEG.dylib (850) <DC750E1E-BD07-339B-A4A6-D86BFE969F68> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib
        0x7fff84ad8000 -     0x7fff84adafff  com.apple.securityhi (4.0 - 55002) <34E45C60-DC7E-3FCC-A1ED-EBF48B77C559> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.fr amework/Versions/A/SecurityHI
        0x7fff84b04000 -     0x7fff84c56fff  com.apple.audio.toolbox.AudioToolbox (1.9 - 1.9) <62770C0F-5600-3EF9-A893-8A234663FFF5> /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
        0x7fff850e0000 -     0x7fff8517bfff  com.apple.CoreSymbolication (3.0 - 117) <C304FDB8-2FF7-34BC-858A-2B96C2B039D5> /System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSy mbolication
        0x7fff8521c000 -     0x7fff854c0ff7  com.apple.CoreImage (8.4.0 - 1.0.1) <CC6DD22B-FFC6-310B-BE13-2397A02C79EF> /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage .framework/Versions/A/CoreImage
        0x7fff859d7000 -     0x7fff85a33ff7  com.apple.Symbolication (1.3 - 93) <F2C7E0B6-B241-3020-B30A-0636D0FA3378> /System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolicat ion
        0x7fff85a34000 -     0x7fff85a35ff7  libSystem.B.dylib (169.3) <365477AB-D641-389D-B8F4-A1FAE9657EEE> /usr/lib/libSystem.B.dylib
        0x7fff85a40000 -     0x7fff85a43ff7  libdyld.dylib (210.2.3) <F59367C9-C110-382B-A695-9035A6DD387E> /usr/lib/system/libdyld.dylib
        0x7fff85a44000 -     0x7fff85a46fff  libCVMSPluginSupport.dylib (8.9.2) <EF1192AC-3357-3A0B-BFAF-6594D7737892> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginS upport.dylib
        0x7fff85a47000 -     0x7fff85a55ff7  libsystem_network.dylib (77.10) <0D99F24E-56FE-380F-B81B-4A4C630EE587> /usr/lib/system/libsystem_network.dylib
        0x7fff86203000 -     0x7fff862cfff7  libsystem_c.dylib (825.26) <4C9EB006-FE1F-3F8F-8074-DFD94CF2CE7B> /usr/lib/system/libsystem_c.dylib
        0x7fff862d0000 -     0x7fff862d4ff7  com.apple.TCC (1.0 - 1) <F2F3B753-FC73-3543-8BBE-859FDBB4D6A6> /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC
        0x7fff862e4000 -     0x7fff8633efff  com.apple.print.framework.PrintCore (8.3 - 387.2) <5BA0CBED-4D80-386A-9646-F835C9805B71> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ PrintCore.framework/Versions/A/PrintCore
        0x7fff8633f000 -     0x7fff86340ff7  libremovefile.dylib (23.2) <6763BC8E-18B8-3AD9-8FFA-B43713A7264F> /usr/lib/system/libremovefile.dylib
        0x7fff86341000 -     0x7fff8636fff7  libsystem_m.dylib (3022.6) <B434BE5C-25AB-3EBD-BAA7-5304B34E3441> /usr/lib/system/libsystem_m.dylib
        0x7fff86370000 -     0x7fff8640afff  libvMisc.dylib (380.6) <714336EA-1C0E-3735-B31C-19DFDAAF6221> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libvMisc.dylib
        0x7fff8640b000 -     0x7fff8641ffff  com.apple.speech.synthesis.framework (4.1.12 - 4.1.12) <94EDF2AB-809C-3D15-BED5-7AD45B2A7C16> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ SpeechSynthesis.framework/Versions/A/SpeechSynthesis
        0x7fff86420000 -     0x7fff86451ff7  com.apple.DictionaryServices (1.2 - 184.4) <054F2D6F-9CFF-3EF1-9778-25C551B616C1> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Diction aryServices.framework/Versions/A/DictionaryServices
        0x7fff864dd000 -     0x7fff86517ff7  com.apple.GSS (3.0 - 2.0) <970CAE00-1437-3F4E-B677-0FDB3714C08C> /System/Library/Frameworks/GSS.framework/Versions/A/GSS
        0x7fff86578000 -     0x7fff865cefff  com.apple.HIServices (1.20 - 417) <A1129272-FEC8-350B-BA26-5A97F23C413D> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ HIServices.framework/Versions/A/HIServices
        0x7fff865db000 -     0x7fff86648ff7  com.apple.datadetectorscore (4.1 - 269.3) <5775F0DB-87D6-310D-8B03-E2AD729EFB28> /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDe tectorsCore
        0x7fff86649000 -     0x7fff8664bff7  libunc.dylib (25) <92805328-CD36-34FF-9436-571AB0485072> /usr/lib/system/libunc.dylib
        0x7fff8664c000 -     0x7fff86765fff  com.apple.ImageIO.framework (3.2.1 - 850) <C3FFCEEB-AA0C-314B-9E94-7005EE48A403> /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
        0x7fff86790000 -     0x7fff8682eff7  com.apple.ink.framework (10.8.2 - 150) <84B9825C-3822-375F-BE58-A753444FBDE2> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework /Versions/A/Ink
        0x7fff8685f000 -     0x7fff8695cff7  libxml2.2.dylib (22.3) <47B09CB2-C636-3024-8B55-6040F7829B4C> /usr/lib/libxml2.2.dylib
        0x7fff86a7f000 -     0x7fff8740f4af  com.apple.CoreGraphics (1.600.0 - 332) <5AB32E51-9154-3733-B83B-A9A748652847> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/CoreGraphics
        0x7fff87410000 -     0x7fff874d5ff7  com.apple.coreui (2.0 - 181.1) <83D2C92D-6842-3C9D-9289-39D5B4554C3A> /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI
        0x7fff8797b000 -     0x7fff8799aff7  libresolv.9.dylib (51) <0882DC2D-A892-31FF-AD8C-0BB518C48B23> /usr/lib/libresolv.9.dylib
        0x7fff879d8000 -     0x7fff879ffff7  com.apple.PerformanceAnalysis (1.16 - 16) <E4888388-F41B-313E-9CBB-5807D077BDA9> /System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/Perf ormanceAnalysis
        0x7fff87bcd000 -     0x7fff87ccffff  libcrypto.0.9.8.dylib (47.1) <72AA650B-0453-3BB4-BA03-824627BB199C> /usr/lib/libcrypto.0.9.8.dylib
        0x7fff87cd0000 -     0x7fff87cd4fff  libCoreVMClient.dylib (32.3) <AD8391D9-56DD-3A78-A294-6A30E6ECE1A2> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClien t.dylib
        0x7fff87cd5000 -     0x7fff87d01ff7  libRIP.A.dylib (332) <D26BC320-B415-3C4D-B57F-D525FC361BB2> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib
        0x7fff87de8000 -     0x7fff881dffff  libLAPACK.dylib (1073.4) <D632EC8B-2BA0-3853-800A-20DA00A1091C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libLAPACK.dylib
        0x7fff881e0000 -     0x7fff881eeff7  libkxld.dylib (2050.24.15) <A619A9AC-09AF-3FF3-95BF-F07CC530EC31> /usr/lib/system/libkxld.dylib
        0x7fff881ef000 -     0x7fff88210fff  com.apple.Ubiquity (1.2 - 243.15) <C9A7EE77-B637-3676-B667-C0843BBB0409> /System/Library/PrivateFrameworks/Ubiquity.framework/Versions/A/Ubiquity
        0x7fff88211000 -     0x7fff88251ff7  com.apple.MediaKit (14 - 687) <8AAA8CC3-3ACD-34A5-9E57-9B24AD8AFD4D> /System/Library/PrivateFrameworks/MediaKit.framework/Versions/A/MediaKit
        0x7fff885f2000 -     0x7fff887f2fff  libicucore.A.dylib (491.11.3) <5783D305-04E8-3D17-94F7-1CEAFA975240> /usr/lib/libicucore.A.dylib
        0x7fff887f4000 -     0x7fff888c6ff7  com.apple.CoreText (260.0 - 275.16) <5BFC1D67-6A6F-38BC-9D90-9C712684EDAC> /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText
        0x7fff88b23000 -     0x7fff88b8cfff  libstdc++.6.dylib (56) <EAA2B53E-EADE-39CF-A0EF-FB9D4940672A> /usr/lib/libstdc++.6.dylib
        0x7fff88b91000 -     0x7fff88bbcfff  libxslt.1.dylib (11.3) <441776B8-9130-3893-956F-39C85FFA644F> /usr/lib/libxslt.1.dylib
        0x7fff88bcb000 -     0x7fff88c17ff7  libauto.dylib (185.4) <AD5A4CE7-CB53-313C-9FAE-673303CC2D35> /usr/lib/libauto.dylib
        0x7fff88c18000 -     0x7fff88c39ff7  libCRFSuite.dylib (33) <736ABE58-8DED-3289-A042-C25AF7AE5B23> /usr/lib/libCRFSuite.dylib
        0x7fff88c3a000 -     0x7fff88c42ff7  libsystem_dnssd.dylib (379.38.1) <BDCB8566-0189-34C0-9634-35ABD3EFE25B> /usr/lib/system/libsystem_dnssd.dylib
        0x7fff88c47000 -     0x7fff88c54fff  libbz2.1.0.dylib (29) <CE9785E8-B535-3504-B392-82F0064D9AF2> /usr/lib/libbz2.1.0.dylib
        0x7fff88c84000 -     0x7fff88cb2fff  com.apple.CoreServicesInternal (154.3 - 154.3) <F4E118E4-E327-3314-83D7-EA20B1717ED0> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/Cor eServicesInternal
        0x7fff88cb3000 -     0x7fff88cb6fff  libRadiance.dylib (850) <62E3F7FB-03E3-3937-A857-AF57A75EAF09> /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.d ylib
        0x7fff88cb7000 -     0x7fff88cb7fff  com.apple.Cocoa (6.7 - 19) <1F77945C-F37A-3171-B22E-F7AB0FCBB4D4> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
        0x7fff88cb8000 -     0x7fff88cc6fff  com.apple.Librarian (1.1 - 1) <5AC28666-7642-395F-A923-C6F8A274BBBD> /System/Library/PrivateFrameworks/Librarian.framework/Versions/A/Librarian
        0x7fff88d35000 -     0x7fff88d35fff  libOpenScriptingUtil.dylib (148.3) <F8681222-0969-3B10-8BCE-C55A4B9C520C> /usr/lib/libOpenScriptingUtil.dylib
        0x7fff88e61000 -     0x7fff88e68fff  libcopyfile.dylib (89) <876573D0-E907-3566-A108-577EAD1B6182> /usr/lib/system/libcopyfile.dylib
        0x7fff88e6b000 -     0x7fff88e82fff  com.apple.GenerationalStorage (1.1 - 132.3) <FD4A84B3-13A8-3C60-A59E-25A361447A17> /System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/Gene rationalStorage
        0x7fff88e83000 -     0x7fff89031fff  com.apple.QuartzCore (1.8 - 304.3) <F450F2DE-2F24-3557-98B6-310E05DAC17F> /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
        0x7fff89092000 -     0x7fff8909afff  liblaunch.dylib (442.26.2) <2F71CAF8-6524-329E-AC56-C506658B4C0C> /usr/lib/system/liblaunch.dylib
        0x7fff8909b000 -     0x7fff890f5ff7  com.apple.opencl (2.2.19 - 2.2.19) <3C7DFB2C-B3F9-3447-A1FC-EAAA42181A6E> /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL
        0x7fff890f6000 -     0x7fff890f8fff  com.apple.TrustEvaluationAgent (2.0 - 23) <A97D348B-32BF-3E52-8DF2-59BFAD21E1A3> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/Tru stEvaluationAgent
        0x7fff890f9000 -     0x7fff89138ff7  com.apple.QD (3.42.1 - 285.1) <77A20C25-EBB5-341C-A05C-5D458B97AD5C> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ QD.framework/Versions/A/QD
        0x7fff89139000 -     0x7fff89147fff  libcommonCrypto.dylib (60027) <BAAFE0C9-BB86-3CA7-88C0-E3CBA98DA06F> /usr/lib/system/libcommonCrypto.dylib
        0x7fff89153000 -     0x7fff89158fff  com.apple.OpenDirectory (10.8 - 151.10) <CF44120B-9B01-32DD-852E-C9C0E1243FC0> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory
        0x7fff891b6000 -     0x7fff891b7fff  liblangid.dylib (116) <864C409D-D56B-383E-9B44-A435A47F2346> /usr/lib/liblangid.dylib
        0x7fff891b8000 -     0x7fff89220fff  l

    Do a backup, using either Time Machine or a cloning program, to ensure files/data can be recovered. Two backups are better than one.
    Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
    Isolating an issue by using another user account
    If the problem is still there, try booting into the Safe Mode.  Shut down the computer and then power it back up. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application unistaller. For each disable/delete, you will need to restart if you don't do them all at once.
    Safe Mode
    Safe Mode - About
    General information.
    Isolating issues in Mac OS X
    Troubleshooting Permission Issues
    Step by Step to Fix Your Mac

  • Infinite loop error after using Java Sun Tutorial for Learning Swing

    I have been attempting to create a GUI following Sun's learning swing by example (example two): http://java.sun.com/docs/books/tutorial/uiswing/learn/example2.html
    In particular, the following lines were used almost word-for-word to avoid a non-static method call problem:
    SwingApplication app = new SwingApplication();
    Component contents = app.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);I believe that I am accidentally creating a new instance of the gui class repeatedly (since it shows new GUI's constantly and then crashes my computer), possibly because I am creating an instance in the main class, but creating another instance in the GUI itself. I am not sure how to avoid this, given that the tutorials I have seen do not deal with having a main class as well as the GUI. I have googled (a nice new verb) this problem and have been through the rest of the swing by example tutorials, although I am sure I am simply missing a website that details this problem. Any pointers on websites to study to avoid this problem would be appreciated.
    Thanks for your time-
    Danielle
    /** GUI for MicroMerger program
    * Created July/06 at IARC
    *@ author Danielle
    package micromerger;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.swing.JFileChooser;
    import java.lang.Object;
    public class MGui
         private static File inputFile1, inputFile2;
         private static File sfile1, sfile2;
         private static String file1Name, file2Name;
         private String currFile1, currFile2;
         private JButton enterFile1, enterFile2;
         private JLabel enterLabel1, enterLabel2;
         private static MGui app;
         public MGui()
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        System.out.println("About to run create GUI method");
                        app = new MGui();
                        System.out.println("declared a new MGui....");
                        createAndShowGUI();
         //initialize look and feel of program
         private static void initLookAndFeel() {
            String lookAndFeel = null;
         lookAndFeel = UIManager.getSystemLookAndFeelClassName();
         try
              UIManager.setLookAndFeel(lookAndFeel);
         catch (ClassNotFoundException e) {
                    System.err.println("Couldn't find class for specified look and feel:"
                                       + lookAndFeel);
                    System.err.println("Did you include the L&F library in the class path?");
                    System.err.println("Using the default look and feel.");
                } catch (UnsupportedLookAndFeelException e) {
                    System.err.println("Can't use the specified look and feel ("
                                       + lookAndFeel
                                       + ") on this platform.");
                    System.err.println("Using the default look and feel.");
                } catch (Exception e) {
                    System.err.println("Couldn't get specified look and feel ("
                                       + lookAndFeel
                                       + "), for some reason.");
                    System.err.println("Using the default look and feel.");
                    e.printStackTrace();
         // Make Components--
         private Component createLeftComponents()
              // Make panel-- grid layout
         JPanel pane = new JPanel(new GridLayout(0,1));
            //Add label
            JLabel welcomeLabel = new JLabel("Welcome to MicroMerger.  Please Enter your files.");
            pane.add(welcomeLabel);
         //Add buttons to enter files:
         enterFile1 = new JButton("Please click to enter the first file.");
         enterFile1.addActionListener(new enterFile1Action());
         pane.add(enterFile1);
         enterLabel1 = new JLabel("");
         pane.add(enterLabel1);
         enterFile2 = new JButton("Please click to enter the second file.");
         enterFile2.addActionListener(new enterFile2Action());
         pane.add(enterFile2);
         enterLabel2 = new JLabel("");
         pane.add(enterLabel2);
         return pane;
         /** Make GUI:
         private static void createAndShowGUI()
         System.out.println("Creating a gui...");
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("MicroMerger");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Add stuff to the frame
         //MGui app = new MGui();
         Component leftContents = app.createLeftComponents();
         frame.getContentPane().add(leftContents, BorderLayout.WEST);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
    private class enterFile1Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile1 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file1Name = inputFile1.getName();
                   enterLabel1.setText(file1Name);
    private class enterFile2Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile2 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file2Name = inputFile2.getName();
                   enterLabel2.setText(file2Name);
    } // end classAnd now the main class:
    * Main.java
    * Created on June 13, 2006, 2:29 PM
    * @author Danielle
    package micromerger;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Main
        /** Creates a new instance of Main */
        public Main()
         * @param args the command line arguments
        public static void main(String[] args)
            MGui mainScreen = new MGui();
            //mainScreen.setVisible(true);
            /**Starting to get file choices and moving them into GPR Handler:
             System.out.println("into main method");
         String file1Name = new String("");
             file1Name = MGui.get1Name();
         System.out.println("good so far- have MGui.get1Name()");
        }// end main(String[] args)
    }// end class Main

    um, yeah, you definitely have a recursion problem, that's going to create an infinite loop. you will eventually end up an out of memory error, if you don't first get the OS telling you you have too many windows. interestingly, because you are deferring execution, you won't get a stack overflow error, which you expect in an infinite recursion.
    lets examine why this is happening:
    in main, you call new MGui().
    new MGui() creates a runnable object which will be run on the event dispatch thread. That method ALSO calls new MGui(), which in turn ALSO creates a new object which will be run on the event dispatch thead. That obejct ALSO calls new MGui(), which ...
    well, hopefully you get the picture.
    you should never unconditionally call a method from within itself. that code that you have put in the constructor for MGui should REALLY be in the main method, and the first time you create the MGui in the main method as it currently exists is unnecessary.
    here's what you do: get rid of the MGui constructor altogether. since it is the implicit constructor anyway, if it doesn't do anything, you don't need to provide it.
    now, your main method should actually look like this:
    public static void main( String [] args ) {
      SwingUtilities.invokeLater( new Runnable() {
        public void run() {
          MGui app = new MGui();
          app.createAndShowGUI();
    }// end mainyou could also declare app and call the constructor before creating the Runnable, as many prefer, because you would have access to it from outside of the Runnable object. The catch there, though, is that app would need to be declared final.
    - Adam

Maybe you are looking for

  • Zen Sleek... any way to hook to car speake

    <FONT color=#ff0000 size=4>Hello, <FONT color=#ff0000 size=4> <FONT color=#ff0000 size=4>Is there any type of adapter or hook ups that will let you hear your songs in your car thru the speakers? <FONT color=#ff0000 size=4>I only have a CD player... n

  • How to do DUMP Analysis ?

    How to do DUMP Analysis ?Can anybody explain me the steps to solve the dump step by step ? thanks Naresh

  • Short Dumps in standard HR Business Event Group/Event creation transactions

    Dear All, I m getting short dumps whlile executing standard HR transactions for Creation of Business Event Groups and Business Event Types. Attaching the Short Dump text herewith. Can anyone plz. help...   An exception occurred that is explained in d

  • Size of idoc

    Hi, how can i find size of an idoc.

  • After Saving Workbook Text Elements are All Blank

    I created a query, made some adjustments in Analyzer and saved the workbook.  Upon going back into my workbook, all my text elements were blank and when I open them, the constants and filter values are all unchecked.  What could have caused these to