Unverified Commit ce4596c1 authored by Shishir Suman's avatar Shishir Suman Committed by GitHub
Browse files

Merge pull request #1 from lakshmi551/release-5.1.0

added logges to find out the question set publish issue
No related merge requests found
Showing with 6 additions and 0 deletions
+6 -0
......@@ -47,6 +47,7 @@ object FileUtils {
val url = new URL(fileUrl)
val httpConn = url.openConnection().asInstanceOf[HttpURLConnection]
val disposition = httpConn.getHeaderField("Content-Disposition")
logger.info("file url : "+url)
httpConn.getContentType
httpConn.getContentLength
val fileName = if (StringUtils.isNotBlank(disposition)) {
......@@ -57,8 +58,10 @@ object FileUtils {
fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length)
} else fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length)
val saveFile = new File(basePath)
logger.info("basePath in downloadFile method" + basePath)
if (!saveFile.exists) saveFile.mkdirs
val saveFilePath = basePath + File.separator + fileName
logger.info("saveFilePath "+saveFilePath)
val inputStream = httpConn.getInputStream
val outputStream = new FileOutputStream(saveFilePath)
IOUtils.copy(inputStream, outputStream)
......
......@@ -121,6 +121,7 @@ trait ContentPublisher extends ObjectReader with ObjectValidator with ObjectEnri
private def isValidUrl(url: String, mimeType: String, allowedExtensionsWord: util.List[String]): Boolean = {
val destPath = s"""${File.separator}tmp${File.separator}validUrl"""
// val destPath = s"""$bundlePath${File.separator}${StringUtils.replace(id, ".img", "")}"""
logger.info(s"url ::: destPath ::: in isValidUrl $url method from contentPublisher : " + destPath)
var isValid = false
try {
val file: File = FileUtils.downloadFile(url, destPath)
......
......@@ -125,6 +125,7 @@ trait ObjectBundle {
newFile
case _ =>
val url = k.asInstanceOf[String]
logger.info(s"file url ::: destPath ::: Processing file: $url for : " + destPath)
// UnknownHostException | FileNotFoundException
try {
FileUtils.downloadFile(url, destPath)
......
......@@ -60,6 +60,7 @@ class QRCodeImageGeneratorFunction(config: QRCodeImageGeneratorConfig,
try {
val fileName = dialcode("id").asInstanceOf[String]
val downloadUrl = dialcode("location").asInstanceOf[String]
logger.info(s"downloadUrl ::: tempFilePath ::: $downloadUrl and : " + tempFilePath)
val file: File = FileUtils.downloadFile(downloadUrl, tempFilePath)
val newFile: File = new File(s"""$tempFilePath${File.separator}$fileName.${imageConfig.imageFormat}""")
FileUtils.copyFile(file, newFile)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment