Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check page bounds on accesses in MetaDataStore
- Loading branch information
Showing
5 changed files
with
445 additions
and
33 deletions.
There are no files selected for viewing
203 changes: 203 additions & 0 deletions
203
community/io/src/test/java/org/neo4j/io/pagecache/DelegatingPageCursor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,203 @@ | |||
/* | |||
* Copyright (c) 2002-2016 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.io.pagecache; | |||
|
|||
import java.io.File; | |||
import java.io.IOException; | |||
|
|||
public class DelegatingPageCursor implements PageCursor | |||
{ | |||
private final PageCursor delegate; | |||
|
|||
public byte getByte() | |||
{ | |||
return delegate.getByte(); | |||
} | |||
|
|||
public int copyTo( int sourceOffset, PageCursor targetCursor, int targetOffset, int lengthInBytes ) | |||
{ | |||
return delegate.copyTo( sourceOffset, targetCursor, targetOffset, lengthInBytes ); | |||
} | |||
|
|||
public void putInt( int value ) | |||
{ | |||
delegate.putInt( value ); | |||
} | |||
|
|||
public void getBytes( byte[] data ) | |||
{ | |||
delegate.getBytes( data ); | |||
} | |||
|
|||
public boolean next() throws IOException | |||
{ | |||
return delegate.next(); | |||
} | |||
|
|||
public void putBytes( byte[] data ) | |||
{ | |||
delegate.putBytes( data ); | |||
} | |||
|
|||
public short getShort() | |||
{ | |||
return delegate.getShort(); | |||
} | |||
|
|||
public File getCurrentFile() | |||
{ | |||
return delegate.getCurrentFile(); | |||
} | |||
|
|||
public void putShort( short value ) | |||
{ | |||
delegate.putShort( value ); | |||
} | |||
|
|||
public long getUnsignedInt() | |||
{ | |||
return delegate.getUnsignedInt(); | |||
} | |||
|
|||
public short getShort( int offset ) | |||
{ | |||
return delegate.getShort( offset ); | |||
} | |||
|
|||
public int getCurrentPageSize() | |||
{ | |||
return delegate.getCurrentPageSize(); | |||
} | |||
|
|||
public long getLong() | |||
{ | |||
return delegate.getLong(); | |||
} | |||
|
|||
public void putLong( long value ) | |||
{ | |||
delegate.putLong( value ); | |||
} | |||
|
|||
public int getOffset() | |||
{ | |||
return delegate.getOffset(); | |||
} | |||
|
|||
public void close() | |||
{ | |||
delegate.close(); | |||
} | |||
|
|||
public void putByte( int offset, byte value ) | |||
{ | |||
delegate.putByte( offset, value ); | |||
} | |||
|
|||
public void putInt( int offset, int value ) | |||
{ | |||
delegate.putInt( offset, value ); | |||
} | |||
|
|||
public void putBytes( byte[] data, int arrayOffset, int length ) | |||
{ | |||
delegate.putBytes( data, arrayOffset, length ); | |||
} | |||
|
|||
public void rewind() | |||
{ | |||
delegate.rewind(); | |||
} | |||
|
|||
public void putByte( byte value ) | |||
{ | |||
delegate.putByte( value ); | |||
} | |||
|
|||
public long getUnsignedInt( int offset ) | |||
{ | |||
return delegate.getUnsignedInt( offset ); | |||
} | |||
|
|||
public boolean checkAndClearBoundsFlag() | |||
{ | |||
return delegate.checkAndClearBoundsFlag(); | |||
} | |||
|
|||
public long getCurrentPageId() | |||
{ | |||
return delegate.getCurrentPageId(); | |||
} | |||
|
|||
public void putShort( int offset, short value ) | |||
{ | |||
delegate.putShort( offset, value ); | |||
} | |||
|
|||
public boolean next( long pageId ) throws IOException | |||
{ | |||
return delegate.next( pageId ); | |||
} | |||
|
|||
public void putLong( int offset, long value ) | |||
{ | |||
delegate.putLong( offset, value ); | |||
} | |||
|
|||
public long getLong( int offset ) | |||
{ | |||
return delegate.getLong( offset ); | |||
} | |||
|
|||
public void getBytes( byte[] data, int arrayOffset, int length ) | |||
{ | |||
delegate.getBytes( data, arrayOffset, length ); | |||
} | |||
|
|||
public int getInt( int offset ) | |||
{ | |||
return delegate.getInt( offset ); | |||
} | |||
|
|||
public void setOffset( int offset ) | |||
{ | |||
delegate.setOffset( offset ); | |||
} | |||
|
|||
public byte getByte( int offset ) | |||
{ | |||
return delegate.getByte( offset ); | |||
} | |||
|
|||
public int getInt() | |||
{ | |||
return delegate.getInt(); | |||
} | |||
|
|||
public boolean shouldRetry() throws IOException | |||
{ | |||
return delegate.shouldRetry(); | |||
} | |||
|
|||
public DelegatingPageCursor( PageCursor delegate ) | |||
{ | |||
this.delegate = delegate; | |||
} | |||
} |
62 changes: 62 additions & 0 deletions
62
community/io/src/test/java/org/neo4j/io/pagecache/DelegatingPagedFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,62 @@ | |||
/* | |||
* Copyright (c) 2002-2016 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.io.pagecache; | |||
|
|||
import java.io.IOException; | |||
|
|||
public class DelegatingPagedFile implements PagedFile | |||
{ | |||
private final PagedFile delegate; | |||
|
|||
public DelegatingPagedFile( PagedFile delegate ) | |||
{ | |||
this.delegate = delegate; | |||
} | |||
|
|||
public PageCursor io( long pageId, int pf_flags ) throws IOException | |||
{ | |||
return delegate.io( pageId, pf_flags ); | |||
} | |||
|
|||
public void flushAndForce() throws IOException | |||
{ | |||
delegate.flushAndForce(); | |||
} | |||
|
|||
public long getLastPageId() throws IOException | |||
{ | |||
return delegate.getLastPageId(); | |||
} | |||
|
|||
public int pageSize() | |||
{ | |||
return delegate.pageSize(); | |||
} | |||
|
|||
public void close() throws IOException | |||
{ | |||
delegate.close(); | |||
} | |||
|
|||
public void flushAndForce( IOLimiter limiter ) throws IOException | |||
{ | |||
delegate.flushAndForce( limiter ); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.