cancel
Showing results for 
Search instead for 
Did you mean: 

Running custom action block

Former Member
0 Kudos

Hi!

I've created my custom action block and successfuly deployed it to MII server, but unfortunately it doesn't work due to followinf runtime errors:

[ERROR]: STEP EXCEPTION () : Invalid Assignment Target: [AstraFile_0.FilePath]
[ERROR]: STEP EXCEPTION (AstraFile_0) : Invalid Assignment Target: [AstraFile_0.FilePath]
[ERROR]: STEP EXCEPTION (Sequence) : Item 'AstraFile_0' is not an Action
[ERROR]: TRANSACTION EXECUTION TERMINATED

Here is source code of my action block:

package org.gazauto.mii.utils;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

import com.sap.xmii.xacute.actions.ActionReflectionBase;
import com.sap.xmii.xacute.core.ILog;
import com.sap.xmii.xacute.core.Transaction;

public class AsciiFileWriter extends ActionReflectionBase {
	
	private static final long serialVersionUID = -482443624682839179L;
	
	private String text;
	private String filePath;
	
    public boolean isConfigurable() {
        return false;
    }
    
    public String GetIconPath() {
        return "icon.png";
    }
	
	public void Invoke(Transaction transaction, ILog log) {		
		byte[] buffer = null;
		try {
			buffer = text.getBytes("Cp866");
		} catch (UnsupportedEncodingException uee) {
			log.error("Unable to switch data encoding");
			_success = false;
		}	
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(filePath);
			fos.write(buffer);
			fos.flush();
			fos.close();
		} catch (IOException ioe) {
			log.error("Unable to access " + filePath);
			_success = false;
		} 
		_success = true;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getText() {
		return text;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getFilePath() {
		return filePath;
	}

}

Did anybody face such kind of problem? How can it be solved?

Edited by: a.kushik on May 27, 2010 7:11 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Looks like access problem. Try making FilePath a public variable.

BR,

SB