Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2326

recent change to UpdateEngineWorker validation is probably wrong

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 4.5.0
    • Jena 4.6.0
    • ARQ
    • None

    Description

      A validation method in UpdateEngineWorker was recently changed. (I think the change is related to JENA-2293.)

      The previous method looked like this:

          private boolean validBinaryGraphOp(UpdateBinaryOp update) {
              if ( update.getSrc().isDefault() )
                  return true;
      
              if ( update.getSrc().isOneNamedGraph() ) {
                  Node gn = update.getSrc().getGraph();
                  if ( !datasetGraph.containsGraph(gn) ) {
                      if ( !update.getSilent() )
                          error("No such graph: " + gn);
                      return false;
                  }
                  return true;
              }
              error("Invalid source target for oepration; " + update.getSrc());
              return false;
          }
      

      The current method looks like this:

       

          private void validateBinaryGraphOp(UpdateBinaryOp update) {
              if ( update.getSrc().isDefault() )
                  return;
              if ( update.getSrc().isOneNamedGraph() ) {
                  Node gn = update.getSrc().getGraph();
                  if ( !datasetGraph.containsGraph(gn) )
                      throw errorEx("No such graph: " + gn);
              }
              throw errorEx("Invalid source target for operation; " + update.getSrc());
          }
       
      

      Assuming the validation logic has not changed, the current method is inconsistent with the previous version. To remain consistent, it should look like this:

       

          private void validateBinaryGraphOp(UpdateBinaryOp update) {
              if ( update.getSrc().isDefault() )
                  return;
              if ( update.getSrc().isOneNamedGraph() ) {
                  Node gn = update.getSrc().getGraph();
                  if ( !datasetGraph.containsGraph(gn) )
                      throw errorEx("No such graph: " + gn);
                  return;
              }
              throw errorEx("Invalid source target for operation; " + update.getSrc());
          }
       
      

      Note the second return statement.

      This is causing unexpected test failures in our product test suite.

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              bvosburgh Brian Vosburgh
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: