public static BaseAmiInfo parseDescription ( String imageDescription ) { BaseAmiInfo info = new BaseAmiInfo ( ) ; if ( imageDescription == null ) { return info ; } info . baseAmiId = extractBaseAmiId ( imageDescription ) ; info . baseAmiName = extractBaseAmiName ( imageDescription ) ; if ( info . baseAmiName != null ) { Matcher dateMatcher = AMI_DATE_PATTERN . matcher ( info . baseAmiName ) ; if ( dateMatcher . matches ( ) ) { try { // Example: 20100823 info . baseAmiDate = new SimpleDateFormat ( "yyyyMMdd" ) . parse ( dateMatcher . group ( 1 ) ) ; } catch ( Exception ignored ) { // Ignore failure. } } } return info ; }
Parse an AMI description into its component parts .