I am using checkstyle to run through my code.
It is highlighting a comment "* #throws Exception the exception".
It is showing the following warning "Method Javadoc: Unused #throws tag for 'Exception'." connected to the comment.
Any ideas how to solve this?
I see two ways of fixing the problem:
Remove that comment as most probably method do not declare throws Exception
Disable option validateThrows if you don't care about #throws tag validation
Related
I've got a Domain Driven Design solution and for some reason, I'm getting this exception at RunTime when the API call is made through GateWay:
One or more errors occurred. (Method not found: 'Void FluentValidation.AbstractValidator`1.When(System.Func`2<!0,Boolean>, System.Action)'.)
The error occurs as below:
I have solution like this:
The main 4 project I'm focusing on right now are:
Core.Model
Account.Api
Service.Api.Gateway
Web.ClientSite
Web.ClientSite makes request to Service.Api.Gateway which then calls Account.Api.
Note that Core.Model is referenced everywhere
VERY IMPORTANT: If I remove the reference of FluentValidation from Core.Model, the exception disappears.
I'm hoping these information is enough. Why do you think I'm getting this exception and how can I eliminate.
Looks like some of libs (ocelot) are incompatible with new changes in FluentValidation 8.1.2. Try to downgrade to FluentValidation before 8.1.2. Hope it helps
I got similar exception:
System.MissingMethodException : Method not found:
'FluentValidation.AssemblyScanner
FluentValidation.AssemblyScanner.FindValidatorsInAssembly(System.Reflection.Assembly)'
In my case I needed to upgrade the ediatR.Extensions.Microsoft.DependencyInjection and MediatR.Extensions.FluentValidation.AspNetCore packages as well to fix the issue.
I found too many FileNotFoundException in LOG file like below. although Error has no real negative impact except for being an annoyance,and cluttering the logs.
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper doFilter SRVE8109W: Uncaught exception thrown by filter AnyChart Resources: java.io.FileNotFoundException
can anyone help me....
In-order to get rid of those exception logs we have suppressed the by creating a custom property in the web-sphere.
com.ibm.ws.webcontainer.suppressLoggingFileNotFoundExceptions = true
Please see the following link for more details:
http://www-01.ibm.com/support/docview.wss?uid=swg1PM64368
I want to suppress (disable) a waring in PhpStorm a message "Member has protected access" for a certain places (not in all code).
Example:
What I have tried
Link 1: on Alt + Enter I do not have anything connected to the message so that I could disable it. As well as I do not have this message in inspection results when Running Inspections.
Link 2 I do not have the message in Inspection Settings so I can not disable it.
Another try: using #noinspection. Here and here I did not find needed message.
There were suggestion to disable suppress all errors with Editor -> Colors & Fonts -> General -> Erros and Warnings -> Errors. But it is not what I need.
Is there no way to do it?
What you could do is implement the __set magic method into your class, which will transform these warnings into "notices".
/**
* #throws \Exception
*/
public function __set($name, $value) {
throw new \Exception(sprintf('Property "%s" does not exist in %s.', $name, __CLASS__));
}
Since PHPStorm can't analyse your code to make sure this property is settable through the magic method, it can't know whether it's an error or not.
Of course, it's kind of an ugly workaround, and means that runtime "Cannot access protected property" fatal errors will now be exceptions, which may or may not be fine in your case.
I use the DoctrineORMModule (https://github.com/doctrine/DoctrineORMModule, installed via Composer) and ZF2 to develop a web application.
My problem is, that I dont get exceptions from doctrine, only an "Internal 500" Error.
Even with
ini_set('display_errors', 1);
error_reporting(E_ALL);
I dont see an error, just the "Internal 500" Message (I applied those settigns in php.ini too). There are no entries in "php_error_log" too.
If I surround the lines with a try-catch-block, no exception is caught. This happens while calling flush() and persist(). Other PHP-Errors are displayed.
Example:
ini_set('display_errors', 1);
error_reporting(E_ALL);
$rel = new \MyApp\Entity\UserRelationship();
$rel->relatingUser = $user;
$rel->relatedUser = $friend;
try {
$em->persist($rel);
} catch ( Exception $e ) {
var_dump($e);
}
This results in an "Internal 500" Error, but I guess doctrine should throw an error.
I googled around for hours, but I cant figure out, if this is the default behaviour, or if you have to configure doctrineORMModule to log/throw exceptions. I would be very thankful if someone could give me a hint on how to get exceptions, because this slows me down very hard.
Edit: I can use persist() and flush(), the database-queries are executed, everything is alright. Its just if I make mistakes in the entities and want to persist or flush them, I dont get exceptions. The "Internal 500" is not shown, if I echo something before persist(), but the database is not updated or anything.
Edit2: The error in the example above, was a wrong "mappedBy"-entry and/or a wrong named setter. Still no exceptions :)
This is not really Doctrine related. The exceptions can be thrown in any library you are using. You must know that in general when you do not catch exceptions, php will create a fatal error because of the uncaught exception. I think you made a mistake when you set the display_errors / error_reporting() because that should show the php error.
Furthermore, Zend Framework has an exception handler to catch exceptions within the run part. If you had this code within an action controller of Zend\Mvc you would be shown a nice error page. The framework catches errors in a lot of places, but if you put this code without any catch it wouldn't get caught.
I have already spent a few hours to resolve this error. The weird thing is when I use this libraries independently, it works absolutely fine but when I integrate them with my ASP .NET MVC website, it start throwing the following exception. I have also used MachineKeySet flag based on suggestion here but still no luck. Could anyone please help me to get rid of this exception. Thanks.
An internal error occurred.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.Security.Cryptography.CryptographicException:
An internal error occurred.
Source Error:
Line 194: if
(string.IsNullOrEmpty(p12FilePassword))
Line 196: certificate = new X509Certificate2(p12FileBytes, "", X509KeyStorageFlags.MachineKeySet);
Line 197: else
I found the solution here. Looks like a known issue. I used X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable flags together and problem disappeared. Other solution is to change the identity of applicationpool to LOCALSERVICE.