auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void repartitionTopology(final String eventTypeName, final int newPartitionsCount) throws NakadiRuntimeException { final Topology currentTopology = getTopology(); final List<Partition> partitionsList = Lists.newArrayList(currentTopology.getPartitions()); final List<Partition> newPartitionsList = new ArrayList<>(); <START> for (final Partition partition : partitionsList) { <END> if (!partition.getEventType().equals(eventTypeName)) { newPartitionsList.add( partition.toState(Partition.State.UNASSIGNED, null, null)); } } for (int index=0; index < newPartitionsCount; index++) { final String partition = String.valueOf(index); newPartitionsList.add(new Partition( eventTypeName, partition, null, null, Partition.State.UNASSIGNED )); try { getCurator().create().creatingParentsIfNeeded().forPath( getOffsetPath(new EventTypePartition(eventTypeName, partition))); } catch (final Exception e) { throw new NakadiRuntimeException(e); } } final Topology partitionedTopology = new Topology( newPartitionsList.toArray(new Partition[0]), currentTopology.getSessionsHash(), Optional.ofNullable(currentTopology.getVersion()).map(v -> v+1).orElse(0) ); try { getLog().info("Updating topology due to repartitioning event type: to {}", eventTypeName, partitionedTopology); getCurator().setData().forPath(getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(partitionedTopology)); } catch (final Exception exception) { throw new NakadiRuntimeException(exception); } }</code><technical_language>do set current partitions in unassigned state</technical_language>

Target:
public void repartitionTopology(final String eventTypeName, final int newPartitionsCount) throws NakadiRuntimeException { final Topology currentTopology = getTopology(); final List<Partition> partitionsList = Lists.newArrayList(currentTopology.getPartitions()); final int oldPartitionsCount = (int) partitionsList.stream(). filter(partition -> partition.getEventType().equals(eventTypeName)).count(); for (int index=oldPartitionsCount; index < newPartitionsCount; index++) { final String partition = String.valueOf(index); partitionsList.add(new Partition( eventTypeName, partition, null, null, Partition.State.UNASSIGNED )); try { getCurator().create().creatingParentsIfNeeded().forPath( getOffsetPath(new EventTypePartition(eventTypeName, partition))); } catch (final Exception e) { throw new NakadiRuntimeException(e); } } final Topology partitionedTopology = new Topology( partitionsList.toArray(new Partition[0]), currentTopology.getSessionsHash(), Optional.ofNullable(currentTopology.getVersion()).map(v -> v+1).orElse(0) ); try { getLog().info("Updating topology due to repartitioning event type: to {}", eventTypeName, partitionedTopology); getCurator().setData().forPath(getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(partitionedTopology)); } catch (final Exception exception) { throw new NakadiRuntimeException(exception); } }
Source:
<code>public void addContent(HttpContent httpContent) throws ClosedChannelException { <START> if (!RestMethod.POST.equals(getRestMethod()) && (!(httpContent instanceof LastHttpContent) <END> || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { NettyContent nettyContent = new NettyContent(httpContent); try { contentLock.lock(); if (!isOpen()) { throw new ClosedChannelException(); } requestContents.add(nettyContent); nettyContent.retain(); } finally { contentLock.unlock(); } } }</code><technical_language>more intuitive write if (getRestMethod().equals(RestMethod.POST))</technical_language>

Target:
public void addContent(HttpContent httpContent) throws ClosedChannelException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { NettyContent nettyContent = new NettyContent(httpContent); contentLock.lock(); try { if (!isOpen()) { throw new ClosedChannelException(); } requestContents.add(nettyContent); nettyContent.retain(); } finally { contentLock.unlock(); } } }
Source:
<code>protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); Drawable drawable = getTopLevelDrawable(); if (drawable != null) { <START> drawable.setBounds(0, 0, w, h); <END> } }</code><technical_language>this account for potential padding set view. need account for too</technical_language>

Target:
protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); Drawable drawable = getTopLevelDrawable(); if (drawable != null) { drawable.setBounds(getPaddingLeft(), getPaddingTop(), w - getPaddingLeft() - getPaddingRight(), h - getPaddingTop() - getPaddingBottom()); } }
Source:
<code>private boolean isDeletionInProgress(EnvironmentStatus environmentStatus) { <START> Collection<EnvironmentStatus> deleteInProgressStatuses = List.of(DELETE_INITIATED, NETWORK_DELETE_IN_PROGRESS, RDBMS_DELETE_IN_PROGRESS, <END> FREEIPA_DELETE_IN_PROGRESS, CLUSTER_DEFINITION_CLEANUP_PROGRESS, UMS_RESOURCE_DELETE_IN_PROGRESS, IDBROKER_MAPPINGS_DELETE_IN_PROGRESS, S3GUARD_TABLE_DELETE_IN_PROGRESS, DATAHUB_CLUSTERS_DELETE_IN_PROGRESS, DATALAKE_CLUSTERS_DELETE_IN_PROGRESS, PUBLICKEY_DELETE_IN_PROGRESS); return deleteInProgressStatuses.contains(environmentStatus); }</code><technical_language>Please a set</technical_language>

Target:
private boolean isDeletionInProgress(EnvironmentStatus environmentStatus) { Set<EnvironmentStatus> deleteInProgressStatuses = Set.of(DELETE_INITIATED, NETWORK_DELETE_IN_PROGRESS, RDBMS_DELETE_IN_PROGRESS, FREEIPA_DELETE_IN_PROGRESS, CLUSTER_DEFINITION_CLEANUP_PROGRESS, UMS_RESOURCE_DELETE_IN_PROGRESS, IDBROKER_MAPPINGS_DELETE_IN_PROGRESS, S3GUARD_TABLE_DELETE_IN_PROGRESS, DATAHUB_CLUSTERS_DELETE_IN_PROGRESS, DATALAKE_CLUSTERS_DELETE_IN_PROGRESS, PUBLICKEY_DELETE_IN_PROGRESS); return deleteInProgressStatuses.contains(environmentStatus); }
Source:
<code>private Map<String, IPageTypeCategoryRole> getTypeNameToCategoryMapIncludeDeprecated() { loadTypeNameToCategoryMap(); ConcurrentMap<String, IPageTypeCategoryRole> completeMap = typeNameToCatCacheDeprecated; <START> completeMap.putAll(typeNameToCatCache); <END> return Collections.unmodifiableMap(completeMap); }</code><technical_language>getAllTypeNames instead of getDeprecatedNames: this readding is needed</technical_language>

Target:
private Map<String, IPageTypeCategoryRole> getTypeNameToCategoryMapIncludeDeprecated() { loadTypeNameCategoryMaps(); return Collections.unmodifiableMap(typeNameToCatCacheDeprecated); }
Source:
<code>public void testModifyTable() throws IOException { TableName tableName = sharedTestEnv.newTestTableName(); sharedTestEnv.createTable(tableName); try(Admin admin = getConnection().getAdmin(); Table table = getConnection().getTable(tableName)) { <START> byte[] rowKey = dataHelper.randomData("testrow-"); <END> byte[] qual = dataHelper.randomData("qual-"); byte[] value = dataHelper.randomData("value-"); Put put = new Put(rowKey); put.addColumn(COLUMN_FAMILY, qual, 1L, value); put.addColumn(COLUMN_FAMILY, qual, 2L, value); table.put(put); assertTrue(table.exists(new Get(rowKey))); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY2)); modifyTable(descriptor); assertTrue(admin.tableExists(tableName)); assertTrue(admin.getTableDescriptor(tableName).hasFamily(COLUMN_FAMILY2)); admin.disableTable(tableName); admin.deleteTable(tableName); } }</code><technical_language>Please remove testing of data, including Puts</technical_language>

Target:
public void testModifyTable() throws IOException { TableName tableName = sharedTestEnv.newTestTableName(); sharedTestEnv.createTable(tableName); try(Admin admin = getConnection().getAdmin(); Table table = getConnection().getTable(tableName)) { HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY2)); modifyTable(descriptor); assertTrue(admin.tableExists(tableName)); assertTrue(admin.getTableDescriptor(tableName).hasFamily(COLUMN_FAMILY2)); assertEquals(1, admin.getTableDescriptor(tableName).getColumnFamilies().length); admin.disableTable(tableName); admin.deleteTable(tableName); } }
Source:
<code>public void testVerifySignatureFailWhenSignatureDoesntMatch() { <START> NotificationRequestSignatureVerifier impl = new NotificationRequestSignatureVerifier("someApiSecret"); <END> boolean actual = impl.verifySignature( "{}", "0", "notMatchingForSure"); assertFalse(actual); }</code><technical_language>impl? called more specific (e.g. verifier), abstract/interface impl involved</technical_language>

Target:
public void testVerifySignatureFailWhenSignatureDoesntMatch() { NotificationRequestSignatureVerifier verifier = new NotificationRequestSignatureVerifier("someApiSecret"); boolean actual = verifier.verifySignature( "{}", "0", "notMatchingForSure"); assertFalse(actual); }
Source:
<code>private void createRecoveryCommand(final UUID jobId) { <START> RecoveryJob recoveryJob = new RecoveryJob(BulkJobType.PUT_BULK); <END> recoveryJob.setBucketName(bucketName); recoveryJob.setId(jobId); recoveryJob.setNumberOfThreads(numberOfThreads); recoveryJob.setDirectory(inputDirectory); if(!Guard.isStringNullOrEmpty(prefix)) { recoveryJob.setPrefix(ImmutableList.of(prefix)); } if (!RecoveryFileManager.writeRecoveryJob(recoveryJob)) { LOG.info("Could not create recovery file in temporary space."); } }</code><technical_language>Missing final</technical_language>

Target:
private void createRecoveryCommand(final UUID jobId) { final RecoveryJob recoveryJob = new RecoveryJob(BulkJobType.PUT_BULK); recoveryJob.setBucketName(bucketName); recoveryJob.setId(jobId); recoveryJob.setNumberOfThreads(numberOfThreads); recoveryJob.setDirectory(inputDirectory); if(!Guard.isStringNullOrEmpty(prefix)) { recoveryJob.setPrefix(ImmutableList.of(prefix)); } if (!RecoveryFileManager.writeRecoveryJob(recoveryJob)) { LOG.info("Could not create recovery file in temporary space."); } }
Source:
<code>private static void decodeObjectSecurity(Message message, Encrypt0Message enc) throws OSException { byte[] total = message.getOptions().getOscore(); byte flagByte = total[0]; int n = flagByte & 0x07; int k = flagByte & 0x08; int h = flagByte & 0xa6; byte[] partialIV = null; byte[] kid = null; int index = 1; if (n > 0) { try { partialIV = Arrays.copyOfRange(total, index, index + n); index += n; } catch (Exception e) { LOGGER.severe("Partial_IV is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } if (h == 16) { int s = total[index]; index += 1; if (s > 0) { LOGGER.severe("Kidcontext is included, but it is not supported. We ignore it and continue processing."); } else { LOGGER.severe("Kid context is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } if (k == 8) { kid = Arrays.copyOfRange(total, index, total.length); } else { <START> if(message instanceof Request){ <END> LOGGER.severe("Kid is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } try { if (partialIV != null) enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); if (kid != null) enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(kid), Attribute.UNPROTECTED); } catch (CoseException e) { e.printStackTrace(); } }</code><technical_language>whitespace</technical_language>

Target:
private static void decodeObjectSecurity(Message message, Encrypt0Message enc) throws OSException { byte[] total = message.getOptions().getOscore(); byte flagByte = total[0]; int n = flagByte & 0x07; int k = flagByte & 0x08; int h = flagByte & 0xa6; byte[] partialIV = null; byte[] kid = null; int index = 1; if (n > 0) { try { partialIV = Arrays.copyOfRange(total, index, index + n); index += n; } catch (Exception e) { LOGGER.error("Partial_IV is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } if (h == 16) { int s = total[index]; index += 1; if (s > 0) { LOGGER.error("Kidcontext is included, but it is not supported. We ignore it and continue processing."); } else { LOGGER.error("Kid context is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } if (k == 8) { kid = Arrays.copyOfRange(total, index, total.length); } else { if (message instanceof Request) { LOGGER.error("Kid is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } try { if (partialIV != null) enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); if (kid != null) enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(kid), Attribute.UNPROTECTED); } catch (CoseException e) { e.printStackTrace(); } }
Source:
<code>public URL getResource(String name, Iterable<String> bundleUrlsOrNameVersionString) { for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { URL result = bundle.get().getResource(name); if (result!=null) return result; } <START> } catch (Throwable e) { <END> Exceptions.propagateIfFatal(e); } } return null; }</code><technical_language>catch Exception instead of Throwable? behavioural difference, is practice possible</technical_language>

Target:
public URL getResource(String name, Iterable<String> bundleUrlsOrNameVersionString) { for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { URL result = bundle.get().getResource(name); if (result!=null) return result; } } catch (Exception e) { Exceptions.propagateIfFatal(e); } } return null; }
Source:
<code>public UnfoldEntityTraversal<Vertex, Vertex> unfold(User entity) { String storedUserId = Vertices.USER + ":" + UUID.randomUUID().toString(); EntityTraversal<Vertex, Vertex> userRoleTraversal = __.identity(); EntityTraversal<Vertex, Vertex> unfoldTraversal = __.identity(); if (entity.getNativeId() != null) { unfoldTraversal.V(entity.getNativeId()) .sideEffect(__.outE(Edges.USER_HAS_USER_ROLES).drop()); } for (UserRole userRole : entity.getRoles()) { userRoleTraversal = userRoleTraversal.V(userRole) .saveV(userRole.getUuid(), userRoleAdapter.unfold(userRole)); userRoleTraversal = userRoleTraversal.addE(Edges.USER_HAS_USER_ROLES) .from(__.<Vertex, Vertex>select(storedUserId).unfold()) .inV(); userRoleTraversal = userRoleTraversal.inE(Edges.USER_HAS_USER_ROLES).outV(); } unfoldTraversal = unfoldTraversal.map(unfoldUser(entity)) .store(storedUserId) <START> .flatMap(userRoleTraversal) <END> .fold() .map(t -> t.get().iterator().next()); return new UnfoldEntityTraversal<>(Vertices.USER, entity, unfoldTraversal); }</code><technical_language>map instead of flatMap</technical_language>

Target:
public UnfoldEntityTraversal<Vertex, Vertex> unfold(User entity) { String storedUserId = Vertices.USER + ":" + UUID.randomUUID().toString(); EntityTraversal<Vertex, Vertex> userRoleTraversal = __.identity(); EntityTraversal<Vertex, Vertex> unfoldTraversal = __.identity(); unfoldTraversal.sideEffect(__.outE(Edges.USER_HAS_SECURITY_ROLES).drop()); for (SecurityRole securityRole : entity.getRoles()) { userRoleTraversal = userRoleTraversal.V(securityRole) .saveV(securityRole.getUuid(), securityRoleAdapter.unfold(securityRole)); userRoleTraversal = userRoleTraversal.addE(Edges.USER_HAS_SECURITY_ROLES) .from(__.<Vertex, Vertex>select(storedUserId).unfold()) .inV(); userRoleTraversal = userRoleTraversal.inE(Edges.USER_HAS_SECURITY_ROLES).outV(); } unfoldTraversal = unfoldTraversal.map(unfoldUser(entity)) .store(storedUserId) .map(userRoleTraversal); return new UnfoldEntityTraversal<>(Vertices.USER, entity, unfoldTraversal); }
Source:
<code><START> public boolean equals(Object o) { <END> if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; return Objects.equals(other.objectId, objectId) && Objects.equals(other.ObjectType, ObjectType) && Objects.equals(other.actionGroup, actionGroup); } return false; }</code><technical_language>This is missing: if (this == obj) { return true; }</technical_language>

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; return Objects.equals(other.objectId, objectId) && Objects.equals(other.ObjectType, ObjectType) && Objects.equals(other.actionGroup, actionGroup); } return false; }
Source:
<code>public String createVolume(int sizeGB, String snapshotId) { IaasProvider iaasInfo = getIaasProvider(); ComputeServiceContext context = iaasInfo.getComputeService() .getContext(); String zone = ComputeServiceBuilderUtil.extractZone(iaasInfo); String diskOfferingID = iaasInfo.getTemplate().getOptions().as(CloudStackTemplateOptions.class) .getDiskOfferingId(); if (zone == null && diskOfferingID == null) { log.fatal("Cannot create a new volume in the , [zone] : " + zone + " of Iaas : " + iaasInfo); return null; } VolumeApi volumeApi = context.unwrapApi(CloudStackApi.class).getVolumeApi(); Volume volume; if (StringUtils.isEmpty(snapshotId)) { if (log.isDebugEnabled()) { <START> log.info("Creating a volume in the zone " + zone); <END> } volumeApi.createVolumeFromCustomDiskOfferingInZone(null, diskOfferingID, zone, sizeGB); } else { if (log.isDebugEnabled()) { log.info("Creating a volume in the zone " + zone + " from the snapshot " + snapshotId); } volumeApi.createVolumeFromSnapshotInZone(null, diskOfferingID, zone); } return null; }</code><technical_language>a isDebugEnabled() do info log? :) Change log.debug</technical_language>

Target:
public String createVolume(int sizeGB, String snapshotId) { IaasProvider iaasInfo = getIaasProvider(); ComputeServiceContext context = iaasInfo.getComputeService() .getContext(); String zone = ComputeServiceBuilderUtil.extractZone(iaasInfo); String diskOfferingID = iaasInfo.getTemplate().getOptions().as(CloudStackTemplateOptions.class) .getDiskOfferingId(); if (zone == null && diskOfferingID == null) { log.error("Could not create a volume in the , [zone] : " + zone + " of Iaas : " + iaasInfo); return null; } VolumeApi volumeApi = context.unwrapApi(CloudStackApi.class).getVolumeApi(); Volume volume; if (StringUtils.isEmpty(snapshotId)) { if (log.isInfoEnabled()) { log.info("Creating a volume in the zone " + zone); } volumeApi.createVolumeFromCustomDiskOfferingInZone(null, diskOfferingID, zone, sizeGB); } else { if (log.isInfoEnabled()) { log.info("Creating a volume in the zone " + zone + " from the snapshot " + snapshotId); } volumeApi.createVolumeFromSnapshotInZone(null, diskOfferingID, zone); } return null; }
Source:
<code>public LinuxKDEWalletKeychainAccessImpl() { try { connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION); } catch (DBusException e) { <START> LOG.error(e.toString(), e.getCause()); <END> } }</code><technical_language>e.toString() of time is give happened exception. If security constraints thrown, print over: LOG.error("Connection acquired because:", e); - yes, space : need parametrize field :wink:</technical_language>

Target:
public LinuxKDEWalletKeychainAccessImpl() throws KeychainAccessException { try { connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION); } catch (DBusException e) { LOG.error("Connecting to D-Bus failed:", e); throw new KeychainAccessException(e); } }
Source:
<code><START> public Degree getDegree() { <END> return ((DegreeUnit) getDelegateFunction().getFunction().getUnit()).getDegree(); }</code><technical_language>change visibility of getDegree in this case</technical_language>

Target:
protected Degree getDegree() { return ((DegreeUnit) getDelegateFunction().getFunction().getUnit()).getDegree(); }
Source:
<code>public Object executeEvaluated(final VirtualFrame frame, final Object receiver) { SImmutableObject rcvr = (SImmutableObject) receiver; boolean allFieldsContainValues = allFieldsContainValues(rcvr); if (allFieldsContainValues) { return rcvr; } return thrower.execute(rcvr); <START> <END> }</code><technical_language>unnecessary blank line</technical_language>

Target:
public Object executeEvaluated(final VirtualFrame frame, final Object receiver) { SImmutableObject rcvr = (SImmutableObject) receiver; boolean allFieldsContainValues = allFieldsContainValues(rcvr); if (allFieldsContainValues) { return rcvr; } return notAValue.signal(rcvr); }
Source:
<code>public void testGetReadOnlyColumn() { <START> generator.registerColumn(pagedTable, callback,true); <END> verify(generator, never()).getEditableColumn(pagedTable, callback); verify(generator).getReadOnlyColumn(); verify(translationService).getTranslation(FormRenderingConstants.EditableColumnGeneratorValueHeader); ArgumentCaptor<Column> columnArgumentCaptor = ArgumentCaptor.forClass(Column.class); verify(pagedTable).addColumn(columnArgumentCaptor.capture(), anyString()); Column column = columnArgumentCaptor.getValue(); assertNotNull(column); assertNull(column.getFieldUpdater()); }</code><technical_language>is a lot of code repeating - extracted a method.</technical_language>

Target:
public void testGetReadOnlyColumn() { testGetColumn(true); }
Source:
<code>public DefaultLeaderElectionService(LeaderElectionDriverFactory leaderElectionDriverFactory) { <START> this.leaderElectionDriverFactory = leaderElectionDriverFactory; <END> leaderContender = null; issuedLeaderSessionID = null; confirmedLeaderSessionID = null; confirmedLeaderAddress = null; running = false; }</code><technical_language>minor: null check</technical_language>

Target:
public DefaultLeaderElectionService(LeaderElectionDriverFactory leaderElectionDriverFactory) { this.leaderElectionDriverFactory = checkNotNull(leaderElectionDriverFactory); leaderContender = null; issuedLeaderSessionID = null; confirmedLeaderSessionID = null; confirmedLeaderAddress = null; running = false; }
Source:
<code>private static int getSize(final String propertyKey, final int defaultValue) { <START> final String propString = getProperty(propertyKey); <END> if (propString != null) { return parseSize(propertyKey, propString); } else { return defaultValue; } }</code><technical_language>propValue is a name propString in long overload</technical_language>

Target:
private static int getSize(final String propertyKey, final int defaultValue) { final String propertyValue = getProperty(propertyKey); if (propertyValue != null) { final long sizeAsLong = parseSize(propertyKey, propertyValue); if (0 <= sizeAsLong && sizeAsLong <= Integer.MAX_VALUE) { return (int)sizeAsLong; } else { throw new ConfigurationException("Value " + sizeAsLong + " for property " + propertyKey + " is too large, must be " + 0 + " <= " + propertyKey + " <= " + Integer.MAX_VALUE); } } else { return defaultValue; } }
Source:
<code>public void unfixLines(final Set<Integer> gids) { final List<Germplasm> listOfGermplasmWithGroup = this.germplasmDataManager.getGermplasmWithGroup(new ArrayList<Integer>(gids)); <START> for (final Germplasm germplasm : listOfGermplasmWithGroup) { <END> germplasm.setMgid(0); this.germplasmDAO.save(germplasm); } }</code><technical_language>@abatac I do get create a new function Dao level update elements SQL execution. I more efficient this approach. do that? a bulk HQL update</technical_language>

Target:
public void unfixLines(final Set<Integer> gids) { this.germplasmDAO.resetGermplasmGroup(new ArrayList<Integer>(gids)); }
Source:
<code>private boolean isDraftPatchSet(PatchSet.Id id, ReviewDb db) throws OrmException { PatchSet ps = db.patchSets().get(id); if (ps == null) { <START> return false; <END> } return ps.isDraft(); }</code><technical_language>suggestion: log error throw exception instead of returning false if ps found</technical_language>

Target:
private boolean isDraftPatchSet(PatchSet.Id id, ReviewDb db) throws OrmException { PatchSet ps = db.patchSets().get(id); if (ps == null) { throw new OrmException("PatchSet " + id + " not found in db"); } return ps.isDraft(); }
Source:
<code>public static SimulationStopCode run() { isRunning = true; INSTANCE.database.addSystemEntry(Database.SystemEntryType.SIM_START); notifyChange(ExecutionState.EXECUTION_STARTED); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); while (!INSTANCE.executionAborted) { if (INSTANCE.checkTerminate()) return stop(SimulationStopCode.TERMINATE_CONDITION); if (INSTANCE.dptManager.checkDPT()) { notifyChange(ExecutionState.STATE_CHANGED); continue; } if (!INSTANCE.eventScheduler.haveEvents()) return stop(SimulationStopCode.NO_MORE_EVENTS); <START> Event current = INSTANCE.eventScheduler.popEvent(); <END> INSTANCE.time = current.getTime(); current.run(); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); } return stop(SimulationStopCode.USER_INTERRUPT); }</code><technical_language>current -> event</technical_language>

Target:
public static SimulationStopCode run() { isRunning = true; INSTANCE.database.addSystemEntry(Database.SystemEntryType.SIM_START); notifyChange(ExecutionState.EXECUTION_STARTED); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); while (!INSTANCE.executionAborted) { if (INSTANCE.checkTerminate()) return stop(SimulationStopCode.TERMINATE_CONDITION); if (INSTANCE.dptManager.checkDPT()) { notifyChange(ExecutionState.STATE_CHANGED); continue; } if (!INSTANCE.eventScheduler.haveEvents()) return stop(SimulationStopCode.NO_MORE_EVENTS); Event event = INSTANCE.eventScheduler.popEvent(); INSTANCE.time = event.getTime(); event.run(); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); } return stop(SimulationStopCode.USER_INTERRUPT); }
Source:
<code>private void onEventSynchronous(CoreEvent event, ExecutorCallback executorCallback, Context ctx) { try { SdkInternalContext sdkInternalContext = from(event); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(getLocation()); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(getLocation()); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { <START> sdkInternalContext.setOperationExecutionParams(getLocation(), configuration, parameters, operationEvent, callback); <END> prepareAndExecuteOperation(event, () -> callback, ctx); }; operationExecutionFunction.execute(resolutionResult, event, executorCallback); } catch (Throwable t) { executorCallback.error(unwrap(t)); } }</code><technical_language>getLocation(), in other occurrences</technical_language>

Target:
private void onEventSynchronous(CoreEvent event, ExecutorCallback executorCallback, Context ctx) { try { SdkInternalContext sdkInternalContext = from(event); final ComponentLocation location = getLocation(); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(location); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(location); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(location, configuration, parameters, operationEvent, callback); prepareAndExecuteOperation(event, () -> callback, ctx); }; operationExecutionFunction.execute(resolutionResult, event, executorCallback); } catch (Throwable t) { executorCallback.error(unwrap(t)); } }
Source:
<code>public final void moveTrack(final double dist) { synchronized (this) { for (int i = 0; i < entities.size(); i++) { if (i == player) { continue; } AbstractEntity entity = entities.get(i); <START> moveEntity(entity, -dist); <END> } int index = 0; if (index == player) { index++; } while (true) { if (index >= entities.size()) { break; } if (entities.get(index).getCenter().getZ() > GameScene.CAMERA_TRANS.getZ()) { break; } entities.remove(index); } } }</code><technical_language>Performance-wise, is handy assign new objects in a for-loop. Suggestion: moveEntity(entities.get(i), -dist); <review,logic</technical_language>

Target:
public final void moveTrack(final double dist) { synchronized (this) { for (int i = 0; i < entities.size(); i++) { if (i == player) { continue; } moveEntity(entities.get(i), -dist); } int index = 0; if (index == player) { index++; } while (true) { if (index >= entities.size()) { break; } if (entities.get(index).getCenter().getZ() > GameScene.CAMERA_TRANS.getZ()) { break; } entities.remove(index); } } }
Source:
<code>public void set(JSONObject properties) { try { final JSONObject sendProperties = new JSONObject(); sendProperties.put("$android_lib_version", MPConfig.VERSION); sendProperties.put("$android_os", "Android"); sendProperties.put("$android_os_version", Build.VERSION.RELEASE == null ? "UNKNOWN" : Build.VERSION.RELEASE); sendProperties.put("$android_manufacturer", Build.MANUFACTURER == null ? "UNKNOWN" : Build.MANUFACTURER); sendProperties.put("$android_brand", Build.BRAND == null ? "UNKNOWN" : Build.BRAND); <START> sendProperties.put("$android_model", Build.MODEL == null ? "UNKNOWN" : Build.MODEL); <END> for (final Iterator<?> iter = properties.keys(); iter.hasNext();) { final String key = (String) iter.next(); sendProperties.put(key, properties.get(key)); } final JSONObject message = stdPeopleMessage("$set", sendProperties); recordPeopleMessage(message); } catch (final JSONException e) { Log.e(LOGTAG, "Exception setting people properties", e); } }</code><technical_language>SWEET! get $android_app_version well? (It's getPackageManager().getPackageInfo(getPackageName(), 0), imply permissions failure states issues)</technical_language>

Target:
public void set(JSONObject properties) { try { final JSONObject sendProperties = new JSONObject(); sendProperties.put("$android_lib_version", MPConfig.VERSION); sendProperties.put("$android_os", "Android"); sendProperties.put("$android_os_version", Build.VERSION.RELEASE == null ? "UNKNOWN" : Build.VERSION.RELEASE); try { PackageManager manager = mContext.getPackageManager(); PackageInfo info = manager.getPackageInfo(mContext.getPackageName(), 0); sendProperties.put("$android_app_version", info.versionName); } catch (PackageManager.NameNotFoundException e) { Log.e(LOGTAG, "Exception getting app version name", e); } sendProperties.put("$android_manufacturer", Build.MANUFACTURER == null ? "UNKNOWN" : Build.MANUFACTURER); sendProperties.put("$android_brand", Build.BRAND == null ? "UNKNOWN" : Build.BRAND); sendProperties.put("$android_model", Build.MODEL == null ? "UNKNOWN" : Build.MODEL); for (final Iterator<?> iter = properties.keys(); iter.hasNext();) { final String key = (String) iter.next(); sendProperties.put(key, properties.get(key)); } final JSONObject message = stdPeopleMessage("$set", sendProperties); recordPeopleMessage(message); } catch (final JSONException e) { Log.e(LOGTAG, "Exception setting people properties", e); } }
Source:
<code>public Attribute getAttributeById(PerunSession sess, Member member, Group group, int id) throws InternalErrorException, AttributeNotExistsException { try { <START> return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + <END> "left join member_group_attr_values mem on id=mem.attr_id and mem.group_id=? and member_id=? " + "where id=?", new AttributeRowMapper(sess, this, member), group.getId(), member.getId(), id); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute id= \"" + id +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }</code><technical_language>problem name above</technical_language>

Target:
public Attribute getAttributeById(PerunSession sess, Member member, Group group, int id) throws InternalErrorException, AttributeNotExistsException { try { return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on id=mem_gr.attr_id and mem_gr.group_id=? and member_id=? " + "where id=?", new AttributeRowMapper(sess, this, member), group.getId(), member.getId(), id); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute id= \"" + id +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
<code>private void generateDotEclipseProduct(File target) throws MojoExecutionException { getLog().debug("Generating .eclipseproduct"); Properties props = new Properties(); setPropertyIfNotNull(props, "version", productConfiguration.getVersion()); setPropertyIfNotNull(props, "name", productConfiguration.getName()); setPropertyIfNotNull(props, "id", productConfiguration.getId()); File eclipseproduct = new File(target, ".eclipseproduct"); FileOutputStream fos = null; try { fos = new FileOutputStream(eclipseproduct); <START> props.store(fos, "Eclipse Product File"); <END> } catch (IOException e) { throw new MojoExecutionException("Error creating .eclipseproduct file.", e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { throw new MojoExecutionException("Error closing stream on .eclipseproduct file.", e); } } } }</code><technical_language>I prefer try/finally props.store(), i.e. try { props.store(fos, "Eclipse Product File"); } finally { IOUtil.close(fos); } This need check for fos==null duplicate exception handle/rethrow logic</technical_language>

Target:
private void generateDotEclipseProduct(File target) throws MojoExecutionException { getLog().debug("Generating .eclipseproduct"); Properties props = new Properties(); setPropertyIfNotNull(props, "version", productConfiguration.getVersion()); setPropertyIfNotNull(props, "name", productConfiguration.getName()); setPropertyIfNotNull(props, "id", productConfiguration.getId()); File eclipseproduct = new File(target, ".eclipseproduct"); FileOutputStream fos = null; try { fos = new FileOutputStream(eclipseproduct); props.store(fos, "Eclipse Product File"); } catch (IOException e) { throw new MojoExecutionException("Error creating .eclipseproduct file.", e); } finally { if (fos != null) { IOUtil.close(fos); } } }
Source:
<code>public List<RedisClientDelegate> redisClientDelegates(ClientConfigurationWrapper redisClientConfigurations, Optional<List<RedisClientDelegate>> otherRedisClientDelegates) { List<RedisClientDelegate> clients = new ArrayList<>(); redisClientConfigurations.clients.forEach((name, config) -> { if (config.primary != null) { clients.add(createClient( RedisClientSelector.getName(true, name), config.primary.driver, config.primary.config, redisClientConfigurations )); <START> } <END> if (config.previous != null) { clients.add(createClient( RedisClientSelector.getName(false, name), config.previous.driver, config.previous.config, redisClientConfigurations )); } }); otherRedisClientDelegates.ifPresent(clients::addAll); return clients; }</code><technical_language>this for need add if (redisClientConfigurations.clients == null || redisClientConfigurations.clients.isEmpty()) { clients.add(createClient("primaryDefault", Driver.REDIS, new HashMap<>(), redisClientConfigurations)); } create a "primaryDefault" client redis.connection appears in config</technical_language>

Target:
public List<RedisClientDelegate> redisClientDelegates(ClientConfigurationWrapper redisClientConfigurations, Optional<List<RedisClientDelegate>> otherRedisClientDelegates) { List<RedisClientDelegate> clients = new ArrayList<>(); if (redisClientConfigurations.clients == null || redisClientConfigurations.clients.isEmpty()) { clients.add(createClient("primaryDefault", REDIS, new HashMap<>(), redisClientConfigurations)); } redisClientConfigurations.clients.forEach((name, config) -> { if (config.primary != null) { clients.add(createClient( RedisClientSelector.getName(true, name), config.primary.driver, config.primary.config, redisClientConfigurations )); } if (config.previous != null) { clients.add(createClient( RedisClientSelector.getName(false, name), config.previous.driver, config.previous.config, redisClientConfigurations )); } }); otherRedisClientDelegates.ifPresent(clients::addAll); return clients; }
Source:
<code>private void start() { <START> final long time = this.latency; <END> final CopyOnWriteArraySet<BkTimeable.ThreadInfo> storage = this.threads; this.service.scheduleAtFixedRate( new Runnable() { @Override public void run() { for (final BkTimeable.ThreadInfo info : storage) { if (System.currentTimeMillis() - info.start > time) { if (info.thread.isAlive()) { info.thread.interrupt(); } storage.remove(info); } } } }, 0, BkTimeable.CHECK_INTERVAL, TimeUnit.MILLISECONDS ); }</code><technical_language>@dmzaytsev avoid extracting local final variable if</technical_language>

Target:
private void start() { this.service.scheduleAtFixedRate( new Runnable() { @Override public void run() { for (final BkTimeable.ThreadInfo info : BkTimeable.this.threads) { if (System.currentTimeMillis() - info.start > BkTimeable.this.latency) { if (info.thread.isAlive() || info.alive) { info.thread.interrupt(); } BkTimeable.this.threads.remove(info); } } } }, 0, 100, TimeUnit.MILLISECONDS ); }
Source:
<code>public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %d", port)); return true; } else { process = null; port = null; pid = null; } port = findAvailablePort(); ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", String.valueOf(port), "-spec", getPathSpec(), "-fixtures", getPathFixture() ); processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT); <START> processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); <END> try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, port = %d, fixtures = %s and %s, " + "error message = %s", port, getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); Thread.sleep(1000); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }</code><technical_language>In other libraries, stripe-mock's output piped interfere regular test-suite's output. Mind here</technical_language>

Target:
public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %s", port)); return true; } else { process = null; port = null; pid = null; } ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", "0", "-spec", getPathSpec(), "-fixtures", getPathFixture() ); try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, fixtures = %s and %s, error message = %s", getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); System.out.println("Finding port bound to stripe-mock..."); port = detectBoundPort(process); if (port == null) { System.out.println(String.format("Unable to find port for stripe-mock, PID = %s", pid)); System.exit(1); } } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }
Source:
<code><START> public final String getCharset() <END> { return charset; }</code><technical_language>charset is @CheckForNull, good propagate annotation well</technical_language>

Target:
@CheckForNull final String getCharset() { return charset; }
Source:
<code><START> public String getPathByName(String workspaceName, String workspaceNamespace) throws IOException { <END> if (!isWindows && hostProjectsFolder != null) { return hostProjectsFolder; } try { Workspace workspace = workspaceDao.get(workspaceName, workspaceNamespace); return getPath(workspace.getId()); } catch (NotFoundException | ServerException e) { throw new IOException(e.getLocalizedMessage()); } }</code><technical_language>remove this method</technical_language>

Target:
String getPathByName(String workspaceName, String workspaceNamespace) throws IOException { if (!isWindows && singleMountPointForAllWorkspaces != null) { return singleMountPointForAllWorkspaces; } try { Workspace workspace = workspaceDao.get(workspaceName, workspaceNamespace); return getPath(workspace.getId()); } catch (NotFoundException | ServerException e) { throw new IOException(e.getLocalizedMessage()); } }
Source:
<code>public void should_execute_query_and_not_log_server_side_warnings() { final String disabledLogFlag = System.getProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "false"); assertThat(disabledLogFlag).isEqualTo("false"); <START> System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "true"); <END> SimpleStatement statement = new SimpleStatement("SELECT count(*) FROM foo"); ResultSet rs = session().execute(statement); Row row = rs.one(); assertThat(row).isNotNull(); ExecutionInfo ei = rs.getExecutionInfo(); List<String> warnings = ei.getWarnings(); assertThat(warnings).isNotEmpty(); assertThat(warnings.size()).isEqualTo(1); assertThat(warnings.get(0)).isEqualTo("Aggregation query used without partition key"); String log = logAppender.getNext(); assertThat(log).isNullOrEmpty(); System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, disabledLogFlag); }</code><technical_language>system properties need modified, special test group isolated</technical_language>

Target:
public void should_execute_query_and_not_log_server_side_warnings() { final String disabledLogFlag = System.getProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "false"); assertThat(disabledLogFlag).isEqualTo("false"); System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "true"); try { SimpleStatement statement = new SimpleStatement("SELECT count(*) FROM foo"); ResultSet rs = session().execute(statement); Row row = rs.one(); assertThat(row).isNotNull(); ExecutionInfo ei = rs.getExecutionInfo(); List<String> warnings = ei.getWarnings(); assertThat(warnings).isNotEmpty(); assertThat(warnings.size()).isEqualTo(1); assertThat(warnings.get(0)).isEqualTo("Aggregation query used without partition key"); String log = logAppender.getNext(); assertThat(log).isNullOrEmpty(); } finally { System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, disabledLogFlag); } }
Source:
<code>private boolean isFinalClass(Class clazz) { boolean isFinal = Modifier.isFinal(clazz.getModifiers()); if (!isFinal) { for (Method m : clazz.getMethods()) { if (clazz == m.getDeclaringClass()) { int mod = m.getModifiers(); if (Modifier.isFinal(mod) && !Modifier.isStatic(mod) <START> && (Modifier.isPublic(mod) || Modifier.isProtected(mod))) <END> { isFinal = true; break; } } } } return isFinal; }</code><technical_language>I !Modifier.isPrivate(mod) better: capture default visibility case well</technical_language>

Target:
private boolean isFinalClass(Class clazz) { boolean isFinal = Modifier.isFinal(clazz.getModifiers()); if (!isFinal) { for (Method m : clazz.getMethods()) { if (clazz == m.getDeclaringClass()) { int mod = m.getModifiers(); if (Modifier.isFinal(mod) && !Modifier.isStatic(mod) && !Modifier.isPrivate(mod)) { isFinal = true; break; } } } } return isFinal; }
Source:
<code>public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey key = (SecurityKey) o; return Objects.equals(this.getDlmsDevice(), key.getDlmsDevice()) && Objects.equals(this.getSecurityKeyType(), key.getSecurityKeyType()) <START> && Objects.equals(this.getValidFrom(), key.getValidFrom()); <END> }</code><technical_language>validFrom is mutable part of equals</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey compareKey = (SecurityKey) o; return Objects.equals(this.getDlmsDevice(), compareKey.getDlmsDevice()) && Objects.equals(this.getSecurityKeyType(), compareKey.getSecurityKeyType()) && Objects.equals(this.getValidFrom(), compareKey.getValidFrom()); }
Source:
<code>private Optional<SqlCommandCall> parseCommand(String line) { final Optional<SqlCommandCall> parsedLine; try { parsedLine = SqlCommandParser.parse(executor.getSqlParser(sessionId), line); } catch (SqlExecutionException e) { printExecutionException(e); return Optional.empty(); } if (!parsedLine.isPresent()) { <START> printError(CliStrings.MESSAGE_UNKNOWN_SQL); <END> } return parsedLine; }</code><technical_language>run this code branch ~</technical_language>

Target:
private Optional<SqlCommandCall> parseCommand(String line) { final SqlCommandCall parsedLine; try { parsedLine = SqlCommandParser.parse(executor.getSqlParser(sessionId), line); } catch (SqlExecutionException e) { printExecutionException(e); return Optional.empty(); } return Optional.of(parsedLine); }
Source:
<code>public ByteBuffer toByteBuffer(int index, int length) { checkIndexLength(index, length); if (base instanceof byte[]) { <START> return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length).slice(); <END> } try { return (ByteBuffer) newByteBuffer.invokeExact(address + index, length, (Object) reference); } catch (Throwable throwable) { if (throwable instanceof Error) { throw (Error) throwable; } if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } if (throwable instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new RuntimeException(throwable); } }</code><technical_language>I pretty get extra allocation also</technical_language>

Target:
public ByteBuffer toByteBuffer(int index, int length) { checkIndexLength(index, length); if (base instanceof byte[]) { return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length).slice(); } if ((reference instanceof ByteBuffer) && ((ByteBuffer) reference).isDirect()) { ByteBuffer buffer = (ByteBuffer) reference; int position = toIntExact(address - bufferAddress(buffer)) + index; buffer = buffer.duplicate(); buffer.position(position); buffer.limit(position + length); return buffer.slice(); } throw new UnsupportedOperationException("Conversion to ByteBuffer not supported for this Slice"); }
Source:
<code>public void release() { if (fileChannel != null) { try { fileChannel.close(); } catch (IOException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>a proper logger</technical_language>

Target:
public void release() { if (raf != null) { try { raf.close(); } catch (IOException e) { logger.error("Close file " + this + " failed", e); } } }