org.pentaho.di.core.Const.getStackTracker()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中org.pentaho.di.core.Const.getStackTracker()方法的一些代码示例,展示了Const.getStackTracker()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Const.getStackTracker()方法的具体详情如下:
包路径:org.pentaho.di.core.Const
类名称:Const
方法名:getStackTracker

Const.getStackTracker介绍

[英]Returns a string of the stack trace of the specified exception
[中]返回指定异常的堆栈跟踪字符串

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void run() {
  try {
   cleanupJarFiles( jarFiles );
  } catch ( Exception e ) {
   System.err.println( "Error cleaning up temporary Talend jar file extracts: "
    + Const.getStackTracker( e ) );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

@VisibleForTesting
static String calculateString( final String packageName, final Locale locale, final String key,
                final Object[] parameters, final Class<?> resourceClass, final String bundleName,
                final boolean fallbackOnRoot ) throws MissingResourceException {
 try {
  ResourceBundle bundle = getBundle( locale, packageName + "." + bundleName, resourceClass, fallbackOnRoot );
  String unformattedString = bundle.getString( key );
  String string = MessageFormat.format( unformattedString, parameters );
  return string;
 } catch ( IllegalArgumentException e ) {
  final StringBuilder msg = new StringBuilder();
  msg.append( "Format problem with key=[" ).append( key ).append( "], locale=[" ).append( locale ).append(
   "], package=" ).append( packageName ).append( " : " ).append( e.toString() );
  log.error( msg.toString() );
  log.error( Const.getStackTracker( e ) );
  throw new MissingResourceException( msg.toString(), packageName, key );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void showDocumentMap() {
 try {
  URL url = new URL( DOCUMENTATION_URL );
  HelpUtils.openHelpDialog( shell, STRING_DOCUMENT_TAB_NAME, url.toString() );
 } catch ( MalformedURLException e1 ) {
  log.logError( Const.getStackTracker( e1 ) );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private String reEncodeWriteAccessIfNecessary( String writeAccess ) {

  if ( writeAccess == null || writeAccess.length() == 0 ) {
   return writeAccess;
  }
  byte[] data = new byte[112];
  try {
   // jxl reads writeAccess with "UnicodeLittle" encoding, but will try to write later with "file.encoding"
   // this throws an ArrayIndexOutOfBoundsException in *nix systems
   StringHelper.getBytes( writeAccess, data, 0 );
  } catch ( ArrayIndexOutOfBoundsException e ) {
   try {
    // properly re-encoding string from UnicodeLittle, removing BOM characters
    return new String( writeAccess.getBytes( "UnicodeLittle" ), System.getProperty( "file.encoding" ) ).substring( 2 );
   } catch ( UnsupportedEncodingException e1 ) {
    logError( Const.getStackTracker( e ) );
   }
  }
  return writeAccess;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public ErrorDialog( Shell parent, String title, String message, Throwable throwable, Function<String, String> exMsgFunction ) {
 super( parent, SWT.NONE );
 this.exMsgFunction = exMsgFunction;
 throwable.printStackTrace();
 // this.log = new LogChannel("ErrorDialog");
 // log.logError(message, throwable);
 if ( throwable instanceof Exception ) {
  showErrorDialog( parent, title, message, (Exception) throwable, false );
 } else {
  // not optimal, but better then nothing
  showErrorDialog( parent, title, message + Const.CR + Const.getStackTracker( throwable ), null, false );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void run() {
 try {
  InputStreamReader isr = new InputStreamReader( is );
  BufferedReader br = new BufferedReader( isr );
  String line = null;
  while ( ( line = br.readLine() ) != null ) {
   lastLine = line;
   if ( errorStream ) {
    log.logError( type + " " + line );
   } else {
    log.logBasic( type + " " + line );
   }
  }
 } catch ( IOException ioe ) {
  log.logError( type + " " + Const.getStackTracker( ioe ) );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Puts the steps in alphabetical order.
 */
public void sortSteps() {
 try {
  Collections.sort( steps );
 } catch ( Exception e ) {
  log.logError( BaseMessages.getString( PKG, "TransMeta.Exception.ErrorOfSortingSteps" ) + e );
  log.logError( Const.getStackTracker( e ) );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public Object nativeToJava( TransferData transferData ) {
 if ( isSupportedType( transferData ) ) {
  try {
   byte[] buffer = (byte[]) super.nativeToJava( transferData );
   String xml = new String( Base64.decodeBase64( new String( buffer ).getBytes() ) );
   return new DragAndDropContainer( xml );
  } catch ( Exception e ) {
   log.logError( "Unexpected error trying to read a drag and drop container from the XML Transfer type: "
    + e.toString() );
   log.logError( Const.getStackTracker( e ) );
   return null;
  }
 }
 return null;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
 try {
  if ( data.fc != null ) {
   data.fc.close();
  }
  if ( data.fis != null ) {
   data.fis.close();
  }
 } catch ( IOException e ) {
  logError( "Unable to close file channel for file '" + meta.getFilename() + "' : " + e.toString() );
  logError( Const.getStackTracker( e ) );
 }
 super.dispose( smi, sdi );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void javaToNative( Object object, TransferData transferData ) {
 if ( !checkMyType( object ) ) {
  return; // DND.error(DND.ERROR_INVALID_DATA);
 }
 try {
  byte[] buffer =
   Base64.encodeBase64( ( (DragAndDropContainer) object ).getXML().getBytes( Const.XML_ENCODING ) );
  super.javaToNative( buffer, transferData );
 } catch ( Exception e ) {
  log.logError( "Unexpected error trying to put a string onto the XML Transfer type: " + e.toString() );
  log.logError( Const.getStackTracker( e ) );
  return;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private synchronized void safeClosePipe() {
 if ( !triedToClosePipe ) {
  try {
   closePipe();
  } catch ( Exception e ) {
   logError( BaseMessages.getString( PKG, "InfobrightLoader.Log.UnexpectedError" ) + " : " + e.toString() );
   logError( Const.getStackTracker( e ) );
  } finally {
   triedToClosePipe = true;
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

protected boolean writeEndedLine() {
 boolean retval = false;
 try {
  String sLine = environmentSubstitute( meta.getEndedLine() );
  if ( sLine != null ) {
   if ( sLine.trim().length() > 0 ) {
    data.writer.write( getBinaryString( sLine ) );
    incrementLinesOutput();
   }
  }
 } catch ( Exception e ) {
  logError( "Error writing ended tag line: " + e.toString() );
  logError( Const.getStackTracker( e ) );
  retval = true;
 }
 return retval;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void println( LogMessageInterface message, Throwable e, LogLevel channelLogLevel ) {
 println( message, channelLogLevel );
 String stackTrace = Const.getStackTracker( e );
 LogMessage traceMessage = new LogMessage( stackTrace, message.getLogChannelId(), LogLevel.ERROR );
 println( traceMessage, channelLogLevel );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override public void run() {
  try {
   Result threadResult = execute( nr + 1, newResult, nextEntry, jobEntryCopy, nextComment );
   threadResults.add( threadResult );
  } catch ( Throwable e ) {
   log.logError( Const.getStackTracker( e ) );
   threadExceptions.add( new KettleException( BaseMessages.getString( PKG, "Job.Log.UnexpectedError",
     nextEntry.toString() ), e ) );
   Result threadResult = new Result();
   threadResult.setResult( false );
   threadResult.setNrErrors( 1L );
   threadResults.add( threadResult );
  }
 }
};

代码示例来源:origin: pentaho/pentaho-kettle

public void println( LogMessageInterface message, Throwable e, LogLevel channelLogLevel ) {
 println( message, channelLogLevel );
 String stackTrace = Const.getStackTracker( e );
 LogMessage traceMessage = new LogMessage( stackTrace, message.getLogChannelId(), LogLevel.ERROR );
 println( traceMessage, channelLogLevel );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void close() throws KettleException {
  if ( ctx != null ) {
   try {
    ctx.close();
    if ( log.isBasic() ) {
     log.logBasic( BaseMessages.getString( PKG, "LDAPInput.log.Disconnection.Done" ) );
    }
   } catch ( Exception e ) {
    log.logError( BaseMessages.getString( PKG, "LDAPInput.Exception.ErrorDisconecting", e.toString() ) );
    log.logError( Const.getStackTracker( e ) );
   } finally {
    ctx = null;
   }
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
 meta = (SocketWriterMeta) smi;
 data = (SocketWriterData) sdi;
 if ( super.init( smi, sdi ) ) {
  try {
   data.serverSocketPort = Integer.parseInt( environmentSubstitute( meta.getPort() ) );
   data.serverSocket =
    getTrans().getSocketRepository().openServerSocket(
     data.serverSocketPort, getTransMeta().getName() + " - " + this.toString() );
   return true;
  } catch ( Exception e ) {
   logError( "Error creating server socket: " + e.toString() );
   logError( Const.getStackTracker( e ) );
  }
 }
 return false;
}

代码示例来源:origin: pentaho/pentaho-kettle

public static void main( String[] args ) {
 Display display = new Display();
 LogChannelInterface log = new LogChannel( APP_NAME );
 PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );
 Translator translator = new Translator( display );
 translator.open();
 try {
  while ( !display.isDisposed() ) {
   if ( !display.readAndDispatch() ) {
    display.sleep();
   }
  }
 } catch ( Throwable e ) {
  log.logError( "An unexpected error occurred : " + e.getMessage() );
  log.logError( Const.getStackTracker( e ) );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private synchronized boolean keepRow( RowMetaInterface rowMeta, Object[] row ) throws KettleException {
 try {
  return meta.getCondition().evaluate( rowMeta, row );
 } catch ( Exception e ) {
  String message =
   BaseMessages.getString( PKG, "FilterRows.Exception.UnexpectedErrorFoundInEvaluationFuction" );
  logError( message );
  logError( BaseMessages.getString( PKG, "FilterRows.Log.ErrorOccurredForRow" ) + rowMeta.getString( row ) );
  logError( Const.getStackTracker( e ) );
  throw new KettleException( message, e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void run() {
  logBasic( "Starting to run..." );
  try {
   while ( processRow( meta, data ) && !isStopped() ) {
    // Process rows
   }
  } catch ( Exception e ) {
   logError( "Unexpected error : " + e.toString() );
   logError( Const.getStackTracker( e ) );
   setErrors( 1 );
   stopAll();
  } finally {
   dispose( meta, data );
   logBasic( "Finished, processing " + getLinesRead() + " rows" );
   markStop();
  }
 }
}

相关文章

微信公众号

最新文章

更多