Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,150 --> 00:00:04,019
The last step is to bulletproof the application, in other words, working to make sure the application
2
00:00:04,019 --> 00:00:05,790
doesn't fail or crash no matter what.
3
00:00:06,420 --> 00:00:07,500
All right, let's run the up.
4
00:00:08,039 --> 00:00:12,120
And the first vulnerability in the opposite, the user enters a blank name or phone number.
5
00:00:14,610 --> 00:00:19,500
The constructor is going to throw in a legal argument exception once again, this is an unchecked exception
6
00:00:19,500 --> 00:00:24,960
because it occurs during the runtime, but under no circumstance should be let the application crash.
7
00:00:25,470 --> 00:00:29,940
If we get an unchecked exception, that means there's something wrong or there's something missing in
8
00:00:29,940 --> 00:00:30,480
your code.
9
00:00:31,840 --> 00:00:36,670
And what's missing in this case is code that anticipates a scenario where the user may enter a blank
10
00:00:36,670 --> 00:00:43,660
name or phone number, so we'll say if name DOT is blank or if the number they pass on is blank.
11
00:00:51,680 --> 00:00:55,760
Then we'll just print the input you provided is not valid registration, f�ilte.
12
00:01:08,860 --> 00:01:10,840
Otherwise, we can add the contact.
13
00:01:21,480 --> 00:01:22,800
If you run the app.
14
00:01:33,170 --> 00:01:33,650
Good.
15
00:01:38,080 --> 00:01:42,820
But another illegal argument exception crashes the app if the user enter the phone number, that's less
16
00:01:42,820 --> 00:01:44,080
than five characters.
17
00:01:50,760 --> 00:01:54,510
Once again, an unchecked exception implies we're missing something in the code.
18
00:02:02,820 --> 00:02:09,000
And all we gotta do is check if the phone number is less than five characters, then we're going to
19
00:02:09,000 --> 00:02:11,330
tell the user that their input is not valid.
20
00:02:11,940 --> 00:02:15,720
And with this final line of code, proud to say that we're all finished.
21
00:02:27,190 --> 00:02:33,400
Just like that, our application is bulletproof, no matter what the user throws at you, the application
22
00:02:33,400 --> 00:02:35,940
is free of bugs and it's never going to crash.
23
00:02:36,640 --> 00:02:39,460
It can process any input and respond accordingly.
24
00:02:40,060 --> 00:02:45,700
In the end, exception handling, which involves catching checked exceptions and fixing unchecked exceptions,
25
00:02:45,700 --> 00:02:48,670
is the key to building bulletproof applications.
2639
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.