auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolumeDao().getById(volumeId); VDSReturnValue retVal = runVdsCommand(VDSCommandType.CreateGlusterVolumeSnapshot, new GlusterVolumeCreateSnapshotVDSParameters(upServer.getId(), volume.getName(), snapshot.getSnapshotName(), snapshot.getDescription(), force)); setSucceeded(retVal.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, retVal.getVdsError().getMessage()); } else { GlusterVolumeSnapshotEntity createdSnapshot = getParameters().getSnapshot(); createdSnapshot.setSnapshotId(((GlusterVolumeSnapshotEntity) retVal.getReturnValue()).getSnapshotId()); createdSnapshot.setCreatedAt(new Date()); createdSnapshot.setStatus(GlusterSnapshotStatus.STARTED); getDbFacade().getGlusterVolumeSnapshotDao().save(createdSnapshot); } }

Target:
protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolume(); VDSReturnValue retVal = runVdsCommand(VDSCommandType.CreateGlusterVolumeSnapshot, new GlusterVolumeCreateSnapshotVDSParameters(upServer.getId(), volume.getName(), snapshot.getSnapshotName(), snapshot.getDescription(), force)); setSucceeded(retVal.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, retVal.getVdsError().getMessage()); } else { GlusterVolumeSnapshotEntity createdSnapshot = getParameters().getSnapshot(); createdSnapshot.setSnapshotId((Guid) retVal.getReturnValue()); createdSnapshot.setStatus(GlusterSnapshotStatus.STARTED); getDbFacade().getGlusterVolumeSnapshotDao().save(createdSnapshot); } }
Source:
private void init(Context context) { ((WordPress) context.getApplicationContext()).component().inject(this); if (!isInEditMode()) { mToken = mAccountStore.getAccessToken(); mReaderChromeClient = new ReaderWebChromeClient(this); this.setWebChromeClient(mReaderChromeClient); this.setWebViewClient(new ReaderWebViewClient(this)); this.getSettings().setUserAgentString(WordPress.getUserAgent()); final float fontScale = getResources().getConfiguration().fontScale; if (((int) (fontScale * 10000)) != 10000) { this.getSettings().setDefaultFontSize((int) (this.getSettings().getDefaultFontSize() * fontScale)); this.getSettings().setDefaultFixedFontSize( (int) (this.getSettings().getDefaultFixedFontSize() * fontScale)); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(this, true); } } }

Target:
private void init(Context context) { ((WordPress) context.getApplicationContext()).component().inject(this); if (!isInEditMode()) { mToken = mAccountStore.getAccessToken(); mReaderChromeClient = new ReaderWebChromeClient(this); this.setWebChromeClient(mReaderChromeClient); this.setWebViewClient(new ReaderWebViewClient(this)); this.getSettings().setUserAgentString(WordPress.getUserAgent()); CookieManager.getInstance().setAcceptThirdPartyCookies(this, true); } }
Source:
public void testScheduleLargeExecutorConstraintCount(int parallelismMultiplier) { Config config = createCSSClusterConfig(10, 10, 0, null); config.put(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH, 50000); List<List<String>> constraints = new LinkedList<>(); addContraints("spout-0", "spout-0", constraints); addContraints("bolt-1", "bolt-1", constraints); addContraints("spout-0", "bolt-0", constraints); addContraints("bolt-2", "spout-0", constraints); addContraints("bolt-1", "bolt-2", constraints); addContraints("bolt-1", "bolt-0", constraints); addContraints("bolt-1", "spout-0", constraints); config.put(Config.TOPOLOGY_RAS_CONSTRAINTS, constraints); TopologyDetails topo = genTopology("testTopo-" + parallelismMultiplier, config, 10, 10, 30 * parallelismMultiplier, 30 * parallelismMultiplier, 31414, 0, "user"); Topologies topologies = new Topologies(topo); Map<String, SupervisorDetails> supMap = genSupervisors(30 * parallelismMultiplier, 30, 3500, 35000); Cluster cluster = new Cluster(new INimbusTest(), new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<String, SchedulerAssignmentImpl>(), topologies, config); ResourceAwareScheduler scheduler = new ResourceAwareScheduler(); scheduler.prepare(config); scheduler.schedule(topologies, cluster); boolean scheduleSuccess = isStatusSuccess(cluster.getStatus(topo.getId())); if (parallelismMultiplier == 5) { Assert.assertTrue(scheduleSuccess); } else if (parallelismMultiplier == 20) { LOG.info("testScheduleLargeExecutorCount scheduling with {}x executor multiplier", scheduleSuccess ? "succeeds" : "fails", parallelismMultiplier); } }

Target:
public void testScheduleLargeExecutorConstraintCount(int parallelismMultiplier) { Config config = createCSSClusterConfig(10, 10, 0, null); config.put(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH, 50000); List<List<String>> constraints = new LinkedList<>(); addContraints("spout-0", "spout-0", constraints); addContraints("bolt-1", "bolt-1", constraints); addContraints("spout-0", "bolt-0", constraints); addContraints("bolt-2", "spout-0", constraints); addContraints("bolt-1", "bolt-2", constraints); addContraints("bolt-1", "bolt-0", constraints); addContraints("bolt-1", "spout-0", constraints); config.put(Config.TOPOLOGY_RAS_CONSTRAINTS, constraints); TopologyDetails topo = genTopology("testTopo-" + parallelismMultiplier, config, 10, 10, 30 * parallelismMultiplier, 30 * parallelismMultiplier, 31414, 0, "user"); Topologies topologies = new Topologies(topo); Map<String, SupervisorDetails> supMap = genSupervisors(30 * parallelismMultiplier, 30, 3500, 35000); Cluster cluster = makeCluster(topologies, supMap); ResourceAwareScheduler scheduler = new ResourceAwareScheduler(); scheduler.prepare(config); scheduler.schedule(topologies, cluster); boolean scheduleSuccess = isStatusSuccess(cluster.getStatus(topo.getId())); if (parallelismMultiplier <= 5) { Assert.assertTrue(scheduleSuccess); } else if (parallelismMultiplier == 20) { LOG.info("testScheduleLargeExecutorCount scheduling with {}x executor multiplier", scheduleSuccess ? "succeeds" : "fails", parallelismMultiplier); } }
Source:
private static RequestHeaders buildDefaultHeaders() { final Multimap<String, String> headers = TreeMultimap.create(); headers.put("Naming-Convention", "s3"); return new RequestHeadersImpl(headers); }

Target:
private static RequestHeaders buildDefaultHeaders() { final RequestHeaders requestHeaders = new RequestHeadersImpl(); requestHeaders.put("Naming-Convention", "s3"); return requestHeaders; }
Source:
default void check() { File storageFile = new File(storagePath()); if (storageFile.exists()) { Preconditions.checkState( storageFile.isDirectory(), "Storage path has to point to a directory", SafeArg.of("path", storagePath())); } Preconditions.checkState(!Paths.get(storagePath()).isAbsolute(), "Storage path must be relative"); }

Target:
default void check() { Preconditions.checkState( !Paths.get(storagePath()).isAbsolute(), "Storage path must be relative", SafeArg.of("storagePath", storagePath())); File storageFile = new File(System.getProperty("user.dir"), storagePath()); if (storageFile.exists()) { Preconditions.checkState( storageFile.isDirectory(), "Storage path has to point to a directory", SafeArg.of("path", storagePath())); } }
Source:
private void fillBuffer() throws IOException { String prefix; if (firstIteratorElement) { prefix = "["; firstIteratorElement = false; } else { prefix = ","; } String entity = iterator.hasNext() ? iterator.next() : ""; String postfix = ""; if (!iterator.hasNext()) { postfix = "]"; } try { closeJSONStream(); jsonElementStream = IOUtils.toInputStream(prefix + entity + postfix, StandardCharsets.UTF_8.name()); } catch (IOException e) { } }

Target:
private void fillBuffer() { String prefix; if (firstIteratorElement) { prefix = "["; firstIteratorElement = false; } else { prefix = ","; } String entity = iterator.hasNext() ? iterator.next() : ""; String postfix = ""; if (!iterator.hasNext()) { postfix = "]"; } IOUtils.closeQuietly(jsonElementStream); try { jsonElementStream = IOUtils.toInputStream(prefix + entity + postfix, StandardCharsets.UTF_8.name()); } catch (IOException e) { } }
Source:
public void whenCompletesEventually() throws Exception { final String response = "someresponse"; InternalCompletableFuture<String> f = localOperationService.invokeOnPartition(new OffloadingOperation(op -> new Offload(op) { @Override public void start() { new Thread() { @Override public void run() { sleepSeconds(5); offloadedOperation().sendResponse(response); } }.start(); } })); assertCompletesEventually(f); assertEquals(response, f.get()); }

Target:
public void whenCompletesEventually() throws Exception { final String response = "someresponse"; InternalCompletableFuture<String> f = localOperationService.invokeOnPartition(new OffloadingOperation(op -> new Offload(op) { @Override public void start() { new Thread(() -> { sleepSeconds(5); offloadedOperation().sendResponse(response); }).start(); } })); assertCompletesEventually(f); assertEquals(response, f.get()); }
Source:
public String toString() { return StringUtils.format( "JdbcExtractionNamespace = { connectorConfig = { %s }, table = %s, filter = %s, keyColumn = %s, valueColumn = %s, tsColumn = %s, pollPeriod = %s}", connectorConfig.toString(), table, filter, keyColumn, valueColumn, tsColumn, pollPeriod ); }

Target:
public String toString() { return "JdbcExtractionNamespace{" + "connectorConfig=" + connectorConfig + ", table='" + table + '\'' + ", keyColumn='" + keyColumn + '\'' + ", valueColumn='" + valueColumn + '\'' + ", tsColumn='" + tsColumn + '\'' + ", filter='" + filter + '\'' + ", pollPeriod=" + pollPeriod + '}'; }
Source:
public MixinEmitter(ClassVisitor v, String className, Class[] classes, int[] route) { super(v); begin_class(Constants.V1_2, Constants.ACC_PUBLIC, className, MIXIN, TypeUtils.getTypes(getInterfaces(classes)), Constants.SOURCE_FILE); EmitUtils.null_constructor(this); EmitUtils.factory_method(this, NEW_INSTANCE); declare_field(Constants.ACC_PRIVATE, FIELD_NAME, Constants.TYPE_OBJECT_ARRAY, null); CodeEmitter e = begin_method(Constants.ACC_PUBLIC, CSTRUCT_OBJECT_ARRAY, null); e.load_this(); e.super_invoke_constructor(); e.load_this(); e.load_arg(0); e.putfield(FIELD_NAME); e.return_value(); e.end_method(); Set unique = new HashSet(); for (int i = 0; i < classes.length; i++) { Method[] methods = getMethods(classes[i]); for (int j = 0; j < methods.length; j++) { if (unique.add(MethodWrapper.create(methods[j]))) { MethodInfo method = ReflectUtils.getMethodInfo(methods[j]); int access = Constants.ACC_PUBLIC; if ((method.getModifiers() & Constants.ACC_VARARGS) == Constants.ACC_VARARGS) { access |= Constants.ACC_VARARGS; } e = EmitUtils.begin_method(this, method, access); e.load_this(); e.getfield(FIELD_NAME); e.aaload((route != null) ? route[i] : i); e.checkcast(method.getClassInfo().getType()); e.load_args(); e.invoke(method); e.return_value(); e.end_method(); } } } end_class(); }

Target:
public MixinEmitter(ClassVisitor v, String className, Class[] classes, int[] route) { super(v); begin_class(Constants.V1_2, Constants.ACC_PUBLIC, className, MIXIN, TypeUtils.getTypes(getInterfaces(classes)), Constants.SOURCE_FILE); EmitUtils.null_constructor(this); EmitUtils.factory_method(this, NEW_INSTANCE); declare_field(Constants.ACC_PRIVATE, FIELD_NAME, Constants.TYPE_OBJECT_ARRAY, null); CodeEmitter e = begin_method(Constants.ACC_PUBLIC, CSTRUCT_OBJECT_ARRAY, null); e.load_this(); e.super_invoke_constructor(); e.load_this(); e.load_arg(0); e.putfield(FIELD_NAME); e.return_value(); e.end_method(); Set unique = new HashSet(); for (int i = 0; i < classes.length; i++) { Method[] methods = getMethods(classes[i]); for (int j = 0; j < methods.length; j++) { if (unique.add(MethodWrapper.create(methods[j]))) { MethodInfo method = ReflectUtils.getMethodInfo(methods[j]); int modifiers = Constants.ACC_PUBLIC; if ((method.getModifiers() & Constants.ACC_VARARGS) == Constants.ACC_VARARGS) { modifiers |= Constants.ACC_VARARGS; } e = EmitUtils.begin_method(this, method, modifiers); e.load_this(); e.getfield(FIELD_NAME); e.aaload((route != null) ? route[i] : i); e.checkcast(method.getClassInfo().getType()); e.load_args(); e.invoke(method); e.return_value(); e.end_method(); } } } end_class(); }
Source:
public void resultPageUrlShouldContainSearchQueryName() { String searchPhrase = "searchPhrase"; String duckDuckUrl = "<LINK_0>"; chromium.sendCommand("Page.navigate", ImmutableMap.of("url", duckDuckUrl)); chromium.sendCommand("Input.insertText", ImmutableMap.of("text", searchPhrase)); chromium.sendCommand("Input.dispatchKeyEvent", sendEnterKeyEventParams()); response = chromium.sendCommandAndGetResponse("Page.getNavigationHistory", ImmutableMap.of()); assertIsPhrasePresentInTheResultsPageUrl(searchPhrase); }

Target:
public void resultPageUrlShouldContainSearchQueryName() { String searchPhrase = "searchPhrase"; String duckDuckUrl = "<LINK_0>"; getChromiumApi().sendCommand("Page.navigate", ImmutableMap.of("url", duckDuckUrl)); getChromiumApi().sendCommand("Input.insertText", ImmutableMap.of("text", searchPhrase)); getChromiumApi().sendCommand("Input.dispatchKeyEvent", sendEnterKeyEventParams()); response = getChromiumApi().sendCommandAndGetResponse("Page.getNavigationHistory", ImmutableMap.of()); assertIsPhrasePresentInTheResultsPageUrl(searchPhrase); }
Source:
public void testZipIterableWithDelay() { TestScheduler scheduler = new TestScheduler(); Observable<Integer> o = Observable.just(1, 2).zipWith(Arrays.asList(1), new Func2<Integer, Integer, Integer>() { @Override public Integer call(Integer v1, Integer v2) { return v1; } }).delay(500, TimeUnit.MILLISECONDS, scheduler); TestSubscriber<Integer> subscriber = new TestSubscriber<Integer>(); o.subscribe(subscriber); scheduler.advanceTimeBy(1000, TimeUnit.DAYS.MILLISECONDS); subscriber.assertValue(1); subscriber.assertNoErrors(); subscriber.assertCompleted(); }

Target:
public void testZipIterableWithDelay() { TestScheduler scheduler = new TestScheduler(); Observable<Integer> o = Observable.just(1, 2).zipWith(Arrays.asList(1), new Func2<Integer, Integer, Integer>() { @Override public Integer call(Integer v1, Integer v2) { return v1; } }).delay(500, TimeUnit.MILLISECONDS, scheduler); TestSubscriber<Integer> subscriber = new TestSubscriber<Integer>(); o.subscribe(subscriber); scheduler.advanceTimeBy(1000, TimeUnit.MILLISECONDS); subscriber.assertValue(1); subscriber.assertNoErrors(); subscriber.assertCompleted(); }
Source:
private void setRowSelection(IntegerUnion modelSelection) { IntegerUnion newSelection; if(tableSorter.isFiltered() || !tableSorter.getSortKeys().isEmpty()) { IntegerUnion viewSelection = new IntegerUnion(); for(Integer modelId : modelSelection) { int viewRowId = table.convertRowIndexToView(modelId); if(viewRowId!=-1) { viewSelection.add(viewRowId); } } newSelection = viewSelection; } else { newSelection = modelSelection; } setViewRowSelection(newSelection); }

Target:
private void setRowSelection(IntegerUnion modelSelection) { IntegerUnion newSelection; if(tableSorter.isFiltered() || !tableSorter.getSortKeys().isEmpty()) { newSelection = new IntegerUnion(); for(Integer modelId : modelSelection) { int viewRowId = table.convertRowIndexToView(modelId); if(viewRowId!=-1) { newSelection.add(viewRowId); } } } else { newSelection = modelSelection; } setViewRowSelection(newSelection); }
Source:
public List<NearbyLocation> getNearestCities(String location, int radiusInKm, int maxResults) throws ParseException, GeoEntryQueryException { Geometry geometry; try { geometry = WKT_READER_THREAD_LOCAL.get().read(location); } catch (org.locationtech.jts.io.ParseException e) { throw new GeoEntryQueryException("Could not parse location"); } double distanceInDegrees = radiusInKm / KM_PER_DEGREE; final Geometry originalGeometry = geometry; Geometry bufferedGeo = originalGeometry.buffer(distanceInDegrees, 14); String wkt = WKT_WRITER_THREAD_LOCAL.get().write(bufferedGeo); String q = String.format( "location_geo_index:\"Intersects( %s ) AND %s\"", ClientUtils.escapeQueryChars(wkt), CITY_SOLR_QUERY); SolrQuery solrQuery = new SolrQuery(q); solrQuery.setRows(Math.min(maxResults, MAX_RESULTS)); QueryResponse response; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { LOGGER.debug("Error executing query for nearest cities", e); throw new GeoEntryQueryException("Error executing query", e); } return response .getResults() .stream() .map(result -> convert(result, originalGeometry)) .collect(Collectors.toList()); }

Target:
public List<NearbyLocation> getNearestCities(String location, int radiusInKm, int maxResults) throws ParseException, GeoEntryQueryException { Geometry geometry; try { geometry = WKT_READER_THREAD_LOCAL.get().read(location); } catch (org.locationtech.jts.io.ParseException e) { throw new GeoEntryQueryException("Could not parse location"); } final Geometry originalGeometry = geometry; Geometry bufferedGeo = originalGeometry.buffer(convertKilometerToDegree(radiusInKm), 14); String wkt = WKT_WRITER_THREAD_LOCAL.get().write(bufferedGeo); String q = String.format( "%s_index:\"Intersects( %s ) AND %s\"", LOCATION, ClientUtils.escapeQueryChars(wkt), CITY_SOLR_QUERY); SolrQuery solrQuery = new SolrQuery(q); solrQuery.setRows(Math.min(maxResults, MAX_RESULTS)); QueryResponse response; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { throw new GeoEntryQueryException("Error executing query for nearest cities", e); } return response .getResults() .stream() .map(result -> convert(result, originalGeometry)) .collect(Collectors.toList()); }
Source:
public void skip(long items) throws IOException { while (items > 0) { if (used == numLiterals) { readValues(); } long consume = Math.min(items, numLiterals - used); used += consume; items -= consume; if (items != 0) { currentRunOffset += (int) consume; } } }

Target:
public void skip(long items) throws IOException { while (items > 0) { if (used == numLiterals) { readValues(); } long consume = Math.min(items, numLiterals - used); used += consume; items -= consume; if (items != 0) { currentRunOffset += toIntExact(consume); } } }
Source:
public RtGithub( @NotNull(message = "token can't be NULL") final String token) { this(URI.create(DEFAULT_GITHUB_HOST), token); }

Target:
public RtGithub( @NotNull(message = "token can't be NULL") final String token) { this(URI.create(RtGithub.DEFAULT_HOST), token); }
Source:
boolean requestCookie(HttpConnectionInterceptorContext context) { return requestCookie(context, sessionURL, sessionRequestBody, sessionRequestMimeType, "application/json", new OnExecuteCallable() { @Override public boolean call(HttpConnection connection) throws IOException { if (sessionHasStarted(connection.responseAsInputStream())) { return storeCookiesFromResponse(connection.getConnection()); } else { InputStream errorStream = connection.getConnection().getErrorStream(); if (errorStream != null) { try { IOUtils.copy(errorStream, NullOutputStream.NULL_OUTPUT_STREAM); } finally { IOUtils.closeQuietly(errorStream); } } return false; } } } ); }

Target:
boolean requestCookie(HttpConnectionInterceptorContext context) { return requestCookie(context, sessionURL, sessionRequestBody, sessionRequestMimeType, "application/json", new OnExecuteCallable() { @Override public boolean call(HttpConnection connection) throws IOException { if (sessionHasStarted(connection.responseAsInputStream())) { return storeCookiesFromResponse(connection.getConnection()); } else { Utils.consumeAndCloseStream(connection.getConnection().getErrorStream ()); return false; } } } ); }
Source:
private void sleepUntilNextRun(Optional<SweepOutcome> maybeOutcome) throws InterruptedException { Duration sleepDuration = maybeOutcome.flatMap(outcome -> { if (outcome == SweepOutcome.SUCCESS) { return Optional.of(Duration.ofMillis(sweepPauseMillis.get())); } else if (outcome == SweepOutcome.NOTHING_TO_SWEEP) { return Optional.of(getBackoffTimeWhenNothingToSweep()); } else { return Optional.empty(); } }).orElseGet(this::getBackoffTimeWhenSweepHasNotRun); sleepFor(sleepDuration); }

Target:
private void sleepUntilNextRun(Optional<SweepOutcome> maybeOutcome) throws InterruptedException { sleepFor(getSleepDuration(maybeOutcome)); }
Source:
@Test public void iteratorThrowsIOException() throws IOException { QueueFile queueFile = newQueueFile(); queueFile.add(values[253]); queueFile.close(); final class BrokenRandomAccessFile extends RandomAccessFile { boolean fail = false; BrokenRandomAccessFile(File file, String mode) throws FileNotFoundException { super(file, mode); } @Override public void write(byte[] b, int off, int len) throws IOException { if (fail) { throw new IOException(); } super.write(b, off, len); } @Override public int read(byte[] b, int off, int len) throws IOException { if (fail) { throw new IOException(); } return super.read(b, off, len); } } BrokenRandomAccessFile braf = new BrokenRandomAccessFile(file, "rwd"); queueFile = newQueueFile(braf); Iterator<byte[]> iterator = queueFile.iterator(); braf.fail = true; try { iterator.next(); } catch (Throwable ioe) { assertThat(ioe).isInstanceOf(IOException.class); } braf.fail = false; iterator.next(); braf.fail = true; try { iterator.remove(); fail(); } catch (Throwable ioe) { assertThat(ioe).isInstanceOf(IOException.class); } }

Target:
@Test public void iteratorThrowsIOException() throws IOException { QueueFile queueFile = newQueueFile(); queueFile.add(values[253]); queueFile.close(); final class BrokenRandomAccessFile extends RandomAccessFile { boolean fail = false; BrokenRandomAccessFile(File file, String mode) throws FileNotFoundException { super(file, mode); } @Override public void write(byte[] b, int off, int len) throws IOException { if (fail) { throw new IOException(); } super.write(b, off, len); } @Override public int read(byte[] b, int off, int len) throws IOException { if (fail) { throw new IOException(); } return super.read(b, off, len); } } BrokenRandomAccessFile braf = new BrokenRandomAccessFile(file, "rwd"); queueFile = newQueueFile(braf); Iterator<byte[]> iterator = queueFile.iterator(); braf.fail = true; try { iterator.next(); fail(); } catch (Exception ioe) { assertThat(ioe).isInstanceOf(IOException.class); } braf.fail = false; iterator.next(); braf.fail = true; try { iterator.remove(); fail(); } catch (Exception ioe) { assertThat(ioe).isInstanceOf(IOException.class); } }
Source:
private void overrideParameters() { boolean isTemplate = isTemplate(); if (getParameters().getOperation() == ImageOperation.Copy) { getParameters().setUseCopyCollapse(true); getParameters().setAddImageDomainMapping(true); if (!isTemplate) { getParameters().setAddImageDomainMapping(false); Guid newId = Guid.newGuid(); Guid newGroupId = Guid.newGuid(); DiskImage image = getImage(); image.setId(newGroupId); image.setImageId(newId); image.setDiskAlias(getDiskAlias()); image.setStorageIds(new ArrayList<Guid>()); image.getStorageIds().add(getParameters().getStorageDomainId()); image.setQuotaId(getParameters().getQuotaId()); image.setDiskProfileId(getParameters().getDiskProfileId()); getParameters().setDestinationImageId(newId); getParameters().setImageGroupID(getParameters().getImageGroupID()); getParameters().setDestImageGroupId(newGroupId); } } else { getParameters().setUseCopyCollapse(false); } if (getParameters().getOperation() == ImageOperation.Move || isTemplate) { getParameters().setDestinationImageId(getImageId()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setDestImageGroupId(getImageGroupId()); } getParameters().setVolumeFormat(getDiskImage().getVolumeFormat()); getParameters().setVolumeType(getDiskImage().getVolumeType()); getParameters().setCopyVolumeType(CopyVolumeType.SharedVol); getParameters().setParentCommand(getActionType()); getParameters().setParentParameters(getParameters()); getParameters().setDiskProfileId(getImage().getDiskProfileId()); }

Target:
private void overrideParameters() { if (getParameters().getOperation() == ImageOperation.Copy) { getParameters().setUseCopyCollapse(true); getParameters().setAddImageDomainMapping(true); if (!isTemplate()) { prepareCopyNotTemplate(); } } else { getParameters().setUseCopyCollapse(false); } if (getParameters().getOperation() == ImageOperation.Move || isTemplate()) { getParameters().setDestinationImageId(getImageId()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setDestImageGroupId(getImageGroupId()); } getParameters().setVolumeFormat(getDiskImage().getVolumeFormat()); getParameters().setVolumeType(getDiskImage().getVolumeType()); getParameters().setCopyVolumeType(CopyVolumeType.SharedVol); getParameters().setParentCommand(getActionType()); getParameters().setParentParameters(getParameters()); getParameters().setDiskProfileId(getImage().getDiskProfileId()); }
Source:
public static String CM_Get_Device_ID(int devInst) { int charToBytes = Boolean.getBoolean("w32.ascii") ? 1 : Native.WCHAR_SIZE; IntByReference pulLen = new IntByReference(); Cfgmgr32.INSTANCE.CM_Get_Device_ID_Size(pulLen, devInst, 0); int deviceIdLength = pulLen.getValue() + 1; Memory buffer = new Memory(deviceIdLength * charToBytes); Cfgmgr32.INSTANCE.CM_Get_Device_ID(devInst, buffer, deviceIdLength, 0); if (charToBytes == 1) { return buffer.getString(0); } else { return buffer.getWideString(0); } }

Target:
public static String CM_Get_Device_ID(int devInst) throws Cfgmgr32Exception { int charToBytes = Boolean.getBoolean("w32.ascii") ? 1 : Native.WCHAR_SIZE; IntByReference pulLen = new IntByReference(); int ret = Cfgmgr32.INSTANCE.CM_Get_Device_ID_Size(pulLen, devInst, 0); if (ret != Cfgmgr32.CR_SUCCESS) { throw new Cfgmgr32Exception(ret); } Memory buffer = new Memory((pulLen.getValue() + 1) * charToBytes); buffer.clear(); ret = Cfgmgr32.INSTANCE.CM_Get_Device_ID(devInst, buffer, pulLen.getValue(), 0); if (ret == Cfgmgr32.CR_BUFFER_SMALL) { ret = Cfgmgr32.INSTANCE.CM_Get_Device_ID_Size(pulLen, devInst, 0); if (ret != Cfgmgr32.CR_SUCCESS) { throw new Cfgmgr32Exception(ret); } buffer = new Memory((pulLen.getValue() + 1) * charToBytes); buffer.clear(); ret = Cfgmgr32.INSTANCE.CM_Get_Device_ID(devInst, buffer, pulLen.getValue(), 0); } if (ret != Cfgmgr32.CR_SUCCESS) { throw new Cfgmgr32Exception(ret); } if (charToBytes == 1) { return buffer.getString(0); } else { return buffer.getWideString(0); } }
Source:
private void init() { getRootPane().registerKeyboardAction( action -> { setVisible(false); }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); multiUserCasesPanel = new OpenMultiUserCasePanel(this); add(multiUserCasesPanel); pack(); setResizable(false); }

Target:
private void init() { multiUserCasesPanel = new OpenMultiUserCasePanel(this); add(multiUserCasesPanel); pack(); setResizable(false); }
Source:
public void startPlayback(PianoView pianoView) { playRunnables.clear(); long playLength = NoteLength.QUARTER.toMilliseconds(Project.DEFAULT_BEATS_PER_MINUTE); long currentTime = SystemClock.uptimeMillis(); for (GridRow row : gridRows) { for (int i = 0; i < row.getGridRowPositions().size(); i++) { int tactIndex = row.getGridRowPositions().keyAt(i); long tactOffset = playLength * 4 * tactIndex; List<GridRowPosition> gridRowPositions = row.getGridRowPositions().get(tactIndex); for (GridRowPosition position : gridRowPositions) { MidiRunnable runnable = new MidiRunnable(MidiSignals.NOTE_ON, row.getNoteName(), playLength - 10, handler, midiDriver, pianoView); handler.postAtTime(runnable, currentTime + tactOffset + playLength * position.getColumnStartIndex() + 10); playRunnables.add(runnable); } } } }

Target:
public void startPlayback(PianoView pianoView) { playRunnables.clear(); long playLength = NoteLength.QUARTER.toMilliseconds(Project.DEFAULT_BEATS_PER_MINUTE); long currentTime = SystemClock.uptimeMillis(); for (GridRow row : gridRows) { for (int i = 0; i < row.getGridRowPositions().size(); i++) { int tactIndex = row.getGridRowPositions().keyAt(i); long tactOffset = playLength * TrackRowView.QUARTER_COUNT * tactIndex; List<GridRowPosition> gridRowPositions = row.getGridRowPositions().get(tactIndex); for (GridRowPosition position : gridRowPositions) { MidiRunnable runnable = new MidiRunnable(MidiSignals.NOTE_ON, row.getNoteName(), playLength - SOUND_OFFSET, handler, midiDriver, pianoView); handler.postAtTime(runnable, currentTime + tactOffset + playLength * position.getColumnStartIndex() + SOUND_OFFSET); playRunnables.add(runnable); } } } }
Source:
public static OkHttpClient getOAuthBasedClient(@NonNull Context context) { OkHttpClient client = new OkHttpClient(); File cacheDirectory = new File(context.getFilesDir(), "http-cache"); if (!cacheDirectory.exists()) { cacheDirectory.mkdirs(); } Cache cache = new com.squareup.okhttp.Cache(cacheDirectory, cacheSize); client.setCache(cache); client.interceptors().add(new GzipRequestInterceptor()); client.interceptors().add(new OauthHeaderRequestInterceptor(context)); client.interceptors().add(new LoggingInterceptor()); return client; }

Target:
public static OkHttpClient getOAuthBasedClient(@NonNull Context context) { final OkHttpClient client = new OkHttpClient(); final File cacheDirectory = new File(context.getFilesDir(), "http-cache"); if (!cacheDirectory.exists()) { cacheDirectory.mkdirs(); } final Cache cache = new Cache(cacheDirectory, cacheSize); client.setCache(cache); client.interceptors().add(new GzipRequestInterceptor()); client.interceptors().add(new OauthHeaderRequestInterceptor(context)); client.interceptors().add(new LoggingInterceptor()); return client; }
Source:
public void testOnStartContainerError() throws Exception { new Context() {{ final List<CompletableFuture<Void>> addContainerRequestFutures = new ArrayList<>(); addContainerRequestFutures.add(new CompletableFuture<>()); addContainerRequestFutures.add(new CompletableFuture<>()); final AtomicInteger addContainerRequestFuturesNumCompleted = new AtomicInteger(0); final CompletableFuture<Void> removeContainerRequestFuture = new CompletableFuture<>(); final CompletableFuture<Void> releaseAssignedContainerFuture = new CompletableFuture<>(); final CompletableFuture<Void> startContainerAsyncFuture = new CompletableFuture<>(); testingYarnAMRMClientAsyncBuilder.setGetMatchingRequestsFunction(ignored -> Collections.singletonList(Collections.singletonList(YarnResourceManagerDriver.getContainerRequest(testingResource)))); testingYarnAMRMClientAsyncBuilder.setAddContainerRequestConsumer((ignored1, ignored2) -> addContainerRequestFutures.get(addContainerRequestFuturesNumCompleted.getAndIncrement()).complete(null)); testingYarnAMRMClientAsyncBuilder.setRemoveContainerRequestConsumer((ignored1, ignored2) -> removeContainerRequestFuture.complete(null)); testingYarnAMRMClientAsyncBuilder.setReleaseAssignedContainerConsumer((ignored1, ignored2) -> releaseAssignedContainerFuture.complete(null)); testingYarnNMClientAsyncBuilder.setStartContainerAsyncConsumer((ignored1, ignored2, ignored3) -> startContainerAsyncFuture.complete(null)); resourceEventHandlerBuilder.setOnWorkerTerminatedConsumer((ignore1, ignore2) -> getDriver().requestResource(testingTaskExecutorProcessSpec)); runTest(() -> { getDriver().requestResource(testingTaskExecutorProcessSpec); ((YarnResourceManagerDriver) getDriver()).getYarnContainerEventHandler().onContainersAllocated(ImmutableList.of(testingContainer)); verifyFutureCompleted(addContainerRequestFutures.get(0)); verifyFutureCompleted(removeContainerRequestFuture); verifyFutureCompleted(startContainerAsyncFuture); ((YarnResourceManagerDriver) getDriver()).getYarnContainerEventHandler().onStartContainerError(testingContainer.getId(), new Exception("start error")); verifyFutureCompleted(releaseAssignedContainerFuture); verifyFutureCompleted(addContainerRequestFutures.get(1)); }); }}; }

Target:
public void testOnStartContainerError() throws Exception { new Context() {{ addContainerRequestFutures.add(new CompletableFuture<>()); addContainerRequestFutures.add(new CompletableFuture<>()); testingYarnAMRMClientAsyncBuilder.setAddContainerRequestConsumer((ignored1, ignored2) -> addContainerRequestFutures.get(addContainerRequestFuturesNumCompleted.getAndIncrement()).complete(null)); resourceEventHandlerBuilder.setOnWorkerTerminatedConsumer((ignore1, ignore2) -> getDriver().requestResource(testingTaskExecutorProcessSpec)); runTest(() -> { runInMainThread(() -> getDriver().requestResource(testingTaskExecutorProcessSpec)); resourceManagerClientCallbackHandler.onContainersAllocated(ImmutableList.of(testingContainer)); nodeManagerClientCallbackHandler.onStartContainerError(testingContainer.getId(), new Exception("start error")); verifyFutureCompleted(releaseAssignedContainerFuture); verifyFutureCompleted(addContainerRequestFutures.get(1)); }); }}; }
Source:
private static void processException(Exception e, SensorContext context, InputFile inputFile) { reportAnalysisError(e, context, inputFile); throw new IllegalStateException("Unable to analyse file " + inputFile.uri(), e); }

Target:
private static void processException(Exception e, SensorContext context, InputFile inputFile) { reportAnalysisError(e, context, inputFile); LOG.error("Unable to analyse file " + inputFile.uri(), e); }
Source:
public IMessage onMessage(MessageRequestBlockUpdate message, MessageContext ctx) { WorldServer world = ctx.getServerHandler().player.getServerWorld(); world.addScheduledTask(() -> { synchronized (EventHandler.requestedBlockUpdates) { if (world.isBlockLoaded(message.pos)) { int dim = world.provider.getDimension(); EventHandler.requestedBlockUpdates.offer(new ImmutablePair<>(dim, message.pos)); } } }); return null; }

Target:
public IMessage onMessage(MessageRequestBlockUpdate message, MessageContext ctx) { WorldServer world = ctx.getServerHandler().player.getServerWorld(); world.addScheduledTask(() -> { if (world.isBlockLoaded(message.pos)) { int dim = world.provider.getDimension(); EventHandler.requestedBlockUpdates.offer(new ImmutablePair<>(dim, message.pos)); } }); return null; }
Source:
public List<BrooklinMetricInfo> getMetricInfos() { _metrics.add(new BrooklinMeterInfo(buildMetricName(NUM_REBALANCES))); _metrics.add(new BrooklinMeterInfo(getDynamicMetricPrefixRegex() + NUM_ERRORS)); _metrics.add(new BrooklinMeterInfo(getDynamicMetricPrefixRegex() + NUM_RETRIES)); _metrics.add(new BrooklinMeterInfo(buildMetricName(NUM_HEARTBEATS))); return Collections.unmodifiableList(_metrics); }

Target:
public List<BrooklinMetricInfo> getMetricInfos() { _metrics.add(new BrooklinMeterInfo(buildMetricName(NUM_REBALANCES))); _metrics.add(new BrooklinMeterInfo(getDynamicMetricPrefixRegex() + NUM_ERRORS)); _metrics.add(new BrooklinMeterInfo(getDynamicMetricPrefixRegex() + NUM_RETRIES)); _metrics.add(new BrooklinCounterInfo(buildMetricName(NUM_HEARTBEATS))); return Collections.unmodifiableList(_metrics); }
Source:
public UserAndPassword1_8 save(UserAndPassword1_8 user) { User openmrsUser = new User(); if (user.getUser().getUserId() == null) { openmrsUser = Context.getUserService().createUser(user.getUser(), user.getPassword()); } else { openmrsUser = Context.getUserService().saveUser(user.getUser()); Context.refreshAuthenticatedUser(); if (openmrsUser.getId() != null && (Context.getAuthenticatedUser().getUuid().equals(openmrsUser.getUuid()))) { Context.getUserService().changePassword(user.getOldPassword(), user.getPassword()); } else if (openmrsUser.getId() != null && StringUtils.isNotBlank(user.getPassword())) { Context.getUserService().changePassword(openmrsUser, user.getPassword()); } } return new UserAndPassword1_8(openmrsUser); }

Target:
public UserAndPassword1_8 save(UserAndPassword1_8 user) { User openmrsUser = new User(); if (user.getUser().getUserId() == null) { openmrsUser = Context.getUserService().createUser(user.getUser(), user.getPassword()); } else { openmrsUser = Context.getUserService().saveUser(user.getUser()); Context.refreshAuthenticatedUser(); } return new UserAndPassword1_8(openmrsUser); }
Source:
public void testWriterWithJson() throws IOException { Mockito.when(sink.getContainsJson()).thenReturn(true); Mockito.when(writeOperation.getSink()).thenReturn(sink); writer = new CouchbaseWriter(writeOperation); CouchbaseConnection connection = Mockito.mock(CouchbaseConnection.class); Mockito.when(sink.getConnection()).thenReturn(connection); Mockito.when(sink.getContainsJson()).thenReturn(true); Schema schema = SchemaBuilder.builder().record("record").fields().requiredString("idFieldName").endRecord(); IndexedRecord record = new GenericRecordBuilder(schema).set("idFieldName", 1).build(); writer.open("random"); writer.write(record); Result result = writer.close(); Assert.assertEquals(1, result.totalCount); Mockito.verify(connection, Mockito.times(1)).insertJsonDocument(Mockito.anyString(), Mockito.any()); Mockito.verify(connection, Mockito.times(1)).increment(); Mockito.verify(connection, Mockito.times(1)).decrement(); }

Target:
public void testWriterWithJson() throws IOException { CouchbaseConnection connection = Mockito.mock(CouchbaseConnection.class); Mockito.when(sink.getConnection()).thenReturn(connection); Mockito.when(sink.getContainsJson()).thenReturn(true); Mockito.when(writeOperation.getSink()).thenReturn(sink); writer = new CouchbaseWriter(writeOperation); Schema schema = SchemaBuilder.builder().record("record").fields().requiredString("idFieldName").endRecord(); IndexedRecord record = new GenericRecordBuilder(schema).set("idFieldName", 1).build(); writer.open("random"); writer.write(record); Result result = writer.close(); assertEquals(1, result.totalCount); Mockito.verify(connection, Mockito.times(1)).insertJsonDocument(Mockito.anyString(), Mockito.any()); Mockito.verify(connection, Mockito.times(1)).increment(); Mockito.verify(connection, Mockito.times(1)).decrement(); }
Source:
public void selectLanguage(String lang) { wait.forElementVisible(wikiLanguageDropdown); wikiLanguageDropdown.click(); List<WebElement> langList = wikiLanguageList.findElements(By.cssSelector("li:not(.spacer)")); for (int i = 0; i < langList.size(); i++) { WebElement selectedLanguage = langList.get(i); String selectedLanguageText = selectedLanguage.getText(); if (selectedLanguageText.contains(lang + ":")) { wait.forElementClickable(selectedLanguage); selectedLanguage.click(); Assertion.assertEquals(languageSelectedIndicator.getText(), lang + "."); PageObjectLogging.log("selectLanguage", "selected " + selectedLanguageText + " language", true, driver); break; } } }

Target:
public void selectLanguage(String lang) { wait.forElementClickable(wikiLanguageDropdown); wikiLanguageDropdown.click(); List<WebElement> langList = wikiLanguageList.findElements(By.cssSelector("li:not(.spacer)")); String langSelector = lang + ":"; for (int i = 0; i < langList.size(); i++) { WebElement selectedLanguage = langList.get(i); String selectedLanguageText = selectedLanguage.getText(); if (selectedLanguageText.contains(langSelector)) { wait.forElementClickable(selectedLanguage); selectedLanguage.click(); Assertion.assertEquals(languageSelectedIndicator.getText(), lang + "."); PageObjectLogging.log("selectLanguage", "selected " + selectedLanguageText + " language", true, driver); break; } } }
Source:
public String getProjectName() { return projectName; }

Target:
public String getProjectName() { return projectName != null ? projectName.get() : null; }
Source:
public WebElement getPortletInRightTable(String name) { try { if (getPanel().findElements(By.xpath(" return getPanel().findElement(By.xpath(" } else { return getPanel().findElement(By.xpath(" } } catch (NoSuchElementException ex) { return null; } }

Target:
public WebElement getPortletInRightTable(String name) { try { if (getPanel().findElements(By.xpath(" return getRightPortletOnExactPosition(name, 2); } else { return getRightPortletOnExactPosition(name, 1); } } catch (NoSuchElementException ex) { return null; } }
Source:
public String toString() { JSONStringer js = new JSONStringer(); try { js.object(); js.key("group").value(group); js.key("coordinatorip").value(coordinatorIp.toString()); js.key("zkinterface").value(zkInterface); js.key("internalinterface").value(internalInterface); js.key("internalport").value(internalPort); js.key("deadhosttimeout").value(deadHostTimeout); js.key("backwardstimeforgivenesswindow").value(backwardsTimeForgivenessWindow); js.key("networkThreads").value(networkThreads); js.key("acceptor").value(acceptor); js.endObject(); return js.toString(); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public String toString() { JSONStringer js = new JSONStringer(); try { js.object(); js.key(GROUP).value(group); js.key(COORDINATOR_IP).value(coordinatorIp.toString()); js.key(ZK_INTERFACE).value(zkInterface); js.key(INTERNAL_INTERFACE).value(internalInterface); js.key(INTERNAL_PORT).value(internalPort); js.key(DEAD_HOST_TIMEOUT).value(deadHostTimeout); js.key(BACKWARDS_TIME_FORGIVENESS_WINDOW).value(backwardsTimeForgivenessWindow); js.key(NETWORK_THREADS).value(networkThreads); js.key(ACCEPTOR).value(acceptor); js.endObject(); return js.toString(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void testStopJobExecution() throws Exception { String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_STEP_EXECUTIONS); checkForJobInList(jobName, JOB_WITH_STEP_EXECUTIONS, true); triggerJobWithDelay(jobName, "5"); Thread.sleep(5000); Table table = (Table) executeCommand("job execution list").getResult(); assertTrue(!table.getRows().isEmpty()); String executionId = table.getRows().get(0).getValue(1); String executionStatus = table.getRows().get(0).getValue(5); assertTrue(executionStatus.equals("STARTING") || executionStatus.equals("STARTED")); executeCommand("job execution stop " + executionId); Thread.sleep(3000); table = (Table) executeCommand("job execution list").getResult(); int n = 0; while (!"STOPPED".equals(executionStatus) && n++ < 100) { for (TableRow tr : table.getRows()) { if (tr.getValue(1).equals(executionId)) { executionStatus = tr.getValue(5); if (!"STOPPED".equals(executionStatus)) { Thread.sleep(100); table = (Table) executeCommand("job execution list").getResult(); } break; } } } assertEquals("STOPPED", executionStatus); }

Target:
public void testStopJobExecution() throws Exception { String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_STEP_EXECUTIONS); checkForJobInList(jobName, JOB_WITH_STEP_EXECUTIONS, true); triggerJobWithDelay(jobName, "5"); Thread.sleep(5000); Table table = (Table) executeCommand("job execution list").getResult(); assertTrue(!table.getRows().isEmpty()); String executionId = table.getRows().get(0).getValue(1); String executionStatus = table.getRows().get(0).getValue(5); assertTrue(executionStatus.equals("STARTING") || executionStatus.equals("STARTED")); executeCommand("job execution stop " + executionId); Thread.sleep(3000); int n = 0; do { table = (Table) executeCommand("job execution list").getResult(); for (TableRow tr : table.getRows()) { if (tr.getValue(1).equals(executionId)) { executionStatus = tr.getValue(5); break; } } if (!"STOPPED".equals(executionStatus)) { Thread.sleep(100); } } while (!"STOPPED".equals(executionStatus) && n++ < 100); assertEquals("STOPPED", executionStatus); }
Source:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } boolean vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(false, constants.vmLeasesSupported()); } else { model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); } }

Target:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } boolean vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(false, constants.vmLeasesSupported()); } else { model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); if (!model.getIsHighlyAvailable().getEntity()) { model.getLease().setChangeProhibitionReason(constants.vmLeasesNotSupportedWithoutHA()); } } }
Source:
public boolean contains(Integer patientId) { return getMembers() != null && getMembers().stream() .anyMatch(m -> m.getPatient().getPatientId().equals(patientId)); }

Target:
public boolean contains(Integer patientId) { return getMembers() != null && getMembers().stream() .anyMatch(m -> m.getPatient().getPatientId().equals(patientId) && m.isMemberActive()); }
Source:
public ObjectProperty<ContainersFilter> filterProperty() { return filter; }

Target:
public ObjectProperty<ContainersFilter> filterProperty() { return this.filter; }
Source:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString("want " + blob.name() + " not valid")); try (Transport tn = testProtocol.open(uri, client, "server")) { tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }

Target:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); try (Transport tn = testProtocol.open(uri, client, "server")) { thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString( "want " + blob.name() + " not valid")); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }
Source:
public void expireDynamicConfig() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); Thread.sleep(6000); HeisenbergExtension anotherConfig = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); assertExpired(config, 5000, 1000); assertInitialised(config); }

Target:
public void expireDynamicConfig() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); try { assertExpired(config, 5000, 1000); } catch (AssertionError e) { HeisenbergExtension anotherConfig = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); } assertExpired(config, 5000, 1000); assertInitialised(config); }
Source:
public void developerOptionsEnabled() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); if (!itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options").exists()) { DeveloperOptionsManager.enableDeveloperOptions(testFramework.getInstrumentation()); } AppLauncher.launch(instrumentation, "Settings"); itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options"); }

Target:
public void developerOptionsEnabled() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); if (!itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options").exists()) { DeveloperOptionsManager.enableDeveloperOptions(instrumentation); } AppLauncher.launch(instrumentation, "Settings"); itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options"); }