auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } this.setContentView(R.layout.main); if (savedInstanceState == null) { Uri uri = BaseballCardContract.getUri(this.getPackageName()); Cursor cursor = this.getContentResolver().query(uri, BaseballCardContract.PROJECTION, null, null, null); FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.add(R.id.fragment_holder, new BaseballCardList(), FragmentTags.CARD_LIST) .addToBackStack(null) .commit(); if (cursor == null || cursor.getCount() == 0) { this.getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_holder, new BaseballCardDetails(), FragmentTags.EDIT_CARD) .addToBackStack(FragmentTags.EDIT_CARD).commit(); } <START> cursor.close(); <END> ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } } prefs = getSharedPreferences(SharedPreferenceKeys.PREFS, MODE_PRIVATE); showSurvey1Dialog(); showSurvey2Dialog(); }</code><technical_language>for changes in this file</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } this.setContentView(R.layout.main); fragmentManager = getSupportFragmentManager(); if (savedInstanceState == null) { fragmentManager.beginTransaction() .add(R.id.fragment_holder, new BaseballCardList(), FragmentTags.CARD_LIST) .addToBackStack(FragmentTags.CARD_LIST) .commit(); fragmentManager.addOnBackStackChangedListener(this); } prefs = getSharedPreferences(SharedPreferenceKeys.PREFS, MODE_PRIVATE); showSurvey1Dialog(); showSurvey2Dialog(); }
Source:
<code>void oneFiringUnitVsOneTargetableUnitMakesOneFiringGroup() { final Unit targetUnit = givenAnyUnit(); final Unit fireUnit = givenAnyUnit(); final List<FiringGroup> firingGroups = FiringGroupSplitterGeneral.of(OFFENSE, unit -> true, UNITS) .apply( givenBattleStateBuilder() .gameData(givenGameData().withAlliedAirIndependent(true).build()) .attacker(attacker) .defender(defender) .attackingUnits(List.of(fireUnit)) .defendingUnits(List.of(targetUnit)) .build()); assertThat(firingGroups, hasSize(1)); <START> assertThat(firingGroups.get(0).getDisplayName(), is(UNITS)); <END> assertThat(firingGroups.get(0).getFiringUnits(), contains(fireUnit)); assertThat(firingGroups.get(0).getTargetUnits(), contains(targetUnit)); assertThat(firingGroups.get(0).isSuicideOnHit(), is(false)); }</code><technical_language>I see, more pointing is testing multiple/all aspects of firingGroups test testing behavior a time. For example, considered a practice for tests reason for fail. If for example firing group size change *or* if displayName change, this test fail. a more concrete level, isolating behaviors easier parameters control outputs. suggesting pivot tests group isolate tests verify display name, size, etc.. do independently</technical_language>

Target:
void oneFiringUnitVsOneTargetableUnitMakesOneFiringGroup() { final Unit targetUnit = givenAnyUnit(); final Unit fireUnit = givenAnyUnit(); final List<FiringGroup> firingGroups = FiringGroupSplitterGeneral.of( OFFENSE, FiringGroupSplitterGeneral.Type.OFFENSIVE_NORMAL, UNITS) .apply( givenBattleStateBuilder() .gameData(givenGameData().withAlliedAirIndependent(true).build()) .attacker(attacker) .defender(defender) .attackingUnits(List.of(fireUnit)) .defendingUnits(List.of(targetUnit)) .build()); assertThat(firingGroups, hasSize(1)); assertThat(firingGroups.get(0).getDisplayName(), is(UNITS)); assertThat(firingGroups.get(0).getFiringUnits(), contains(fireUnit)); assertThat(firingGroups.get(0).getTargetUnits(), contains(targetUnit)); assertThat(firingGroups.get(0).isSuicideOnHit(), is(false)); }
Source:
<code>private void assertNotAMember(String organizationUuid, UserDto user) { assertThat(dbClient.organizationMemberDao().select(dbSession, organizationUuid, user.getId())).isNotPresent(); <START> assertThat(userIndex.getNullableByLogin(user.getLogin()).organizationUuids()).doesNotContain(organizationUuid); <END> }</code><technical_language>userIndex.getNullableByLogin removed someday, es search, for instance : assertThat( esTester.client() .prepareSearch(INDEX_TYPE_USER) .setQuery(termQuery(FIELD_ORGANIZATIONS, nameQuery)) .get() .getHits() .getTotalHits()).isEqualTo(0);</technical_language>

Target:
private void assertNotAMember(String organizationUuid, UserDto user) { assertThat(dbClient.organizationMemberDao().select(dbSession, organizationUuid, user.getId())).isNotPresent(); assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(organizationUuid).setTextQuery(user.getLogin()).build(), new SearchOptions()).getDocs()).isEmpty(); }
Source:
<code>public void setRelativeCoordinatesToPreviousPoint(float previousX, float previousY) { relativeX = <START> Math.round(this.xCoord * DSTFileConstants.STITCH_POINT_UNIT_FACTOR) - Math.round(previousX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); <END> relativeY = Math.round(this.yCoord * DSTFileConstants.STITCH_POINT_UNIT_FACTOR) - Math.round(previousY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); setDSTPointBytes(); }</code><technical_language>Please create a global helper function for this</technical_language>

Target:
public void setRelativeCoordinatesToPreviousPoint(float previousX, float previousY) { relativeX = toEmbroideryUnit(xCoord) - toEmbroideryUnit(previousX); relativeY = toEmbroideryUnit(yCoord) - toEmbroideryUnit(previousY); }
Source:
<code>public void theRetrieveAdministrativeStatusRequestIsReceived() throws Throwable { <START> PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); <END> PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }</code><technical_language>GetAdministrativeStatus tested E-meter DEVICE_IDENTIFICATION_G_LABEL -> DEVICE_IDENTIFICATION_E_LABEL getDeviceIdG -> getDeviceIdE</technical_language>

Target:
public void theRetrieveAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
<code><START> public static ItemStack setupNewMap(World worldIn, double worldX, double worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking) { <END> ItemStack itemstack = new ItemStack(CUSTOM_MAP, 1, worldIn.getUniqueDataId(PREFIX)); String s = PREFIX + "_" + itemstack.getMetadata(); MapData mapdata = new MapData(s); worldIn.setData(s, mapdata); mapdata.scale = scale; mapdata.calculateMapCenter(worldX, worldZ, mapdata.scale); mapdata.dimension = worldIn.provider.getDimension(); mapdata.trackingPosition = trackingPosition; mapdata.unlimitedTracking = unlimitedTracking; mapdata.markDirty(); return itemstack; }</code><technical_language>This is called</technical_language>

Target:
public static ItemStack setupNewMap(World worldIn, double worldX, double worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking) { ItemStack itemstack = new ItemStack(CUSTOM_MAP, 1, worldIn.getUniqueDataId(PREFIX)); String s = PREFIX + "_" + itemstack.getMetadata(); MapData mapdata = new CustomMapData(s); worldIn.setData(s, mapdata); mapdata.scale = scale; mapdata.calculateMapCenter(worldX, worldZ, mapdata.scale); mapdata.dimension = worldIn.provider.getDimension(); mapdata.trackingPosition = trackingPosition; mapdata.unlimitedTracking = unlimitedTracking; mapdata.markDirty(); return itemstack; }
Source:
<code>private FmsUser umsUserToUser(User umsUser) { FmsUser fmsUser = new FmsUser(); fmsUser.withName(umsUser.getWorkloadUsername()); fmsUser.withFirstName(getOrDefault(umsUser.getFirstName(), "None")); fmsUser.withLastName(getOrDefault(umsUser.getLastName(), "None")); <START> fmsUser.withAzureObjectId(getOptionalAzureObjectId(umsUser.getCloudIdentitiesList())); <END> return fmsUser; }</code><technical_language>AzureObjectId belongs in UmsUsersState, UsersState information is provided UMS matching information FreeIPA side. equality compare FmsUser FmsGroup models generated UMS generated FreeIPA. Adding in asymmetric information break equality state difference calculation. handle workload credentials instead. I pass List<CloudIdentity> handleUser method store there. This store OIDs for users access environment instead of users</technical_language>

Target:
private FmsUser umsUserToUser(User umsUser) { FmsUser fmsUser = new FmsUser(); fmsUser.withName(umsUser.getWorkloadUsername()); fmsUser.withFirstName(getOrDefault(umsUser.getFirstName(), "None")); fmsUser.withLastName(getOrDefault(umsUser.getLastName(), "None")); return fmsUser; }
Source:
<code><START> public String generateDescriptor() { <END> String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); org.ovirt.engine.api.model.GraphicsType type = org.ovirt.engine.api.model.GraphicsType.valueOf(consoleString); GraphicsType graphicsType = getMappingLocator().getMapper(org.ovirt.engine.api.model.GraphicsType.class, GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); return runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); }</code><technical_language>Consider changing this returns byte[] instead of String, is more efficient represents fact is opaque data for RESTAPI</technical_language>

Target:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }
Source:
<code>protected int getTotalCount() throws ServerException { try { <START> return ((Number) managerProvider.get().createNamedQuery("User.getTotalCount").getSingleResult()).intValue(); <END> } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }</code><technical_language>Long.class argument in .createNamedQuery method, please remove cast</technical_language>

Target:
protected long getTotalCount() throws ServerException { try { return managerProvider.get().createNamedQuery("User.getTotalCount", Long.class).getSingleResult(); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
<code>protected Object decode( ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { if (buf.readableBytes() < KEEP_ALIVE_LENGTH) { return null; } if (buf.getUnsignedByte(buf.readerIndex()) == 0xD0) { ByteBuf frame = buf.readBytes(KEEP_ALIVE_LENGTH); <START> if (ctx != null && ctx.channel() != null) { <END> ctx.channel().writeAndFlush(new NetworkMessage(frame, ctx.channel().remoteAddress())); } return frame; } else { int index = new AsciiString(buf.array(), buf.readerIndex(), buf.writerIndex(), false).indexOf("\r\n"); if (index != -1) { ByteBuf frame = buf.readBytes(index - buf.readerIndex()); buf.skipBytes(2); return frame; } } return null; }</code><technical_language>channel a separate variable, I need context</technical_language>

Target:
protected Object decode( ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { if (buf.readableBytes() < KEEP_ALIVE_LENGTH) { return null; } if (buf.getUnsignedByte(buf.readerIndex()) == 0xD0) { ByteBuf frame = buf.readBytes(KEEP_ALIVE_LENGTH); if (channel != null) { channel.writeAndFlush(new NetworkMessage(frame, channel.remoteAddress())); } return frame; } else { ByteBuf delimiter = Unpooled.wrappedBuffer("\r\n".getBytes(StandardCharsets.US_ASCII)); int index = ByteBufUtil.indexOf(delimiter, buf); if (index != -1) { ByteBuf frame = buf.readBytes(index - buf.readerIndex()); buf.skipBytes(2); return frame; } } return null; }
Source:
<code>protected File execute(UnalignedSettings settings) throws Exception { <START> final File checkpointDir = temp.newFolder(); <END> StreamExecutionEnvironment env = settings.createEnvironment(checkpointDir); int minCheckpoints = 10; settings.dagCreator.accept(env, minCheckpoints, settings.slotSharing); try { final JobExecutionResult result = env.execute(); collector.checkThat("NUM_OUT_OF_ORDER", result.<Long>getAccumulatorResult(NUM_OUT_OF_ORDER), equalTo(0L)); collector.checkThat("NUM_DUPLICATES", result.<Long>getAccumulatorResult(NUM_DUPLICATES), equalTo(0L)); collector.checkThat("NUM_LOST", result.<Long>getAccumulatorResult(NUM_LOST), equalTo(0L)); collector.checkThat("NUM_FAILURES", result.<Integer>getAccumulatorResult(NUM_FAILURES), equalTo(settings.expectedFailures)); } catch (Exception e) { if (settings.generateCheckpoint) { return Files.find(checkpointDir.toPath(), 2, (file, attr) -> attr.isDirectory() && file.getFileName().toString().startsWith("chk")) .findFirst() .map(Path::toFile) .orElseThrow(() -> new IllegalStateException("Cannot generate checkpoint", e)); } throw e; } if (settings.generateCheckpoint) { fail("Could not generate checkpoint"); } return null; }</code><technical_language>Drawback of removing timeout is, if multiple deadlocks in single azure build, test level timeout show of them. Azure level show one. Azure level timeout longer kick in? strictly removing it. pointing this out. test level timeout is annoying debugging, in +/- 0 for this change</technical_language>

Target:
protected File execute(UnalignedSettings settings) throws Exception { final File checkpointDir = temp.newFolder(); StreamExecutionEnvironment env = settings.createEnvironment(checkpointDir); settings.dagCreator.create(env, settings.minCheckpoints, settings.slotSharing, settings.expectedFailures - 1); try { final JobExecutionResult result = env.execute(); collector.checkThat("NUM_OUT_OF_ORDER", result.<Long>getAccumulatorResult(NUM_OUT_OF_ORDER), equalTo(0L)); collector.checkThat("NUM_DUPLICATES", result.<Long>getAccumulatorResult(NUM_DUPLICATES), equalTo(0L)); collector.checkThat("NUM_LOST", result.<Long>getAccumulatorResult(NUM_LOST), equalTo(0L)); collector.checkThat("NUM_FAILURES", result.<Integer>getAccumulatorResult(NUM_FAILURES), equalTo(settings.expectedFailures)); } catch (Exception e) { if (settings.generateCheckpoint) { return Files.find(checkpointDir.toPath(), 2, (file, attr) -> attr.isDirectory() && file.getFileName().toString().startsWith("chk")) .findFirst() .map(Path::toFile) .orElseThrow(() -> new IllegalStateException("Cannot generate checkpoint", e)); } throw e; } if (settings.generateCheckpoint) { fail("Could not generate checkpoint"); } return null; }
Source:
<code>public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } try { formController.newRepeat(); } catch (RuntimeException e) { <START> error.setValue(e.getCause() != null ? e.getCause().getMessage() : "Unknown issue occurred while adding a new group"); <END> } if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException e) { error.setValue(e.getCause() != null ? e.getCause().getMessage() : "Unknown issue occurred while adding a new group"); } } }</code><technical_language>I if cause, exception's message. provide more specific information</technical_language>

Target:
public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } try { formController.newRepeat(); } catch (RuntimeException e) { error.setValue(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); } if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException e) { error.setValue(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); } } }
Source:
<code>public void validateDiskInBackupDomainForUpVM() { createParameters(); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); <START> StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); srcStorageDomain.setStatus(StorageDomainStatus.Active); srcStorageDomain.setStorageType(StorageType.NFS); <END> StorageDomain destStorageDomain = initStorageDomain(dstStorageId); destStorageDomain.setStatus(StorageDomainStatus.Active); destStorageDomain.setStorageType(StorageType.NFS); destStorageDomain.setBackup(true); doReturn(destStorageDomain).when(command).getStorageDomain(); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); }</code><technical_language>need for this check destination storage</technical_language>

Target:
public void validateDiskInBackupDomainForUpVM() { createParameters(); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); StorageDomain destStorageDomain = initStorageDomain(dstStorageId); destStorageDomain.setStatus(StorageDomainStatus.Active); destStorageDomain.setStorageType(StorageType.NFS); destStorageDomain.setBackup(true); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); }
Source:
<code>public static String relativize(String base, String other) { if (base.equals(other)) return ""; final boolean ignoreCase = <START> SystemReader.getInstance().isWindows(); <END> final String[] baseSegments = base.split(Pattern.quote(File.separator)); final String[] otherSegments = other.split(Pattern .quote(File.separator)); int commonPrefix = 0; while (commonPrefix < baseSegments.length && commonPrefix < otherSegments.length) { if (ignoreCase && baseSegments[commonPrefix] .equalsIgnoreCase(otherSegments[commonPrefix])) commonPrefix++; else if (!ignoreCase && baseSegments[commonPrefix] .equals(otherSegments[commonPrefix])) commonPrefix++; else break; } final StringBuilder builder = new StringBuilder(); for (int i = commonPrefix; i < baseSegments.length; i++) builder.append("..").append(File.separator); for (int i = commonPrefix; i < otherSegments.length; i++) { builder.append(otherSegments[i]); if (i < otherSegments.length - 1) builder.append(File.separator); } return builder.toString(); }</code><technical_language>No, this time Windows. Mac's (with HFS+) specific behavior differs e.g. standard linux filesystems. Instead ask FS class: FS.isCaseSensitive(). (Do in tests, rely windows)</technical_language>

Target:
public static String relativize(String base, String other) { if (base.equals(other)) return ""; final boolean ignoreCase = !FS.DETECTED.isCaseSensitive(); final String[] baseSegments = base.split(Pattern.quote(File.separator)); final String[] otherSegments = other.split(Pattern .quote(File.separator)); int commonPrefix = 0; while (commonPrefix < baseSegments.length && commonPrefix < otherSegments.length) { if (ignoreCase && baseSegments[commonPrefix] .equalsIgnoreCase(otherSegments[commonPrefix])) commonPrefix++; else if (!ignoreCase && baseSegments[commonPrefix] .equals(otherSegments[commonPrefix])) commonPrefix++; else break; } final StringBuilder builder = new StringBuilder(); for (int i = commonPrefix; i < baseSegments.length; i++) builder.append("..").append(File.separator); for (int i = commonPrefix; i < otherSegments.length; i++) { builder.append(otherSegments[i]); if (i < otherSegments.length - 1) builder.append(File.separator); } return builder.toString(); }
Source:
<code>protected Object writeReplace() { Channel currentChannel = Channel.current(); if (currentChannel == null) <START> return null; <END> return remoteProxyFor(currentChannel.export(IGitAPI.class, this)); }</code><technical_language>I throw <LINK_0> block serialization other channels propagate error</technical_language>

Target:
protected Object writeReplace() throws java.io.ObjectStreamException { Channel currentChannel = Channel.current(); if (currentChannel == null) throw new java.io.WriteAbortedException("No current channel", new java.lang.NullPointerException()); return remoteProxyFor(currentChannel.export(IGitAPI.class, this)); }
Source:
<code>public void mergeDependencies(Collection<ClassLoaderModel> otherClassloaderModels) { for (ClassLoaderModel otherClassLoaderModel : otherClassloaderModels) { Artifact pluginArtifact = getClassLoaderModel().getDependencies().stream() .filter(dependency -> dependency.getArtifactCoordinates().equals(otherClassLoaderModel.getArtifactCoordinates())) .findFirst() .orElseThrow(() -> new IllegalStateException(format("Couldn't find an artifact coordinate for '%s' to merge dependencies as inline", otherClassLoaderModel.getArtifactCoordinates()))); if (nestedClassLoaderModels.putIfAbsent(otherClassLoaderModel.getArtifactCoordinates(), otherClassLoaderModel) != null) { <START> throw new IllegalArgumentException(format("Duplicated definition of a nested class loader model for artifact coordinates '%s'", <END> otherClassLoaderModel.getArtifactCoordinates())); } pluginArtifact.setDependencies(otherClassLoaderModel.getDependencies()); } }</code><technical_language>If maven resolution is correct, this happen right</technical_language>

Target:
public void mergeDependencies(Collection<ClassLoaderModel> otherClassloaderModels) { doMergeDependencies(otherClassloaderModels, context -> { }); }
Source:
<code>public Bundle getAuthToken(final Context context, final Bundle requestBundle) throws AuthenticationException { final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicReference<Bundle> bundleResult = new AtomicReference<>(null); final AtomicReference<Throwable> exception = new AtomicReference<>(null); bindToBrokerAccountService(context, new Callback<BrokerAccountServiceConnection>() { @Override public void onSuccess(BrokerAccountServiceConnection result) { final IBrokerAccountService brokerAccountService = result.getBrokerAccountServiceProvider(); try { <START> HttpWebRequest.throwIfNetworkNotAvaliable(context); <END> bundleResult.set(brokerAccountService.acquireTokenSilently(prepareGetAuthTokenRequestData(context, requestBundle))); } catch (final RemoteException | AuthenticationException exc) { exception.set(exc); } countDownLatch.countDown(); } @Override public void onError(Throwable throwable) { exception.set(throwable); countDownLatch.countDown(); } }); try { countDownLatch.await(); } catch (final InterruptedException e) { exception.set(e); } final Throwable throwable = exception.getAndSet(null); if (throwable != null) { throw new AuthenticationException(ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, throwable.getMessage(), throwable); } return bundleResult.getAndSet(null); }</code><technical_language>work? skipping access token lookup valid</technical_language>

Target:
public Bundle getAuthToken(final Context context, final Bundle requestBundle) throws AuthenticationException { final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicReference<Bundle> bundleResult = new AtomicReference<>(null); final AtomicReference<Throwable> exception = new AtomicReference<>(null); bindToBrokerAccountService(context, new Callback<BrokerAccountServiceConnection>() { @Override public void onSuccess(BrokerAccountServiceConnection result) { final IBrokerAccountService brokerAccountService = result.getBrokerAccountServiceProvider(); try { bundleResult.set(brokerAccountService.acquireTokenSilently(prepareGetAuthTokenRequestData(context, requestBundle))); } catch (final RemoteException remoteException) { exception.set(remoteException); } countDownLatch.countDown(); } @Override public void onError(Throwable throwable) { exception.set(throwable); countDownLatch.countDown(); } }); try { countDownLatch.await(); } catch (final InterruptedException e) { exception.set(e); } final Throwable throwable = exception.getAndSet(null); if (throwable != null) { throw new AuthenticationException(ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, throwable.getMessage(), throwable); } return bundleResult.getAndSet(null); }
Source:
<code>private String getTeamNameForUser(String giver, InstructorAttributes instructorGiver, StudentAttributes studentGiver) { String giverTeam = null; boolean isStudentGiver = studentGiver != null; boolean isInstructorGiver = instructorGiver != null; if (isStudentGiver) { giverTeam = studentGiver.team; } else if (isInstructorGiver) { giverTeam = Const.USER_TEAM_FOR_INSTRUCTOR; } else { giverTeam = giver; } <START> return giverTeam; <END> }</code><technical_language>java if (isStudentGiver) { return ...; } else if (isInstructorGiver) { return ...; } return ...;</technical_language>

Target:
private String getTeamNameForUser(String giver, InstructorAttributes instructorGiver, StudentAttributes studentGiver) { boolean isStudentGiver = studentGiver != null; boolean isInstructorGiver = instructorGiver != null; if (isStudentGiver) { return studentGiver.team; } else if (isInstructorGiver) { return Const.USER_TEAM_FOR_INSTRUCTOR; } return giver; }
Source:
<code>public void setType(int x, int z, int y, int type) { if (type < 0 || type >= 256) throw new IllegalArgumentException("Block type out of range: " + type); ChunkSection section = getSection(y); if (section == null) { if (type == 0) { return; } else { int idx = y >> 4; if (y < 0 || y >= DEPTH || idx >= sections.length) { return; } sections[idx] = section = new ChunkSection(); } } int tileEntityIndex = coordToIndex(x, z, y); if (tileEntities.containsKey(tileEntityIndex)) { tileEntities.remove(tileEntityIndex).destroy(); } int index = section.index(x, y, z); if (type == 0) { <START> if(section.types[index] != 0) section.count--; <END> } else { if(section.types[index] == 0) section.count++; } section.types[index] = (char) (type << 4); if (type == 0 && section.count == 0) { sections[y / SEC_DEPTH] = null; return; } createEntity(x, y, z, type); }</code><technical_language><LINK_0></technical_language>

Target:
public void setType(int x, int z, int y, int type) { if (type < 0 || type >= 256) throw new IllegalArgumentException("Block type out of range: " + type); ChunkSection section = getSection(y); if (section == null) { if (type == 0) { return; } else { int idx = y >> 4; if (y < 0 || y >= DEPTH || idx >= sections.length) { return; } sections[idx] = section = new ChunkSection(); } } int tileEntityIndex = coordToIndex(x, z, y); if (tileEntities.containsKey(tileEntityIndex)) { tileEntities.remove(tileEntityIndex).destroy(); } int index = section.index(x, y, z); if (type == 0) { if(section.types[index] != 0) { section.count--; } } else { if(section.types[index] == 0) { section.count++; } } section.types[index] = (char) (type << 4); if (type == 0 && section.count == 0) { sections[y / SEC_DEPTH] = null; return; } createEntity(x, y, z, type); }
Source:
<code>public long addTaskStarted(Task task, Map<String, Object> parameters) { int totalActions = task.getActions().size(); TaskActivity activity = taskActivitiesDataService.create( <START> new TaskActivity(TASK_IN_PROGRESS, Arrays.asList("0", String.valueOf(totalActions)), task.getId(), TaskActivityType.IN_PROGRESS, null, parameters, totalActions)); <END> return activity.getId(); }</code><technical_language>saving "0" totalActions count</technical_language>

Target:
public long addTaskStarted(Task task, Map<String, Object> parameters) { int totalActions = task.getActions().size(); TaskActivity activity = taskActivitiesDataService.create( new TaskActivity(TASK_IN_PROGRESS, Arrays.asList("0", String.valueOf(totalActions)), task.getId(), TaskActivityType.IN_PROGRESS, null, parameters, new TaskExecutionProgress(totalActions))); return activity.getId(); }
Source:
<code>public boolean editUserText(String fullname, String text) throws ActionFailedException { JSONObject object = (JSONObject) restClient.post( "thing_id=" + fullname + "&text=" + text + "&uh=" + user.getModhash(), ApiEndpointUtils.EDITUSERTEXT, user.getCookie() ).getResponseObject(); <START> if (object.toJSONString().contains(".error.USER_REQUIRED")) { <END> System.err.println("User is required for this action."); return false; } else if (object.toJSONString().contains(".error.NOT_AUTHOR")) { System.err.println("User is not the author of this thing."); return false; } else if (object.toJSONString().contains(".error.TOO_LONG")) { System.err.println("The text is too long."); return false; } else if (object.toJSONString().contains(".error.NO_TEXT")) { System.err.println("Missing text."); return false; } else { return true; } }</code><technical_language>a local variable JSON String call times object.toJSONString(). this: String responseAsString = object.toJSONString(); of variable declared. for returns if successful not, a boolean variable set variable if not. Example: boolean successful = true; if (responseAsTring.contains(".error.NOT_AUTHOR")) { successful = false; } .... return successful; chained if's. I in other places in code of switch case. I making of .contains(). response else ".error.NOT_AUTHOR", for instance</technical_language>

Target:
public boolean editUserText(String fullname, String text) throws ActionFailedException { JSONObject object = (JSONObject) restClient.post( "thing_id=" + fullname + "&text=" + text + "&uh=" + user.getModhash(), ApiEndpointUtils.EDITUSERTEXT, user.getCookie() ).getResponseObject(); String responseAsString = object.toJSONString(); if (responseAsString.contains(".error.USER_REQUIRED")) { System.err.println("User is required for this action."); return false; } else if (responseAsString.contains(".error.NOT_AUTHOR")) { System.err.println("User is not the author of this thing."); return false; } else if (responseAsString.contains(".error.TOO_LONG")) { System.err.println("The text is too long."); return false; } else if (responseAsString.contains(".error.NO_TEXT")) { System.err.println("Missing text."); return false; } else { return true; } }
Source:
<code>public void testTaggedVersionListenerHandleRemovedDocuments() { DocumentModel doc = session.createDocumentModel("/", "doc", "File"); doc = session.createDocument(doc); <START> session.save(); <END> DocumentRef version = session.checkIn(doc.getRef(), VersioningOption.MAJOR, "checked in !"); doc = session.restoreToVersion(doc.getRef(), version); session.removeDocument(doc.getRef()); txFeature.nextTransaction(); assertTrue(logCaptureResult.getCaughtEventMessages().isEmpty()); }</code><technical_language>this is strictly necessary, @efge</technical_language>

Target:
public void testTaggedVersionListenerHandleRemovedDocuments() { DocumentModel doc = session.createDocumentModel("/", "doc", "File"); doc = session.createDocument(doc); DocumentRef version = session.checkIn(doc.getRef(), VersioningOption.MAJOR, "checked in !"); doc = session.restoreToVersion(doc.getRef(), version); session.removeDocument(doc.getRef()); txFeature.nextTransaction(); assertTrue(logCaptureResult.getCaughtEventMessages().isEmpty()); }
Source:
<code>public static void flashOff() { <START> Log.d(TAG, "flashOff()"); <END> if (!isAvailable()) { return; } CameraManager.getInstance().setFlashParams(paramsOff); currentFlashValue = false; }</code><technical_language>another log removed (I part of commit, please do anyway)</technical_language>

Target:
public static void flashOff() { if (!isAvailable()) { return; } CameraManager.getInstance().setFlashParams(paramsOff); currentFlashValue = false; }
Source:
<code>public InvokeMethodRunnable(ITestNGMethod thisMethod, Object instance, Object[] parameters, IHookable hookable, ITestResult testResult) { m_method = thisMethod; m_instance = instance; m_parameters = parameters; <START> this.hookable = hookable; <END> this.testResult = testResult; }</code><technical_language>called m_hookable m_testResult, more need for this.</technical_language>

Target:
public InvokeMethodRunnable(ITestNGMethod thisMethod, Object instance, Object[] parameters, IHookable hookable, ITestResult testResult) { m_method = thisMethod; m_instance = instance; m_parameters = parameters; m_hookable = hookable; m_testResult = testResult; }
Source:
<code><START> private List<Object[]> getUserListCore(String searchTerm, String sortKey, Integer resultLimit, Integer offset) { <END> if ((sortKey == null) || (sortKey.isEmpty())){ sortKey = "u.username"; }else{ sortKey = "u." + sortKey; } if ((resultLimit == null)||(resultLimit < 1)){ resultLimit = 1; } if ((searchTerm==null)||(searchTerm.isEmpty())){ searchTerm = ""; } if ((offset == null)||(offset < 0)){ offset = 0; } searchTerm = searchTerm.trim(); String sharedSearchClause = ""; if (!searchTerm.isEmpty()) { sharedSearchClause = " AND " + getSharedSearchClause(); } String qstr = "SELECT u.id, u.useridentifier,"; qstr += " u.lastname, u.firstname, u.email,"; qstr += " u.affiliation, u.superuser,"; qstr += " u.position, u.modificationtime,"; qstr += " prov.id, prov.factoryalias"; qstr += " FROM authenticateduser u,"; qstr += " authenticateduserlookup prov_lookup,"; qstr += " authenticationproviderrow prov"; qstr += " WHERE"; qstr += " u.id = prov_lookup.authenticateduser_id"; qstr += " AND prov_lookup.authenticationproviderid = prov.id"; qstr += sharedSearchClause; qstr += " ORDER BY u.useridentifier"; qstr += " LIMIT " + resultLimit; qstr += " OFFSET " + offset; qstr += ";"; logger.log(Level.FINE, "getUserCount: {0}", qstr); Query nativeQuery = em.createNativeQuery(qstr); nativeQuery.setParameter("searchTerm", searchTerm + "%"); return nativeQuery.getResultList(); }</code><technical_language>Is a reason Integers ints</technical_language>

Target:
private List<Object[]> getUserListCore(String searchTerm, String sortKey, Integer resultLimit, Integer offset) { if ((sortKey == null) || (sortKey.isEmpty())){ sortKey = "u.username"; }else{ sortKey = "u." + sortKey; } if ((resultLimit == null)||(resultLimit < 1)){ resultLimit = 1; } if ((searchTerm==null)||(searchTerm.isEmpty())){ searchTerm = ""; } if ((offset == null)||(offset < 0)){ offset = 0; } searchTerm = searchTerm.trim(); String sharedSearchClause = ""; if (!searchTerm.isEmpty()) { sharedSearchClause = " AND " + getSharedSearchClause(); } String qstr = "SELECT u.id, u.useridentifier,"; qstr += " u.lastname, u.firstname, u.email,"; qstr += " u.affiliation, u.superuser,"; qstr += " u.position,"; qstr += " u.createdtime, u.lastlogintime, u.lastapiusetime, "; qstr += " prov.id, prov.factoryalias"; qstr += " FROM authenticateduser u,"; qstr += " authenticateduserlookup prov_lookup,"; qstr += " authenticationproviderrow prov"; qstr += " WHERE"; qstr += " u.id = prov_lookup.authenticateduser_id"; qstr += " AND prov_lookup.authenticationproviderid = prov.id"; qstr += sharedSearchClause; qstr += " ORDER BY u.useridentifier"; qstr += " LIMIT " + resultLimit; qstr += " OFFSET " + offset; qstr += ";"; logger.log(Level.FINE, "getUserCount: {0}", qstr); Query nativeQuery = em.createNativeQuery(qstr); nativeQuery.setParameter("searchTerm", searchTerm + "%"); return nativeQuery.getResultList(); }
Source:
<code>public void presentAnnotationIsAvailable() { TestClass tc = new TestClass(AnnotatedClass.class); Annotation annotation = tc.getAnnotation(Ignore.class); <START> assertThat(annotation, isA((Class)Ignore.class)); <END> }</code><technical_language>style-nit: space cast operator (or previous suggestion)</technical_language>

Target:
public void presentAnnotationIsAvailable() { TestClass tc = new TestClass(AnnotatedClass.class); Annotation annotation = tc.getAnnotation(Ignore.class); assertTrue(Ignore.class.isAssignableFrom(annotation.getClass())); }
Source:
<code>private String getFullKey(String site, String key) { <START> StringBuffer sb = new StringBuffer(); <END> if (prefix != null) { sb.append(prefix); sb.append(separator); } if (site != null) { sb.append(site.substring(site.indexOf(":")+3)); } else { sb.append(GLOBAL_KEY); } sb.append(separator); sb.append(key); return sb.toString().replace(":", "-"); }</code><technical_language>StringBuilder instead</technical_language>

Target:
private String getFullKey(String site, String key) { StringBuilder sb = new StringBuilder(); if (prefix != null) { sb.append(prefix); sb.append(separator); } if (site != null) { sb.append(site.substring(site.indexOf(':')+3)); } else { sb.append(GLOBAL_KEY); } sb.append(separator); sb.append(key); return sb.toString().replace(":", "-"); }
Source:
<code>private int mapSQLStateToXAErrorCode(SQLException sqlException) { <START> if (isPostgreSQLIntegrityConstraintViolation(sqlException)) { <END> return XAException.XA_RBROLLBACK; } return XAException.XAER_RMFAIL; }</code><technical_language>Is reason integrity constraint violation exceptions treated special</technical_language>

Target:
private int mapSQLStateToXAErrorCode(SQLException sqlException) { if (isPostgreSQLIntegrityConstraintViolation(sqlException)) { return XAException.XA_RBINTEGRITY; } return XAException.XAER_RMFAIL; }
Source:
<code>public void validTest() throws Exception { String mimetype = "text/plain"; String checksumPrefix = "urn:sha1:"; String checksum = "61673dacf6c6eea104e77b151584ed7215388ea3"; Model model = ModelFactory.createDefaultModel(); Resource resc = model.createResource(RESC_ID); resc.addProperty(RDF.type, Fcrepo4Repository.Binary); resc.addProperty(Ebucore.hasMimeType, mimetype); resc.addProperty(Premis.hasMessageDigest, checksumPrefix + checksum); setMessageBody(model); processor.process(exchange); <START> verify(message).setHeader("CdrChecksum", checksum); <END> verify(message).setHeader("CdrMimeType", mimetype); verify(message).setHeader("CdrBinaryPath", BINARY_BASE + "61/67/3d/" + checksum); }</code><technical_language>constants for this is constants supposed protect from, lets switch this constants :)</technical_language>

Target:
public void validTest() throws Exception { String mimetype = "text/plain"; String checksumPrefix = "urn:sha1:"; String checksum = "61673dacf6c6eea104e77b151584ed7215388ea3"; Model model = ModelFactory.createDefaultModel(); Resource resc = model.createResource(RESC_ID); resc.addProperty(RDF.type, Fcrepo4Repository.Binary); resc.addProperty(Ebucore.hasMimeType, mimetype); resc.addProperty(Premis.hasMessageDigest, checksumPrefix + checksum); setMessageBody(model); processor.process(exchange); verify(message).setHeader(CdrBinaryChecksum, checksum); verify(message).setHeader(CdrBinaryMimeType, mimetype); verify(message).setHeader(CdrBinaryPath, BINARY_BASE + "61/67/3d/" + checksum); }
Source:
<code>public void update() { deltaManager.tick(); if(worldObj.isRemote) { return; } if(currentRecipe != null) { ItemStack resultStack = invResult.getStackInSlot(0); if(resultStack == null || currentRecipe.getRecipeOutput().stackSize + resultStack.stackSize <= currentRecipe.getRecipeOutput().getMaxStackSize()) { if(tryUseMaterials()) { if(resultStack != null) { if(StackUtil.canMerge(resultStack, currentRecipe.getRecipeOutput())) { resultStack.stackSize += currentRecipe.getRecipeOutput().stackSize; } } else { resultStack = currentRecipe.getRecipeOutput().copy(); } } } invResult.setStackInSlot(0, resultStack); <START> } <END> }</code><technical_language>a lot more complicated this - call IRecipe.getRemainingItems IRecipe.getCraftingResult properly craft recipe custom recipe handlers do things. is of bindings in</technical_language>

Target:
public void update() { deltaManager.tick(); if (getWorld().isRemote) { return; } moveOverflowDown(); updateRecipe(); if (hasMaterialsForRecipe()) { if (progress == 0) { deltaProgress.addDelta(0, 200, 100); deltaProgress.addDelta(200, 205, -100); } if (progress < 200) { progress++; return; } if (invOverflow.getStackInSlot(1) == null) { ItemStack out = crafting.craft(); ItemStack leftOver = invResult.insertItem(0, out, false); InvUtils.dropItems(getWorld(), leftOver, getPos()); progress = 0; } } else if (progress != -1) { progress = -1; deltaProgress.setValue(0); } }
Source:
<code>private TimestampData convertToTimestamp(Object object) { final long millis; if (object instanceof Long) { millis = (Long) object; } else { final DateTime value = (DateTime) object; millis = value.toDate().getTime(); } <START> return TimestampData.fromEpochMillis(millis - LOCAL_TZ.getOffset(millis)); <END> }</code><technical_language>need LOCAL_TZ offset for TimestampData, millis is epoch milliseconds</technical_language>

Target:
private TimestampData convertToTimestamp(Object object) { final long millis; if (object instanceof Long) { millis = (Long) object; } else { final DateTime value = (DateTime) object; millis = value.toDate().getTime(); } return toTimestampData(millis); }
Source:
<code>public JsonInstanceSerializer(Class<T> payloadClass) { <START> this(payloadClass, false, false); <END> }</code><technical_language>this approach imply moving Curator 2.12.x requires change code base break compatibility? default in compatibility mode? upgrade 2.12.x work, need change code base pick fix for CURATOR-275</technical_language>

Target:
public JsonInstanceSerializer(Class<T> payloadClass) { this(payloadClass, true, false); }
Source:
<code>private static DatatypeFactory getDatatypeFactory() { if (datatypeFactory == null) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException dce) { log.warn(DATATYPE_FACTORY_CREATION_FAILED, dce.getMessage()); <START> log.debug("Exception", dce); <END> } } return datatypeFactory; }</code><technical_language>stack trace level message</technical_language>

Target:
private static DatatypeFactory getDatatypeFactory() { if (datatypeFactory == null) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException dce) { log.warn(DATATYPE_FACTORY_CREATION_FAILED, dce); } } return datatypeFactory; }
Source:
<code>public DefaultLogBuilder(Logger logger, Level level) { this.logger = logger; this.level = level; this.inUse = false; this.threadId = Thread.currentThread().getId(); <START> this.inUse = true; <END> }</code><technical_language>inUse is set in this constructor</technical_language>

Target:
public DefaultLogBuilder(Logger logger, Level level) { this.logger = logger; this.level = level; this.threadId = Thread.currentThread().getId(); this.inUse = true; }
Source:
<code>public static NullTypes copyOrUpdate(Realm realm, NullTypes object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( <START> "Objects belonging to Realm instances in other threads cannot be copied into this Realm instance."); <END> } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } return copy(realm, object, update, cache); }</code><technical_language>"belonging" -> "which belong"</technical_language>

Target:
public static NullTypes copyOrUpdate(Realm realm, NullTypes object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( "Objects which belong to Realm instances in other threads cannot be copied into this Realm instance."); } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } return copy(realm, object, update, cache); }
Source:
<code>private void populatePanes(LabelPickerState state) { populateAssignedLabels(state.getInitialLabels(), state.getRemovedLabels(), state.getAddedLabels(), <START> state.getCurrentSuggestion()); <END> populateFeedbackLabels(state.getAssignedLabels(), state.getMatchedLabels(), state.getCurrentSuggestion()); getDialogPane().getScene().getWindow().sizeToScene(); }</code><technical_language>Indent this improve readability. populateAssignedLabels(state.getInitialLabels(), state.getRemovedLabels(), state.getAddedLabels(), state.getCurrentSuggestion());</technical_language>

Target:
private final void populatePanes(LabelPickerState state) { populateAssignedLabels(state.getInitialLabels(), state.getRemovedLabels(), state.getAddedLabels(), state.getCurrentSuggestion()); populateFeedbackLabels(state.getAssignedLabels(), state.getMatchedLabels(), state.getCurrentSuggestion()); getDialogPane().getScene().getWindow().sizeToScene(); }