auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onPlayerJoin(final PlayerJoinEvent event) { for (NPC npc : getAllNPCs()) { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { ((CraftPlayer)event.getPlayer()).getHandle().playerConnection.sendPacket( new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, ((CraftPlayer) npc .getEntity()).getHandle())); } } Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { for (NPC npc : getAllNPCs()) { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { ((CraftPlayer)event.getPlayer()).getHandle().playerConnection.sendPacket( new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, ((CraftPlayer) npc .getEntity()).getHandle())); } } } <START> }, 60); <END> }</code><technical_language>3 seconds</technical_language>

Target:
public void onPlayerJoin(final PlayerJoinEvent event) { for (NPC npc : getAllNPCs()) { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { NMS.sendPlayerlistPacket(true, event.getPlayer(), npc); } } Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { for (NPC npc : getAllNPCs()) { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { NMS.sendPlayerlistPacket(false, event.getPlayer(), npc); } } } }, 60); }
Source:
<code>public void updateShuttleRoutesStopView(final MITShuttle mitShuttle, final boolean isFirstStop) { HashMap<String, String> stopParams = new HashMap<String, String>(); stopParams.put("route", mitShuttle.getRouteID()); if (isFirstStop) { stopParams.put("stop", mitShuttle.getFirstStopID()); } else { stopParams.put("stop", mitShuttle.getSecondStopID()); } apiClient.get(Constants.SHUTTLES, Constants.Shuttles.STOP_INFO_PATH, stopParams, null, new Callback<MITShuttleStopWrapper>() { @Override public void success(MITShuttleStopWrapper mitShuttleStopWrapper, Response response) { <START> if (mitShuttleStopWrapper.getPredictions() != null) { <END> if (mitShuttleStopWrapper.getPredictions().size() != 0) { if (isFirstStop) { mitShuttle.setFirstMinute(mitShuttleStopWrapper.getPredictions().get(0). getSeconds() / 60 + "m"); } else { mitShuttle.setSecondMinute(mitShuttleStopWrapper.getPredictions().get(0). getSeconds() / 60 + "m"); } } } mitShuttleAdapter.notifyDataSetChanged(); } @Override public void failure(RetrofitError error) { } }); }</code><technical_language>Instead of nesting IFs, check if predictions is null predictions size >0 in 1 IF condition, long null check is</technical_language>

Target:
public void updateShuttleRoutesStopView(final MITShuttle mitShuttle, final boolean isFirstStop) { HashMap<String, String> stopParams = new HashMap<String, String>(); stopParams.put("route", mitShuttle.getRouteID()); if (isFirstStop) { stopParams.put("stop", mitShuttle.getFirstStopID()); } else { stopParams.put("stop", mitShuttle.getSecondStopID()); } apiClient.get(Constants.SHUTTLES, Constants.Shuttles.STOP_INFO_PATH, stopParams, null, new Callback<MITShuttleStopWrapper>() { @Override public void success(MITShuttleStopWrapper mitShuttleStopWrapper, Response response) { if (mitShuttleStopWrapper.getPredictions() != null && mitShuttleStopWrapper.getPredictions().size() > 0) { if (isFirstStop) { mitShuttle.setFirstMinute(mitShuttleStopWrapper.getPredictions().get(0). getSeconds() / 60 + "m"); } else { mitShuttle.setSecondMinute(mitShuttleStopWrapper.getPredictions().get(0). getSeconds() / 60 + "m"); } } mitShuttleAdapter.notifyDataSetChanged(); } @Override public void failure(RetrofitError error) { } }); }
Source:
<code>public List<JobVertexID> getVertices() { <START> return vertices; <END> }</code><technical_language>suggestion return Collections.unmodifiableList(vertices);</technical_language>

Target:
public List<JobVertexID> getVertices() { return Collections.unmodifiableList(vertices); }
Source:
<code>public InputFilterMinMax(String min, String max) { <START> this.min = Double.parseDouble(min); <END> this.max = Double.parseDouble(max); }</code><technical_language>This throw exception</technical_language>

Target:
public InputFilterMinMax(String min, String max) { this.min = ReadingTools.safeParseDouble(min); this.max = ReadingTools.safeParseDouble(max); }
Source:
<code>public void eval(FunctionContext ctx, Tuple params) { CurrentValueContext currentValueCtx = (CurrentValueContext)ctx; <START> if (params.get(0).isNotNull()) { <END> currentValueCtx.current = params.get(0); } else { currentValueCtx.current = NullDatum.get(); } }</code><technical_language>This line check params.get(0) is NullDatum not. In addition this, check params.get(0) is null not</technical_language>

Target:
public void eval(FunctionContext ctx, Tuple params) { CurrentValueContext currentValueCtx = (CurrentValueContext)ctx; if (params.get(0) == null || params.get(0).isNull()) { currentValueCtx.current = NullDatum.get(); } else { currentValueCtx.current = params.get(0); } }
Source:
<code><START> public void testKeepAliveTTLWith2Req() throws Exception { <END> int numReqs = 2; AtomicInteger current = new AtomicInteger(); AtomicLong connection1CloseTimestamp = new AtomicLong(); AtomicLong connection2StartTimestamp = new AtomicLong(); server.requestHandler(req -> { current.getAndIncrement(); if(current.get() == 2) connection2StartTimestamp.set(System.currentTimeMillis()); try { Thread.sleep(1500); } catch (InterruptedException e) { e.printStackTrace(); } req.response().end(); }); HttpClientOptions options = createBaseClientOptions() .setMaxPoolSize(1) .setKeepAlive(true) .setKeepAliveTimeout(300) .setHttp2KeepAliveTimeout(300) .setKeepAliveTTL(1); startServer(testAddress); client.close(); client = vertx.createHttpClient(options.setPoolCleanerPeriod(1)); for (int i = 0;i < numReqs; i++) { client.request(HttpMethod.GET, testAddress, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI) .onComplete(onSuccess(resp -> { resp.request().connection().closeHandler(v -> { if(current.get() == 1) connection1CloseTimestamp.set(System.currentTimeMillis()); if (current.get() == numReqs) { assertTrue("Connection2 start timestamp > Connection1 end timestamp", connection2StartTimestamp.get() > connection1CloseTimestamp.get()); testComplete(); } }); })) .end(); } await(); }</code><technical_language>test needs check connection obtained for responses instances (i.e physical connections)</technical_language>

Target:
public void testKeepAliveTTLWith2Req() throws Exception { int numReqs = 2; AtomicInteger current = new AtomicInteger(); AtomicLong connection1CloseTimestamp = new AtomicLong(); AtomicLong connection2StartTimestamp = new AtomicLong(); ArrayList<HttpConnection> connections = new ArrayList<>(); server.requestHandler(req -> { current.getAndIncrement(); if(current.get() == 2) connection2StartTimestamp.set(System.currentTimeMillis()); try { Thread.sleep(1500); } catch (InterruptedException e) { e.printStackTrace(); } req.response().end(); }); HttpClientOptions options = createBaseClientOptions() .setMaxPoolSize(1) .setKeepAlive(true) .setKeepAliveTimeout(300) .setHttp2KeepAliveTimeout(300) .setKeepAliveTTL(1) .setPoolCleanerPeriod(1); startServer(testAddress); client.close(); client = vertx.createHttpClient(options); for (int i = 0; i < numReqs; i++) { client.request(HttpMethod.GET, testAddress, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI) .onComplete(onSuccess(resp -> { connections.add(resp.request().connection().closeHandler(v -> { if(current.get() == 1) { connection1CloseTimestamp.set(System.currentTimeMillis()); } if (current.get() == numReqs) { assertTrue("Connection2 start timestamp > Connection1 end timestamp", connection2StartTimestamp.get() > connection1CloseTimestamp.get()); assertNotSame("Connection1 and connection2 are different physical connections", connections.get(0), connections.get(1)); testComplete(); } })); })) .end(); } await(); }
Source:
<code>private ActiveQueryPickManager() { <START> activeQueryWorkingQueue = new ConcurrentLinkedQueue<>(); <END> activeQueryWaitingQueue = new ConcurrentLinkedQueue<>(); sharedLock = new Object(); }</code><technical_language>this</technical_language>

Target:
private ActiveQueryPickManager() { this.activeQueryQueue = new ConcurrentLinkedQueue<>(); }
Source:
<code>public boolean stop() { if (s_logger.isInfoEnabled()) { <START> s_logger.info("Stopping Alert Manager"); <END> } return true; }</code><technical_language>This log message deceptive. This class is quota statements alerts</technical_language>

Target:
public boolean stop() { if (s_logger.isInfoEnabled()) { s_logger.info("Stopping Statement Manager"); } return true; }
Source:
<code>public PostResourceMethodInvokers() { <START> this.invokers = new LinkedHashSet<>(); <END> }</code><technical_language>Do need a Set internally relying a Map here? simply ArrayList ? I care duplicates (it's internal abstraction), do we? Basically, affecting memory footprint, considering this object is created for invocation</technical_language>

Target:
public PostResourceMethodInvokers() { this.invokers = new ArrayList<>(); }
Source:
<code>private boolean shouldModifyIndexes(FlagAffectedCommand command, InvocationContext ctx, Object key, Object value) { if (indexingMode != null) { return indexingMode.shouldModifyIndexes(command, ctx, distributionManager, rpcManager, key); } if (isManualIndexing) return false; CacheMode cacheMode = cacheConfiguration.clustering().cacheMode(); if (!cacheMode.isClustered()) return true; <START> if (value == null) return cacheMode.isReplicated() || ctx.isOriginLocal(); <END> return IndexModificationStrategy.ALL.shouldModifyIndexes(command, ctx, distributionManager, rpcManager, key); }</code><technical_language>I understood purpose of null check in previous version of this method. indexingMode is null, return indexingMode.shouldModifyIndexes(command, ctx, distributionManager, rpcManager, key); executed rest of method is dead code</technical_language>

Target:
private boolean shouldModifyIndexes(FlagAffectedCommand command, InvocationContext ctx, Object key, Object value) { if (isManualIndexing) return false; if (key == null || distributionManager == null) { return true; } DistributionInfo info = distributionManager.getCacheTopology().getDistribution(key); return info.isPrimary() || info.isWriteOwner() && (ctx.isInTxScope() || !ctx.isOriginLocal() || command != null && command.hasAnyFlag(FlagBitSets.PUT_FOR_STATE_TRANSFER)); }
Source:
<code>protected Object handleObjectGet() throws Exception { String workspace = getAttribute("workspace"); ServiceInfo service; if (workspace != null) { WorkspaceInfo ws = geoServer.getCatalog().getWorkspaceByName(workspace); service = geoServer.getService(ws, clazz); } else { service = geoServer.getService(clazz); } if (service == null) { throw new RestletException("Service for workspace " + workspace + " does not exist", Status.CLIENT_ERROR_NOT_FOUND); } <START> return service.clone(true); <END> }</code><technical_language>this is configuration, more sense show parameters in output, accept in input, fix validation done in UI</technical_language>

Target:
protected Object handleObjectGet() throws Exception { String workspace = getAttribute("workspace"); ServiceInfo service; if (workspace != null) { WorkspaceInfo ws = geoServer.getCatalog().getWorkspaceByName(workspace); service = geoServer.getService(ws, clazz); } else { service = geoServer.getService(clazz); } if (service == null) { throw new RestletException("Service for workspace " + workspace + " does not exist", Status.CLIENT_ERROR_NOT_FOUND); } return service; }
Source:
<code>private boolean formatHDFS(boolean transactional) throws StorageException{ return format(transactional, INodeDataAccess.class, InMemoryInodeDataAccess.class, SmallOnDiskInodeDataAccess.class, MediumOnDiskInodeDataAccess.class, LargeOnDiskInodeDataAccess.class, BlockInfoDataAccess.class, LeaseDataAccess.class, LeasePathDataAccess.class, ReplicaDataAccess.class, ReplicaUnderConstructionDataAccess.class, InvalidateBlockDataAccess.class, ExcessReplicaDataAccess.class, PendingBlockDataAccess.class, CorruptReplicaDataAccess.class, UnderReplicatedBlockDataAccess.class, HdfsLeDescriptorDataAccess.class, DirectoryWithQuotaFeatureDataAccess.class, StorageIdMapDataAccess.class, BlockLookUpDataAccess.class, SafeBlocksDataAccess.class, MisReplicatedRangeQueueDataAccess.class, QuotaUpdateDataAccess.class, EncodingStatusDataAccess.class, BlockChecksumDataAccess.class, OngoingSubTreeOpsDataAccess.class, MetadataLogDataAccess.class, EncodingJobsDataAccess.class, RepairJobsDataAccess.class, UserDataAccess.class, GroupDataAccess.class, UserGroupDataAccess.class,VariableDataAccess.class, HashBucketDataAccess.class, StorageDataAccess.class, AceDataAccess.class, RetryCacheEntryDataAccess.class, CacheDirectiveDataAccess.class, CachePoolDataAccess.class, CachedBlockDataAccess.class, ActiveBlockReportsDataAccess.class, XAttrDataAccess.class, EncryptionZoneDataAccess.class, <START> FileProvenanceDataAccess.class, FileProvXAttrBufferDataAccess.class, AppProvenanceDataAccess.class); <END> }</code><technical_language>move AppProvenanceDataAccess formatYarn function</technical_language>

Target:
private boolean formatHDFS(boolean transactional) throws StorageException{ return format(transactional, INodeDataAccess.class, InMemoryInodeDataAccess.class, SmallOnDiskInodeDataAccess.class, MediumOnDiskInodeDataAccess.class, LargeOnDiskInodeDataAccess.class, BlockInfoDataAccess.class, LeaseDataAccess.class, LeasePathDataAccess.class, ReplicaDataAccess.class, ReplicaUnderConstructionDataAccess.class, InvalidateBlockDataAccess.class, ExcessReplicaDataAccess.class, PendingBlockDataAccess.class, CorruptReplicaDataAccess.class, UnderReplicatedBlockDataAccess.class, HdfsLeDescriptorDataAccess.class, DirectoryWithQuotaFeatureDataAccess.class, StorageIdMapDataAccess.class, BlockLookUpDataAccess.class, SafeBlocksDataAccess.class, MisReplicatedRangeQueueDataAccess.class, QuotaUpdateDataAccess.class, EncodingStatusDataAccess.class, BlockChecksumDataAccess.class, OngoingSubTreeOpsDataAccess.class, MetadataLogDataAccess.class, EncodingJobsDataAccess.class, RepairJobsDataAccess.class, UserDataAccess.class, GroupDataAccess.class, UserGroupDataAccess.class,VariableDataAccess.class, HashBucketDataAccess.class, StorageDataAccess.class, AceDataAccess.class, RetryCacheEntryDataAccess.class, CacheDirectiveDataAccess.class, CachePoolDataAccess.class, CachedBlockDataAccess.class, ActiveBlockReportsDataAccess.class, XAttrDataAccess.class, EncryptionZoneDataAccess.class, FileProvenanceDataAccess.class, FileProvXAttrBufferDataAccess.class); }
Source:
<code>private double[] getVolatilityAdjoint(final EuropeanVanillaOption option, final double forward, final SABRFormulaData data) { if (_sabrFunction instanceof SABRHaganVolatilityFunction) { return ((SABRHaganVolatilityFunction) _sabrFunction).getVolatilityAdjoint(option, forward, data); } <START> throw new NotImplementedException(); <END> }</code><technical_language>VolatilityFunctionProvider compute getVolatilityAdjoint finite difference overridden (which is case for SABRHaganVolatilityFunction) is necessary throw exception here. Also, added a construction VolatilityFunctionProvider<SABRFormulaData> (rather a hard coded SABRHaganVolatilityFunction), throwing exception for other SABRHaganVolatilityFunction breaks design</technical_language>

Target:
private double[] getVolatilityAdjoint(final EuropeanVanillaOption option, final double forward, final SABRFormulaData data) { VolatilityFunctionProvider<SABRFormulaData> sabrFunction = getVolatilityFunction(); if (sabrFunction instanceof SABRHaganVolatilityFunction) { return ((SABRHaganVolatilityFunction) sabrFunction).getVolatilityAdjoint(option, forward, data); } Function1D<SABRFormulaData, double[]> adjointFunction = sabrFunction.getVolatilityAdjointFunction(option, forward); return adjointFunction.evaluate(data); }
Source:
<code>public Series extract(RoviSeasonHistoryLine season) { Series series = new Series(); Optional<Publisher> parentPublisher = Optional.absent(); try { parentPublisher = parentPublisherCache.get(season.getSeasonProgramId()); <START> } catch (ExecutionException e) { <END> } if (parentPublisher.isPresent()) { series.setPublisher(parentPublisher.get()); } else { series.setPublisher(RoviConstants.DEFAULT_PUBLISHER); } series.setCanonicalUri(RoviUtils.canonicalUriForSeason(season.getSeasonProgramId())); String brandCanonicalUri = RoviUtils.canonicalUriForProgram(season.getSeriesId()); series.setParentRef(new ParentRef(brandCanonicalUri)); if (season.getSeasonName().isPresent()) { series.setTitle(season.getSeasonName().get()); } if (season.getSeasonNumber().isPresent()) { series.withSeriesNumber(season.getSeasonNumber().get()); } return series; }</code><technical_language>getUnchecked avoid execption swallowing</technical_language>

Target:
public Series extract(RoviSeasonHistoryLine season) { Series series = new Series(); Optional<Publisher> parentPublisher = Optional.absent(); String parentCanonicalUri = canonicalUriForProgram(season.getSeriesId()); parentPublisher = parentPublisherCache.getUnchecked(parentCanonicalUri); if (parentPublisher.isPresent()) { series.setPublisher(parentPublisher.get()); } else { series.setPublisher(DEFAULT_PUBLISHER); } series.setCanonicalUri(canonicalUriForSeason(season.getSeasonProgramId())); series.setParentRef(new ParentRef(parentCanonicalUri)); if (season.getSeasonName().isPresent()) { series.setTitle(season.getSeasonName().get()); } if (season.getSeasonNumber().isPresent()) { series.withSeriesNumber(season.getSeasonNumber().get()); } return series; }
Source:
<code>private static IncludedInDetail resolveBranches(RevCommit commit) <START> throws Exception { <END> Repository git = gitMgr.openRepository(change.getProject()); RevWalk rw = new RevWalk(git); return IncludedInResolver.resolve(git, rw, commit); }</code><technical_language>This explicitly mention exceptions thrown, mentioning Exception base class</technical_language>

Target:
private static IncludedInDetail resolveBranches(RevCommit commit) throws RepositoryNotFoundException, IOException, OrmException { Repository git = gitMgr.openRepository(change.getProject()); try { RevWalk rw = new RevWalk(git); try { return IncludedInResolver.resolve(git, rw, commit); } finally { rw.release(); } } finally { git.close(); } }
Source:
<code><START> public void setPolicy(ComputationPolicy policy) { <END> this.policy = policy; }</code><technical_language>protected this method is in tests + editable</technical_language>

Target:
protected void setPolicy(ComputationPolicy policy) { this.policy = policy; }
Source:
<code><START> private List<JarDto> getProjectExternalLibraries(ExternalLibrariesParameters params) { <END> params.setProjectUri(LanguageServiceUtils.prefixURI(params.getProjectUri())); CompletableFuture<Object> result = executeCommand(GET_EXTERNAL_LIBRARIES_COMMAND, singletonList(params)); Type targetClassType = new TypeToken<ArrayList<Jar>>() {}.getType(); try { return gson.fromJson(gson.toJson(result.get(10, TimeUnit.SECONDS)), targetClassType); } catch (JsonSyntaxException | InterruptedException | ExecutionException | TimeoutException e) { throw new JsonRpcException(-27000, e.getMessage()); } }</code><technical_language>I guess, methods invoke some common method. simplify code. private <T, P> List<T> doGet(String commandType, P params) { ... }</technical_language>

Target:
private List<Jar> getProjectExternalLibraries(ExternalLibrariesParameters params) { params.setProjectUri(prefixURI(params.getProjectUri())); Type type = new TypeToken<ArrayList<Jar>>() {}.getType(); return doGetList(GET_EXTERNAL_LIBRARIES_COMMAND, params, type); }
Source:
<code>public TopologyDescriptor(long topologyConfigId, @NonNull List<ClusterDescriptor> activeClusters, @NonNull List<ClusterDescriptor> standbyClusters, @NonNull List<ClusterDescriptor> invalidClusters) { <START> this.topologyConfigId = topologyConfigId; <END> this.activeClusters = new HashMap<>(); this.standbyClusters = new HashMap<>(); this.invalidClusters = new HashMap<>(); activeClusters.forEach(activeCluster -> this.activeClusters.put(activeCluster.getClusterId(), activeCluster)); standbyClusters.forEach(standbyCluster -> this.standbyClusters.put(standbyCluster.getClusterId(), standbyCluster)); invalidClusters.forEach(invalidCluster -> this.invalidClusters.put(invalidCluster.getClusterId(), invalidCluster)); }</code><technical_language>Replace with: this(topologyConfigId, activeClusters, standbyClusters); invalidClusters.forEach(invalidCluster -> this.invalidClusters.put(invalidCluster.getClusterId(), invalidCluster));</technical_language>

Target:
public TopologyDescriptor(long topologyConfigId, @NonNull List<ClusterDescriptor> activeClusters, @NonNull List<ClusterDescriptor> standbyClusters, @NonNull List<ClusterDescriptor> invalidClusters) { this(topologyConfigId, activeClusters, standbyClusters); invalidClusters.forEach(invalidCluster -> this.invalidClusters.put(invalidCluster.getClusterId(), invalidCluster)); }
Source:
<code>private List<? extends ParameterValue> filter(List<ParameterValue> parameters) { if (this.run == null) { return parameters; } if (this.parameterDefinitionNames == null) { return parameters; } String shouldKeepFlag = SystemProperties.getString(KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME); if ("true".equalsIgnoreCase(shouldKeepFlag)) { return parameters; } List<ParameterValue> filteredParameters = new ArrayList<ParameterValue>(); for (ParameterValue v : this.parameters) { if (this.parameterDefinitionNames.contains(v.getName()) || isSafeParameter(v.getName())) { filteredParameters.add(v); <START> } else if (!"false".equalsIgnoreCase(shouldKeepFlag)) { <END> LOGGER.log(Level.WARNING, "Skipped parameter `{0}` as it is undefined on `{1}`. Set `-D{2}=true` to allow " + "undefined parameters to be injected as environment variables or `-D{3}=[comma-separated list]` to whitelist specific parameter names, " + "even though it represents a security breach or `-D{2}=false` to no longer show this message.", new Object { v.getName(), run.getParent().getFullName(), KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME, SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME }); } } return filteredParameters; }</code><technical_language>Generally this string comparison is correct (foo string false well), SystemProperties.getBoolean() instead cover false strings. for comparison above</technical_language>

Target:
private List<? extends ParameterValue> filter(List<ParameterValue> parameters) { if (this.run == null) { return parameters; } if (this.parameterDefinitionNames == null) { return parameters; } Boolean shouldKeepFlag = SystemProperties.optBoolean(KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME); if (shouldKeepFlag != null && shouldKeepFlag.booleanValue()) { return parameters; } List<ParameterValue> filteredParameters = new ArrayList<ParameterValue>(); for (ParameterValue v : this.parameters) { if (this.parameterDefinitionNames.contains(v.getName()) || isSafeParameter(v.getName())) { filteredParameters.add(v); } else if (shouldKeepFlag == null) { LOGGER.log(Level.WARNING, "Skipped parameter `{0}` as it is undefined on `{1}`. Set `-D{2}=true` to allow " + "undefined parameters to be injected as environment variables or `-D{3}=[comma-separated list]` to whitelist specific parameter names, " + "even though it represents a security breach or `-D{2}=false` to no longer show this message.", new Object { v.getName(), run.getParent().getFullName(), KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME, SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME }); } } return filteredParameters; }
Source:
<code>public static String convertToJson(Listing listing) { StringBuilder sb = new StringBuilder("{"); sb.append("\"id\" : ").append(listing.id).append(","); sb.append("\"supplierId\" : ").append(listing.supplierId).append(","); sb.append("\"lot\" : \"").append(listing.lot).append("\","); sb.append("\"title\" : \"").append(listing.title).append("\","); sb.append("\"lastUpdated\" : \"").append(listing.getLastUpdated()).append("\","); sb.append("\"lastUpdatedByEmail\" : \"").append(listing.lastUpdatedEmail).append("\","); sb.append("\"lastCompleted\" : \"").append(listing.getLastCompleted()).append("\","); <START> sb.append("\"lastCompletedByEmail\" : \"").append(listing.lastCompletedByEmail).append("\","); <END> for (Page page : listing.completedPages) { sb.append(getPageJSON(page)); } if (sb.length() > 0) { sb.setLength(sb.length() - 1); } sb.append("}"); return sb.toString(); }</code><technical_language>I if of fields allow double quotes. simpler pass gson.toJson it</technical_language>

Target:
public static String convertToJson(Listing listing) { StringBuilder sb = new StringBuilder("{"); sb.append("\"id\" : ").append(listing.id).append(","); sb.append("\"supplierId\" : ").append(listing.supplierId).append(","); sb.append("\"lot\" : ").append(gson.toJson(listing.lot)).append(","); sb.append("\"title\" : ").append(gson.toJson(listing.title)).append(","); sb.append("\"lastUpdated\" : ").append(gson.toJson(listing.getLastUpdated())).append(","); sb.append("\"lastUpdatedByEmail\" : ").append(gson.toJson(listing.lastUpdatedEmail)).append(","); sb.append("\"lastCompleted\" : ").append(gson.toJson(listing.getLastCompleted())).append(","); sb.append("\"lastCompletedByEmail\" : ").append(gson.toJson(listing.lastCompletedByEmail)).append(","); for (Page page : listing.completedPages) { sb.append(getPageJSON(page)); } if (sb.length() > 0) { sb.setLength(sb.length() - 1); } sb.append("}"); return sb.toString(); }
Source:
<code>public static Collection<Object[]> data() throws Exception { <START> String localEpoch = ((new Date(0)).toInstant()) <END> .atZone(ZoneId.systemDefault()) .truncatedTo(ChronoUnit.SECONDS) .format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); return Arrays.asList(new Object[][] { { getPollerResponse(), "<?xml version=\"1.0\"?>\n" + "<poller-response>" + "<poll-status code=\"1\" name=\"Up\" time=\"" + localEpoch + "\"/>" + "</poller-response>" } }); }</code><technical_language>do similar date manipulation in other XML tests too: <LINK_0> this method generic move org.opennms.core.test-api.xml project instead? Bonus points for refactoring NorthboundAlarmTest :)</technical_language>

Target:
public static Collection<Object[]> data() throws Exception { return Arrays.asList(new Object[][] { { getPollerResponse(), "<?xml version=\"1.0\"?>\n" + "<poller-response>" + "<poll-status code=\"1\" name=\"Up\" time=\"" + StringUtils.iso8601OffsetString(new Date(0), ZoneId.systemDefault(), ChronoUnit.SECONDS) + "\"/>" + "</poller-response>" } }); }
Source:
<code>public int hashCode() { int hash = 17; hash = hash * 31 + Objects.hashCode(_numeratorUnits); hash = hash * 31 + Objects.hashCode(_denominatorUnits); <START> return hash; <END> }</code><technical_language>Coud java.util.Objects.hash(_numeratorUnits, _denominatorUnits)</technical_language>

Target:
public int hashCode() { return Objects.hash(_numeratorUnits, _denominatorUnits); }
Source:
<code>protected void initServConf() { regConfForProvider = new RegistryConfig(); regConfForService = new RegistryConfig(); provConf = new ProviderConfig(); protoConfForProvider = new ProtocolConfig("mockprotocol"); protoConfForService = new ProtocolConfig("mockprotocol"); methodConfForService = new MethodConfig(); servConf = new ServiceConfig<DemoService>(); servConf.setApplication(application); provConf.setRegistry(regConfForProvider); servConf.setRegistry(regConfForService); <START> provConf.setProtocols(new ArrayList<>(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}))); <END> servConf.setProtocols(new ArrayList<>(Arrays.asList(new ProtocolConfig[]{protoConfForService}))); servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService})); servConf.setProvider(provConf); servConf.setRef(demoService); servConf.setInterfaceClass(DemoService.class); methodConfForService.setName("sayName"); regConfForService.setAddress("127.0.0.1:9090"); regConfForService.setProtocol("mockregistry"); application.setName("ConfigTests"); }</code><technical_language>this</technical_language>

Target:
protected void initServConf() { regConfForProvider = new RegistryConfig(); regConfForService = new RegistryConfig(); provConf = new ProviderConfig(); protoConfForProvider = new ProtocolConfig("mockprotocol"); protoConfForService = new ProtocolConfig("mockprotocol"); methodConfForService = new MethodConfig(); servConf = new ServiceConfig<DemoService>(); servConf.setApplication(application); provConf.setRegistry(regConfForProvider); servConf.setRegistry(regConfForService); provConf.setProtocols(new ArrayList<>(Arrays.asList(protoConfForProvider))); servConf.setProtocols(new ArrayList<>(Arrays.asList(protoConfForService))); servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService})); servConf.setProvider(provConf); servConf.setRef(demoService); servConf.setInterfaceClass(DemoService.class); methodConfForService.setName("sayName"); regConfForService.setAddress("127.0.0.1:9090"); regConfForService.setProtocol("mockregistry"); application.setName("ConfigTests"); }
Source:
<code>public Response updateStudentAddress( @PathParam("STUDENTID") Long studentId, @PathParam("ID") Long id, fi.otavanopisto.pyramus.rest.model.Address body ) { Student student = studentController.findStudentById(studentId); if (student == null) { return Response.status(Status.NOT_FOUND).build(); } if (student.getArchived()) { return Response.status(Status.NOT_FOUND).build(); } if (!restSecurity.hasPermission( new String[] { StudentPermissions.UPDATE_STUDENTADDRESS }, student) && !restSecurity.hasPermission( <START> new String[] { PersonPermissions.PERSON_OWNER }, <END> student.getPerson() )) { return Response.status(Status.FORBIDDEN).build(); } Address address = commonController.findAddressById(id); if (address == null) { return Response.status(Status.NOT_FOUND).build(); } if (!address.getContactInfo().getId().equals(student.getContactInfo().getId())) { return Response.status(Status.NOT_FOUND).build(); } ContactType contactType = commonController.findContactTypeById(body.getContactTypeId()); address = studentController.updateStudentAddress( address, contactType, body.getDefaultAddress(), body.getName(), body.getStreetAddress(), body.getPostalCode(), body.getCity(), body.getCountry()); return Response.ok(objectFactory.createModel(address)).build(); }</code><technical_language>Person_owner student_owner? @pkukkon</technical_language>

Target:
public Response updateStudentAddress( @PathParam("STUDENTID") Long studentId, @PathParam("ID") Long id, fi.otavanopisto.pyramus.rest.model.Address body ) { Student student = studentController.findStudentById(studentId); if (student == null) { return Response.status(Status.NOT_FOUND).build(); } if (student.getArchived()) { return Response.status(Status.NOT_FOUND).build(); } if (!restSecurity.hasPermission( new String[] { StudentPermissions.UPDATE_STUDENTADDRESS }, student) && !restSecurity.hasPermission( new String[] { StudentPermissions.STUDENT_OWNER }, student.getPerson() )) { return Response.status(Status.FORBIDDEN).build(); } Address address = commonController.findAddressById(id); if (address == null) { return Response.status(Status.NOT_FOUND).build(); } if (!address.getContactInfo().getId().equals(student.getContactInfo().getId())) { return Response.status(Status.NOT_FOUND).build(); } ContactType contactType = commonController.findContactTypeById(body.getContactTypeId()); address = studentController.updateStudentAddress( address, contactType, body.getDefaultAddress(), body.getName(), body.getStreetAddress(), body.getPostalCode(), body.getCity(), body.getCountry()); return Response.ok(objectFactory.createModel(address)).build(); }
Source:
<code>private static void callCallbackForRequest(NetworkRequestInfo nri, NetworkAgentInfo networkAgent, int notificationType, int arg1) { if (nri.messenger == null) { return; } Bundle bundle = new Bundle(); putParcelable(bundle, new NetworkRequest(nri.request)); Message msg = Message.obtain(); if (notificationType != ConnectivityManager.CALLBACK_UNAVAIL) { putParcelable(bundle, networkAgent.network); } switch (notificationType) { case ConnectivityManager.CALLBACK_LOSING: { msg.arg1 = arg1; break; } case ConnectivityManager.CALLBACK_CAP_CHANGED: { final NetworkCapabilities nc = <START> new NetworkCapabilities(networkAgent.networkCapabilities); nc.setUids(null); <END> putParcelable(bundle, nc); break; } case ConnectivityManager.CALLBACK_IP_CHANGED: { putParcelable(bundle, new LinkProperties(networkAgent.linkProperties)); break; } } msg.what = notificationType; msg.setData(bundle); try { if (VDBG) { String notification = ConnectivityManager.getCallbackName(notificationType); log("sending notification " + notification + " for " + nri.request); } nri.messenger.send(msg); } catch (RemoteException e) { loge("RemoteException caught trying to send a callback msg for " + nri.request); } }</code><technical_language>Consider calling getNetworkCapabilitiesInternal too</technical_language>

Target:
private void callCallbackForRequest(NetworkRequestInfo nri, NetworkAgentInfo networkAgent, int notificationType, int arg1) { if (nri.messenger == null) { return; } Bundle bundle = new Bundle(); putParcelable(bundle, new NetworkRequest(nri.request)); Message msg = Message.obtain(); if (notificationType != ConnectivityManager.CALLBACK_UNAVAIL) { putParcelable(bundle, networkAgent.network); } switch (notificationType) { case ConnectivityManager.CALLBACK_LOSING: { msg.arg1 = arg1; break; } case ConnectivityManager.CALLBACK_CAP_CHANGED: { final NetworkCapabilities nc = getNetworkCapabilitiesInternal(networkAgent); putParcelable(bundle, nc); break; } case ConnectivityManager.CALLBACK_IP_CHANGED: { putParcelable(bundle, new LinkProperties(networkAgent.linkProperties)); break; } } msg.what = notificationType; msg.setData(bundle); try { if (VDBG) { String notification = ConnectivityManager.getCallbackName(notificationType); log("sending notification " + notification + " for " + nri.request); } nri.messenger.send(msg); } catch (RemoteException e) { loge("RemoteException caught trying to send a callback msg for " + nri.request); } }
Source:
<code><START> public Integer getResourceMaxPartitionsPerInstance() { <END> return _resourceMaxPartitionsPerInstance; }</code><technical_language>Checked callers assignments int, is need return Integer here</technical_language>

Target:
public int getResourceMaxPartitionsPerInstance() { return _resourceMaxPartitionsPerInstance; }
Source:
<code>protected void setCurrentUrl(DownloadUrlLink link) { widget.setVisible(true); String sshPort = "29418"; String sshAddr = Gerrit.getConfig().getSshdAddress(); int p = sshAddr.lastIndexOf(':'); if (p != -1 && !sshAddr.endsWith(":")) { sshPort = sshAddr.substring(p + 1); } StringBuilder cmd = new StringBuilder(); cmd.append("git clone "); cmd.append(link.getUrlData()); cmd.append(" && scp -p -P "); cmd.append(sshPort); cmd.append(" "); cmd.append(Gerrit.getUserAccount().getUserName()); cmd.append("@"); if (sshAddr.startsWith("*:") || p == -1) { cmd.append(Window.Location.getHostName()); } else { <START> sshAddr = sshAddr.substring(0, p); <END> } cmd.append(":hooks/commit-msg "); p = project.get().lastIndexOf('/'); if (p != -1) { cmd.append(project.get().substring(p + 1)); } else { cmd.append(project.get()); } cmd.append("/.git/hooks/"); copyLabel.setText(cmd.toString()); }</code><technical_language>missing cmd.append(). build substring put host name command line</technical_language>

Target:
protected void setCurrentUrl(DownloadUrlLink link) { widget.setVisible(true); String sshPort = "29418"; String sshAddr = Gerrit.getConfig().getSshdAddress(); int p = sshAddr.lastIndexOf(':'); if (p != -1 && !sshAddr.endsWith(":")) { sshPort = sshAddr.substring(p + 1); } StringBuilder cmd = new StringBuilder(); cmd.append("git clone "); cmd.append(link.getUrlData()); cmd.append(" && scp -p -P "); cmd.append(sshPort); cmd.append(" "); cmd.append(Gerrit.getUserAccount().getUserName()); cmd.append("@"); if (sshAddr.startsWith("*:") || p == -1) { cmd.append(Window.Location.getHostName()); } else { cmd.append(sshAddr.substring(0, p)); } cmd.append(":hooks/commit-msg "); p = project.get().lastIndexOf('/'); if (p != -1) { cmd.append(project.get().substring(p + 1)); } else { cmd.append(project.get()); } cmd.append("/.git/hooks/"); copyLabel.setText(cmd.toString()); }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { <START> case CommCareHomeActivity.INIT_APP: <END> if (resultCode == RESULT_OK) { if(!CommCareApplication._().getCurrentApp().areResourcesValidated()){ Intent i = new Intent(this, CommCareVerificationActivity.class); i.putExtra(KEY_LAUNCH_FROM_MANAGER, true); this.startActivityForResult(i, CommCareHomeActivity.MISSING_MEDIA_ACTIVITY); } else { Toast.makeText(this, "New app installed successfully", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(this, "No app was installed!", Toast.LENGTH_LONG).show(); } break; case CommCareHomeActivity.MISSING_MEDIA_ACTIVITY: if (resultCode == RESULT_CANCELED) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Media Not Verified"); builder.setMessage(R.string.skipped_verification_warning) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } else if (resultCode == RESULT_OK) { Toast.makeText(this, "Media Validated!", Toast.LENGTH_LONG).show(); } break; } }</code><technical_language>funky spacing</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { case CommCareHomeActivity.INIT_APP: boolean installFailed = intent != null && intent.getBooleanExtra( CommCareSetupActivity.KEY_INSTALL_FAILED, false); if (resultCode == RESULT_OK && !installFailed) { if (!CommCareApplication._().getCurrentApp().areMMResourcesValidated()) { Intent i = new Intent(this, CommCareVerificationActivity.class); i.putExtra(KEY_LAUNCH_FROM_MANAGER, true); this.startActivityForResult(i, CommCareHomeActivity.MISSING_MEDIA_ACTIVITY); } } else { Toast.makeText(this, R.string.no_installation, Toast.LENGTH_LONG).show(); } break; case CommCareHomeActivity.MISSING_MEDIA_ACTIVITY: if (resultCode == RESULT_CANCELED) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.media_not_verified); builder.setMessage(R.string.skipped_verification_warning) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } else if (resultCode == RESULT_OK) { Toast.makeText(this, R.string.media_verified, Toast.LENGTH_LONG).show(); } break; case CommCareHomeActivity.CONNECTION_DIAGNOSTIC_ACTIVITY: return; } }
Source:
<code>public void startApp() { System.out.println("START"); WebPublicKeyStore cs = WebPublicKeyStore.getTrustedKeyStore(); int numberOfKeys = cs.numberOfKeys(); if (numberOfKeys != 1) { <START> System.out.println("FAIL - Number of keys (" + numberOfKeys + ") != 1"); <END> } PublicKeyInfo keyInfo = cs.getKey(0); if (keyInfo.getOwner().length() == 0) { System.out.println("FAIL - Owner must be a string with length > 0"); } X509Certificate[] certificates = cs.getCertificates(keyInfo.getOwner()); X509Certificate aCert = certificates[0]; try { aCert.verify(aCert.getPublicKey()); } catch (CertificateException e) { System.out.println("FAIL - Verification should succeed"); e.printStackTrace(); } System.out.println("DONE"); }</code><technical_language>Hmm, number of keys change build build, I assume store a specific number of keys. reasonable assume key, though, users rebuild get default store, while do import GoDaddy key it. I check store key</technical_language>

Target:
public void startApp() { System.out.println("START"); WebPublicKeyStore cs = WebPublicKeyStore.getTrustedKeyStore(); int numberOfKeys = cs.numberOfKeys(); if (numberOfKeys < 1) { System.out.println("FAIL - Number of keys (" + numberOfKeys + ") < 1"); } PublicKeyInfo keyInfo = cs.getKey(0); if (keyInfo.getOwner().length() == 0) { System.out.println("FAIL - Owner must be a string with length > 0"); } X509Certificate[] certificates = cs.getCertificates(keyInfo.getOwner()); X509Certificate aCert = certificates[0]; try { aCert.verify(aCert.getPublicKey()); } catch (CertificateException e) { System.out.println("FAIL - Verification should succeed"); e.printStackTrace(); } System.out.println("DONE"); }
Source:
<code>public void publishProvider(URL providerUrl) throws RpcException { providerUrl = providerUrl.removeParameters(PID_KEY, TIMESTAMP_KEY, Constants.BIND_IP_KEY, Constants.BIND_PORT_KEY, TIMESTAMP_KEY); try { String interfaceName = providerUrl.getParameter(INTERFACE_KEY); if (StringUtils.isNotEmpty(interfaceName)) { <START> Class interfaceClass =Thread.currentThread().getContextClassLoader().loadClass(interfaceName); <END> FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, providerUrl.getParameters()); metadataReport.storeProviderMetadata(new MetadataIdentifier(providerUrl.getServiceInterface(), providerUrl.getParameter(VERSION_KEY), providerUrl.getParameter(GROUP_KEY), PROVIDER_SIDE, providerUrl.getParameter(APPLICATION_KEY)), fullServiceDefinition); return; } logger.error("publishProvider interfaceName is empty . providerUrl: " + providerUrl.toFullString()); } catch (ClassNotFoundException e) { logger.error("publishProvider getServiceDescriptor error. providerUrl: " + providerUrl.toFullString(), e); } }</code><technical_language>I this change is appropriate, Thread.currentThread().getContextClassLoader().loadClass NullPointerException if calling Thread.currentThread().setContextClassLoader(null) first</technical_language>

Target:
public void publishProvider(URL providerUrl) throws RpcException { providerUrl = providerUrl.removeParameters(PID_KEY, TIMESTAMP_KEY, Constants.BIND_IP_KEY, Constants.BIND_PORT_KEY, TIMESTAMP_KEY); try { String interfaceName = providerUrl.getParameter(INTERFACE_KEY); if (StringUtils.isNotEmpty(interfaceName)) { ClassLoader classLoader = null == Thread.currentThread().getContextClassLoader() ? this.getClass().getClassLoader() : Thread.currentThread().getContextClassLoader(); Class interfaceClass = Class.forName(interfaceName, true, classLoader); FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, providerUrl.getParameters()); metadataReport.storeProviderMetadata(new MetadataIdentifier(providerUrl.getServiceInterface(), providerUrl.getParameter(VERSION_KEY), providerUrl.getParameter(GROUP_KEY), PROVIDER_SIDE, providerUrl.getParameter(APPLICATION_KEY)), fullServiceDefinition); return; } logger.error("publishProvider interfaceName is empty . providerUrl: " + providerUrl.toFullString()); } catch (ClassNotFoundException e) { logger.error("publishProvider getServiceDescriptor error. providerUrl: " + providerUrl.toFullString(), e); } }
Source:
<code>public void increaseBackpressure(int messageSize) { assert(m_expectedThreadId == Thread.currentThread().getId()); if (messageSize < 1) { throw new IllegalArgumentException("Message size must be > 0 but was " + messageSize); } m_pendingTxnBytes += messageSize; m_pendingTxnCount++; checkAndLogInvariants(); if (m_pendingTxnBytes > MAX_DESIRED_PENDING_BYTES || m_pendingTxnCount > MAX_DESIRED_PENDING_TXNS) { if (!m_hadBackPressure) { <START> hostLog.info("TXN back pressure began"); <END> m_hadBackPressure = true; for (ACGMember m : m_members) { m.onBackpressure(); } } } }</code><technical_language>Unintended changes for debugging</technical_language>

Target:
public void increaseBackpressure(int messageSize) { assert(m_expectedThreadId == Thread.currentThread().getId()); if (messageSize < 1) { throw new IllegalArgumentException("Message size must be > 0 but was " + messageSize); } m_pendingTxnBytes += messageSize; m_pendingTxnCount++; checkAndLogInvariants(); if (m_pendingTxnBytes > MAX_DESIRED_PENDING_BYTES || m_pendingTxnCount > MAX_DESIRED_PENDING_TXNS) { if (!m_hadBackPressure) { hostLog.debug("TXN back pressure began"); m_hadBackPressure = true; for (ACGMember m : m_members) { m.onBackpressure(); } } } }
Source:
<code>protected Map<Object, Object> getRelationshipValues( Class<?> relationshipType, List<Object> joinFieldIds ) { if (joinFieldIds.isEmpty()) { return Collections.emptyMap(); } List<Object> uniqueIds = joinFieldIds.stream() .distinct() .collect(Collectors.toCollection(LinkedList::new)); List<Object> loaded = getEntityManager() .createQuery( String.format( "SELECT e FROM %s e WHERE %s IN (:idList)", relationshipType.getCanonicalName(), getEntityDictionary().getIdFieldName(relationshipType) ) ) .setParameter("idList", uniqueIds) .getResultList(); return loaded.stream() .map(obj -> new AbstractMap.SimpleImmutableEntry<>( <START> getEntityDictionary().getValue(obj, "id", null), obj)) <END> .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); }</code><technical_language>getValue is a safe get ID of entity. change this</technical_language>

Target:
protected Map<Object, Object> getRelationshipValues( Class<?> relationshipType, List<Object> joinFieldIds ) { if (joinFieldIds.isEmpty()) { return Collections.emptyMap(); } List<Object> uniqueIds = joinFieldIds.stream() .distinct() .collect(Collectors.toCollection(LinkedList::new)); List<Object> loaded = getEntityManager() .createQuery( String.format( "SELECT e FROM %s e WHERE %s IN (:idList)", relationshipType.getCanonicalName(), getEntityDictionary().getIdFieldName(relationshipType) ) ) .setParameter("idList", uniqueIds) .getResultList(); return loaded.stream() .map(obj -> new AbstractMap.SimpleImmutableEntry<>(CoerceUtil.coerce((Object) getEntityDictionary(). getId(obj), getEntityDictionary().getIdType(relationshipType)), obj)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); }
Source:
<code>public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { User user = (fields == null || fields.size() == 0) ? dataStore.get(key) : dataStore.get(key, fields.toArray(DUMMY_ARRAY)); <START> for (int i = 0; i < fieldCount; i++) { <END> String field = FIELDS[i + 1]; int fieldIndex = i + 1; String value = user.get(fieldIndex).toString(); result.put(field, new StringByteIterator(value)); } } catch (Exception e) { LOG.info("There is a problem in reading data from the table \n"+e.getMessage(), e); return Status.ERROR; } return Status.OK; }</code><technical_language>Please proper variable naming</technical_language>

Target:
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { User user = (fields == null || fields.size() == 0) ? dataStore.get(key) : dataStore.get(key, fields.toArray(DUMMY_ARRAY)); for (int fieldCount = 0; fieldCount < totalFieldCount; fieldCount++) { String field = FIELDS[fieldCount + 1]; int fieldIndex = fieldCount + 1; String value = user.get(fieldIndex).toString(); result.put(field, new StringByteIterator(value)); } } catch (Exception e) { LOG.info("There is a problem in reading data from the table \n {}", e.getMessage(), e); return Status.ERROR; } return Status.OK; }