The urination when punished is called submissive urination. Here is a great article:
The genetically shy dog is a super submissive type and unlike many dogs is quite sensitive to anyforms of "dominant" behavior in humans. Even ordinarily submissive dogs can become extremely submissive if its owner misunderstands and unintentionally forces it to increase its submissiveness. Mistreated dogs may also become excessively submissive. First, tone down your aggressive behavior -- with a submissive dog there is no real need to consciously dominate it. Examples of dominating behavior include: • Direct eye contact • Standing over the dog • Walking towards the dog while looking at it Tips: Wait when you come home. Say "hi" and be verbally friendly, but don't touch or pet it for about 5-15 minutes. Try not to make the moment more exciting than it already is. When you greet it, get down on its level. Rather than standing and bending at the waist, bend at the knees (or sit) so that your face is about level with his and you are not looking down on him. This is a less dominant position, and less likely to trigger a submissive posture. Don't pet it on the head. Rather, tell it to sit, maybe "shake hands", then scratch it under the chin and on the chest. This is less dominating than the pat on the head (because you avoid standing over it). Giving s/he an alternative behavior will help. He can’t submissive pee and sit and shake hands at the same time.When you correct this type of dog, do so with your voice only (avoid direct eye contact). If it starts to urinate, then say immediately, "OK, let's go out!" in a happy tone of voice -- and take it out. Or, take a toy out (something it likes to do) and play with it. What you are doing here is telling your dog, "OK, I see your submissiveness. That's good." When guests come over, ask them to ignore your dog and not look at it even if it comes up and sniffs them. After a bit, when people are sitting down then have them gently put their hands out and talk to your dog, without looking at it. Usually after about 15 minutes or so everything is fine. In general, show signs of low-key approval immediately when the dog becomes submissive. Then distract it with something else. When you ignore submissiveness or get mad at it, you're in effect telling the dog "You're not submissive enough!" so the poor thing intensifies its efforts -- and submissive urination is about as submissive as it gets. Be really positive with your dog, this type lacks self-confidence and will look to you quite often to make sure everything is OK.