Skip to content
Snippets Groups Projects
Commit 021054e4 authored by gmantele's avatar gmantele
Browse files

[UWS,TAP] Fix UPLOAD bug (the last line of the table to upload was ignored)....

[UWS,TAP] Fix UPLOAD bug (the last line of the table to upload was ignored). Fix an improbable NullPointerException in the MultipartParser.
parent e10cca67
No related branches found
No related tags found
No related merge requests found
......@@ -128,6 +128,13 @@ public class VOTableIterator implements TableIterator {
@Override
public synchronized void endRows() throws IOException{
try{
// Wait until the last accepted row has been consumed:
while(!endReached && pendingRow != null)
wait();
}catch(InterruptedException ie){
/* Nothing to do in particular ; the end of the stream will be set anyway. */
}finally{
// No more rows are available:
pendingRow = null;
// Set the END flag:
......@@ -135,6 +142,7 @@ public class VOTableIterator implements TableIterator {
// Notify all waiting threads that the end has been reached:
notifyAll();
}
}
/**
* <p>Get the metadata found in the VOTable.</p>
......@@ -193,7 +201,7 @@ public class VOTableIterator implements TableIterator {
wait();
// If there is no more rows, just return NULL (meaning for the called "end of stream"):
if (endReached)
if (endReached && pendingRow == null)
return null;
/* Otherwise, reset pendingRow to NULL in order to enable the reading of the next row,
......@@ -351,6 +359,7 @@ public class VOTableIterator implements TableIterator {
// Initiate the stream process:
Thread streamThread = new Thread(){
@Override
public void run(){
try{
tb.streamStarTable(input, sink, null);
......
......@@ -512,7 +512,7 @@ public class DALIUpload {
// Check the label:
if (!parts[0].matches("[a-zA-Z][a-zA-Z0-9_]*"))
throw new TAPException("Wrong uploaded item name syntax: \"" + parts[0] + "\"! An uploaded item must have a label with the syntax: [a-zA-Z][a-zA-Z0-9_]*.", UWSException.BAD_REQUEST);
throw new TAPException("Wrong uploaded item name syntax: \"" + parts[0] + "\"! An uploaded item must have a label respecting the 'regular_identifier' production of ADQL 2.0 (regular expression: [a-zA-Z][a-zA-Z0-9_]*).", UWSException.BAD_REQUEST);
// Check the URI:
else if (!parts[1].matches("[a-zA-Z][a-zA-Z0-9\\+\\.\\-]*:.+"))
throw new TAPException("Bad URI syntax: \"" + parts[1] + "\"! A URI must start with: \"<scheme>:\", where <scheme>=\"[a-zA-Z][a-zA-Z0-9+.-]*\".", UWSException.BAD_REQUEST);
......
......@@ -166,6 +166,8 @@ public class MultipartParser implements RequestParser {
throw new UWSException(UWSException.BAD_REQUEST, "Uploads are not allowed by this service!");
while(e.hasMoreElements()){
param = e.nextElement();
if (multipart.getFile(param) == null)
continue;
/*
* TODO !!!POSSIBLE ISSUE!!!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment