Appeals court says judge wrongly forced DA to bring charges