replaced array sharing by array copying to remove a findbugs warning (this is used only for exception, so there should be no performance problems here)