A federal judge on Tuesday spoke out against threats to public officials in sentencing a man who threatened to shoot House Speaker Nancy Pelosi to 28 months in federal prison.