Mark Kearney and Sally Murrer, former lovers, are close friends
A former police officer, his son and two journalists have been cleared of charges in connection with the alleged leaking of confidential information.
Det Sgt Mark Kearney, who was involved in the unrelated bugging of an MP's prison visit earlier this year, was cleared of misconduct in public office.
His son, Harry, and journalists Sally Murrer and Derek Webb were cleared of aiding and abetting misconduct.
The judge said the journalists' right to protect sources had been infringed.
Prosecutor Sir Alan Green QC said the Crown has decided against seeking leave to appeal.
Mr Kearney, who has since retired from Thames Valley police, had faced eight charges of misconduct in public office, three of which alleged he passed confidential information to Mr Webb and five of which related to Ms Murrer, his former lover.
One count of aiding and abetting misconduct in public office against Mr Kearney's son, Harry, a soldier, was also dropped.
All four were formally acquitted at Kingston Crown Court.
Mr Justice Southwell said the journalists were both entitled, under Article 10 of the European Convention on Human Rights, to protect their sources.
Thames Valley Police had flouted the convention by raiding Mr Webb's premises and authorising the bugging of Mr Kearney's car to discover if he was the source of the journalists' information, the court heard.
Mr Justice Southwell said: "The protection of journalists' sources is a cornerstone of the freedom of the press... which is so important for a healthy and democratic society."
Cannot play media. Sorry, this media is not available in your territory.
Journalist tells of 'sheer hell'
The decision in what is being seen as the latest test case involving journalists' sources builds on rulings in the case of journalists Bill Goodwin and Robin Ackroyd, who both refused to identify their sources.
National Union of Journalists general secretary Jeremy Dear said: "This is a major victory, not just for Sally but for all journalists.
"This case was yet another example of members of the police force believing they were above the law, able to trample over well-established journalistic rights and freedoms.
Mr Kearney's son Harry, a serving soldier, denied the charge
"The importance of journalism to our democracy and society has been recognised for hundreds of years and is clearly enshrined in law.
"This judgment sends a clear message to the authorities - they must recognise the importance of free and open journalism.
"Hard questions must now be asked of the police and CPS as to why these costly proceedings were allowed to get so far."
At one point during the proceedings Sir Alan Green said Mr Kearney's crimes were not so much what he had allegedly leaked but his "potential" to leak more serious information, a claim which Mr Kearney's counsel Samuel Stein described as "Orwellian".
The charges were not related to Mr Kearney's involvement in an earlier row over the bugging of a conversation between Labour MP Sadiq Khan and his constitutent Babar Ahmed, a terror suspect.
Earlier this year Mr Kearney revealed he had been pressurised by senior officers in the Metropolitan Police into bugging the MP's visit to Mr Ahmed, who was being held at Woodhill Prison, Milton Keynes.
He said he had also been asked to eavesdrop on a confidential conversation between a terror suspect and his solicitor.
The Home Secretary, Jacqui Smith, later confirmed the bugging had taken place but said it had not breached protocol.
Mr Ahmed remains in prison, fighting extradition to the US.
Mr Kearney told the BBC: "In my 11,000-word defence statement I mentioned the bugging of Sadiq Khan to give a flavour of some of the information I was privy to. I was in possession of information far more sensitive than the trivial information I was accused of leaking to Sally Murrer and Derek Webb."
He added: "The frustration for all of us in many respects is that had the evidence been tested we would have been acquitted."
After the ruling, Ms Murrer said: "I expected to feel vindicated and victorious but I still feel violated. It has been nineteen-and-a-half months of utter hell for all of us."
Thames Valley Police said it was disappointed that the trial of Mark Kearney was not going ahead but the judge had ruled any disclosure to journalists had to be very serious, such as threatening national security, for a prosecution.
In a statement it said: "It is noted that during the legal arguments the judge commented that the methods used to obtain the evidence were lawfully authorised by domestic law and that the actions of the police were proportionate.
"We can also confirm that the methods were independently scrutinised as part of an annual inspection."
It added: "The leaking of sensitive information is a serious matter which can jeopardise police investigations, put officers and members of the public at risk and lead to criminal and misconduct charges."