public String getChecksum() throws KettleStepException { String ck = this.className + this.source; try { byte[] b = MessageDigest.getInstance( "MD5" ).digest( ck.getBytes() ); return Hex.encodeHexString( b ); } catch ( Exception ex ) { // Can't get MD5 hashcode ? throw new KettleStepException( "Unable to obtain checksum of UDJC - " + this.className ); } }
/** * Send input row to output * * @param rowIndex */ private void echoRow( int rowIndex ) { try { putRow( data.outputRowMeta, data.inputRowBuffer[rowIndex] ); } catch ( KettleStepException e ) { logError( e.getLocalizedMessage() ); } catch ( ArrayIndexOutOfBoundsException e ) { logError( e.getLocalizedMessage() ); } }
if ( data.customchannels[i] < 0 ) { // couldn't find field! throw new KettleStepException( BaseMessages.getString( PKG, "RssOutput.Exception.FieldRequired", meta .getChannelCustomFields()[i] ) ); if ( data.customitems[i] < 0 ) { // couldn't find field! throw new KettleStepException( BaseMessages.getString( PKG, "RssOutput.Exception.FieldRequired", meta .getItemCustomFields()[i] ) ); logError( BaseMessages.getString( PKG, "RssOutputMeta.Log.ErrorInStep" ) + e.getMessage() ); setErrors( 1 ); stopAll();
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { int size = transMeta.findNrPrevSteps( stepInfo ); try { if ( before ) { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchInputFields.Message" ), size ); // Searching // for // input // fields... fields = transMeta.getPrevStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) ); } else { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchOutputFields.Message" ), size ); // Searching // for // output // fields... fields = transMeta.getStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) ); } } catch ( KettleStepException kse ) { throw new InvocationTargetException( kse, BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Log.UnableToGetFields", stepInfo.toString(), kse.getMessage() ) ); } monitor.done(); }
if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "PropertyOutputMeta.Log.ErrorInStep" ) + e.getMessage() ); setErrors( 1 ); stopAll();
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } try { stepname = wStepname.getText(); // return value getInfo( input ); } catch ( KettleStepException e ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( e.toString() ); mb.setText( BaseMessages.getString( PKG, "System.Warning" ) ); mb.open(); } dispose(); }
new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "TransMeta.CheckResult.TypeResultError.ErrorOccurredGettingStepInfoFields.Description", "" + stepMeta, Const.CR + kse.getMessage() ), stepMeta ); remarks.add( cr ); new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages .getString( PKG, "TransMeta.CheckResult.TypeResultError.ErrorOccurredGettingInputFields.Description", "" + stepMeta, Const.CR + kse.getMessage() ), stepMeta ); remarks.add( cr );
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } try { stepname = wStepname.getText(); // return value getInfo( input ); } catch ( KettleStepException e ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( e.toString() ); mb.setText( BaseMessages.getString( PKG, "System.Warning" ) ); mb.open(); } dispose(); }
public void getDeleteFields( RowMetaInterface inputRowMeta ) throws KettleStepException { if ( deleteName != null && deleteName.length > 0 ) { // DESELECT values from the stream... for ( int i = 0; i < deleteName.length; i++ ) { try { inputRowMeta.removeValueMeta( deleteName[i] ); } catch ( KettleValueException e ) { throw new KettleStepException( e ); } } } }
putRow( row, rowMeta ); } catch ( KettleStepException e ) { logError( "An error occurred, processing will be stopped: " + e.getMessage() ); setErrors( 1 ); stopAll();
/** * Send input row to error. * * @param index * @param errorMsg */ private void rejectRow( int index, String errorMsg ) { try { putError( getInputRowMeta(), data.inputRowBuffer[index], 1, errorMsg, null, INSERT_ERROR_CODE ); } catch ( KettleStepException e ) { logError( e.getLocalizedMessage() ); } catch ( ArrayIndexOutOfBoundsException e ) { logError( e.getLocalizedMessage() ); } }
private byte[] getBinaryString( String string ) throws KettleStepException { try { if ( data.hasEncoding ) { return string.getBytes( meta.getEncoding() ); } else { return string.getBytes(); } } catch ( Exception e ) { throw new KettleStepException( e ); } }
public void widgetSelected( SelectionEvent e ) { RssOutputMeta tfoi = new RssOutputMeta(); getInfo( tfoi ); try { String[] files = tfoi.getFiles( transMeta ); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, BaseMessages.getString( PKG, "RssOutputDialog.SelectOutputFiles.DialogTitle" ), BaseMessages.getString( PKG, "RssOutputDialog.SelectOutputFiles.DialogMessage" ) ); esd.setViewOnly(); esd.open(); } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "RssOutputDialog.NoFilesFound.DialogMessage" ) ); mb.setText( BaseMessages.getString( PKG, "System.DialogTitle.Error" ) ); mb.open(); } } catch ( KettleStepException s ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "RssOutputDialog.ErrorGettingFiles.DialogMessage", s .getMessage() ) ); mb.setText( BaseMessages.getString( PKG, "System.DialogTitle.Error" ) ); mb.open(); } } } );
private void sendErrorRow( String errorMsg ) { try { // same error as before String defaultErrCode = "JsonInput001"; if ( data.readrow != null ) { putError( getInputRowMeta(), data.readrow, 1, errorMsg, meta.getFieldValue(), defaultErrCode ); } else { // when no input only error fields are recognized putError( new RowMeta(), new Object[ 0 ], 1, errorMsg, null, defaultErrCode ); } } catch ( KettleStepException e ) { logError( e.getLocalizedMessage(), e ); } }
private String readStringFromInputStream( InputStream is, String encoding ) throws KettleStepException { try { StringBuilder sb = new StringBuilder( Math.max( 16, is.available() ) ); char[] tmp = new char[ 4096 ]; try { InputStreamReader reader = new InputStreamReader( is, encoding != null ? encoding : "UTF-8" ); for ( int cnt; ( cnt = reader.read( tmp ) ) > 0; ) { sb.append( tmp, 0, cnt ); } } finally { is.close(); } return sb.toString(); } catch ( Exception e ) { throw new KettleStepException( "Unable to read web service response data from input stream", e ); } }
stepMeta.logDebug( ex.getMessage(), ex );
private void writeField( ValueMetaInterface valueMeta, Object valueData, String element ) throws KettleStepException { try { String value = valueMeta.getString( valueData ); if ( value != null ) { data.writer.writeStartElement( element ); data.writer.writeCharacters( value ); data.writer.writeEndElement(); } else { data.writer.writeEmptyElement( element ); } } catch ( Exception e ) { throw new KettleStepException( "Error writing line :", e ); } }
throw new InvocationTargetException( kse, BaseMessages.getString( PKG, "Spoon.RipDB.Exception.ErrorGettingSQLFromTransformation" ) + transMeta + "] : " + kse.getMessage() );
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( outputIDField ) { if ( outputIDFieldName == null || outputIDFieldName.length() == 0 ) { throw new KettleStepException( "Error while retrieving fields", new Exception( "ID field name is null" ) ); } ValueMetaInterface v = new ValueMetaInteger( outputIDFieldName ); v.setOrigin( name ); row.addValueMeta( v ); } }
@Override protected Map<String, RowMetaInterface> getInputRowMetaInterfaces( KafkaConsumerInputMeta meta ) { Map<String, RowMetaInterface> inputRows = new HashMap<>(); try { RowMeta rowMeta = new RowMeta(); for ( KafkaConsumerField.Name kafkaField : KafkaConsumerField.Name.values() ) { baseStepMeta.putFieldOnRowMeta( new KafkaConsumerField( kafkaField, kafkaField.toString() ), rowMeta, "", parentTransMeta ); } inputRows.put( RESOURCE, rowMeta ); } catch ( KettleStepException e ) { log.warn( e.getMessage(), e ); } return inputRows; }