My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label in. Show all posts
Showing posts with label in. Show all posts

Thursday, May 28, 2020

Avoid Throwing Raw Exception Types rule in Checkstyle

See a sample violation in java code:

com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck:299 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.ClassResolver:179 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck:270 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck:321 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck:685 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.indentation.HandlerFactory:68 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.indentation.HandlerFactory:169 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.indentation.HandlerFactory:174 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..
com.puppycrawl.tools.checkstyle.checks.indentation.HandlerFactory:177 Rule:AvoidThrowingRawExceptionTypes Priority:1 Avoid throwing raw exception types..


So there comes a question what do we want to use instead of RuntimeException? Is private exception with descriptive name what went wrong good approach for you? Or we should create package with exceptions to choose from? I'll try to use standard JDK exceptions where possible.
It's also possible to create RuntimeCheckstyleException, but I don't think it is good idea.

To be specific we might also want to know what do we want to use instead of RuntimeException?
That is very controversial question. As demand for more specific type of Exception is clear , especially when we have a lot of exception types in our disposal (http://docs.oracle.com/javase/7/docs/api/java/lang/RuntimeException.html?is-external=true) even in standard JDK.

But some time where is no need to be specific and exception is signal to stop processing. Details in message is good enough - it is very good practice to keep message informative, exception type will allow only in creation additional logic but that is contradict with "ExceptionAsFlowControl".


We need to work on these validations if it comes. Consider a little redesign of your code.

Thursday, June 16, 2011

Keyboard shortcuts for VMware

I am listing some keyboard shortcuts for VMWare. These have been prepared by learning, help docs and the internet. Please comment if I miss something important, or if any thing is not working with the version you are using.


F11 switch to full-screen mode and also back to normal mode
Ctrl-Alt-Insert Like a Ctrl-Alt-Delete to the VMware OS running
Ctrl-Alt used for mouse release and exit full screen mode
Ctrl-Alt-Enter VM into full-screen.
Also acts like Tab in windows to choose between VMs
Ctrl-Alt-Tab switch between multiple VM.


Ctrl+N create a new VM for you
Ctrl+O open a new VM for you
Ctrl+P edit VMware settings and Preferences
Ctrl+B power on some VM
Ctrl+E power off
Ctrl+R reset power
Ctrl+Z suspend some VM



Oh cumon! I am not giving all keyboard shortcuts. The UI is rich enough. But actually these are often required especially when your mouse starts non-responsive. Afterall, VMware and OS are also softwares. And they can be buggy sometimes ;) Hope you find this cool/