Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EGL Development Tools » Validators error(Cannot generate validator)
Validators error [message #894225] Sat, 07 July 2012 21:20 Go to next message
Nathan Reed is currently offline Nathan ReedFriend
Messages: 74
Registered: June 2012
Member
Windows XP
RichUI with one dedicated service
Migrating from RBD
EDT 0.8.0

I was using the following code in RBD with no issue. When I gen it in EDT it results in the following error:

This method must return a result of type string

I have several of these functions and they all return this error. I have shown one below and the associated RichUI code that uses it.

I assume I need to modify the way this worked from RBD but am not seeing it.

Can anyone offer a suggestion?

Thx,

Nathan Reed


package common;


// basic library
library ValidationLibrary
	
	function validateProcessorName(input string in) returns(string?)
		teststring int = 1;
		if (input == "")
			errortext string = "Processor name cannot be blank.";
			return (errortext);
		end // End if
	end // End function

end

// RichUI segment

	ProcessorMasterDefinition_PROCNAME_nameLabel TextLabel { text = "Processor name:" , layoutData =    new GridLayoutData { row = 1, column = 1} };
	ProcessorMasterDefinition_PROCNAME_field DojoTextField {layoutData = new GridLayoutData { row = 1, column = 2}, width = 360 };
	ProcessorMasterDefinition_PROCNAME_controller Controller { @MVC {model = ProcessorMasterDefinition.PROCNAME,
																view = ProcessorMasterDefinition_PROCNAME_field},

 
validators = [validationLibrary.validateProcessorName]};


	ProcessorMasterDefinition_PROCNAME_errorLabel TextLabel { layoutData = new GridLayoutData { row = 1, column = 3}, color = "red" };
	ProcessorMasterDefinition_PROCNAME_formField FormField { controller = ProcessorMasterDefinition_PROCNAME_controller, 
																nameLabel = ProcessorMasterDefinition_PROCNAME_nameLabel, 
																errorLabel = ProcessorMasterDefinition_PROCNAME_errorLabel};
Re: Validators error [message #894329 is a reply to message #894225] Sun, 08 July 2012 09:01 Go to previous messageGo to next message
Richard Moulton is currently offline Richard MoultonFriend
Messages: 92
Registered: August 2011
Location: Devon, UK
Member
Nathan,

I've noticed similar errors myself with library functions I've developed though these don't stop you from running your application.

What I have noticed is that if the library part is in the common package then attempts are made to generate both java and js code. If you move the library part to the client package then the error will go away.

My assumption on this is that anything within the common package is intended for use by either the client or the server and so needs to generate both java and js.

Within RBD isn't this configuration defined within the build descriptor. I'm not sure if this is configurable within EDT.

When generating services from db files the tooling creates packages automatically, such as server.myserver.common. So, as a means of grouping like parts maybe the intention is to create separate packages, client.handlers, client.common, etc

Richard
Re: Validators error [message #894330 is a reply to message #894329] Sun, 08 July 2012 09:13 Go to previous messageGo to next message
Richard Moulton is currently offline Richard MoultonFriend
Messages: 92
Registered: August 2011
Location: Devon, UK
Member
Nathan,

I found where the compiler options are specified in EDT, against the package name. By default the common package has compiler generation options for both java and js.

Richard
Re: Validators error [message #894331 is a reply to message #894330] Sun, 08 July 2012 09:27 Go to previous messageGo to next message
Nathan Reed is currently offline Nathan ReedFriend
Messages: 74
Registered: June 2012
Member
Richard:

I also had some issues in my service program from RBD that were similar. Seems it does not like code that has logic that will not result in a return. Just modified the code to include an else and execute a return if no error as shown below. This cleared up the error issue.

I noticed before that the code actually executed the same as it did in RBD. I just noticed the errors and became concerned.

I tested after adding the return of blanks on no error and everything seems to be functioning exactly the same.

Will check out the compiler issues in more detail. Starting to get a grip.

Thx,

Nathan Reed



	function validateProcessorName(input string in) returns(string?)
		teststring int = 1;
		if (input == "")
			errortext string = "Processor name cannot be blank.";
			return (errortext);
		else
			errortext string = "";
			return (errortext);
		end // End if
	end // End function
Re: Validators error [message #894584 is a reply to message #894331] Mon, 09 July 2012 17:33 Go to previous messageGo to next message
Brian Svihovec is currently offline Brian SvihovecFriend
Messages: 55
Registered: July 2009
Member
Nathan,

Thanks for highlighting this difference between RBD and EDT. I have updated the EGL Language Conversion wiki page to add a section on Function return statements: http: //wiki.eclipse.org/EDT:EGL_Language_conversion

As you discovered, EDT requires that all function exit paths specify a return statement if the function signature contains a 'returns'.

-Brian
Re: Validators error [message #894605 is a reply to message #894584] Mon, 09 July 2012 19:35 Go to previous message
Nathan Reed is currently offline Nathan ReedFriend
Messages: 74
Registered: June 2012
Member
Brian:

My coding practice in EGL is not yet the best.

The other issue you may want to note is that "unreachable code" will set an error. I had to do some clean up and caught some issues I did not know I had.

Thx,

Nathan Reed
Previous Topic:Dedicated service call
Next Topic:More issues with IBM i program calls
Goto Forum:
  


Current Time: Mon Oct 07 23:22:33 GMT 2024

Powered by FUDForum. Page generated in 0.04621 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top