Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add EmptyPipe as FastNoSuchElementException and update IsEmptyPipe.

The new exception is not caught by the old exception technique but Pipes is completely switched over to the new exception anyway so removed the old handler code.
  • Loading branch information...
commit e226fe5cd329c82a186f5f133928c61707970bc4 1 parent a9c7026
@pangloss pangloss authored
Showing with 8 additions and 12 deletions.
  1. +5 −12 lib/pacer/pipe/is_empty_pipe.rb
  2. +3 −0  lib/pacer/pipes.rb
View
17 lib/pacer/pipe/is_empty_pipe.rb
@@ -6,20 +6,13 @@ def initialize
end
def processNextStart
- raise Pacer::NoSuchElementException if @raise
- @starts.next
+ raise EmptyPipe.instance if @raise
+ starts.next
@raise = true
- rescue NativeException => e
- if e.cause.getClass == NoSuchElementException.getClass
- # This is the only case where we return true.
- # The only time we get here is if the first call to next
- # has no results.
- true
- else
- raise e
- end
+ rescue EmptyPipe
+ true
else
- raise Pacer::NoSuchElementException
+ raise EmptyPipe.instance
end
def reset
View
3  lib/pacer/pipes.rb
@@ -32,6 +32,9 @@ module Pipes
NoSuchElementException = e.cause
Pipes::NoSuchElementException = e.cause
end
+
+ EmptyPipe = com.tinkerpop.pipes.util.FastNoSuchElementException
+ Pipes::EmptyPipe = EmptyPipe
end
require 'pacer/pipe/ruby_pipe'
Please sign in to comment.
Something went wrong with that request. Please try again.