auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private IsWidget createRxColumn(VdsNetworkInterface hostInterface) { Column rxCol = new Column(ColumnSize.SM_3); DListElement dl = Document.get().createDLElement(); addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { hostInterface.getStatistics().getReceiveRate(), hostInterface.hasSpeed() ? hostInterface.getSpeed().doubleValue() : 0 })), dl); dl.addClassName(Styles.PULL_LEFT); rxCol.getElement().appendChild(dl); FlowPanel divider = new FlowPanel(); divider.addStyleName(RATE_DIVIDER); rxCol.add(divider); dl = Document.get().createDLElement(); addDetailItem(templates.sub(constants.rxTotal(), constants.bytes()), SafeHtmlUtils.fromString(totalRenderer.render(hostInterface.getStatistics().getReceivedBytes())), dl); dl.addClassName(Styles.PULL_LEFT); rxCol.getElement().appendChild(dl); return rxCol; }

Target:
private IsWidget createRxColumn(VdsNetworkInterface hostInterface) { Column rxCol = new Column(ColumnSize.SM_3); DListElement dl = Document.get().createDLElement(); addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { hostInterface.getStatistics().getReceiveRate(), hostInterface.hasSpeed() ? hostInterface.getSpeed().doubleValue() : 0.0 })), dl); dl.addClassName(Styles.PULL_LEFT); rxCol.getElement().appendChild(dl); FlowPanel divider = new FlowPanel(); divider.addStyleName(RATE_DIVIDER); rxCol.add(divider); dl = Document.get().createDLElement(); addDetailItem(templates.sub(constants.rxTotal(), constants.bytes()), SafeHtmlUtils.fromString(totalRenderer.render(hostInterface.getStatistics().getReceivedBytes())), dl); dl.addClassName(Styles.PULL_LEFT); rxCol.getElement().appendChild(dl); return rxCol; }
Source:
public void verifyUndoSucceeded() { driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); try { String notificationMsg = driver.findElement(By.cssSelector(".global-notification .msg")).getText(); PageObjectLogging.log("verifyUndoSucceeded", "grabbing notification text", true); Assertion.assertEquals(notificationMsg, "This page has been restored."); } catch (NoSuchElementException e) { PageObjectLogging.log("verifyUndoSucceeded", "no notification present", true); driver.quit(); } }

Target:
public void verifyUndoSucceeded() { waitForElementByElement(notification); String notificationMsg = notification.getText(); Assertion.assertEquals(notificationMsg, "This page has been restored."); PageObjectLogging.log("verifyUndoSucceeded", "able to undo a swapped video", true); }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { for (String p : new String[]{"android.permission.ACCESS_FINE_LOCATION"}) { if (getApplicationContext().checkCallingOrSelfPermission(p) != PackageManager.PERMISSION_GRANTED) { Log.e(TAG, String.format("Cannot mock location due to missing permission '%s'", p)); return START_NOT_STICKY; } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Log.w(TAG, "Starting location service"); startService(ForegroundService.getForegroundServiceIntent(LocationService.this)); } handleIntent(intent); return START_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { for (String p : new String[]{"android.permission.ACCESS_FINE_LOCATION"}) { if (getApplicationContext().checkCallingOrSelfPermission(p) != PackageManager.PERMISSION_GRANTED) { Log.e(TAG, String.format("Cannot mock location due to missing permission '%s'", p)); return START_NOT_STICKY; } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Log.i(TAG, "Starting location service"); startService(ForegroundService.getForegroundServiceIntent(LocationService.this)); } handleIntent(intent); return START_STICKY; }
Source:
public static String getMaxFeature(final Server server, String sqlQuery, final int configuration) throws PerfEnforceException { try { String explainQuery = "EXPLAIN " + sqlQuery; List<String> featuresList = new ArrayList<String>(); String maxFeature = ""; double maxCost = Integer.MIN_VALUE; String[] allWorkerFeatures = server.executeSQLStatement( explainQuery, Schema.ofFields("explain", Type.STRING_TYPE), PerfEnforceUtils.getWorkerRangeSet(configuration)); for (String currentWorkerFeatures : allWorkerFeatures) { if (currentWorkerFeatures.contains("cost")) { currentWorkerFeatures = currentWorkerFeatures.substring(currentWorkerFeatures.indexOf("cost")); currentWorkerFeatures = currentWorkerFeatures.replace("\"", " "); String[] cmd = { "sh", "-c", "echo \"" + currentWorkerFeatures + "\" | sed -e 's/.*cost= }; ProcessBuilder pb = new ProcessBuilder(cmd); Process p = pb.start(); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); currentWorkerFeatures = input.readLine(); if (explainQuery.contains("WHERE")) { String[] tables = explainQuery .substring(explainQuery.indexOf("FROM"), explainQuery.indexOf("WHERE")) .split(","); currentWorkerFeatures = tables.length + "," + currentWorkerFeatures; } else { currentWorkerFeatures = "1," + currentWorkerFeatures; } currentWorkerFeatures += "," + configuration + ",0"; featuresList.add(currentWorkerFeatures); } } for (String f : featuresList) { double cost = Double.parseDouble(f.split(",")[2]); if (cost > maxCost) { maxCost = cost; maxFeature = f; } } return maxFeature; } catch (Exception e) { throw new PerfEnforceException("Error collecting the max feature"); } }

Target:
public static String getMaxFeature(final Server server, String sqlQuery, final int configuration) throws PerfEnforceException { try { String explainQuery = "EXPLAIN " + sqlQuery; List<String> featuresList = new ArrayList<String>(); String maxFeature = ""; double maxCost = Integer.MIN_VALUE; String[] allWorkerFeatures = server.executeSQLStatement( explainQuery, Schema.ofFields("explain", Type.STRING_TYPE), PerfEnforceUtils.getWorkerRangeSet(configuration)); for (String currentWorkerFeatures : allWorkerFeatures) { if (currentWorkerFeatures.contains("cost")) { currentWorkerFeatures = currentWorkerFeatures.substring(currentWorkerFeatures.indexOf("cost")); currentWorkerFeatures = currentWorkerFeatures .replace("\"", " ") .replaceAll(".*cost=|\\)", "") .replaceAll("\\.\\.| rows=| width=", ","); if (explainQuery.contains("WHERE")) { String[] tables = explainQuery .substring(explainQuery.indexOf("FROM"), explainQuery.indexOf("WHERE")) .split(","); currentWorkerFeatures = tables.length + "," + currentWorkerFeatures; } else { currentWorkerFeatures = "1," + currentWorkerFeatures; } currentWorkerFeatures += "," + configuration + ",0"; featuresList.add(currentWorkerFeatures); } } for (String f : featuresList) { double cost = Double.parseDouble(f.split(",")[2]); if (cost > maxCost) { maxCost = cost; maxFeature = f; } } return maxFeature; } catch (Exception e) { throw new PerfEnforceException("Error collecting the max feature"); } }
Source:
private void assertColumnList(List<Column> actual, List<com.amazonaws.services.glue.model.Column> expected) { if (expected == null) { assertNull(actual); } assertEquals(actual.size(), expected.size()); for (int i = 0; i < expected.size(); i++) { assertColumn(actual.get(i), expected.get(i)); } }

Target:
private static void assertColumnList(List<Column> actual, List<com.amazonaws.services.glue.model.Column> expected) { if (expected == null) { assertNull(actual); } assertEquals(actual.size(), expected.size()); for (int i = 0; i < expected.size(); i++) { assertColumn(actual.get(i), expected.get(i)); } }
Source:
public WinePrefix create(String version) throws CancelException, ScriptFailureException { try { return this.create(version, Architecture.fetchCurrentArchitecture().name()); } catch (PlayOnLinuxException e) { throw new ScriptFailureException(e); } }

Target:
public WinePrefix create(String version) throws ScriptFailureException { try { return this.create(version, Architecture.fetchCurrentArchitecture().name()); } catch (PlayOnLinuxException e) { throw new ScriptFailureException(e); } }
Source:
private static void processCannon(Tank tank, World world) { if (Gdx.input.isKeyPressed(Keys.SPACE) && tank.isCannonReady()) { float tankCenterX = tank.getX() + 16; float tankCenterY = tank.getY() + 16; Bullet bullet = tank.fireCannon(world, tankCenterX + 18 * (float)Math.cos(tank.getRotation()), tankCenterY + 18 * (float)Math.sin(tank.getRotation())); Network net = NetworkSystem.getInstance(); net.send(new CreateEntity(Bullet.class, bullet.getId(), bullet.getX(), bullet.getY(), bullet.getRotation())); } }

Target:
private static void processCannon(Tank tank, World world) { if (Gdx.input.isKeyPressed(Keys.SPACE) && tank.isCannonReady()) { float tankCenterX = tank.getX(); float tankCenterY = tank.getY(); Bullet bullet = tank.fireCannon(world, tankCenterX + 18 * (float)Math.cos(tank.getRotation()), tankCenterY + 18 * (float)Math.sin(tank.getRotation())); Network net = NetworkSystem.getInstance(); net.send(new CreateEntity(Bullet.class, bullet.getId(), bullet.getX(), bullet.getY(), bullet.getRotation())); } }
Source:
private MediaType getStorageMediaType(Configuration configuration, boolean embeddedMode, boolean internalCache, PersistenceMarshaller persistenceMarshaller) { EncodingConfiguration encodingConfiguration = configuration.encoding(); ContentTypeConfiguration contentTypeConfiguration = isKey ? encodingConfiguration.keyDataType() : encodingConfiguration.valueDataType(); Marshaller userMarshaller = persistenceMarshaller.getUserMarshaller(); MediaType mediaType = userMarshaller.mediaType(); boolean heap = !configuration.memory().offHeap(); if (contentTypeConfiguration.isMediaTypeChanged()) { MediaType configuredMediaType = contentTypeConfiguration.mediaType(); return configuredMediaType != null ? configuredMediaType : mediaType; } if (!embeddedMode && configuration.indexing().enabled() && contentTypeConfiguration.mediaType() == null) { return MediaType.APPLICATION_PROTOSTREAM; } if (internalCache) return MediaType.APPLICATION_OBJECT; if (embeddedMode) { return heap ? MediaType.APPLICATION_OBJECT : mediaType; } return MediaType.APPLICATION_UNKNOWN; }

Target:
private MediaType getStorageMediaType(Configuration configuration, boolean embeddedMode, boolean internalCache, PersistenceMarshaller persistenceMarshaller) { EncodingConfiguration encodingConfiguration = configuration.encoding(); ContentTypeConfiguration contentTypeConfiguration = isKey ? encodingConfiguration.keyDataType() : encodingConfiguration.valueDataType(); Marshaller userMarshaller = persistenceMarshaller.getUserMarshaller(); MediaType mediaType = userMarshaller.mediaType(); boolean heap = configuration.memory().storageType() == StorageType.OBJECT; if (contentTypeConfiguration.isMediaTypeChanged()) { return contentTypeConfiguration.mediaType(); } if (!embeddedMode && configuration.indexing().enabled() && contentTypeConfiguration.mediaType() == null) { return MediaType.APPLICATION_PROTOSTREAM; } if (internalCache) return MediaType.APPLICATION_OBJECT; if (embeddedMode) { return heap ? MediaType.APPLICATION_OBJECT : mediaType; } return MediaType.APPLICATION_UNKNOWN; }
Source:
public void testPalettes() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); resetTimeRange(bot); TimeGraphViewStub view = getView(); Rectangle bounds = fBounds; IPaletteProvider paletteBlue = SequentialPaletteProvider.create(new RGBAColor(0x23, 0x67, 0xf3, 0xff), 5); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public String getPreferenceKey() { return "Blue palette"; } @Override public IPaletteProvider getPalette() { return paletteBlue; } })); List<RGB> rgbs = Lists.transform(paletteBlue.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); IPaletteProvider paletteGreen = SequentialPaletteProvider.create(new RGBAColor(0x23, 0xf3, 0x67, 0xff), 5); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public String getPreferenceKey() { return "Green palette"; } @Override public IPaletteProvider getPalette() { return paletteGreen; } })); rgbs = Lists.transform(paletteGreen.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); IPaletteProvider rotating = new QualitativePaletteProvider.Builder().setAttenuation(0.5f).setBrightness(1.0f).setNbColors(4).build(); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public String getPreferenceKey() { return "Rotating Palette"; } @Override public IPaletteProvider getPalette() { return rotating; } })); rgbs = Lists.transform(rotating.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); }

Target:
public void testPalettes() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); resetTimeRange(bot); TimeGraphViewStub view = getView(); Rectangle bounds = fBounds; IPaletteProvider paletteBlue = SequentialPaletteProvider.create(new RGBAColor(0x23, 0x67, 0xf3, 0xff), 5); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public IPaletteProvider getPalette() { return paletteBlue; } })); List<RGB> rgbs = Lists.transform(paletteBlue.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); IPaletteProvider paletteGreen = SequentialPaletteProvider.create(new RGBAColor(0x23, 0xf3, 0x67, 0xff), 5); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public IPaletteProvider getPalette() { return paletteGreen; } })); rgbs = Lists.transform(paletteGreen.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); IPaletteProvider rotating = new QualitativePaletteProvider.Builder().setAttenuation(0.5f).setBrightness(1.0f).setNbColors(4).build(); UIThreadRunnable.syncExec(() -> view.setPresentationProvider(new PalettedPresentationProvider() { @Override public IPaletteProvider getPalette() { return rotating; } })); rgbs = Lists.transform(rotating.get(), a->RGBAUtil.fromInt(a.toInt()).rgb); fViewBot.bot().waitUntil(new PaletteIsPresent(rgbs, bounds)); }
Source:
public boolean isAvailable(Tenantable tenantable) { if (!contextInstance.isLoaded()) { if (!tenantable.requiresTenantContext() || tenantNotRequired(tenantable)) { return true; } lock.lock(); try { String componentId = contextInstance.getInstanceComponentId(); int unavailableCount = blockedCounts.compute(componentId, (k, v) -> v == null ? 0 : ++v); log.log(unavailableCount > 100 ? Level.INFO : Level.FINEST, String.format("BLOCKED: tenant not available: %s, module %s, Operation: %s", componentId, moduleName, tenantable.getClass().getName())); if (unavailableCount > 100) { blockedCounts.remove(componentId); } condition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { } finally { lock.unlock(); } return false; } return true; }

Target:
public boolean isAvailable(Tenantable tenantable) { if (contextInstance.isLoaded()) { return true; } if (!tenantable.requiresTenantContext() || tenantNotRequired(tenantable)) { return true; } lock.lock(); try { String componentId = contextInstance.getInstanceComponentId(); int unavailableCount = blockedCounts.compute(componentId, (k, v) -> v == null ? 0 : ++v); log.log(unavailableCount > 100 ? Level.INFO : Level.FINEST, String.format("BLOCKED: tenant not available: %s, module %s, Operation: %s", componentId, moduleName, tenantable.getClass().getName())); if (unavailableCount > 100) { blockedCounts.remove(componentId); } condition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { } finally { lock.unlock(); } return false; }
Source:
public static void pingService(InetSocketAddress address, alluxio.grpc.ServiceType serviceType, AlluxioConfiguration conf, UserState userState) throws AlluxioStatusException { Preconditions.checkNotNull(address, "address"); Preconditions.checkNotNull(serviceType, "serviceType"); GrpcChannel channel = GrpcChannelBuilder.newBuilder(GrpcServerAddress.create(address), conf) .setClientType("PingService").disableAuthentication().setSubject(userState.getSubject()) .build(); try { ServiceVersionClientServiceGrpc.ServiceVersionClientServiceBlockingStub versionClient = ServiceVersionClientServiceGrpc.newBlockingStub(channel) .withDeadlineAfter(conf.getMs(PropertyKey.WORKER_MASTER_PERIODICAL_CONNECT_TIMEOUT), TimeUnit.MILLISECONDS); versionClient.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(serviceType).build()); } catch (Throwable t) { throw AlluxioStatusException.fromThrowable(t); } finally { channel.shutdown(); } }

Target:
public static void pingService(InetSocketAddress address, alluxio.grpc.ServiceType serviceType, AlluxioConfiguration conf, UserState userState) throws AlluxioStatusException { Preconditions.checkNotNull(address, "address"); Preconditions.checkNotNull(serviceType, "serviceType"); GrpcChannel channel = GrpcChannelBuilder.newBuilder(GrpcServerAddress.create(address), conf) .setClientType("PingService").disableAuthentication().setSubject(userState.getSubject()) .build(); try { ServiceVersionClientServiceGrpc.ServiceVersionClientServiceBlockingStub versionClient = ServiceVersionClientServiceGrpc.newBlockingStub(channel) .withDeadlineAfter(conf.getMs(PropertyKey.USER_MASTER_POLLING_TIMEOUT), TimeUnit.MILLISECONDS); versionClient.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(serviceType).build()); } catch (Throwable t) { throw AlluxioStatusException.fromThrowable(t); } finally { channel.shutdown(); } }
Source:
public void testLeaveConstructor() { final String groupId = "group_id"; final String memberId = "member_id"; final int throttleTimeMs = 10; final LeaveGroupRequestData expectedData = new LeaveGroupRequestData() .setGroupId(groupId) .setMemberId(memberId); final LeaveGroupRequest.Builder builder = new LeaveGroupRequest.Builder(new LeaveGroupRequestData() .setGroupId(groupId) .setMemberId(memberId)); for (short version = 0; version < LeaveGroupRequestData.SCHEMAS.length; version++) { LeaveGroupRequest request = builder.build(version); assertEquals(expectedData, request.data()); int expectedThrottleTime = version >= 1 ? throttleTimeMs : AbstractResponse.DEFAULT_THROTTLE_TIME; LeaveGroupResponse expectedResponse = new LeaveGroupResponse( new LeaveGroupResponseData() .setErrorCode(Errors.NOT_CONTROLLER.code()) .setThrottleTimeMs(expectedThrottleTime) ); assertEquals(expectedResponse, request.getErrorResponse(throttleTimeMs, Errors.NOT_CONTROLLER.exception())); } }

Target:
public void testLeaveConstructor() { final String groupId = "group_id"; final String memberId = "member_id"; final int throttleTimeMs = 10; final LeaveGroupRequestData expectedData = new LeaveGroupRequestData() .setGroupId(groupId) .setMemberId(memberId); final LeaveGroupRequest.Builder builder = new LeaveGroupRequest.Builder(new LeaveGroupRequestData() .setGroupId(groupId) .setMemberId(memberId)); for (short version = 0; version <= ApiKeys.LEAVE_GROUP.latestVersion(); version++) { LeaveGroupRequest request = builder.build(version); assertEquals(expectedData, request.data()); int expectedThrottleTime = version >= 1 ? throttleTimeMs : AbstractResponse.DEFAULT_THROTTLE_TIME; LeaveGroupResponse expectedResponse = new LeaveGroupResponse( new LeaveGroupResponseData() .setErrorCode(Errors.NOT_CONTROLLER.code()) .setThrottleTimeMs(expectedThrottleTime) ); assertEquals(expectedResponse, request.getErrorResponse(throttleTimeMs, Errors.NOT_CONTROLLER.exception())); } }
Source:
protected List<Disk> getOtherVmDisks() { if (otherVmDisks == null) { otherVmDisks = getDiskDao().getAllForVm(getVmId()); otherVmDisks.removeAll(LinqUtils.filter(otherVmDisks, new Predicate<Disk>() { @Override public boolean eval(Disk o) { return o.getId().equals(oldDisk.getId()); } })); } return otherVmDisks; }

Target:
protected List<Disk> getOtherVmDisks() { if (otherVmDisks == null) { otherVmDisks = getDiskDao().getAllForVm(getVmId()); Iterator<Disk> iter = otherVmDisks.iterator(); while (iter.hasNext()) { Disk evalDisk = iter.next(); if (evalDisk.getId().equals(oldDisk.getId())) { iter.remove(); } break; } } return otherVmDisks; }
Source:
public Object get(Object key) { Object field = record.get(key.toString()); if (fromPigAvroStorage && field instanceof GenericData.Array) { return Lists.transform((List) field, PIG_AVRO_STORAGE_ARRAY_TO_STRING_INCLUDING_NULL::apply); } if (field instanceof ByteBuffer) { if (binaryAsString) { return new String(((ByteBuffer) field).array()); } else { return Arrays.toString(((ByteBuffer) field).array()); } } if (field instanceof Utf8) { return field.toString(); } return field; }

Target:
public Object get(Object key) { Object field = record.get(key.toString()); if (fromPigAvroStorage && field instanceof GenericData.Array) { return Lists.transform((List) field, PIG_AVRO_STORAGE_ARRAY_TO_STRING_INCLUDING_NULL); } if (field instanceof ByteBuffer) { if (binaryAsString) { return new String(((ByteBuffer) field).array()); } else { return Arrays.toString(((ByteBuffer) field).array()); } } if (field instanceof Utf8) { return field.toString(); } return field; }
Source:
public GetPartitionsResponse getPartitionsByAlgebra(RpcController controller, PartitionsByAlgebraProto request) throws ServiceException { String dbName = request.getDatabaseName(); String tbName = request.getTableName(); try { if (linkedMetadataManager.existsDatabase(dbName)) { return GetPartitionsResponse.newBuilder().setState(errUndefinedPartitionMethod(tbName)).build(); } } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetPartitionsResponse.newBuilder() .setState(returnError(t)) .build(); } if (metaDictionary.isSystemDatabase(dbName)) { return GetPartitionsResponse.newBuilder().setState(errUndefinedPartitionMethod(tbName)).build(); } rlock.lock(); try { boolean contain; contain = store.existDatabase(dbName); if (contain) { contain = store.existTable(dbName, tbName); if (contain) { if (store.existPartitionMethod(dbName, tbName)) { GetPartitionsResponse.Builder builder = GetPartitionsResponse.newBuilder(); List<PartitionDescProto> partitions = store.getPartitionsByAlgebra(request); builder.addAllPartition(partitions); builder.setState(OK); return builder.build(); } else { return GetPartitionsResponse.newBuilder() .setState(errUndefinedPartitionMethod(tbName)) .build(); } } else { return GetPartitionsResponse.newBuilder() .setState(errUndefinedTable(tbName)) .build(); } } else { return GetPartitionsResponse.newBuilder() .setState(errUndefinedDatabase(dbName)) .build(); } } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetPartitionsResponse.newBuilder() .setState(returnError(t)) .build(); } finally { rlock.unlock(); } }

Target:
public GetPartitionsResponse getPartitionsByAlgebra(RpcController controller, PartitionsByAlgebraProto request) throws ServiceException { String dbName = request.getDatabaseName(); String tbName = request.getTableName(); try { if (linkedMetadataManager.existsDatabase(dbName)) { return GetPartitionsResponse.newBuilder().setState(errUndefinedPartitionMethod(tbName)).build(); } } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetPartitionsResponse.newBuilder() .setState(returnError(t)) .build(); } if (metaDictionary.isSystemDatabase(dbName)) { return GetPartitionsResponse.newBuilder().setState(errUndefinedPartitionMethod(tbName)).build(); } rlock.lock(); try { GetPartitionsResponse.Builder builder = GetPartitionsResponse.newBuilder(); List<PartitionDescProto> partitions = store.getPartitionsByAlgebra(request); builder.addAllPartition(partitions); builder.setState(OK); return builder.build(); } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetPartitionsResponse.newBuilder() .setState(returnError(t)) .build(); } finally { rlock.unlock(); } }
Source:
public boolean cancel(boolean interruptThread) { boolean canceled; synchronized (resultLock) { if (! done) { this.canceled = true; if (interruptThread) { Thread runningThread = this.runningThread; if (runningThread != null) { runningThread.interrupt(); } } setDone(); canceled = true; } else { canceled = false; } } if (canceled) { listenerHelper.callListeners(); } return canceled; }

Target:
public boolean cancel(boolean interruptThread) { if (done) { return false; } boolean canceled; synchronized (resultLock) { if (! done) { this.canceled = true; if (interruptThread) { Thread runningThread = this.runningThread; if (runningThread != null) { runningThread.interrupt(); } } setDone(); canceled = true; } else { canceled = false; } } if (canceled) { listenerHelper.callListeners(); } return canceled; }
Source:
public void fillContext(Context context, HttpServletRequest request) { ViewToolContext vtc = (ViewToolContext)context; vtc.put("variable", "happiness"); M_log.info("fillContext() called"); }

Target:
public void fillContext(Context context, HttpServletRequest request) { M_log.debug("fillContext() called"); ViewToolContext vtc = (ViewToolContext)context; }
Source:
public Result getResultThresholdNumber(XUnitLog log, int testCount, int newTestCount) { String errorMessage = "The total number of tests for this category exceeds the specified '%s' threshold value."; if (isValid(getFailureThreshold()) && (convertToInteger(getFailureThreshold()) < testCount)) { log.infoConsoleLogger(String.format(errorMessage, "failure")); return Result.FAILURE; } if (isValid(getFailureNewThreshold()) && (convertToInteger(getFailureNewThreshold()) < newTestCount)) { log.infoConsoleLogger(String.format(errorMessage, "new failure")); return Result.FAILURE; } if (isValid(getUnstableThreshold()) && (convertToInteger(getUnstableThreshold()) < testCount)) { log.infoConsoleLogger(String.format(errorMessage, "unstable")); return Result.UNSTABLE; } if (isValid(getUnstableNewThreshold()) && (convertToInteger(getUnstableNewThreshold()) < newTestCount)) { log.infoConsoleLogger(String.format(errorMessage, "new unstable")); return Result.UNSTABLE; } return Result.SUCCESS; }

Target:
public Result getResultThresholdNumber(XUnitLog log, int testCount, int newTestCount) { String thresholdErrorMessage = "The %s number of tests for this category exceeds the specified '%s' threshold value."; if (isValid(getFailureThreshold()) && (convertToInteger(getFailureThreshold()) < testCount)) { log.infoConsoleLogger(String.format(thresholdErrorMessage, "total", "failure")); return Result.FAILURE; } if (isValid(getFailureNewThreshold()) && (convertToInteger(getFailureNewThreshold()) < newTestCount)) { log.infoConsoleLogger(String.format(thresholdErrorMessage, "new", "new failure")); return Result.FAILURE; } if (isValid(getUnstableThreshold()) && (convertToInteger(getUnstableThreshold()) < testCount)) { log.infoConsoleLogger(String.format(thresholdErrorMessage, "total", "unstable")); return Result.UNSTABLE; } if (isValid(getUnstableNewThreshold()) && (convertToInteger(getUnstableNewThreshold()) < newTestCount)) { log.infoConsoleLogger(String.format(thresholdErrorMessage, "new", "new unstable")); return Result.UNSTABLE; } return Result.SUCCESS; }
Source:
public static HashMap<Long, ArtifactId> findExcludedArtifactsByView(ArtifactId viewId, BranchId branch) { HashMap<Long, ArtifactId> excludedArtifactIdMap = new HashMap<>(); if (!viewId.equals(ArtifactId.SENTINEL)) { Object[] objs = {branch, viewId, branch}; List<ArtifactId> excludedArtifacts = ArtifactLoader.selectArtifactIds(OseeSql.LOAD_EXCLUDED_ARTIFACT_IDS.getSql(), objs, 300); for (ArtifactId artId : excludedArtifacts) { excludedArtifactIdMap.put(artId.getId(), artId); } } return excludedArtifactIdMap; }

Target:
public static Set<ArtifactId> findExcludedArtifactsByView(ArtifactId viewId, BranchId branch) { Set<ArtifactId> excludedArtifactIdMap = new HashSet<>(); if (!viewId.equals(ArtifactId.SENTINEL)) { Object[] objs = {branch, viewId, branch}; List<ArtifactId> excludedArtifacts = ArtifactLoader.selectArtifactIds(OseeSql.LOAD_EXCLUDED_ARTIFACT_IDS.getSql(), objs, 300); for (ArtifactId artId : excludedArtifacts) { excludedArtifactIdMap.add(artId); } } return excludedArtifactIdMap; }
Source:
public static int determineHttpStatusCode(MessageContext msgContext) { int httpStatus = HttpStatus.SC_OK; if (msgContext.isPropertyTrue(PassThroughConstants.SC_ACCEPTED)) { httpStatus = HttpStatus.SC_ACCEPTED; } else { boolean handleFault = msgContext.getEnvelope() != null ? (msgContext.getEnvelope().getBody().hasFault() || msgContext.isProcessingFault()):false; try { boolean faultsAsHttp200 = PassThroughConstants.TRUE.equals( msgContext.getProperty(PassThroughConstants.FAULTS_AS_HTTP_200).toString().toUpperCase()); if (handleFault && !faultsAsHttp200) { httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; } } catch (NullPointerException e) { if (handleFault) { httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; } log.warn("FAULTS_AS_HTTP_200 Property is missing in the proxy service configuration."); } Object statusCode = msgContext.getProperty(PassThroughConstants.HTTP_SC); if (statusCode != null) { try { httpStatus = Integer.parseInt( msgContext.getProperty(PassThroughConstants.HTTP_SC).toString()); } catch (NumberFormatException e) { log.warn("Unable to set the HTTP status code from the property " + PassThroughConstants.HTTP_SC + " with value: " + statusCode); } } } return httpStatus; }

Target:
public static int determineHttpStatusCode(MessageContext msgContext) { int httpStatus = HttpStatus.SC_OK; if (msgContext.isPropertyTrue(PassThroughConstants.SC_ACCEPTED)) { httpStatus = HttpStatus.SC_ACCEPTED; } else { boolean handleFault = msgContext.getEnvelope() != null ? (msgContext.getEnvelope().getBody().hasFault() || msgContext.isProcessingFault()):false; if(handleFault && msgContext.getProperty(PassThroughConstants.FAULTS_AS_HTTP_200) != null) { boolean faultsAsHttp200 = PassThroughConstants.TRUE.equals( msgContext.getProperty(PassThroughConstants.FAULTS_AS_HTTP_200).toString().toUpperCase()); if (!faultsAsHttp200) { httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; } }else if(handleFault && msgContext.getProperty(PassThroughConstants.FAULTS_AS_HTTP_200) == null){ httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; } Object statusCode = msgContext.getProperty(PassThroughConstants.HTTP_SC); if (statusCode != null) { try { httpStatus = Integer.parseInt( msgContext.getProperty(PassThroughConstants.HTTP_SC).toString()); } catch (NumberFormatException e) { log.warn("Unable to set the HTTP status code from the property " + PassThroughConstants.HTTP_SC + " with value: " + statusCode); } } } return httpStatus; }
Source:
protected List<String> getExtensibleChannelTypeIds(Map<String, String> attributes) { String extensible = attributes.get("extensible"); if (extensible == null) { return Collections.emptyList(); } return Arrays.asList(extensible.split(",")); }

Target:
protected List<String> getExtensibleChannelTypeIds(Map<String, String> attributes) { String extensible = attributes.get("extensible"); if (extensible == null) { return Collections.emptyList(); } return Arrays.stream(extensible.split(",")).map(String::trim).collect(toList()); }
Source:
public void deleteAllTexts(@Nonnull Mapping field) { for (MongoTranslation translation : fetchAllTranslations(field)) { mango.delete(translation); } if (owner instanceof Journaled) { JournalData.addJournalEntry(owner, "Deleted all translated texts for " + field.getName()); } }

Target:
public void deleteAllTexts(@Nonnull Mapping field) { mongo.delete() .where(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .where(Translation.TRANSLATION_DATA.inner(TranslationData.FIELD), field.getName()) .manyFrom(MongoTranslation.class); if (owner instanceof Journaled) { JournalData.addJournalEntry(owner, "Deleted all translated texts for " + field.getName()); } }
Source:
private void setupGroupsForVariableContext(VariableContext vctx, String user) throws IOException { if (groups == null) { LOG.warn( "Group provider hasn't been set, cannot query groups for user {}", user); return; } Set<String> groupsSet = groups.getGroupsSet(user); if (groupsSet.isEmpty()) { LOG.warn("There are no groups for user {}", user); return; } String secondaryGroup = null; Iterator<String> it = groupsSet.iterator(); String primaryGroup = it.next(); while (it.hasNext()) { String group = it.next(); if (this.queueManager.getQueue(group) != null) { secondaryGroup = group; break; } } if (secondaryGroup == null && LOG.isDebugEnabled()) { LOG.debug("User is not associated with any Secondary " + "Group. Hence it may use the 'default' queue", user); } vctx.put("%primary_group", primaryGroup); vctx.put("%secondary_group", secondaryGroup); vctx.putExtraDataset("groups", groupsSet); }

Target:
private void setupGroupsForVariableContext(VariableContext vctx, String user) throws IOException { if (groups == null) { LOG.warn( "Group provider hasn't been set, cannot query groups for user {}", user); return; } Set<String> groupsSet = groups.getGroupsSet(user); if (groupsSet.isEmpty()) { LOG.warn("There are no groups for user {}", user); vctx.putExtraDataset("groups", groupsSet); return; } String secondaryGroup = null; Iterator<String> it = groupsSet.iterator(); String primaryGroup = it.next(); while (it.hasNext()) { String group = it.next(); if (this.queueManager.getQueue(group) != null) { secondaryGroup = group; break; } } if (secondaryGroup == null && LOG.isDebugEnabled()) { LOG.debug("User is not associated with any Secondary " + "Group. Hence it may use the 'default' queue", user); } vctx.put("%primary_group", primaryGroup); vctx.put("%secondary_group", secondaryGroup); vctx.putExtraDataset("groups", groupsSet); }
Source:
private void copyToClipboard() { EditorFrame editorFrame = EditorFrame.getInstance(); if(editorFrame != null) { editorFrame.copyToClipboard(); } }

Target:
private void copyToClipboard() { Container parent = getParent(); while( parent.getClass() != EditorFrame.class ) { parent = parent.getParent(); } ((EditorFrame)parent).copyToClipboard(); }
Source:
public void setReview(@NotNull Review review) { try { log.debug("Set review in Gerrit: {}", review); boolean commentOnlyChangedLines = parseBoolean(configuration.getProperty(GeneralOption.COMMENT_ONLY_CHANGED_LINES)); CommentFilter filter = commentOnlyChangedLines ? new JGitCommentFilter(gerritPatchset.getRevisionId()).init() : CommentFilter.EMPTY_FILTER; ReviewInput reviewInput = new ReviewInputBuilder(filter).toReviewInput(review); gerritApi.changes().id(gerritPatchset.getChangeId()).revision(gerritPatchset.getRevisionId()).review(reviewInput); } catch (RestApiException e) { throw new GerritException("Error when setting review", e); } }

Target:
public void setReview(@NotNull Review review) { try { log.debug("Set review in Gerrit: {}", review); ReviewInput reviewInput = new ReviewInputBuilder(commentFilter.init()).toReviewInput(review); gerritApi.changes().id(gerritPatchset.getChangeId()).revision(gerritPatchset.getRevisionId()).review(reviewInput); } catch (RestApiException e) { throw new GerritException("Error when setting review", e); } }
Source:
public void actionPerformed(ActionEvent e) { if (okayButton.equals(e.getSource())) { bombPanel.applyChoice(); newLoadout = bombPanel.getChoice(); for (int type = 0; type < BombType.B_NUM; type++) { if(bombChoices[type] != newLoadout[type]) { newLoadout[type] = bombChoices[type] - newLoadout[type]; } else newLoadout[type] = 0; } for (int type = 0; type < BombType.B_NUM; type++) { if(newLoadout[type] != 0 && bombCatalog[type] > 0) { AmmoStorage storedBombs = (AmmoStorage) campaign.getPart(bombCatalog[type]); storedBombs.changeShots(newLoadout[type]); if(storedBombs.getShots() == 0) campaign.removePart(storedBombs); } } setVisible(false); } else if (cancelButton.equals(e.getSource())) { setVisible(false); } }

Target:
public void actionPerformed(ActionEvent e) { if (okayButton.equals(e.getSource())) { bombPanel.applyChoice(); int[] newLoadout = bombPanel.getChoice(); for (int type = 0; type < BombType.B_NUM; type++) { if(bombChoices[type] != newLoadout[type]) { newLoadout[type] = bombChoices[type] - newLoadout[type]; } else { newLoadout[type] = 0; } } for (int type = 0; type < BombType.B_NUM; type++) { if(newLoadout[type] != 0 && bombCatalog[type] > 0) { AmmoStorage storedBombs = (AmmoStorage) campaign.getPart(bombCatalog[type]); storedBombs.changeShots(newLoadout[type]); if(storedBombs.getShots() == 0) { campaign.removePart(storedBombs); } } } setVisible(false); } else if (cancelButton.equals(e.getSource())) { setVisible(false); } }
Source:
public void onPostExecute(@NonNull Boolean result) { if (result) { mainActivityWeakReference.get().getDrawer().refreshDrawer(); } }

Target:
public void onPostExecute(@NonNull Boolean result) { if (result) { final MainActivity mainActivity = this.mainActivity.get(); if (mainActivity != null) { mainActivity.getDrawer().refreshDrawer(); } } }
Source:
private static RateCurveId createRateCurveId(CurveGroupName curveGroup, String curveTypeStr, String referenceStr) { if ("forward".equals(curveTypeStr.toLowerCase())) { RateIndex index = (RateIndex) LoaderUtils.findIndex(referenceStr); return RateIndexCurveId.of(index, curveGroup); } else if ("discount".equals(curveTypeStr.toLowerCase())) { Currency ccy = Currency.of(referenceStr); return DiscountCurveId.of(ccy, curveGroup); } else { throw new IllegalArgumentException(Messages.format("Unsupported curve type: {}", curveTypeStr)); } }

Target:
private static RateCurveId createRateCurveId(CurveGroupName curveGroup, String curveTypeStr, String referenceStr) { if (FORWARD.equals(curveTypeStr.toLowerCase())) { RateIndex index = (RateIndex) LoaderUtils.findIndex(referenceStr); return RateIndexCurveId.of(index, curveGroup); } else if (DISCOUNT.equals(curveTypeStr.toLowerCase())) { Currency ccy = Currency.of(referenceStr); return DiscountCurveId.of(ccy, curveGroup); } else { throw new IllegalArgumentException(Messages.format("Unsupported curve type: {}", curveTypeStr)); } }
Source:
private FeatureVector createdFeatureVector(Terms terms, IndexReader reader, boolean tweetsearch) { FeatureVector f = new FeatureVector(); try { int numDocs = reader.numDocs(); TermsEnum termsEnum = terms.iterator(); BytesRef text; while ((text = termsEnum.next()) != null) { String term = text.utf8ToString(); if (term.length() < 2 || term.length() > 20) continue; if (!term.matches("[a-z0-9]+")) continue; if (tweetsearch) { int df = reader.docFreq(new Term(FIELD_BODY, term)); if (numDocs > 100000000) { if (((float) df / numDocs) > 0.007f) continue; } else { if (((float) df / numDocs) > 0.01f) continue; } } else { int df = reader.docFreq(new Term(FIELD_BODY, term)); if (((float) df / numDocs) > 0.1f) continue; } int freq = (int) termsEnum.totalTermFreq(); f.addFeatureWeight(term, (float) freq); } } catch (Exception e) { e.printStackTrace(); return f; } return f; }

Target:
private FeatureVector createdFeatureVector(Terms terms, IndexReader reader, boolean tweetsearch) { FeatureVector f = new FeatureVector(); try { int numDocs = reader.numDocs(); TermsEnum termsEnum = terms.iterator(); BytesRef text; while ((text = termsEnum.next()) != null) { String term = text.utf8ToString(); if (term.length() < 2 || term.length() > 20) continue; if (!term.matches("[a-z0-9]+")) continue; int df = reader.docFreq(new Term(FIELD_BODY, term)); float ratio = (float) df / numDocs; if (tweetsearch) { if (numDocs > 100000000) { if (ratio > 0.007f) continue; } else { if (ratio > 0.01f) continue; } } else if (ratio > 0.1f) continue; int freq = (int) termsEnum.totalTermFreq(); f.addFeatureWeight(term, (float) freq); } } catch (Exception e) { e.printStackTrace(); return f; } return f; }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); String dir = TmfTraceManager.getSupplementaryFileDir(this); fFile = new File(dir + new File(path).getName()); if (!fFile.exists()) { Job sortJob = new SortingJob(this, path); sortJob.schedule(); while(sortJob.getResult() == null) { try { sortJob.join(); } catch (InterruptedException e) { throw new TmfTraceException(e.getMessage(), e); } } IStatus result = sortJob.getResult(); if (!result.isOK()) { throw new TmfTraceException("Job failed " + result.getMessage()); } } try { fFileInput = new BufferedRandomAccessFile(fFile, "r"); } catch (IOException e) { throw new TmfTraceException(e.getMessage(), e); } }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); fProperties.put("Type", "Trace-Event"); String dir = TmfTraceManager.getSupplementaryFileDir(this); fFile = new File(dir + new File(path).getName()); if (!fFile.exists()) { Job sortJob = new SortingJob(this, path); sortJob.schedule(); while (sortJob.getResult() == null) { try { sortJob.join(); } catch (InterruptedException e) { throw new TmfTraceException(e.getMessage(), e); } } IStatus result = sortJob.getResult(); if (!result.isOK()) { throw new TmfTraceException("Job failed " + result.getMessage()); } } try { fFileInput = new BufferedRandomAccessFile(fFile, "r"); goToCorrectStart(fFileInput); } catch (IOException e) { throw new TmfTraceException(e.getMessage(), e); } }
Source:
protected void onPostExecute(Void aVoid) { SyncthingService syncthingService = refSyncthingService.get(); if (syncthingService != null) { syncthingService.onStartupTaskCompleteListener(); } return; }

Target:
protected void onPostExecute(Void aVoid) { SyncthingService syncthingService = refSyncthingService.get(); if (syncthingService != null) { syncthingService.onStartupTaskCompleteListener(); } }
Source:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(ackTarget); if (ackTarget != null) { output.writeLong(id); } output.writeInt(topologyId); if (keys != null) { MarshallUtil.marshallCollection(keys, output); } else { assert segments != null; MarshallUtil.marshallIntCollection(segments, output); } }

Target:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(ackTarget); if (ackTarget != null) { output.writeLong(id); } output.writeInt(topologyId); MarshallUtil.marshallCollection(keys, output); }
Source:
public int update() { session.commit(true); Table view = getSchema().findTableOrView(session, viewName); if (view == null) { if (!ifExists) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } } else { if (TableType.VIEW != view.getTableType()) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } session.getUser().checkRight(view, Right.ALL); if (dropAction == ConstraintReferential.RESTRICT) { for (DbObject child : view.getChildren()) { if (child instanceof TableView) { throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName()); } } } TableView tableView = (TableView) view; ArrayList<Table> copyOfDependencies = new ArrayList<Table>(tableView.getTables()); view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view); session.getDatabase().unlockMeta(session); for( Table childTable: copyOfDependencies){ if(TableType.VIEW == childTable.getTableType()){ TableView childTableView = (TableView) childTable; if(childTableView.isTableExpression() && childTableView.getName()!=null){ session.getDatabase().removeSchemaObject(session, childTableView); } } } } return 0; }

Target:
public int update() { session.commit(true); Table view = getSchema().findTableOrView(session, viewName); if (view == null) { if (!ifExists) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } } else { if (TableType.VIEW != view.getTableType()) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } session.getUser().checkRight(view, Right.ALL); if (dropAction == ConstraintReferential.RESTRICT) { for (DbObject child : view.getChildren()) { if (child instanceof TableView) { throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName()); } } } TableView tableView = (TableView) view; ArrayList<Table> copyOfDependencies = new ArrayList<Table>(tableView.getTables()); view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view); for (Table childTable: copyOfDependencies) { if (TableType.VIEW == childTable.getTableType()) { TableView childTableView = (TableView) childTable; if (childTableView.isTableExpression() && childTableView.getName() != null) { session.getDatabase().removeSchemaObject(session, childTableView); } } } session.getDatabase().unlockMeta(session); } return 0; }
Source:
private void reportBooleanExpression(CheckerContext context, AlwaysTrueOrFalseExpressionCollector atof, Tree condition, boolean isTrue) { if (!AlwaysTrueOrFalseExpressionCollector.hasUnreachableCode(condition, isTrue)) { Set<List<JavaFileScannerContext.Location>> flows = atof.flowForExpression(condition).stream() .filter(flow -> !flow.isEmpty()) .map(flow -> AlwaysTrueOrFalseExpressionCollector.addIssueLocation(flow, condition, isTrue)) .collect(Collectors.toSet()); context.reportIssue(condition, this, "Remove this expression which always evaluates to \"" + isTrue + "\"", flows); } }

Target:
private void reportBooleanExpression(CheckerContext context, AlwaysTrueOrFalseExpressionCollector atof, Tree condition, boolean isTrue) { if (!AlwaysTrueOrFalseExpressionCollector.hasUnreachableCode(condition, isTrue)) { Set<List<JavaFileScannerContext.Location>> flows = atof.flowForExpression(condition).stream() .map(flow -> AlwaysTrueOrFalseExpressionCollector.addIssueLocation(flow, condition, isTrue)) .collect(Collectors.toSet()); context.reportIssue(condition, this, "Remove this expression which always evaluates to \"" + isTrue + "\"", flows); } }
Source:
public static long produced(AtomicLong requested, long n) { for (;;) { long r = requested.get(); if (r == Long.MAX_VALUE) { return Long.MAX_VALUE; } long u = r - n; if (u < 0L) { RxJavaPlugins.onError(new IllegalStateException("More produced than requested: " + u)); u = 0L; } if (requested.compareAndSet(r, u)) { return r; } } }

Target:
public static long produced(AtomicLong requested, long n) { for (;;) { long current = requested.get(); if (current == Long.MAX_VALUE) { return Long.MAX_VALUE; } long update = current - n; if (update < 0L) { RxJavaPlugins.onError(new IllegalStateException("More produced than requested: " + update)); update = 0L; } if (requested.compareAndSet(current, update)) { return update; } } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); String initialValue = getTransitivityDepth(); InputDialog depthInput = new InputDialog(window.getShell(), "Transitivity depth", "Input the wished depth limit for transitivity. Enter 0 if no limit is wished.", initialValue, null); if (depthInput.open() == Window.OK) { String depth = depthInput.getValue(); setTransitivityDepth(depth); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); String initialValue = getTransitivityDepth(); InputDialog depthInput = new InputDialog(window.getShell(), "Transitivity depth", "Input the desired depth limit for transitivity. Enter 0 if no limit is desired.", initialValue, null); if (depthInput.open() == Window.OK) { String depth = depthInput.getValue(); setTransitivityDepth(depth); } return null; }
Source:
public MinecraftServer getServer() { final World world = getEntityWorld(); if (world != null) { return world.getMinecraftServer(); } return SpongeImpl.getServer(); }

Target:
public MinecraftServer getServer() { return getEntityWorld().getMinecraftServer(); }
Source:
public OutputStream createOutputStream(long offset) throws IOException { if (doesExist()) { return file.createOutputStream(); } StorageUtils.LOG.FINE("Uploading file '%s'", childName); return parent.resolve(childName).createOutputStream(); }

Target:
public OutputStream createOutputStream(long offset) throws IOException { if (doesExist()) { return file.createOutputStream(); } StorageUtils.LOG.FINE("Layer3/FTP: Uploading file '%s' in '%s'", childName, parent); return parent.resolve(childName).createOutputStream(); }