Bug #2190
Unable to generate the 'Top Traffic' report from the GUI on production.
Description
Why "Drive outputs folder is not present: null" coming during top traffic generation on prod from GUI?
Related issues
Added by Ayush Khandelwal over 2 years ago. Updated over 1 year ago.
Description
Why "Drive outputs folder is not present: null" coming during top traffic generation on prod from GUI?
Related issues
The response for the request Url:
"files": [
{
"kind": "drive#file",
"id": "1Ub4roUaaO4W9R8Tba0zFE5AsSZ-wBzvq",
"name": "Prod",
"mimeType": "application/vnd.google-apps.folder"
},
{
"kind": "drive#file",
"id": "1wgGhfGFM8fDaXI62xpje8MoMhA6Wq_Ld",
"name": "prod",
"mimeType": "application/vnd.google-apps.folder"
},
{
"kind": "drive#file",
"id": "1SzmNJviLic3al-1dwmZbWJexvFfk4AcQ",
"name": "Prod",
"mimeType": "application/vnd.google-apps.folder"
}
]
}
There are three folders data present in the response. In the response, it is supposed to have only one folder.But here it had fetched 3 folders. So we are returning the first drive file object (i-e)in the response to ReportGenerationAPI, it is returning the object which is having "id": "1Ub4roUaaO4W9R8Tba0zFE5AsSZ-wBzvq","name": "Prod"
But there is no folder named "Prod" in this https://drive.google.com/drive/folders/1Zi7cD085GyhX6ZaW1h7tLl6pkeYfzh6F . It didn't have an outputs folder. So the drive file object becomes null and showed a null pointer exception.
The second drive file object("id": "1wgGhfGFM8fDaXI62xpje8MoMhA6Wq_Ld", "name": "prod") is the one which is present in the https://drive.google.com/drive/folders/1Zi7cD085GyhX6ZaW1h7tLl6pkeYfzh6F.
fix - Iterate over the files array until we found the drive object which has the outputs folder
Issue:
java.lang.ArrayIndexOutOfBoundsException occured at processMessage() method in ReadJsonPayloadLogs class.
The error occurred at line 87 where we put a key( like url, userAgent, ..) and their value into the map. we are splitting the string by ":" (i-e "url:/learn/python3-docs"). I think the value part is not present for some key. It showed Array Index Out of Bounds Exception while accessing that index.
For the String accept-language: it only the have the key and don't have the value.
After the String is splitted, Array only have one element(pair0) and we are trying to access the value part(pair1) which is not present in the array.
This lead to java.lang.ArrayIndexOutOfBoundsException.
Fix:
we can add the condition to access the pair1 only if the array length is 2.
Working as expected