auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) { List<AbstractProject> projectList = Util.filter(config.getProjectList(owner.getParent(), null), AbstractProject.class); for (AbstractProject project : projectList) ParameterizedDependency.add(owner, project, config, graph); } }

Target:
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) { List<AbstractProject> projectList = config.getProjectList(owner.getParent(), null); for (AbstractProject project : projectList) { ParameterizedDependency.add(owner, project, config, graph); } } }
Source:
public void testGetTopLevelDataTypeWithName(){ final String topLevelType = "tType"; final DataType dataType = mock(DataType.class); final Optional<DataType> type = Optional.of(dataType); doReturn(type).when(manager).findTopLevelDataTypeWithName(topLevelType); final DataType actual = manager.getTopLevelDataTypeWithName(topLevelType); assertEquals(dataType, actual); }

Target:
public void testGetTopLevelDataTypeWithName() { final String topLevelType = "tType"; final DataType dataType = mock(DataType.class); final Optional<DataType> type = Optional.of(dataType); doReturn(type).when(manager).findTopLevelDataTypeWithName(topLevelType); final Optional<DataType> actual = manager.getTopLevelDataTypeWithName(topLevelType); assertTrue(actual.isPresent()); assertEquals(dataType, actual.get()); }
Source:
public AxisAlignedBB getSelectedBoundingBox() { double x = tileEntity.getPos().getX(); double y = tileEntity.getPos().getY(); double z = tileEntity.getPos().getZ(); return AxisAlignedBB.fromBounds(x, y, z, x + 1, y + 1, z + 1); }

Target:
public AxisAlignedBB getSelectedBoundingBox() { return AABBFactory.make().createBoxForTileAt(getPos()).build(); }
Source:
public void open(OpenEvent event) { if (event !=null ) { ISelection selection = event.getSelection(); if (selection !=null && selection instanceof TreeSelection ) { TreeSelection treeSelection = (TreeSelection)selection; Object element = treeSelection.getFirstElement(); if (element !=null && element instanceof DslNode) { DslNode node = (DslNode)element; } } } }

Target:
public void open(OpenEvent event) { if (event !=null ) { ISelection selection = event.getSelection(); if (selection instanceof TreeSelection ) { TreeSelection treeSelection = (TreeSelection)selection; Object element = treeSelection.getFirstElement(); if (element instanceof DslNode) { DslNode node = (DslNode)element; ICProject project = node.getProject(); IFile file = project.getProject().getFile("CallHierarchy_test.java"); IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage(); IEditorInput input = new FileEditorInput(file); IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName()); UIJob ui = new UIJob("Open File") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { try { String editorId = null; if (desc == null || desc.isOpenExternal()) { editorId = "org.eclipse.ui.DefaultTextEditor"; } else { editorId = desc.getId(); } IEditorPart editor = page.openEditor(input, editorId); IMarker fMarker = file.createMarker(IMarker.TEXT); HashMap<String, Object> map = new HashMap<String, Object>(); map.put(IMarker.LINE_NUMBER, 3); fMarker.setAttributes(map); IDE.gotoMarker(editor,fMarker); } catch (PartInitException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, ""); } }; ui.schedule(); } } } }
Source:
public void assignPartitionKeys(Collection<Partition<AbstractSinglePortHDHTWriter<EVENT>>> partitions, InputPort<?> inputPort) { if (partitions.isEmpty()) { throw new IllegalArgumentException("partitions collection cannot be empty"); } LOG.info("Totoal number of buckets = {}, Partitions = {}", numberOfBuckets, partitions.size()); int partitionBits = (Integer.numberOfLeadingZeros(0) - Integer.numberOfLeadingZeros(numberOfBuckets - 1)); int partitionMask = 0; if (partitionBits > 0) { partitionMask = -1 >>> (Integer.numberOfLeadingZeros(-1)) - partitionBits; } Iterator<Partition<AbstractSinglePortHDHTWriter<EVENT>>> iterator = partitions.iterator(); for (int i = 0; i <= partitionMask; i++) { Partition<?> p; if (iterator.hasNext()) { p = iterator.next(); } else { iterator = partitions.iterator(); p = iterator.next(); } PartitionKeys pks = p.getPartitionKeys().get(inputPort); if (pks == null) { p.getPartitionKeys().put(inputPort, new PartitionKeys(partitionMask, Sets.newHashSet(i))); } else { pks.partitions.add(i); } } }

Target:
public void assignPartitionKeys(Collection<Partition<AbstractSinglePortHDHTWriter<EVENT>>> partitions, InputPort<?> inputPort) { if (partitions.isEmpty()) { throw new IllegalArgumentException("partitions collection cannot be empty"); } LOG.info("Total number of buckets = {}, Partitions = {}", numberOfBuckets, partitions.size()); int partitionMask = setPartitionMask(); Iterator<Partition<AbstractSinglePortHDHTWriter<EVENT>>> iterator = partitions.iterator(); for (int i = 0; i <= partitionMask; i++) { Partition<?> p; if (iterator.hasNext()) { p = iterator.next(); } else { iterator = partitions.iterator(); p = iterator.next(); } PartitionKeys pks = p.getPartitionKeys().get(inputPort); if (pks == null) { p.getPartitionKeys().put(inputPort, new PartitionKeys(partitionMask, Sets.newHashSet(i))); } else { pks.partitions.add(i); } } }
Source:
public void uploadAvatar(String file) { File fileCheck = new File("." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "ImagesForUploadTests" + File.separator + file); if (!fileCheck.isFile()) { try { throw new Exception("the file doesn't exist"); } catch (Exception e) { e.printStackTrace(); } } uplaodInput.sendKeys(fileCheck.getAbsoluteFile().toString()); PageObjectLogging.log("typeInFileToUploadPath", "type file "+file+" to upload it", true, driver); }

Target:
public void uploadAvatar(String file) { File fileCheck = new File("." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "ImagesForUploadTests" + File.separator + file); if (!fileCheck.isFile()) { try { throw new Exception("the file doesn't exist"); } catch (Exception e) { e.printStackTrace(); } } uploadInput.sendKeys(fileCheck.getAbsoluteFile().toString()); PageObjectLogging.log("typeInFileToUploadPath", "type file " + file + " to upload it", true, driver); }
Source:
public void should_generate_yaml() throws Exception { RestxSpec testCase = restxSpecLoader.load( "restx/tests/restx_test_case_example_1.yaml"); String actual = testCase.toString(); System.out.println("actual = " + actual); assertThat(replaceNewLine(actual)).isEqualTo(replaceNewLine(Resources.toString( Resources.getResource("restx/tests/expected_restx_case_example_1.yaml"), Charsets.UTF_8))); }

Target:
public void should_generate_yaml() throws Exception { RestxSpec testCase = restxSpecLoader.load( "restx/tests/restx_test_case_example_1.yaml"); String actual = testCase.toString(); assertThat(actual).isEqualTo(Resources.toString( Resources.getResource("restx/tests/expected_restx_case_example_1.yaml"), Charsets.UTF_8)); }
Source:
public void testENG16879() throws Exception { String ddl = "CREATE TABLE without_ttl migrate to target foo (i int NOT NULL, j FLOAT, ts TIMESTAMP);\n"; setup(ddl); try { m_client.callProcedure("@AdHoc", "MIGRATE FROM without_ttl WHERE NOT MIGRATING() \n" + "AND without_ttl.i < (SELECT MIN(i) FROM without_ttl \n" + "WHERE FLOOR(without_ttl.j) <> without_ttl.j ORDER BY NULL, without_ttl.i);"); } catch (ProcCallException e) { assertTrue(e.getMessage().contains("Expression is too complicated")); } finally { teardownSystem(); } }

Target:
public void testENG16879() throws Exception { String ddl = "CREATE TABLE without_ttl migrate to target foo (i int NOT NULL, j FLOAT, ts TIMESTAMP);\n"; setup(ddl); try { m_client.callProcedure("@AdHoc", "MIGRATE FROM without_ttl WHERE NOT MIGRATING() \n" + "AND without_ttl.i < (SELECT MIN(i) FROM without_ttl \n" + "WHERE FLOOR(without_ttl.j) <> without_ttl.j ORDER BY NULL, without_ttl.i);"); fail("Hsql parser should fail when parsing this sql query."); } catch (ProcCallException e) { assertTrue(e.getMessage().contains("Expression is too complicated")); } finally { teardownSystem(); } }
Source:
void afterGroupNumChanged() { numberOfGroupsInput = numGroups.getText().toString().trim(); boolean isInputValid = isInputValid(); if (numGroups.isFocused() && isInputValid && autocomplete.isChecked()) { namesPerGroup.setText(getMatchingNumber(numberOfGroupsInput)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isInputValid); maybeShowUnevenGroupsWarning(); }

Target:
void afterGroupNumChanged() { String numberOfGroupsInput = numGroups.getText().toString().trim(); boolean isInputValid = isInputValid(numberOfGroupsInput); if (numGroups.isFocused() && isInputValid && autocomplete.isChecked()) { namesPerGroup.setText(getMatchingNumber(numberOfGroupsInput)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isInputValid); maybeShowUnevenGroupsWarning(); }
Source:
public void reset() { size = 0; buckets = Math.min(tableArenaSize / bucketSize, INITIAL_BUCKETS); if (buckets < 1) { throw new IAE( "Not enough capacity for even one row! Need[%,d] but have[%,d].", bucketSize + Ints.BYTES, buffer.capacity() ); } maxSize = Math.max(1, (int) (buckets * MAX_LOAD_FACTOR)); for (int i = 0; i < buckets; i++) { buffer.put(i * bucketSize, (byte) 0); } final ByteBuffer bufferDup = buffer.duplicate(); bufferDup.position(0); bufferDup.limit(buckets * bucketSize); tableBuffer = bufferDup.slice(); tableStart = 0; keySerde.reset(); }

Target:
public void reset() { size = 0; buckets = Math.min(tableArenaSize / bucketSize, initialBuckets); maxSize = maxSizeForBuckets(buckets); if (buckets < 1) { throw new IAE( "Not enough capacity for even one row! Need[%,d] but have[%,d].", bucketSize + Ints.BYTES, buffer.capacity() ); } tableStart = tableArenaSize - buckets * bucketSize; int nextBuckets = buckets * 2; while (true) { final int nextTableStart = tableStart - nextBuckets * bucketSize; if (nextTableStart > tableArenaSize / 2) { tableStart = nextTableStart; nextBuckets = nextBuckets * 2; } else { break; } } if (tableStart < tableArenaSize / 2) { tableStart = 0; } final ByteBuffer bufferDup = buffer.duplicate(); bufferDup.position(tableStart); bufferDup.limit(tableStart + buckets * bucketSize); tableBuffer = bufferDup.slice(); for (int i = 0; i < buckets; i++) { tableBuffer.put(i * bucketSize, (byte) 0); } keySerde.reset(); }
Source:
private Supplier<StorageStatement> storeStatementSupplier( NeoStores neoStores ) { Supplier<IndexReaderFactory> indexReaderFactory = () -> new IndexReaderFactory.Caching( indexingService ); LockService lockService = takePropertyReadLocks ? this.lockService : NO_LOCK_SERVICE; return new Supplier<StorageStatement>() { @Override public StorageStatement get() { return new StoreStatement( neoStores, indexReaderFactory, labelScanStore::newReader, lockService, allocateCommandCreationContext() ); } }; }

Target:
private Supplier<StorageStatement> storeStatementSupplier( NeoStores neoStores ) { Supplier<IndexReaderFactory> indexReaderFactory = () -> new IndexReaderFactory.Caching( indexingService ); LockService lockService = takePropertyReadLocks ? this.lockService : NO_LOCK_SERVICE; return () -> new StoreStatement( neoStores, indexReaderFactory, labelScanStore::newReader, lockService, allocateCommandCreationContext() ); }
Source:
private InternalCacheEntry<WrappedBytes, WrappedBytes> peekOrGet(WrappedBytes k, boolean peek) { int hashCode = k.hashCode(); int lockOffset = getLockOffset(hashCode); Lock lock = locks.getLockWithOffset(lockOffset).readLock(); lock.lock(); try { checkDeallocation(); InternalCacheEntry<WrappedBytes, WrappedBytes> value = lockedPeekOrGet(memoryLookup, k, hashCode, peek); if (value == null && oldMemoryLookup != null) { value = lockedPeekOrGet(oldMemoryLookup, k, hashCode, peek); } return value; } finally { lock.unlock(); } }

Target:
private InternalCacheEntry<WrappedBytes, WrappedBytes> peekOrGet(WrappedBytes k, boolean peek) { int hashCode = k.hashCode(); int lockOffset = getLockOffset(hashCode); Lock lock = locks.getLockWithOffset(lockOffset).readLock(); lock.lock(); try { checkDeallocation(); MemoryAddressHash memoryLookup; if (pendingBlocks != null && pendingBlocks.contains(lockOffset)) { memoryLookup = this.oldMemoryLookup; } else { memoryLookup = this.memoryLookup; } return lockedPeekOrGet(memoryLookup, k, hashCode, peek); } finally { lock.unlock(); } }
Source:
public void testIncludeCipherEmpty() throws Exception { String keyStorePath = new File(getResource("test.keystore").toURI()).getAbsolutePath(); String keyStorePassword = "airlift"; HttpServerConfig config = new HttpServerConfig() .setHttpsEnabled(true) .setHttpsPort(0) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setHttpsIncludedCipherSuites(" , "); NodeInfo nodeInfo = new NodeInfo("test"); HttpServerInfo httpServerInfo = new HttpServerInfo(config, nodeInfo); HttpServer server = createServer(nodeInfo, httpServerInfo, config); try { server.start(); URI httpsUri = httpServerInfo.getHttpsUri(); HttpClient httpClient = createClient(new String[] {}, new String[] {"TLS_RSA_WITH_AES_128_CBC_SHA"}, keyStorePath, keyStorePassword); httpClient.GET(httpsUri); } finally { server.stop(); } }

Target:
public void testIncludeCipherEmpty() throws Exception { HttpServerConfig config = new HttpServerConfig() .setHttpsEnabled(true) .setHttpsPort(0) .setKeystorePath(KEY_STORE_PATH) .setKeystorePassword(KEY_STORE_PASSWORD) .setHttpsIncludedCipherSuites(" , "); NodeInfo nodeInfo = new NodeInfo("test"); HttpServerInfo httpServerInfo = new HttpServerInfo(config, nodeInfo); HttpServer server = createServer(nodeInfo, httpServerInfo, config); try { server.start(); URI httpsUri = httpServerInfo.getHttpsUri(); HttpClient httpClient = createClientIncludeCiphers(CIPHER_1); httpClient.GET(httpsUri); httpClient = createClientIncludeCiphers(CIPHER_2); httpClient.GET(httpsUri); httpClient = createClientIncludeCiphers(CIPHER_3); httpClient.GET(httpsUri); } finally { server.stop(); } }
Source:
public Pointer convertToNumpy(INDArray array) { LongPointer size = new LongPointer(1); Pointer header = NativeOpsHolder .getInstance().getDeviceNativeOps() .numpyHeaderForNd4j( array.data().pointer(), array.shapeInfoDataBuffer().pointer(), array.data().getElementSize() ,size); header.capacity(size.get()); header.position(0); BytePointer bytePointer = new BytePointer((int) (size.get() + (array.data().getElementSize() * array.data().length()))); BytePointer headerCast = new BytePointer(header); int pos = 0; bytePointer.position(pos); Pointer.memcpy(bytePointer,headerCast,headerCast.capacity()); pos += (headerCast.capacity() - 1); bytePointer.position(pos); Nd4j.getAffinityManager().ensureLocation(array, AffinityManager.Location.HOST); Pointer.memcpy(bytePointer,array.data().pointer(),(array.data().getElementSize() * array.data().length())); bytePointer.position(0); return bytePointer; }

Target:
public Pointer convertToNumpy(INDArray array) { val size = new LongPointer(1); Pointer header = NativeOpsHolder .getInstance().getDeviceNativeOps() .numpyHeaderForNd4j( array.data().pointer(), array.shapeInfoDataBuffer().pointer(), array.data().getElementSize() ,size); val headerSize = size.get() - 1; header.capacity(headerSize); header.position(0); BytePointer bytePointer = new BytePointer((int) (headerSize + (array.data().getElementSize() * array.data().length()))); BytePointer headerCast = new BytePointer(header); val indexer = ByteIndexer.create(headerCast); int pos = 0; bytePointer.position(pos); Pointer.memcpy(bytePointer, headerCast,headerCast.capacity()); pos += (headerCast.capacity()); bytePointer.position(pos); Nd4j.getAffinityManager().ensureLocation(array, AffinityManager.Location.HOST); Pointer.memcpy(bytePointer,array.data().pointer(),(array.data().getElementSize() * array.data().length())); bytePointer.position(0); return bytePointer; }
Source:
private void startFailedAutoStartVmsImpl() { processVmsToAdd(); if (autoStartVmsToRestart.isEmpty()) { return; } final DateTime iterationStartTime = DateTime.getNow(); Collection<Guid> vmIds = autoStartVmsToRestart.keySet(); List<AutoStartVmToRestart> vmsToRestart = new ArrayList<>(autoStartVmsToRestart.values()); Map<Guid, VM> vms = vmDao.getVmsByIds(vmIds).stream() .collect(Collectors.toMap(VM::getId, vm -> vm)); vmsToRestart.forEach(vmToRestart -> vmToRestart.setVm(vms.get(vmToRestart.getVmId()))); if (considerPriority) { vmsToRestart.sort(Comparator.<AutoStartVmToRestart>comparingInt(a -> a.getVm().getPriority()).reversed()); } int neededPriority = Integer.MIN_VALUE; for (AutoStartVmToRestart autoStartVmToRestart : vmsToRestart) { boolean shouldRemoveVm = autoStartVmToRestart.isWaitingForUp() ? processStartingVm(autoStartVmToRestart) : processDownVm(autoStartVmToRestart, neededPriority, iterationStartTime); if (shouldRemoveVm) { autoStartVmsToRestart.remove(autoStartVmToRestart.getVmId()); } else { neededPriority = Math.max(neededPriority, autoStartVmToRestart.getVm().getPriority()); } } }

Target:
private void startFailedAutoStartVmsImpl() { processVmsToAdd(); if (autoStartVmsToRestart.isEmpty()) { return; } final DateTime iterationStartTime = DateTime.getNow(); Collection<Guid> vmIds = autoStartVmsToRestart.keySet(); List<AutoStartVmToRestart> vmsToRestart = new ArrayList<>(autoStartVmsToRestart.values()); Map<Guid, VM> vms = vmDao.getVmsByIds(vmIds).stream() .collect(Collectors.toMap(VM::getId, vm -> vm)); vmsToRestart.forEach(vmToRestart -> vmToRestart.setVm(vms.get(vmToRestart.getVmId()))); if (considerPriority) { vmsToRestart.sort(Comparator.<AutoStartVmToRestart>comparingInt(a -> a.getVm().getPriority()).reversed()); } int neededPriority = Integer.MIN_VALUE; for (AutoStartVmToRestart autoStartVmToRestart : vmsToRestart) { if (!autoStartVmToRestart.isWaitingForUp()) { if (processDownVm(autoStartVmToRestart, neededPriority, iterationStartTime)) { autoStartVmToRestart.setWaitingForUp(true); } } if (autoStartVmToRestart.isWaitingForUp()) { boolean shouldWaitForVm = considerPriority && autoStartVmToRestart.shouldWaitForVmUp(); if (!shouldWaitForVm) { autoStartVmsToRestart.remove(autoStartVmToRestart.getVmId()); continue; } } neededPriority = Math.max(neededPriority, autoStartVmToRestart.getVm().getPriority()); } }
Source:
protected void begin() { super.begin(); controller = JumpingSumoDeviceController.getInstance(); deviceController = controller.getDeviceController(); if (deviceController != null) { deviceController.getFeatureJumpingSumo().sendAnimationsJump(ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_HIGH); Log.d(TAG, "send jump high command JS down"); } else { Log.d(TAG, "error: send jump high command JS"); } }

Target:
protected void begin() { super.begin(); controller = JumpingSumoDeviceController.getInstance(); deviceController = controller.getDeviceController(); if (deviceController != null) { deviceController.getFeatureJumpingSumo().sendAnimationsJump(ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_HIGH); Log.d(TAG, "send jump high command JS down"); } }
Source:
public String getFullPropertyString() { StringBuffer sb = new StringBuffer(); sb.append("bf=sub;"); sb.append(super.getFullPropertyString()); if (language != null && language.length() > 0) { sb.append("lang="); sb.append(escapeString(language)); sb.append(';'); } if (path != null && path.length() > 0) { sb.append("path="); sb.append(escapeString(path)); sb.append(';'); } if (compositionPageId != null && compositionPageId.length() > 0) { sb.append("cpgid="); sb.append(compositionPageId); sb.append(';'); } if (ancillaryPageId != null && ancillaryPageId.length() > 0) { sb.append("apgid="); sb.append(ancillaryPageId); sb.append(';'); } if(this.forced == true) { sb.append("forced="); sb.append("true"); sb.append(';'); } else { sb.append("forced="); sb.append("false"); sb.append(';'); } return sb.toString(); }

Target:
public String getFullPropertyString() { StringBuffer sb = new StringBuffer(); sb.append("bf=sub;"); sb.append(super.getFullPropertyString()); if (language != null && language.length() > 0) { sb.append("lang="); sb.append(escapeString(language)); sb.append(';'); } if (path != null && path.length() > 0) { sb.append("path="); sb.append(escapeString(path)); sb.append(';'); } if (compositionPageId != null && compositionPageId.length() > 0) { sb.append("cpgid="); sb.append(compositionPageId); sb.append(';'); } if (ancillaryPageId != null && ancillaryPageId.length() > 0) { sb.append("apgid="); sb.append(ancillaryPageId); sb.append(';'); } sb.append("forced="); sb.append(forced); sb.append(';'); return sb.toString(); }
Source:
public void onCreate() { instance = new WeakReference<>(this); addModule(new AndroidLoggerModule()); addModule(OkHttpModule.withCache(this)); super.onCreate(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); realm = Realm.getDefaultInstance(); realm.executeTransactionAsync( new DefaultDataTransaction(), new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { log.debug("Loading default data successful"); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { log.error("Error loading default data", error); } } ); TinyDB.getInstance().init(getApplicationContext()); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true); }

Target:
public void onCreate() { instance = new WeakReference<>(this); addModule(new AndroidLoggerModule()); addModule(OkHttpModule.withCache(this)); super.onCreate(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); final Realm realm = Realm.getDefaultInstance(); realm.executeTransactionAsync( new DefaultDataTransaction(), new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { log.debug("Loading default data successful"); realm.close(); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { log.error("Error loading default data", error); realm.close(); } } ); TinyDB.getInstance().init(getApplicationContext()); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true); }
Source:
public String toString() { return "Operation.Successful"; }

Target:
public String toString() { return "SUCCESSFUL"; }
Source:
public void switchAndWrite(String text) { driver.switchTo().frame(miniEditorIframe); waitForElementByElement(messageBodyField); messageBodyField.sendKeys(text); }

Target:
public void switchAndWrite(String text) { waitForElementByElement(miniEditorIframe); driver.switchTo().frame(miniEditorIframe); waitForElementByElement(messageBodyField); messageBodyField.sendKeys(text); }
Source:
public Iterable<Content> iterate(final String pattern, final String ref) throws IOException { final Iterable<XML> nodes = this.storage.xml().nodes( String.format("%s/content[@ref='%s']", this.xpath(), ref) ); final Collection<Content> result = new LinkedList<Content>(); for (final XML node : nodes) { final String path = node.xpath("path/text()").get(0); if (path.startsWith(pattern)) { result.add( this.mkContent(ref, path) ); } } return result; }

Target:
public Iterable<Content> iterate(final String pattern, final String ref) throws IOException { final Collection<XML> nodes = this.storage.xml().nodes( String.format("%s/content[@ref='%s']", this.xpath(), ref) ); final Collection<Content> result = new ArrayList<Content>(nodes.size()); for (final XML node : nodes) { final String path = node.xpath("path/text()").get(0); if (path.startsWith(pattern)) { result.add( this.mkContent(ref, path) ); } } return result; }
Source:
public RepositoryObject getParent() { return null; }

Target:
public RepositoryObject getParent() { return dataLoader.getParentObject(this); }
Source:
public Object getParameter(String name) { final HostThread currentHostThread = fCurrentHostThread; if (currentHostThread == null) { return null; } if (name.equals(CriticalPathModule.PARAM_WORKER)) { IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } return currentHostThread; } return null; }

Target:
public Object getParameter(String name) { if (name.equals(CriticalPathModule.PARAM_WORKER)) { final HostThread currentHostThread = fCurrentHostThread; if (currentHostThread == null) { return null; } IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } return currentHostThread; } return null; }
Source:
public static ReadCountCollection removeColumnsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumColumnZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<String> columnsToKeep = IntStream.range(0, counts.getColumnDimension()).boxed() .filter(i -> countZeroes(counts.getColumn(i)) <= maximumColumnZeros) .map(i -> readCounts.columnNames().get(i)).collect(Collectors.toSet()); final int columnsToDropCount = readCounts.columnNames().size() - columnsToKeep.size(); if (columnsToDropCount == 0) { logger.info( String.format("No count column dropped due to zero counts; there is no column with a large number of targets with zero counts (<= %d of %d) ", maximumColumnZeros, readCounts.targets().size())); return readCounts; } else if (columnsToDropCount == readCounts.columnNames().size()) { throw new UserException.BadInput("The number of zeros per count column is too large resulting in all count columns to be dropped"); } else { logger.info( String.format("Some counts columns dropped, %d of %d, as they have too many targets with zeros (> %d of %d)." , columnsToDropCount, readCounts.columnNames().size(), maximumColumnZeros, readCounts.targets().size())); return readCounts.subsetColumns(columnsToKeep); } }

Target:
public static ReadCountCollection removeColumnsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumColumnZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<String> columnsToKeep = IntStream.range(0, counts.getColumnDimension()).boxed() .filter(i -> countZeroes(counts.getColumn(i)) <= maximumColumnZeros) .map(i -> readCounts.columnNames().get(i)).collect(Collectors.toSet()); final int columnsToDropCount = readCounts.columnNames().size() - columnsToKeep.size(); if (columnsToDropCount == 0) { logger.info( String.format("There were no columns with a large number of targets with zero counts " + "(<= %d of %d) to drop", maximumColumnZeros, readCounts.targets().size())); return readCounts; } else if (columnsToDropCount == readCounts.columnNames().size()) { throw new UserException.BadInput("The number of zeros per count column is too large resulting in all count " + "columns to be dropped"); } else { final double droppedPercentage = ((double)(columnsToDropCount) / readCounts.columnNames().size()) * 100; logger.info(String.format("Some counts columns dropped (%d out of %d, %.2f%%) as they had too many targets with zeros (> %d of %d)", columnsToDropCount, readCounts.columnNames().size(), droppedPercentage, maximumColumnZeros, readCounts.targets().size())); return readCounts.subsetColumns(columnsToKeep); } }
Source:
public synchronized void close() { if (closed) { return; } closed = true; if (parentMemoryContext != null) { parentMemoryContext.updateBytes(-usedBytes); } usedBytes = 0; }

Target:
public synchronized void close() { if (closed) { return; } closed = true; parentMemoryContext.updateBytes(-usedBytes); usedBytes = 0; }
Source:
public Partition getPartitionObj(int idx) throws Exception { return partitionObjs == null ? null : (Partition)JSONMessageFactory.getTObj(partitionObjs.get(idx), Partition.class); }

Target:
public Partition getPartitionObj(int idx) throws Exception { return (partitionObjs == null ? null : (partitionObjs.get(idx) == null ? null : (Partition)JSONMessageFactory.getTObj(partitionObjs.get(idx), Partition.class))); }
Source:
public static Pair<Integer, Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig) { int audioObjectType = (audioSpecificConfig[0] >> 3) & 0x1F; if (audioObjectType != 31) { int byteOffset = audioObjectType == 5 || audioObjectType == 29 ? 1 : 0; int frequencyIndex = (audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1); Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = (audioSpecificConfig[byteOffset + 1] >> 3) & 0xF; return Pair.create(sampleRate, channelCount); } else { int frequencyIndex = (audioSpecificConfig[1] & 0x1E) >> 1; Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = (audioSpecificConfig[1] & 0x01) << 2 | ((audioSpecificConfig[2] >> 6) & 0x03); return Pair.create(sampleRate, channelCount); } }

Target:
public static Pair<Integer, Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig) { int audioObjectType = (audioSpecificConfig[0] >> 3) & 0x1F; if (audioObjectType < 31) { int byteOffset = audioObjectType == 5 || audioObjectType == 29 ? 1 : 0; int frequencyIndex = (audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1); Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[ (audioSpecificConfig[byteOffset + 1] >> 3) & 0xF]; return Pair.create(sampleRate, channelCount); } else { int frequencyIndex = (audioSpecificConfig[1] & 0x1E) >> 1; Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[ (audioSpecificConfig[1] & 0x01) << 3 | ((audioSpecificConfig[2] >> 5) & 0x07)]; return Pair.create(sampleRate, channelCount); } }
Source:
public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( getDownHosts(allHosts, parameters), getMaintenanceHosts(allHosts, parameters), getEmptyHosts(allHosts, parameters), parameters); if (action != null) { processPmAction(action); } return migrationRule; }

Target:
public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); getHostLists(allHosts, parameters, emptyHosts, maintenanceHosts, downHosts); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( downHosts, maintenanceHosts, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }
Source:
private List<String> readLines(final File file, final String encoding, final boolean tail, final int skip, final int numberOfLines) throws IOException { final List<String> lines; if (numberOfLines < 0) { lines = new ArrayList<String>(); } else { lines = new ArrayList<String>(numberOfLines); } final InputStream in; BufferedReader reader = null; try { if (tail) { in = new LogFileResourceDefinition.LifoFileInputStream(file); } else { in = new FileInputStream(file); } if (encoding == null) { reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); } else { reader = new BufferedReader(new InputStreamReader(in, encoding)); } int lineCount = 0; String line; while ((line = reader.readLine()) != null) { if (++lineCount <= skip) continue; if (lines.size() == numberOfLines) break; lines.add(line); } if (tail) { Collections.reverse(lines); } return lines; } finally { safeClose(reader); } }

Target:
private List<String> readLines(final File file, final String encoding, final boolean tail, final int skip, final int numberOfLines) throws IOException { final List<String> lines; if (numberOfLines < 0) { lines = new ArrayList<String>(); } else { lines = new ArrayList<String>(numberOfLines); } final InputStream in; BufferedReader reader = null; try { if (tail) { in = new LogFileResourceDefinition.LifoFileInputStream(file); } else { in = new FileInputStream(file); } if (encoding == null) { reader = new BufferedReader(new InputStreamReader(in)); } else { reader = new BufferedReader(new InputStreamReader(in, encoding)); } int lineCount = 0; String line; while ((line = reader.readLine()) != null) { if (++lineCount <= skip) continue; if (lines.size() == numberOfLines) break; lines.add(line); } if (tail) { Collections.reverse(lines); } return lines; } finally { safeClose(reader); } }
Source:
public List<TmfAnalysisElement> getAvailableAnalysis() { List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>(); IPath path = getProject().getTracesFolder().getPath(); if (fResource instanceof IFolder) { IFolder folder = (IFolder) fResource; path = folder.getFullPath(); } else if (fResource instanceof IFile) { IFile file = (IFile) fResource; path = path.append(file.getName()); } for (IAnalysisModule module : TmfAnalysisManager.getAnalysisModules(TmfExperiment.class).values()) { IFolder newresource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path.append(module.getId())); TmfAnalysisElement analysis = new TmfAnalysisElement(module.getName(), newresource, this, module.getId()); list.add(analysis); } return list; }

Target:
public List<TmfAnalysisElement> getAvailableAnalysis() { List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>(); return list; }
Source:
private void handleAccessRestrictionByImportPackage(IProject currentProject, ExportPackageDescription desc, AbstractClassResolutionCollector collector) { BundleDescription supplier = desc.getSupplier(); if (supplier != null) { String supplierId = supplier.getSymbolicName(); IPluginModelBase base = PluginRegistry.findModel(currentProject); BundleDescription bd = base.getBundleDescription(); BundleSpecification[] imports = bd.getRequiredBundles(); boolean supplierImported = false; for (BundleSpecification import1 : imports) { BundleDescription importSupplier = (BundleDescription) import1.getSupplier(); if (importSupplier != null && importSupplier.getSymbolicName().equals(supplierId)) { supplierImported = true; break; } } if (!supplierImported) { boolean proposeImportPackage = true; ImportPackageSpecification[] importPackages = bd.getImportPackages(); for (ImportPackageSpecification importPackage : importPackages) { if (desc.getName().equals(importPackage.getName())) { proposeImportPackage = false; break; } } if (proposeImportPackage) { collector.addResolutionModification(currentProject, desc); } collector.addRequireBundleModification(currentProject, desc, 16); } } }

Target:
private void handleAccessRestrictionByImportPackage(IProject currentProject, ExportPackageDescription desc, AbstractClassResolutionCollector collector) { BundleDescription supplier = desc.getSupplier(); if (supplier != null) { String supplierId = supplier.getSymbolicName(); IPluginModelBase base = PluginRegistry.findModel(currentProject); BundleDescription bd = base.getBundleDescription(); BundleSpecification[] imports = bd.getRequiredBundles(); boolean supplierImported = false; for (BundleSpecification importstatement : imports) { BundleDescription importSupplier = (BundleDescription) importstatement.getSupplier(); if (importSupplier != null && importSupplier.getSymbolicName().equals(supplierId)) { supplierImported = true; break; } } if (!supplierImported) { boolean proposeImportPackage = true; ImportPackageSpecification[] importPackages = bd.getImportPackages(); for (ImportPackageSpecification importPackage : importPackages) { if (desc.getName().equals(importPackage.getName())) { proposeImportPackage = false; break; } } if (proposeImportPackage) { collector.addResolutionModification(currentProject, desc); } collector.addRequireBundleModification(currentProject, desc, 16); } } }
Source:
protected void recoverAndCommit(FlinkKafkaProducer.KafkaTransactionState transaction) { if (transaction.isTransactional()) { FlinkKafkaInternalProducer<byte[], byte[]> producer = null; try { producer = initTransactionalProducer(transaction.transactionalId, false); producer.resumeTransaction(transaction.producerId, transaction.epoch); producer.commitTransaction(); } catch (InvalidTxnStateException | ProducerFencedException ex) { LOG.warn("Encountered error while recovering transaction {}. " + "Presumably this transaction has been already committed before", ex, transaction); } finally { if (producer != null) { producer.close(30, TimeUnit.SECONDS); } } } }

Target:
protected void recoverAndCommit(FlinkKafkaProducer.KafkaTransactionState transaction) { if (transaction.isTransactional()) { FlinkKafkaInternalProducer<byte[], byte[]> producer = null; try { producer = initTransactionalProducer(transaction.transactionalId, false); producer.resumeTransaction(transaction.producerId, transaction.epoch); producer.commitTransaction(); } catch (InvalidTxnStateException | ProducerFencedException ex) { LOG.warn("Encountered error while recovering transaction {}. " + "Presumably this transaction has been already committed before", ex, transaction); } finally { if (producer != null) { producer.close(0, TimeUnit.SECONDS); } } } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || !getClass().equals(o.getClass())) return false; TimeSeriesKey<?> that = (TimeSeriesKey<?>) o; if (timestamp != that.timestamp) return false; if (seqNum != that.seqNum) return false; return key != null ? key.equals(that.key) : that.key == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TimeSeriesKey<?> that = (TimeSeriesKey<?>) o; if (timestamp != that.timestamp) return false; if (seqNum != that.seqNum) return false; return key != null ? key.equals(that.key) : that.key == null; }
Source:
public GHPoint asPoint() { return null; }

Target:
public GHPoint asPoint() { throw new UnsupportedOperationException("Not supported"); }
Source:
static Iterator<Integer> rangeClosedBy(int from, int toInclusive, int step) { if (step == 0) { throw new IllegalArgumentException("step cannot be 0"); } else if (from == toInclusive) { return of(from); } else if (Integer.signum(step) == Integer.signum(from - toInclusive)) { return empty(); } else { if (step > 0) { return new Iterator<Integer>() { int next = from; boolean overflow = false; @Override public boolean hasNext() { return !overflow && next <= toInclusive; } @Override public Integer next() { if (!hasNext()) { throw new NoSuchElementException(); } int curr = next; int r = curr + step; overflow = ((curr ^ r) & (step ^ r)) < 0; next = r; return curr; } }; } else { return new Iterator<Integer>() { int next = from; boolean overflow = false; @Override public boolean hasNext() { return !overflow && next >= toInclusive; } @Override public Integer next() { if (!hasNext()) { throw new NoSuchElementException(); } int curr = next; int r = curr + step; overflow = ((curr ^ r) & (step ^ r)) < 0; next = r; return curr; } }; } } }

Target:
static Iterator<Integer> rangeClosedBy(int from, int toInclusive, int step) { if (step == 0) { throw new IllegalArgumentException("step cannot be 0"); } if (step > 0) { return new RangeIntForwardIterator(from, toInclusive, step, true); } else { return new RangeIntBackwardIterator(from, toInclusive, step, true); } }
Source:
private static void simulateServerDelay() { long delay = getServerDelay(); if (delay > 0) { try { Thread.sleep(delay); } catch (InterruptedException e) { logger.info("", e); } } }

Target:
private static void simulateServerDelay() { long delay = getServerDelay(); if (delay > 0) { try { Thread.sleep(delay); } catch (InterruptedException e) { logger.warn("", e); } } }
Source:
private ParquetReader(Configuration conf, Path file, ReadSupport<T> readSupport, Filter filter) throws IOException { this.readSupport = readSupport; this.filter = checkNotNull(filter, "filter"); this.conf = conf; FileSystem fs = file.getFileSystem(conf); List<FileStatus> statuses = Arrays.asList(fs.listStatus(file, HiddenFileFilter.INSTANCE)); List<Footer> footers = ParquetFileReader.readAllFootersInParallelUsingSummaryFiles(conf, statuses, false); this.footersIterator = footers.iterator(); globalMetaData = ParquetFileWriter.getGlobalMetaData(footers); MessageType schema = globalMetaData.getSchema(); Map<String, Set<String>> extraMetadata = globalMetaData.getKeyValueMetaData(); readContext = readSupport.init(new InitContext(conf, extraMetadata, schema)); }

Target:
private ParquetReader(Configuration conf, Path file, ReadSupport<T> readSupport, Filter filter) throws IOException { this.readSupport = readSupport; this.filter = checkNotNull(filter, "filter"); this.conf = conf; FileSystem fs = file.getFileSystem(conf); List<FileStatus> statuses = Arrays.asList(fs.listStatus(file, HiddenFileFilter.INSTANCE)); List<Footer> footers = ParquetFileReader.readAllFootersInParallelUsingSummaryFiles(conf, statuses, false); this.footersIterator = footers.iterator(); GlobalMetaData globalMetaData = ParquetFileWriter.getGlobalMetaData(footers); MessageType schema = globalMetaData.getSchema(); Map<String, Set<String>> extraMetadata = globalMetaData.getKeyValueMetaData(); readContext = readSupport.init(new InitContext(conf, extraMetadata, schema)); }
Source:
public void declareOutputFields(OutputFieldsDeclarer declarer) { for (String stream : ruleProcessorRuntime.getStreams()) { declarer.declareStream(stream, new Fields(IotasEvent.IOTAS_EVENT)); } }

Target:
public void declareOutputFields(OutputFieldsDeclarer declarer) { for (String stream : boltDependenciesFactory.createRuleProcessorRuntime().getStreams()) { declarer.declareStream(stream, new Fields(IotasEvent.IOTAS_EVENT)); } }
Source:
public void validate_valid_3ds_flex_credentials() throws Exception { stubFor(post("/shopper/3ds/ddc.html").willReturn(ok())); var validIssuer = "54i0917n10va4428b69l5id0"; var validOrgUnitId = "57992i087n0v4849895alid2"; var validJwtMacKey = "4inva5l2-0133-4i82-d0e5-2024dbeddaa9"; var payload = new ObjectMapper().writeValueAsString(Map.of( "issuer", validIssuer, "organisational_unit_id", validOrgUnitId, "jwt_mac_key", validJwtMacKey)); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, testAccount.getAccountId())) .then() .statusCode(200) .body("result", is("valid")); }

Target:
public void validate_valid_3ds_flex_credentials() throws Exception { stubFor(post("/shopper/3ds/ddc.html").willReturn(ok())); var validIssuer = "54i0917n10va4428b69l5id0"; var validOrgUnitId = "57992i087n0v4849895alid2"; var validJwtMacKey = "4inva5l2-0133-4i82-d0e5-2024dbeddaa9"; var payload = objectMapper.writeValueAsString(Map.of( "issuer", validIssuer, "organisational_unit_id", validOrgUnitId, "jwt_mac_key", validJwtMacKey)); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, testAccount.getAccountId())) .then() .statusCode(200) .body("result", is("valid")); }
Source:
public double compute(Vector a, Vector b) throws CardinalityException { Set<Double> aSet = new HashSet<>(); for (int i = 0; i < a.size(); i++) aSet.add(a.get(i)); double intersect = 0; for (int i = 0; i < b.size(); i++) if (aSet.contains(b.get(i))) ++intersect; return intersect / (a.size() + b.size() - intersect); }

Target:
@Override public double compute(Vector a, Vector b) throws CardinalityException { Set<Double> uniqueValues = new HashSet<>(); for (int i = 0; i < a.size(); i++) uniqueValues.add(a.get(i)); double intersect = 0; for (int i = 0; i < b.size(); i++) if (uniqueValues.contains(b.get(i))) ++intersect; return intersect / (a.size() + b.size() - intersect); }
Source:
public void testMarkerOffset_Bug486610() { String code = getAboveComment(); loadCodeAndRun(code); IMarker marker = checkErrorLine(2); int start = marker.getAttribute(IMarker.CHAR_START, -1); int end = marker.getAttribute(IMarker.CHAR_END, -1); assertTrue(code.substring(start, end).equals("x\n = x")); }

Target:
public void testMarkerOffset_Bug486610() throws Exception { String code = getAboveComment(); loadCodeAndRun(code); IMarker marker = checkErrorLine(2); int start = marker.getAttribute(IMarker.CHAR_START, -1); int end = marker.getAttribute(IMarker.CHAR_END, -1); assertTrue(code.substring(start, end).equals("x\n = x")); }
Source:
public Relationship byInode(final String inode){ Relationship rel = null; try { rel = cache.getRelationshipByInode(inode); if(rel != null) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } try { final DotConnect dc = new DotConnect(); dc.setSQL(sql.FIND_BY_INODE); dc.addParam(inode); List<Map<String, Object>> results; results = dc.loadObjectResults(); if (results.size() == 0) { throw new NotFoundInDbException("Relationship with inode: " + inode + " not found"); } rel = new DbRelationshipTransformer(results).from(); }catch (DotDataException e){ Logger.error(this, "Error getting Relationship with inode: " + inode, e); } if(rel!= null && InodeUtils.isSet(rel.getInode())) { cache.putRelationshipByInode(rel); } return rel; }

Target:
public Relationship byInode(final String inode){ Relationship rel = null; try { rel = cache.getRelationshipByInode(inode); if(rel != null) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } try { final List<Map<String, Object>> results = new DotConnect() .setSQL(sql.FIND_BY_INODE) .addParam(inode) .loadObjectResults(); if (results.isEmpty()) { throw new NotFoundInDbException("Relationship with inode: " + inode + " not found"); } rel = new DbRelationshipTransformer(results).from(); }catch (DotDataException e){ Logger.error(this, "Error getting Relationship with inode: " + inode, e); } if(rel!= null && InodeUtils.isSet(rel.getInode())) { cache.putRelationshipByInode(rel); } return rel; }
Source:
public void testSkipStatsHint2() throws Exception { methodWatcher.executeQuery(format( "call SYSCS_UTIL.COLLECT_SCHEMA_STATISTICS('%s', false)", spliceSchemaWatcher.toString())); String query = "explain select * from --splice-properties joinOrder=fixed\n" + "t2 as X --splice-properties skipStats=true\n" + ",t2 as Y --splice-properties joinStrategy=BROADCAST,skipStats=false\n" + "where X.a2=Y.a2"; try(ResultSet resultSet = methodWatcher.executeQuery(query)){ int i = 1; double outputRowWithStats = 0; double outputRowWithoutStats = 0; while(resultSet.next()){ if (i == 4) { outputRowWithStats = parseOutputRows(resultSet.getString(1)); Assert.assertEquals(outputRowWithStats, 40960, 10); } if (i == 5) { outputRowWithoutStats = parseOutputRows(resultSet.getString(1)); Assert.assertNotEquals(outputRowWithStats, outputRowWithoutStats, 10); } } } }

Target:
public void testSkipStatsHint2() throws Exception { methodWatcher.executeQuery(format( "call SYSCS_UTIL.COLLECT_SCHEMA_STATISTICS('%s', false)", spliceSchemaWatcher.toString())); String query = "explain select * from --splice-properties joinOrder=fixed\n" + "t2 as X --splice-properties skipStats=true\n" + ",t2 as Y --splice-properties joinStrategy=BROADCAST,skipStats=false\n" + "where X.a2=Y.a2"; try(ResultSet resultSet = methodWatcher.executeQuery(query)){ int i = 1; double outputRowWithStats = 0; double outputRowWithoutStats = 0; while(resultSet.next()){ if (i == 4) { outputRowWithStats = parseOutputRows(resultSet.getString(1)); Assert.assertEquals(outputRowWithStats, 40960, 10); } else if (i == 5) { outputRowWithoutStats = parseOutputRows(resultSet.getString(1)); Assert.assertNotEquals(outputRowWithStats, outputRowWithoutStats, 10); } } } }