auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> void foo() throws Exception { <END> var a = 2; var list = new ArrayList<String>(); list.add("hello"); list.add("world"); for (var counter = 0; counter < list.size(); counter++) { var value = list.get(counter); } for (var value : list) { value.length(); } var url = new URL("<LINK_0>"); var conn = url.openConnection(); try (var reader = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { var stream = reader.lines(); } var myA = new A() { Object myField; @Override public void foo() { this.myField = bar(); } String bar() { return "42"; } }; myA.bar(); if (myA.myField != null) { myA.foo(); } Object var; }</code><technical_language>testing usage of [var in lambda parameter definition](<LINK_1> (JEP-323)? java @Nonnull var x = new Foo(); (@Nonnull var x, @Nullable var y) -> x.process(y)</technical_language>

Target:
void foo() throws Exception { var a = 2; var list = new ArrayList<String>(); list.add("hello"); list.add("world"); for (var counter = 0; counter < list.size(); counter++) { var value = list.get(counter); } for (var value : list) { value.length(); } var url = new URL("<LINK_0>"); var conn = url.openConnection(); try (var reader = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { var stream = reader.lines(); } var myA = new A() { Object myField; @Override public void foo() { this.myField = bar(); } String bar() { return "42"; } }; myA.bar(); if (myA.myField != null) { myA.foo(); } Object var; var x = new A(); java.util.function.BiConsumer<A, String> lambda = (var l1, var l2) -> l1.process(l2); }
Source:
<code>ByteBuf encode( final ByteBufAllocator allocator, final int streamId, boolean fragmentFollows, boolean complete, boolean next, int requestN, @Nullable ByteBuf metadata, ByteBuf data) { int flags = 0; if (metadata != null) { flags |= FrameHeaderFlyweight.FLAGS_M; } if (fragmentFollows) { flags |= FrameHeaderFlyweight.FLAGS_F; } if (complete) { flags |= FrameHeaderFlyweight.FLAGS_C; } if (next) { flags |= FrameHeaderFlyweight.FLAGS_N; } ByteBuf header = FrameHeaderFlyweight.encode(allocator, streamId, frameType, flags); if (requestN > 0) { header.writeInt(requestN); } <START> if (metadata != null & data != null) { <END> return DataAndMetadataFlyweight.encode(allocator, header, metadata, data); } else if (data != null) { return DataAndMetadataFlyweight.encodeOnlyData(allocator, header, data); } else { return header; } }</code><technical_language>condition simplified data null</technical_language>

Target:
ByteBuf encode( final ByteBufAllocator allocator, final int streamId, boolean fragmentFollows, boolean complete, boolean next, int requestN, @Nullable ByteBuf metadata, ByteBuf data) { int flags = 0; if (metadata != null) { flags |= FrameHeaderFlyweight.FLAGS_M; } if (fragmentFollows) { flags |= FrameHeaderFlyweight.FLAGS_F; } if (complete) { flags |= FrameHeaderFlyweight.FLAGS_C; } if (next) { flags |= FrameHeaderFlyweight.FLAGS_N; } ByteBuf header = FrameHeaderFlyweight.encode(allocator, streamId, frameType, flags); if (requestN > 0) { header.writeInt(requestN); } if (metadata != null) { return DataAndMetadataFlyweight.encode(allocator, header, metadata, data); } else { return DataAndMetadataFlyweight.encodeOnlyData(allocator, header, data); } }
Source:
<code>public List<Comment> parseComments(int id) throws IOException { CommentVaultHtmlContentHandler commentVaultHtmlContentHandler = new CommentVaultHtmlContentHandler(); URL url = new URL(String.format(environment.getProperty("vault.mapCommentUrl"), id)); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); <START> logger.info("Fetching comments from {}", url); <END> try (BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) { JsonReader jsonReader = new JsonReader(reader); jsonReader.beginObject(); while (jsonReader.hasNext()) { String key = jsonReader.nextName(); if (!"comments".equals(key)) { jsonReader.skipValue(); continue; } String comments = jsonReader.nextString(); return htmlParser.parse(comments, commentVaultHtmlContentHandler); } jsonReader.endObject(); } throw new IllegalStateException("Comment vault could not be read from " + url); }</code><technical_language>logger.debug</technical_language>

Target:
public List<Comment> parseComments(int id) throws IOException { CommentVaultHtmlContentHandler commentVaultHtmlContentHandler = new CommentVaultHtmlContentHandler(); URL url = new URL(String.format(environment.getProperty("vault.mapCommentUrl"), id)); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); logger.debug("Fetching comments from {}", url); try (BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) { JsonReader jsonReader = new JsonReader(reader); jsonReader.beginObject(); while (jsonReader.hasNext()) { String key = jsonReader.nextName(); if (!"comments".equals(key)) { jsonReader.skipValue(); continue; } String comments = jsonReader.nextString(); return htmlParser.parse(comments, commentVaultHtmlContentHandler); } jsonReader.endObject(); } throw new IllegalStateException("Comment vault could not be read from " + url); }
Source:
<code>private Object convertValue(Object value, Type type) { if (value == null) { return null; } if (BOOLEAN.equals(type) || Varchars.isVarcharType(type)) { return value; } if (BIGINT.equals(type)) { return ((Number) value).longValue(); } if (INTEGER.equals(type)) { return ((Number) value).intValue(); } if (DOUBLE.equals(type)) { return ((Number) value).doubleValue(); } if (DATE.equals(type)) { return value; } <START> throw new AssertionError("unhandled type: " + type); <END> }</code><technical_language>IllegalArgumentException a fit here</technical_language>

Target:
private Object convertValue(Object value, Type type) { if (value == null) { return null; } if (BOOLEAN.equals(type) || Varchars.isVarcharType(type)) { return value; } if (BIGINT.equals(type)) { return ((Number) value).longValue(); } if (INTEGER.equals(type)) { return ((Number) value).intValue(); } if (DOUBLE.equals(type)) { return ((Number) value).doubleValue(); } if (DATE.equals(type)) { return value; } throw new IllegalArgumentException("unhandled type: " + type); }
Source:
<code>protected List<ServerName> fetchSlavesAddresses() { try { AsyncClusterConnection peerConn = getPeerConnection(); ServerName master = FutureUtils.get(peerConn.getAdmin().getMaster()); MasterService.BlockingInterface masterStub = MasterService.newBlockingStub( peerConn.getRpcClient() .createBlockingRpcChannel(master, User.getCurrent(), shortOperationTimeout)); ListReplicationSinkServersResponse resp = masterStub .listReplicationSinkServers(null, ListReplicationSinkServersRequest.newBuilder().build()); <START> isReplicationServer = resp.getIsReplicationServer(); <END> return ProtobufUtil.toServerNameList(resp.getServerNameList()); } catch (ServiceException | IOException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); } return Collections.emptyList(); }</code><technical_language>Do do hasReplicationServer first? read if present? this defaults false if present</technical_language>

Target:
protected List<ServerName> fetchSlavesAddresses() throws IOException { try { ServerName master = FutureUtils.get(conn.getAdmin().getMaster()); MasterService.BlockingInterface masterStub = MasterService.newBlockingStub( conn.getRpcClient().createBlockingRpcChannel(master, User.getCurrent(), operationTimeout)); ListReplicationSinkServersResponse resp = masterStub .listReplicationSinkServers(null, ListReplicationSinkServersRequest.newBuilder().build()); return ProtobufUtil.toServerNameList(resp.getServerNameList()); } catch (ServiceException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); throw ProtobufUtil.getRemoteException(e); } catch (IOException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); throw e; } }
Source:
<code>public void testCreateBootstrapDatastream() throws IOException, DatastreamException, RemoteInvocationException { <START> Datastream bootstrapDatastream = generateDatastream(3); <END> LOG.info("Bootstrap datastream : " + bootstrapDatastream); DatastreamRestClient restClient = new DatastreamRestClient("http://localhost:8080/"); restClient.createBootstrapDatastream(bootstrapDatastream); Datastream createdDatastream = restClient.getDatastream(bootstrapDatastream.getName()); LOG.info("Created Datastream : " + createdDatastream); Assert.assertEquals(bootstrapDatastream.getName(), createdDatastream.getName()); }</code><technical_language>this need a bootstrap datastream? I thought generateDatastream() generates DUMMY datastream</technical_language>

Target:
public void testCreateBootstrapDatastream() throws IOException, DatastreamException, RemoteInvocationException { Datastream bootstrapDatastream = generateDatastream(3); LOG.info("Bootstrap datastream : " + bootstrapDatastream); DatastreamRestClient restClient = new DatastreamRestClient("http://localhost:8080/"); restClient.createBootstrapDatastream(bootstrapDatastream); Datastream createdDatastream = restClient.getDatastream(bootstrapDatastream.getName()); LOG.info("Created Datastream : " + createdDatastream); Assert.assertEquals(bootstrapDatastream.getName(), createdDatastream.getName()); Assert.assertEquals(bootstrapDatastream.getConnectorType(), createdDatastream.getConnectorType()); }
Source:
<code>private static void setUpTable() { items.clear(); itemTable.getColumns().clear(); itemTable.setItems(items); items.addAll(Style.getAndy(), Style.getBoy(), Style.getCaptain(), Style.getIronMan(), <START> Style.getNoob(), Style.getPlank()); <END> TableColumn<AbstractSkin, String> name = new TableColumn<>("Name"); name.setCellValueFactory(new PropertyValueFactory<>("skinName")); name.setResizable(false); TableColumn<AbstractSkin, Integer> price = new TableColumn<>("Price"); price.setCellValueFactory(new PropertyValueFactory<>("skinPrice")); name.setResizable(false); itemTable.getColumns().add(name); itemTable.getColumns().add(price); itemTable.setRowFactory(e -> { TableRow<AbstractSkin> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { State.setSkin(row.getItem()); } }); return row; }); }</code><technical_language>a Style.getAllSkins() method returning a collection? addAll :) <logic,review</technical_language>

Target:
private static void setUpTable() { items.clear(); itemTable.getColumns().clear(); itemTable.setItems(items); itemTable.setTooltip(new Tooltip("Double click to change appearance")); items.addAll(Style.getAndy(), Style.getBoy(), Style.getCaptain(), Style.getIronMan(), Style.getNoob(), Style.getPlank()); final TableColumn<Skin, String> name = new TableColumn<>("Name"); name.setCellValueFactory(new PropertyValueFactory<>("skinName")); name.setResizable(false); final TableColumn<Skin, Integer> price = new TableColumn<>("Price"); price.setCellValueFactory(new PropertyValueFactory<>("skinPrice")); name.setResizable(false); itemTable.getColumns().add(name); itemTable.getColumns().add(price); itemTable.setRowFactory(e -> { final TableRow<Skin> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty()) { State.setSkin(row.getItem()); } }); return row; }); }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TestTcpDiscoverySpi discoSpi = (TestTcpDiscoverySpi)cfg.getDiscoverySpi(); DiscoveryHook discoveryHook = new DiscoveryHook() { @Override public void beforeDiscovery(DiscoverySpiCustomMessage msg) { <START> DiscoveryCustomMessage customMsg = msg == null ? <END> null : (DiscoveryCustomMessage)IgniteUtils.field(msg, "delegate"); if (customMsg instanceof MetadataUpdateAcceptedMessage) { try { U.sleep(50); } catch (IgniteInterruptedCheckedException e) { fail("Unexpected error:" + e); } } } }; discoSpi.discoveryHooks(discoveryHook); discoSpi.setIpFinder(IP_FINDER); cfg.setPeerClassLoadingEnabled(true); return cfg; }</code><technical_language>I provide customMsg argument (or instead of DiscoverySpiCustomMessage msg) do duplicate: DiscoveryCustomMessage customMsg = msg == null ? null : (DiscoveryCustomMessage)IgniteUtils.field(msg, "delegate");</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TestTcpDiscoverySpi)cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() { @Override public void beforeDiscovery(DiscoveryCustomMessage customMsg) { if (customMsg instanceof MetadataUpdateAcceptedMessage) { try { U.sleep(50); } catch (IgniteInterruptedCheckedException e) { fail("Unexpected error:" + e); } } } }); cfg.setPeerClassLoadingEnabled(true); return cfg; }
Source:
<code>public MoveToBlockAITask.Builder from(MoveToBlockAITask value) { <START> return this.speed(value.getSpeed()).searchRange(value.getSearchRange()); <END> }</code><technical_language>MoveToBlockAITask.builer().from(task).build() crash of absence of predicate. good..</technical_language>

Target:
public MoveToBlockAITask.Builder from(MoveToBlockAITask value) { if (!((IMixinEntityAIMoveToBlock) value).isVanillaTask()) { destinationPredicate(value.getDestinationPredicate()); } return this.speed(value.getSpeed()).searchRange(value.getSearchRange()); }
Source:
<code>public void setValueFactory(SymbolicValueFactory valueFactory) { <START> if (symbolicValueFactory != null) { <END> throw new IllegalStateException("The symbolic value factory has already been defined by another checker!"); } symbolicValueFactory = valueFactory; }</code><technical_language>guava preconditions check in this case : <LINK_0> Simplifies a bit code</technical_language>

Target:
public void setValueFactory(SymbolicValueFactory valueFactory) { Preconditions.checkState(symbolicValueFactory == null, "The symbolic value factory has already been defined by another checker!"); symbolicValueFactory = valueFactory; }
Source:
<code>private Collection<VCastResult> getResultFiles(VCastDataStore dataStore) { Collection<VCastResult> results = null; try { results = dataStore.getAllResults(); } catch (OseeCoreException ex) { <START> throw new OseeCoreException(ex, "SQL error while reading results"); <END> } return results; }</code><technical_language>point of catching throwing exception type</technical_language>

Target:
private Collection<VCastResult> getResultFiles(VCastDataStore dataStore) { Collection<VCastResult> results = null; results = dataStore.getAllResults(); return results; }
Source:
<code>public StudentProfileEditBox(String name, String isEditingPhoto, StudentProfileAttributes profile, String googleId, String pictureUrl) { this.name = name; this.editingPhoto = isEditingPhoto; this.shortName = StringHelper.convertToEmptyStringIfNull(profile.shortName); this.email = StringHelper.convertToEmptyStringIfNull(profile.email); this.institute = StringHelper.convertToEmptyStringIfNull(profile.institute); this.nationality = StringHelper.convertToEmptyStringIfNull(profile.nationality); this.nationalitySelectField = PageData.getNationalitiesAsElementTags(profile.nationality); <START> this.legacyNationality = PageData.getLegacyNationalityInstructions(profile.nationality); <END> this.gender = profile.gender; this.moreInfo = StringHelper.convertToEmptyStringIfNull(profile.moreInfo); this.googleId = googleId; this.pictureUrl = pictureUrl; }</code><technical_language>variable renamed similarly</technical_language>

Target:
public StudentProfileEditBox(String name, String isEditingPhoto, StudentProfileAttributes profile, String googleId, String pictureUrl) { this.name = name; this.editingPhoto = isEditingPhoto; this.shortName = StringHelper.convertToEmptyStringIfNull(profile.shortName); this.email = StringHelper.convertToEmptyStringIfNull(profile.email); this.institute = StringHelper.convertToEmptyStringIfNull(profile.institute); this.nationality = StringHelper.convertToEmptyStringIfNull(profile.nationality); this.nationalitySelectField = PageData.getNationalitiesAsElementTags(profile.nationality); this.legacyNationalityInstructions = PageData.getLegacyNationalityInstructions(profile.nationality); this.gender = profile.gender; this.moreInfo = StringHelper.convertToEmptyStringIfNull(profile.moreInfo); this.googleId = googleId; this.pictureUrl = pictureUrl; }
Source:
<code>private void addCapability0(CapReqBuilder builder) { builder.setResource(resource); <START> CapReqBuilder previous = capabilities.putIfAbsent(builder, builder); <END> }</code><technical_language>is point of local var is immediately out of scope</technical_language>

Target:
private Capability addCapability0(CapReqBuilder builder) { Capability cap = buildCapability(builder); Capability previous = capabilities.put(cap, cap); if (previous != null) { return previous; } return cap; }
Source:
<code><START> public BuildImageCmd withNoCache(Boolean noCache) { <END> this.noCache = noCache; return this; }</code><technical_language>potentially binary breaking change</technical_language>

Target:
public BuildImageCmdImpl withNoCache(Boolean noCache) { this.noCache = noCache; return this; }
Source:
<code>private void logZkConnectString() { String zkConnectFromEnv = environment.resolvePlaceholders(ZK_CONNECT_OPTION); <START> String zkClientConnect = (StringUtils.hasText(zkConnectFromEnv)) ? zkConnectFromEnv <END> : ZooKeeperConnection.DEFAULT_CLIENT_CONNECT_STRING; logger.info("Zookeeper Client-Connect String(s): " + zkClientConnect); }</code><technical_language>Ditto, this happen blank</technical_language>

Target:
private void logZkConnectString() { String zkConnectString = environment.resolvePlaceholders(ZK_CONNECT_OPTION); Assert.isTrue(StringUtils.hasText(zkConnectString) && !zkConnectString.equals(ZK_CONNECT_OPTION)); logger.info("Zookeeper Client-Connect String(s): " + zkConnectString); }
Source:
<code><START> protected void executeCommand() { <END> VmHandler.LockVm(getVm().getDynamicData(), getCompensationContext()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType .MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); return null; } }); }</code><technical_language>of u checked lock status of VM, I is VmHandler.checkStatusAndLockVm()</technical_language>

Target:
protected void executeCommand() { VmHandler.checkStatusAndLockVm(getVm().getvm_guid()); VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType.MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); }
Source:
<code>private void download() { try { File random = new File(Directories.getCachePath() + File.separator + "randoms.jar"); if (random.exists()) { Core.verbose("Public random dependency already exists, no need to download it..."); return; } <START> String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + "?stable=false" : Configuration.GET_RANDOMS); <END> WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener()); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>a Configuration for ?stable=false, if client only. If client only, add internal API configuration</technical_language>

Target:
private void download() { try { File random = new File(Directories.getCachePath() + File.separator + fileName); if (random.exists()) { Core.verbose("Public random dependency already exists, no need to download it..."); return; } String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + Configuration.NIGHTLY_APPEND : Configuration.GET_RANDOMS); WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener()); } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>public static double computeArea(Point a, Point b) { final double x1 = a.getTimestamp(); final double x2 = b.getTimestamp(); if (x1 > x2) { throw new IllegalArgumentException("timestamp of b needs to be greater than a"); } <START> if (x1 == x2) { <END> return 0; } final double y1 = a.getValue(); final double y2 = b.getValue(); if (sameSign(y1, y2)) { final double area = areaPositivePoints(x1, Math.abs(y1), x2, Math.abs(y2)); return Math.copySign(area, y1); } else { final double interceptsX = computeInterceptsX(x1, x2, y1, y2); final double area1 = areaPositivePoints(x1, Math.abs(y1), interceptsX, 0); final double area2 = areaPositivePoints(interceptsX, 0, x2, Math.abs(y2)); return Math.copySign(area1, y1) + Math.copySign(area2, y2); } }</code><technical_language>want perform a long comparison due potentially problematic floating point comparisons</technical_language>

Target:
public static double computeArea(Point a, Point b) { if (a.getTimestamp() == b.getTimestamp()) { return 0; } if (a.getTimestamp() > b.getTimestamp()) { return computeArea(b, a); } final double x1 = a.getTimestamp(); final double x2 = b.getTimestamp(); final double y1 = a.getValue(); final double y2 = b.getValue(); if (sameSign(y1, y2)) { final double area = areaPositivePoints(x1, Math.abs(y1), x2, Math.abs(y2)); return Math.copySign(area, y1); } else { final double interceptsX = computeInterceptsX(x1, x2, y1, y2); final double area1 = areaPositivePoints(x1, Math.abs(y1), interceptsX, 0); final double area2 = areaPositivePoints(interceptsX, 0, x2, Math.abs(y2)); return Math.copySign(area1, y1) + Math.copySign(area2, y2); } }
Source:
<code>public NoSuchPartitionKeyException(String tableName, String partitionKey) { <START> super(String.format("ERROR: partition column \"%s\" does not exist in \"%s\".", partitionKey, tableName)); <END> }</code><technical_language>This message means table of tableName partitionKey column. print partitionKey column is partition key of tableName table</technical_language>

Target:
public NoSuchPartitionKeyException(String tableName, String partitionKey) { super(String.format("ERROR: \"%s\" column is not the partition key of \"%s\".", partitionKey, tableName)); }
Source:
<code>public AxisConfiguration(GraphData data) throws JSONException, InvalidStateException { super(data); JSONObject x = new JSONObject(); JSONObject y = new JSONObject(); JSONObject y2 = new JSONObject(); <START> if (Boolean.valueOf(mData.getConfiguration("show-axes", "true")).equals(Boolean.FALSE)) { <END> JSONObject show = new JSONObject("{ show: false }"); x = show; y = show; y2 = show; } else { JSONObject padding = new JSONObject("{top: 0, right: 0, bottom: 0, left: 0}"); x.put("padding", padding); y.put("padding", padding); y2.put("padding", padding); addTitle(x, "x-title", "outer-center"); addTitle(y, "y-title", "outer-middle"); addTitle(y2, "secondary-y-title", "outer-middle"); addBounds(x, "x"); addBounds(y, "y"); addBounds(y2, "secondary-y"); for (SeriesData s : mData.getSeries()) { if (Boolean.valueOf(s.getConfiguration("secondary-y", "false")).equals(Boolean.TRUE)) { y2.put("show", true); break; } } addTickConfig(x, "x-labels", "xLabels"); addTickConfig(y, "y-labels", "yLabels"); addTickConfig(y2, "secondary-y-labels", "y2Labels"); } mConfiguration.put("x", x); mConfiguration.put("y", y); mConfiguration.put("y2", y2); if (mData.getType().equals(Graph.TYPE_BAR) && !mData.getConfiguration("bar-orientation", "horizontal").equalsIgnoreCase("vertical")) { mConfiguration.put("rotated", true); } }</code><technical_language>(...).equals(Boolean.FALSE) -> !(...)</technical_language>

Target:
public AxisConfiguration(GraphData data) throws JSONException, InvalidStateException { super(data); JSONObject x = getAxis("x"); JSONObject y = getAxis("y"); JSONObject y2 = getAxis("secondary-y"); for (SeriesData s : mData.getSeries()) { boolean hasSecondaryAxis = Boolean.valueOf(s.getConfiguration("secondary-y", "false")); if (hasSecondaryAxis) { y2.put("show", true); break; } } mConfiguration.put("x", x); mConfiguration.put("y", y); mConfiguration.put("y2", y2); if (mData.getType().equals(Graph.TYPE_BAR) && !mData.getConfiguration("bar-orientation", "horizontal").equalsIgnoreCase("vertical")) { mConfiguration.put("rotated", true); } }
Source:
<code>public CompletableFuture<Void> putAsync(K key, V value) { <START> put(key, value); <END> return CompletableFuture.completedFuture(null); }</code><technical_language>This happen future</technical_language>

Target:
public CompletableFuture<Void> putAsync(K key, V value) { if (key == null) { return deleteAsync(key); } CompletableFuture<Void> future = new CompletableFuture<>(); try { cache.put(key, value); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
Source:
<code>public synchronized void deleteAll(List<K> keys) { Preconditions.checkNotNull(rwTable, "Cannot delete from a read-only table: " + rdTable); keys.stream().forEach(k -> { <START> cache.delete(k); <END> rwTable.delete(k); }); }</code><technical_language>call CachingTable.delete(key)</technical_language>

Target:
public void deleteAll(List<K> keys) { Preconditions.checkNotNull(rwTable, "Cannot delete from a read-only table: " + rdTable); keys.stream().forEach(k -> delete(k)); }
Source:
<code>public static void listObject_test5() throws Exception { System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix, " + "final boolean recursive)"); String[] objectNames = new String[1050]; int i = 0; <START> for (i = 0; i < 1050; i++) { <END> objectNames[i] = getRandomName(); InputStream is = new ContentInputStream(1); client.putObject(bucketName, objectNames[i], is, 1, null); is.close(); } i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != 1050) { throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: 1050, " + "found: " + i); } for (i = 0; i < 1050; i++) { client.removeObject(bucketName, objectNames[i]); } }</code><technical_language>hardcode objCount</technical_language>

Target:
public static void listObject_test5() throws Exception { System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix, " + "final boolean recursive)"); int objCount = 1050; String[] objectNames = new String[objCount]; int i = 0; for (i = 0; i < objCount; i++) { objectNames[i] = getRandomName(); InputStream is = new ContentInputStream(1); client.putObject(bucketName, objectNames[i], is, 1, null); is.close(); } i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != objCount) { throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: " + objCount + ", found: " + i); } for (i = 0; i < objCount; i++) { client.removeObject(bucketName, objectNames[i]); } }
Source:
<code>public String ensureFolderOnPath(String existingPath, String folder) { existingPath = (existingPath == null ? "" : existingPath); String[] roots = null; if( existingPath.isEmpty() && pathCommand != null) { String pathresult = runCommand(pathCommand, false); roots = pathresult.split(delim); } else <START> roots = existingPath.split(delim); <END> ArrayList<String> list = new ArrayList(Arrays.asList(roots)); if( !list.contains(folder)) { list.add(folder); } return String.join(delim, list); }</code><technical_language>empty string, "".split(delim) returns array of length 1 empty string element. Then, adding list a folder "myFolder" joining result in ";myFolder" - leading delimeter. is important in this case, please check it</technical_language>

Target:
public String ensureFolderOnPath(String existingPath, String folder) { existingPath = (existingPath == null ? "" : existingPath); String[] roots = null; if( existingPath.isEmpty() && pathCommand != null) { String pathresult = runCommand(pathCommand); roots = pathresult.split(delim); } else roots = existingPath.split(delim); ArrayList<String> list = new ArrayList<String>(Arrays.asList(roots)); if( !list.contains(folder)) { list.add(folder); } return String.join(delim, list); }
Source:
<code>public void testBindingCteAssociationToEntityId() { transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a.id") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a.id") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); <START> List<MyEntity> resultList = select <END> .getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }</code><technical_language>Instead of ignoring test, please catch exception verify right exception is thrown i.e. check for a part of exception message</technical_language>

Target:
public void testBindingCteAssociationToEntityId() { expectedException.expectMessage("An association should be bound to its association type and not its identifier type"); transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a.id") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a.id") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); select.getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }
Source:
<code>public ModelNode getAddOperation() { ModelNode addOperation = Util.createAddOperation(address); addOperation.get("authentication-realm").set(authenticationRealm); if (authorizationRealm != null) { addOperation.get("authorization-realm").set(authorizationRealm); } if (authorizationRealms != null) { ModelNode realms = addOperation.get("authorization-realms"); <START> for (String realmName : authorizationRealms) { <END> realms.add(realmName); } } return addOperation; }</code><technical_language>Is reason support authentication-realm authorization-realms attributes time? else statement</technical_language>

Target:
public ModelNode getAddOperation() { ModelNode addOperation = Util.createAddOperation(address); addOperation.get("authentication-realm").set(authenticationRealm); if (authorizationRealm != null) { addOperation.get("authorization-realm").set(authorizationRealm); } if (authorizationRealms != null) { ModelNode realms = addOperation.get("authorization-realms"); for (String realmName : authorizationRealms) { realms.add(realmName); } } if (principalTransformer != null) { addOperation.get("principal-transformer").set(principalTransformer); } return addOperation; }
Source:
<code>private Collection<VCastInstrumentedFile> getInstrumentedFiles(VCastDataStore dataStore) { Collection<VCastInstrumentedFile> instrumentedFiles = new ArrayList<VCastInstrumentedFile>(); try { instrumentedFiles = dataStore.getAllInstrumentedFiles(); <START> } catch (OseeCoreException ex) { <END> } if (instrumentedFiles.isEmpty()) { } return instrumentedFiles; }</code><technical_language>DO something</technical_language>

Target:
private Collection<VCastInstrumentedFile> getInstrumentedFiles(VCastDataStore dataStore) { Collection<VCastInstrumentedFile> instrumentedFiles = new ArrayList<VCastInstrumentedFile>(); try { instrumentedFiles = dataStore.getAllInstrumentedFiles(); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading functions for directory: ", vCastDir); } return instrumentedFiles; }
Source:
<code>public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Ds3Element)) { return false; } final Ds3Element element = (Ds3Element) obj; <START> return Objects.equals(this.getName(), element.getName()) <END> && Objects.equals(this.getType(), element.getType()) && Objects.equals(this.getComponentType(), element.getComponentType()); }</code><technical_language>This is checking for reference equality, string equality</technical_language>

Target:
public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Ds3Element)) { return false; } final Ds3Element element = (Ds3Element) obj; return this.getName().equals(element.getName()) && this.getType().equals(element.getType()) && (this.getComponentType() == null ? element.getComponentType() == null : this.getComponentType().equals(element.getComponentType())); }
Source:
<code>private Class<?> loadClass(String className) { Class<?> clazz = null; try { clazz = classLoader.loadClass(className); <START> } catch (ClassNotFoundException ex) { <END> } if (clazz == null) { throw new ClassFileInfoException("Unable to load class " + className); } return clazz; }</code><technical_language>Instead of suppressing exception checking for null, raise exception catch block instead</technical_language>

Target:
private Class<?> loadClass(String className) { log.trace("Loading class with class loader: " + className); Class<?> clazz = null; try { clazz = classLoader.loadClass(className); } catch (ClassNotFoundException ex) { throw new ClassFileInfoException("Unable to load class " + className); } return clazz; }
Source:
<code>private Map<String, Class<?>> loadExtensionClasses() { cacheDefaultExtensionName(); <START> Map<String, Class<?>> extensionClasses = new HashMap<String, Class<?>>(); <END> loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName()); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); return extensionClasses; }</code><technical_language>suggestion Map<String, Class<?>> extensionClasses = new HashMap<>(); this</technical_language>

Target:
private Map<String, Class<?>> loadExtensionClasses() { cacheDefaultExtensionName(); Map<String, Class<?>> extensionClasses = new HashMap<>(); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName()); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); return extensionClasses; }
Source:
<code>public void testManualDocumentMovedToFolderRule() throws InterruptedException { RetentionRule testRule = createManualEventBasedRuleMillis(DocumentEventTypes.DOCUMENT_MOVED, "document.getPathAsString().startsWith('/testFolder')", 1000L); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); Record record = file.getAdapter(Record.class); assertTrue(record.isRetainUntilInderterminate()); awaitRetentionExpiration(500L); file = session.getDocument(file.getRef()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); record = file.getAdapter(Record.class); assertTrue(record.isRetainUntilInderterminate()); DocumentModel folder = session.createDocumentModel("/", "testFolder", "Folder"); folder = session.createDocument(folder); folder = session.saveDocument(folder); file = session.move(file.getRef(), folder.getRef(), null); <START> awaitRetentionExpiration(500L); <END> record = file.getAdapter(Record.class); assertFalse(record.isRetainUntilInderterminate()); assertFalse(record.isRetentionExpired()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); awaitRetentionExpiration(500L); file = session.getDocument(file.getRef()); record = file.getAdapter(Record.class); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); assertTrue(record.isRetentionExpired()); }</code><technical_language>awaitRetentionExpiration(500L); -> awaitRetentionExpiration(500); for</technical_language>

Target:
public void testManualDocumentMovedToFolderRule() throws InterruptedException { RetentionRule testRule = createManualEventBasedRuleMillis(DocumentEventTypes.DOCUMENT_MOVED, "document.getPathAsString().startsWith('/testFolder')", 1000); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); Record record = file.getAdapter(Record.class); assertTrue(record.isRetentionIndeterminate()); awaitRetentionExpiration(500); file = session.getDocument(file.getRef()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); record = file.getAdapter(Record.class); assertTrue(record.isRetentionIndeterminate()); DocumentModel folder = session.createDocumentModel("/", "testFolder", "Folder"); folder = session.createDocument(folder); folder = session.saveDocument(folder); file = session.move(file.getRef(), folder.getRef(), null); awaitRetentionExpiration(500); record = file.getAdapter(Record.class); assertFalse(record.isRetentionIndeterminate()); assertFalse(record.isRetentionExpired()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); awaitRetentionExpiration(500); file = session.getDocument(file.getRef()); record = file.getAdapter(Record.class); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); assertTrue(record.isRetentionExpired()); }
Source:
<code>private void onShareClicked() { <START> String timestamp = !isLive() ? "&t=" + getPlaybackSeekBar().getProgress() / 1000 : ""; <END> ShareUtils.shareUrl(service, getVideoTitle(), getVideoUrl() + timestamp); }</code><technical_language>this variable final? reverse ternary statement negative, i.e. isLive ? "" : "&t=" + ? Thanks for contribution</technical_language>

Target:
private void onShareClicked() { final String ts = isLive() ? "" : ("&t=" + (getPlaybackSeekBar().getProgress() / 1000)); ShareUtils.shareUrl(service, getVideoTitle(), getVideoUrl() + ts); }
Source:
<code>public void onConfirmation(String callerTag) { Activity parentActivity = getActivity(); AccountManager am = AccountManager.get(parentActivity); AccountManagerCallback<Boolean> callback = (AccountManagerCallback<Boolean>) parentActivity; am.removeAccount(mTargetAccount, callback, new Handler()); String authority = getResources().getString(R.string.document_provider_authority); Uri rootsUri = DocumentsContract.buildRootsUri(authority); <START> Objects.requireNonNull(getContext()).getContentResolver().notifyChange(rootsUri, null); <END> }</code><technical_language>a question, do Objects like: if (getContext() != null) { getContext().getContentResolver().notifyChange(rootsUri, null); }</technical_language>

Target:
public void onConfirmation(String callerTag) { Activity parentActivity = getActivity(); AccountManager am = AccountManager.get(parentActivity); AccountManagerCallback<Boolean> callback = (AccountManagerCallback<Boolean>) parentActivity; am.removeAccount(mTargetAccount, callback, new Handler()); String authority = getResources().getString(R.string.document_provider_authority); Uri rootsUri = DocumentsContract.buildRootsUri(authority); if (getContext() != null) { getContext().getContentResolver().notifyChange(rootsUri, null); } }
Source:
<code>public int hashCode() { return Objects.hash(listDelimiter, columns, findColumnsFromHeader, skipHeaderRows); <START> } <END></code><technical_language>format is missing in equalsAndHashCode</technical_language>

Target:
public int hashCode() { return Objects.hash(listDelimiter, columns, findColumnsFromHeader, skipHeaderRows, format); }
Source:
<code><START> static String constructSegmentPath(String baseKey, String storageDir) <END> { return JOINER.join( baseKey.isEmpty() ? null : baseKey, storageDir ) + "/index.zip"; }</code><technical_language>if in extensions, public remain so</technical_language>

Target:
public static String constructSegmentPath(String baseKey, String storageDir) { return JOINER.join( baseKey.isEmpty() ? null : baseKey, storageDir ) + "/index.zip"; }
Source:
<code>public static void setup() { if (currencySymbolLookup == null) { currencySymbolLookup = new HashMap<String, String>(); currencySymbolLookup.put("USD", "$"); <START> currencySymbolLookup.put("EUR", "???"); <END> currencySymbolLookup.put("CNY", "??"); currencySymbolLookup.put("GBP", "??"); } }</code><technical_language>file format is uft8 resulted in loss of currency symbols</technical_language>

Target:
public static void setup() { if (currencySymbolLookup == null) { currencySymbolLookup = new HashMap<String, String>(); currencySymbolLookup.put("USD", "$"); currencySymbolLookup.put("EUR", "€"); currencySymbolLookup.put("CNY", "¥"); currencySymbolLookup.put("GBP", "£"); } }
Source:
<code>private SiteNode getSiteTreeTarget() { if (!extension.getView().getSiteTreePanel().getTreeSite().isSelectionEmpty()) { <START> SiteNode targetNode = (SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getSelectionPath() <END> .getLastPathComponent(); return targetNode; } return null; }</code><technical_language>return immediately</technical_language>

Target:
private SiteNode getSiteTreeTarget() { if (!extension.getView().getSiteTreePanel().getTreeSite().isSelectionEmpty()) { return (SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getSelectionPath() .getLastPathComponent(); } return null; }
Source:
<code>public SQLTemplates.Builder getBuilder(DatabaseMetaData md) throws SQLException { String name = md.getDatabaseProductName().toLowerCase(); if (name.equals("cubrid")) { return CUBRIDTemplates.builder(); } else if (name.equals("apache derby")) { return DerbyTemplates.builder(); } else if (name.startsWith("firebird")) { return FirebirdTemplates.builder(); } else if (name.equals("h2")) { return H2Templates.builder(); } else if (name.equals("hsql")) { return HSQLDBTemplates.builder(); } else if (name.equals("mysql")) { return MySQLTemplates.builder(); } else if (name.equals("oracle")) { return OracleTemplates.builder(); } else if (name.equals("postgresql")) { return PostgreSQLTemplates.builder(); } else if (name.equals("sqlite")) { return SQLiteTemplates.builder(); } else if (name.startsWith("teradata")) { return TeradataTemplates.builder(); } else if (name.equals("microsoft sql server")) { switch (md.getDatabaseMajorVersion()) { case 12: case 11: return SQLServer2012Templates.builder(); case 10: return SQLServer2008Templates.builder(); case 9: return SQLServer2005Templates.builder(); default: return SQLServerTemplates.builder(); } } else { return new SQLTemplates.Builder() { @Override protected SQLTemplates build(char escape, boolean quote) { <START> return new SQLiteTemplates(escape, quote); <END> } }; } }</code><technical_language>wondering, SQLiteTemplates</technical_language>

Target:
public SQLTemplates.Builder getBuilder(DatabaseMetaData md) throws SQLException { String name = md.getDatabaseProductName().toLowerCase(); if (name.equals("cubrid")) { return CUBRIDTemplates.builder(); } else if (name.equals("apache derby")) { return DerbyTemplates.builder(); } else if (name.startsWith("firebird")) { return FirebirdTemplates.builder(); } else if (name.equals("h2")) { return H2Templates.builder(); } else if (name.equals("hsql")) { return HSQLDBTemplates.builder(); } else if (name.equals("mysql")) { return MySQLTemplates.builder(); } else if (name.equals("oracle")) { return OracleTemplates.builder(); } else if (name.equals("postgresql")) { return PostgreSQLTemplates.builder(); } else if (name.equals("sqlite")) { return SQLiteTemplates.builder(); } else if (name.startsWith("teradata")) { return TeradataTemplates.builder(); } else if (name.equals("microsoft sql server")) { switch (md.getDatabaseMajorVersion()) { case 12: case 11: return SQLServer2012Templates.builder(); case 10: return SQLServer2008Templates.builder(); case 9: return SQLServer2005Templates.builder(); default: return SQLServerTemplates.builder(); } } else { return new SQLTemplates.Builder() { @Override protected SQLTemplates build(char escape, boolean quote) { return new SQLTemplates(Keywords.DEFAULT, "\"", escape, quote); } }; } }
Source:
<code>public void init(NewApplicationRequest dataObject) { super.init(dataObject); view.resetControls(); openShiftClient.getProjects().then(new Operation<List<Project>>() { @Override public void apply(final List<Project> projects) throws OperationException { for (Project project : projects) { <START> openShiftProjects.add(project.getMetadata().getName()); <END> } view.setExistOpenShiftProjects(projects); } }); projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> projects) throws OperationException { for (ProjectDescriptor project : projects) { cheProjects.add(project.getName()); } } }); }</code><technical_language><LINK_0></technical_language>

Target:
public void init(NewApplicationRequest dataObject) { super.init(dataObject); view.resetControls(); openShiftClient.getProjects().then(new Operation<List<Project>>() { @Override public void apply(final List<Project> projects) throws OperationException { openShiftProjects.clear(); for (Project project : projects) { openShiftProjects.add(project.getMetadata().getName()); } view.setExistOpenShiftProjects(projects); } }); projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> projects) throws OperationException { openShiftProjects.clear(); for (ProjectDescriptor project : projects) { cheProjects.add(project.getName()); } } }); }
Source:
<code>private static String processLinks(String bbEncodedText) { StringBuilder stringBuilder = new StringBuilder(); int prevPos = 0; <START> Matcher matcher = htmlTagsToSkip.matcher(bbEncodedText); <END> while (matcher.find()) { String substring = bbEncodedText.substring(prevPos, matcher.start()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } stringBuilder.append(matcher.group()); prevPos = matcher.end(); } String substring = bbEncodedText.substring(prevPos, bbEncodedText.length()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } if (stringBuilder.length() > 0) { return stringBuilder.toString(); } return bbEncodedText; }</code><technical_language>i understand. describe logic of this method</technical_language>

Target:
private static String processLinks(String bbEncodedText) { StringBuilder stringBuilder = new StringBuilder(); int prevPos = 0; Matcher matcher = htmlTagsToSkip.matcher(bbEncodedText); while (matcher.find()) { String substring = bbEncodedText.substring(prevPos, matcher.start()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } stringBuilder.append(matcher.group()); prevPos = matcher.end(); } if (prevPos == 0) { return processUrlInText(bbEncodedText); } String substring = bbEncodedText.substring(prevPos, bbEncodedText.length()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } return stringBuilder.toString(); }