But the user did not validate the input right?
so number 2 is also correct? isnt it?
About Question enthuware.ocpjp.v11.2.3415 :
Moderator: admin
-
- Posts: 8
- Joined: Tue Sep 19, 2023 12:11 pm
- Contact:
-
- Site Admin
- Posts: 10101
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3415 :
There is nothing to validate in the input. The input is a file name and if the file name is incorrect, there will be an exception as indicated by the throws clause.
The real issue in the code is opening unlimited number of files.
The real issue in the code is opening unlimited number of files.
If you like our products and services, please help us by posting your review here.
-
- Posts: 8
- Joined: Tue Sep 19, 2023 12:11 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3415 :
Ok got it now,
thanks
thanks
-
- Posts: 2
- Joined: Fri May 03, 2024 6:41 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3415 :
About this code:
The name of the argument refers to the fact that the entry is a list, that is, it contains several file names separated by commas.
Is that to confuse? How do we know that only the name of a file arrives there?
Then, there is no File constructor that receives several file names separated by commas, which is why the input would have to be previously validated to verify the type of value in the argument that arrives,
That's why my answer would also be No. 2.
The security part is very broad and extensive, but the answers to why one or the other is selected is not clear.
Could you expand the explanation further?
Code: Select all
public void processUploads(String listOfFilesFile) throws IOException{
File f = new File(listOfFilesFile);
The name of the argument refers to the fact that the entry is a list, that is, it contains several file names separated by commas.
Is that to confuse? How do we know that only the name of a file arrives there?
Then, there is no File constructor that receives several file names separated by commas, which is why the input would have to be previously validated to verify the type of value in the argument that arrives,
That's why my answer would also be No. 2.
The security part is very broad and extensive, but the answers to why one or the other is selected is not clear.
Could you expand the explanation further?
-
- Site Admin
- Posts: 10101
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3415 :
The name listOfFilesFile ends with 'File', so it is quite clear that it will get a String containing the name of the file that contains a list of files. Also, the parameter type is just String and not List<String>.
Further, File f = new File(listOfFilesFile); clearly implies that listOfFilesFile is a path to a file.
Further, File f = new File(listOfFilesFile); clearly implies that listOfFilesFile is a path to a file.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 21 guests