In current case, it seems journalists are keeping most details under the wraps. Only thing I can get is that the guy was doing some kind of study on security changes that occurred after Arab spring. He should have known that the topic of rebellion would be big hot potato in any monarchy and the country-wide security study adds lot of fire on the top. The right way to do this would be take permission from the local government, inform them things you will be collecting and make sure embassy works with you on this. There is no information on whether this happened.
Finally, why should any one visit such countries? World is not perfect but is wonderful. Human rights and individual freedom are relatively new things and just 300 years ago doing some study like this even in Western country would have same predicament. It is still important to experience and understand different cultures, points of views and communicate yours to others. That is the essence of travelling the world.