Opened 10 years ago

Closed 9 years ago

#910 closed defect (fixed)

WCS ProcessRequest does not work on Webkit browsers

Reported by: Alex Dumitru Owned by: Bang Pham Huu
Priority: major Milestone: 9.2
Component: undecided Version: development
Keywords: Cc:
Complexity: Medium

Description

I.e. on:
http://localhost:11111/ows/wcs?service=WCS&version=2.0.0&request=ProcessCoverages&query=for%20c%20in%20(mean_summer_airtemp)%20return%20encode(c,%20%22csv%22)

No response is received by the browser. This seems to be due to incorrect used of multipart response in petascope interface.

Change History (9)

comment:1 by Dimitar Misev, 9 years ago

Milestone: 9.2

comment:2 by Bang Pham Huu, 9 years ago

Owner: changed from Alex Dumitru to Bang Pham Huu
Status: newassigned

comment:3 by Bang Pham Huu, 9 years ago

Yes, as Alex expected, this has problem with MultipartResponse as it has not support with some Browser (I've checked although this is from old information), so I change to another way to write Byte Array to Output Stream and it looks it can work correctly with Chrome (Webkit Browser). After few test, I will submit this patch and please have a validation. Thanks.

comment:4 by Dimitar Misev, 9 years ago

Bang your patch is not valid, Alex pointed out that "IOUtils.close() calls flush() and then close(). Calling them once more is undefined behaviour and can lead to bugs."

comment:5 by Bang Pham Huu, 9 years ago

@Dimitar: I copy the command from

http://rasdaman.org/browser/applications/petascope/src/main/java/petascope/PetascopeInterface.java#L680

but as Alex has pointed out in Java close() also invoke flush() so don't need flush() anymore. I will make a patch that eliminate the above line also. Thanks.

comment:6 by Dimitar Misev, 9 years ago

Ok could you please fix the line you copied from as well?

comment:7 by Bang Pham Huu, 9 years ago

yes, my pleasure to do this, please accept the patch after viewing.

comment:8 by Alex Dumitru, 9 years ago

@Bang

+                    IOUtils.closeQuietly(os);
+                    if (os != null) {
+                        os.close();
+                    }

should be

+                    IOUtils.closeQuietly(os);

IOUtils.closeQuietly(os) is defined as {try{os.flush(); os.close()} catch(Exception e) {}}. As you can see, it already closes the stream, so closing once more or doing any operation on it is undefined behavior (it can just return or it can crash). So there's no need for the if statment. The same holds for the other lines.

comment:9 by Bang Pham Huu, 9 years ago

Resolution: fixed
Status: assignedclosed

As this patch has been accepted, I would close the ticket and thanks for Alex with your careful reviewing in times.

Note: See TracTickets for help on using tickets.