Struts 2 setter unknown field parameters - error-handling

My struts 2 (2.3.1) application at debug mode for url http://localhost/app/check.action?13239 raises such kind of exceptions
2011-12-15 14:45:06,455 DEBUG [CommonsLogger.java:68] : Setting static parameters {}
2011-12-15 14:45:06,456 DEBUG [CommonsLogger.java:68] : Setting params NONE
2011-12-15 14:45:06,456 DEBUG [CommonsLogger.java:68] : Setting params 13239 => [ ]
2011-12-15 14:45:06,461 WARN [CommonsLogger.java:60] : Error setting expression '13239' with value '[Ljava.lang.String;#33b4450e'
ognl.InappropriateExpressionException: Inappropriate OGNL expression: 13239
at ognl.SimpleNode.setValueBody(SimpleNode.java:312)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
I was expecting silently ignoring them according to documentation. What is the correct way to fix this problem?
By the way it seems that struts looking for a setter field for the value 13239 however I guess that it is not suitable for a property which is started by a number.

That is more or less a issue of your personal taste.Sometime we wants to know any time a parameter is submitted that doesn't have a matching getter/setter on the action and its a common use case in development our application and we forget a getter/setter on an action, we want to know about any possible error case.
One possible way to is setting the logging level differently from dev to production.There was a long discussion about this on Struts2 mailing list here is the link for same
OgnlValueStack Error setting expression warnings after upgrade from struts 2 to struts 2.1.7

Related

jackson's ObjectMapper withColonInTimeZone

I would need to set colonInTimeZone false as recent jackson lib version upgrade (2.10.3->2.13.3) in my project.
The customer needs to keep the current response which is 2022-10-19T13:23:12.000+0000 and we have input value, 2022-10-18T15:53:49.000Z
I have set spring.jackson.date-format: "yyyy-MM-dd'T'HH:mm:ss.SSSZ" and it creates the response as expected without colon but it throws an InvalidFormatException while parsing input value.
I can fix this issue by mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(false)) but I would need to fix without touching the source code. mostly in the config file, application.yml
I tried spring.jackson.date-format.withColonIntimeZone: false but it seems it's not working. Please, guide me.

I have two types of Errors in Blazor Server that appear in razor.g.cs files (upgrading to preview 9)

I created a preview 9 server blazor project and attempted to convert an existing preview 6 to it, Using a guide that is public in the internet. I get two types of errors (35 errors) that appears in razor.g.cs files:
Error CS1662 Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type BlazorStore9 C:...\obj\Debug\netcoreapp3.0\Razor\Pages\Admin\EditProductComponents\AddEditProductDescriptionImage.razor.g.cs
and
Error CS1503 Argument 6: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to 'Microsoft.AspNetCore.Components.EventCallback' BlazorStore9 C:...\obj\Debug\netcoreapp3.0\Razor\Pages\Admin\EditProductComponents\AddEditProductDescriptionImage.razor.g.cs 326 Active
I managed to solve all the errors (thousands) based on that guide, but finally stop here, how do I solve this?
Solved:
The error raised because new Radzen file input version expects a TValue="string" attribute for setting up its callback.

Cache files always created with wrong permissions in Yii 2

I get this error in my log files every time a cache file doesn't exist it seems. On the first page load, I always get this error
[message] => filemtime(): stat failed for [...]/runtime/cache/my/myapp03eab921185f7b68bbca50d8debc0dda.bin
[file] => [...]/vendor/yiisoft/yii2/caching/FileCache.php
[line] => 113
It doesn't happen anymore on next page loads but that one time is really annoying since the slack bot watcher is spamming our channel with this useless warning. Is there a way to avoid that, or is it a permission problem?
The "runtime", "cache" and "my" folders all have 775.
Update
Turns out the issue is that I'm using error_get_last() that is also getting warning-level errors. So it's a different issue entirely, not Yii-related
Make sure that you don't have enabled scream in your php.ini. Warnings from this filemtime() call should be suppressed by # operator, but scream setting can override this operator and generate warning anyway.
if (#filemtime($cacheFile) > time()) {
// ...
}
You must be getting this in PHP 7.1. try to run this with PHP 5.5 and see if you are getting the same error.
To reproduce you need to delete all files from runtime/cache directory
Then start app again(reload page) and look into runtime/cache. It is empty
Yii2 doesn't make cache again
Got same issue in Yii. The error was on the same string (FileCache.php:113)
if (#filemtime($cacheFile) > time()) {...
In my case reason was that my custom php error handler (heir
of the class yii\base\ErrorHandler) didn't check if
error type need to be handled according error_reporting().
Custom handlers allways gets every error, even muted by Error Control operator (#)
https://www.php.net/manual/en/function.set-error-handler.php
error_reporting() settings will have no effect and your error handler will be called regardless

Using Robot Framework Ldap Library

How far has the Robot framework Ldap library implementation gone ?
Can the keywords be used for execution with pybot ?
Updating the question now.
I came across python-ldap and using that for performing an ldapsearch
def my_search(l, baseDN, searchScope, searchFilter, retrieveAttributes):
logger.console("Reachedhere")
try:
logger.console("Reachedhereinsidetry\n")
ldap_result_id = l.search(baseDN,searchScope,searchFilter,retrieveAttributes)
logger.console("Gotresult\n")
Now I invoked my_search in my Robot testcase. It throws this error
TypeError: an integer is required
Robot Testcase excerpt. :
${SearchReturn} my_search ${ldapObj} "uid=2343,ds=SU,o=DEFAULT,dc=C-N" ldap.SCOPE_ONELEVEL "objectClass=*" None
There is nothing in integer format here. What could be the issue ?
Any leads on this ?
The error you're getting seems to me to be a casting error. I.e. something is fed a string, where an integer is expected. This is an easy situation to come in with the Robot Framework script.
In the Robot Framework general documentation the section about Number Variables shows that you can set a variable to an integer via the ${76}notation. This should happen in the calling keyword or test case.
In case you're unable to do that in the calling keyword, the BuiltIn library has a Convert To Integer keyword which would then do the conversion for you.

Gradle / Groovy properties

I would like to control 'global' config in Gradle build scripts using external property files on each build machine (dev, ci, uat,...) and specify the filename with a command line argument.
e.g. gradle -DbuildProperties=/example/config/build.properties
I specifically don't want to use gradle.properties as we have existing projects that already use this approach and (for example) we want to be able to amend database urls and jdbc drivers without having to change every project.
So far have tried:-
Properties props = new Properties()
props.load(new FileInputStream("$filename"))
project.setProperty('props', props)
which works but has a deprecated warning, but I can't figure out how to avoid this.
Have also tried using groovy style config files with ConfigSlurper:-
environments {
dev {
db.security {
driver=net.sourceforge.jtds.jdbc.Driver
url=jdbc:someserver://somehost:1234/some_db
username=userId
password=secret
}
}
}
but the colons and forward slashes are causing exceptions and we don't want to have to mess up config with escape characters.
There must be a non-deprecated way to do this - can anyone suggest the 'right' way to do it?
Thanks
You can get rid of the deprecated warning quite easily. The message you got probably looks something like this:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "props" on "root project 'private'", value: "true".
It can be fixed by replacing:
project.setProperty('props', props)
with
project.ext.props = props
Just to supplement the response given by #Steinar:
it's still possible to use next syntax:
project.ext.set('prop_name', prop_value)
in case you have several properties from file:
props.each({ project.ext.set(it.key, it.value)} )