A German court has convicted a far-right politician for burning down a building intended as housing for refugees.