Both cases reflect attitudes toward women's rights and safety that have persisted for years in this Southeast Asian archipelago nation of 240 million people. The difference now: Both officials are at risk of losing their jobs.
Women in this social-media-obsessed country have been rallying, online and on the streets, against sexist comments and attacks on women. The response is seen as a small step for women's rights in Indonesia, where the government is secular and most people practice a moderate form of Islam.
"We are living in a different era now," said Husein Muhammad of the National Commission on Violence Against Women. "... Now we have supporting laws and social media to bring severe consequences and social sanctions."
Still, rights groups say the country remains far behind on many issues involving gender equality and violence. Rape cases often are not properly investigated, and victims are sometimes blamed.
And although it is rare to divorce by text message, as Aceng Fikri did last summer, unregistered polygamous marriages such as his are common.
Fikri, chief of Garut district in West Java province, called it quits four days after marrying his teenage bride in July. He claimed she was not a virgin, which she denied.
A photo of the couple posted on the Internet slowly began to stoke chatter—and then rage. The outcry spread by local media and on Twitter, blogs, Facebook and popular mobile phone networking groups such as BlackBerry and Yahoo Messenger.
Thousands of people took to the streets in December to protest. Students and women's rights activists in Garut demanded that he resign, trampling and spitting on photos of his face before setting them ablaze outside his council building.
President Susilo Bambang Yudhoyono responded by issuing a rare public condemnation of the 40-year-old official and his illegal marriage. The Supreme Court late last month recommended that the president dismiss Fikri for violating the marriage law, and police are investigating the case because it involves a minor.
Outrage also erupted in social media in January after Judge Muhammad Daming Sunusi told a parliamentary selection panel for Supreme Court positions that it could be a mistake to impose the death penalty for rape because both the attacker and the victim "might have enjoyed" it. The remark reportedly drew laughter from panel members. Sunusi later apologized and said he been joking.
"Enough is enough!" said Muhammad, of the commission on violence against women. "Our officials should no longer mess around and issue ridiculous statements even as a dumb joke."
Not only was Sunusi rejected for a job on the Supreme Court, but the country's Judicial Commission has recommended that he be dismissed from his position on the South Sumatra High Court. But the Supreme Court would have to agree, and it has said such punishment would be too severe because he made the remark in an interview, not during a trial.
Sunusi is hardly the first in Indonesia to be criticized for his comments about rape.
In 2011, after a woman was gang raped on a minibus, then-Jakarta governor Fauzi Bowo drew protests after warning women not to wear miniskirts on public transportation because it could arouse male passengers. Bowo lost his re-election bid last year.
A sex-trafficking case involving a 14-year-old girl prompted Education Minister Mohammad Nuh to say last year that not all girls who report such crimes are victims: "They do it for fun, and then the girl alleges that it's rape," he said. His response to the criticism he received was that it's difficult to prove whether sexual assault allegations are "real rapes."
Growing concern in Indonesia over women's rights reflects that in India, where a brutal and deadly New Delhi gang rape in December has drawn nationwide protests and demands for change. That case also resonated in Indonesia.
"Let's imagine the suffering of women who are treated badly by their husbands and the rape victims. What if it happened to our own families?" said Ellin Rozana, a women's rights activist in Bandung, capital of West Java province. "We need government officials who will be on the front line to protect women, and judges who can see that violence against women is a serious crime."
In the West Java official's case, it was the text-message divorce that prompted outrage more than his unregistered second marriage, though such weddings raise issues about women's rights. They are regularly performed for Indonesians ranging from poor rice farmers to celebrities, politicians and Muslim clerics.
Polygamy remains common in many Muslim countries, based on Islamic teachings that allow men to take up to four wives.
In Indonesia, men are allowed to marry a second wife only after the first gives her blessing. Since most women refuse to agree to share their husbands, unregistered ceremonies, or "nikah siri," are often secretly carried out by an Islamic cleric outside the law.
Some of the marriages are simply a cover for prostitution. A cleric is paid to conduct "contract marriages" as short as one night in some parts of Indonesia, usually for Middle Eastern tourists.
Practices differ slightly elsewhere, with men in places such as Malaysia sometimes marrying outside the country to avoid informing existing spouses and seeking permission from an Islamic court. Ceremonies in Iraq are often held in secret for the same reason. No approval is needed in the Palestinian territories, but contract marriages are banned.
Without a marriage certificate, wives lack legal rights. Children from the marriage are often considered illegitimate and are typically not issued birth certificates, creating a lifetime of obstacles ranging from attending schools to getting a passport.
However, in another sign of Indonesia's changing attitudes, the Supreme Court this month ordered all judges to obey an earlier Constitutional Court ruling granting rights such as inheritance to children born out of wedlock, and to punish fathers who neglect them.
The women's commission on violence is now pushing for a revision of Indonesia's 1974 marriage law to grant more protections to women and children.
Associated Press writers Ibrahim Barzak in Gaza City, Gaza Strip, Sameer N. Yacoub in Baghdad, Iraq and Eileen Ng in Kuala Lumpur, Malaysia, also contributed to this story.