An officer making an arrest under Article 231 shall, without unnecessary delay, take the person arrested before a judge of the parish in which the arrest was made, who shall conduct a hearing for the purpose of determining the lawfulness of the arrest. If the judge determines that the arrest was lawful he shall, subject to rights of bail as stated in Article 271, commit the person arrested to jail for a period of time, not exceeding thirty days, to await the issuance of an extradition warrant by the governor of this state. If the judge determines that the arrest was unlawful he shall discharge the person arrested.