Commit db866e95 authored by Robert Butora's avatar Robert Butora
Browse files

mcutout: improve logging when checking UploadFile-type in POST-body

parent b9fd2417
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -68,15 +68,14 @@ public class UWSMCutoutWork extends JobThread
         long startTime_msec = System.currentTimeMillis();
         boolean showDuration = true;

			logger.logThread(LogLevel.INFO, this, "Is mcutout UploadFile type?",
															"Is mcutout UploadFile type?",null);
         logger.logThread(LogLevel.INFO, this, "", "Job started",null);

         Object obj = job.getAdditionalParameterValue("mcutout");
			if(obj instanceof UploadFile)
			{
			   logger.logThread(LogLevel.INFO, this, "mcutout is UploadFile",
														"mcutout is UploadFile",null);
				UploadFile jsonFile = (UploadFile)obj;//job.getAdditionalParameterValue("mcutout");
			   logger.logThread(LogLevel.INFO, this, "", "mcutout is UploadFile", null);

				UploadFile jsonFile = (UploadFile)obj;
				InputStreamReader isr = new InputStreamReader( jsonFile.open() );
				BufferedReader input = new BufferedReader(isr);
				StringBuffer jsonStringBuffer = new StringBuffer();
@@ -98,17 +97,13 @@ public class UWSMCutoutWork extends JobThread
				publishOnEndpoint("Report", "application/json", mresult.resJsonPathname);
				publishOnEndpoint("mcutout.tar.gz", "application/gzip", mresult.fileName);

				// delete cut-files (were published/copied to uws-file store) 

				//mresult.deleteResJson();
				//mresult.deleteCutFiles();

				FileUtils.deleteDirectory(new File(workDir));
				//FileUtils.deleteQuietly(new File(workDir));// FIXME Never throws except. leaves the dir there if error
			}
			else
			{
              // mcutout-json not in body
			     logger.logThread(LogLevel.INFO, this, "",
               "mcutout is NOT UploadFile type: wrong argument ? Nothing to do, exiting..."
               , null);
			}

			/* FIXME here was uws-check is-job-Interrupted */
@@ -116,7 +111,8 @@ public class UWSMCutoutWork extends JobThread
		catch(IOException ex)
		{
			logger.error("MCutout error", ex);
			throw new UWSException("Internal error: jsonFile.open() throws IOException:" + ex.getMessage());
			throw new UWSException("UploadFile::jsonFile.open() throws IOException:"
                   + ex.getMessage());
		}
	}