auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private CompletionStage<RestResponse> getXSiteTakeOffline(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); String site = request.variables().get("site"); Cache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, request); XSiteAdminOperations xsiteAdmin = cache.getAdvancedCache().getComponentRegistry().getComponent(XSiteAdminOperations.class); if (!xsiteAdmin.checkSite(site)) { return CompletableFuture.completedFuture(responseBuilder.status(NOT_FOUND.code()).build()); } OfflineStatus offlineStatus = xsiteAdmin.getOfflineStatus(site); try { byte[] payload = invocationHelper.getMapper().writeValueAsBytes(new TakeOffline(offlineStatus.getTakeOffline())); <START> responseBuilder.entity(payload); <END> } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }</code><technical_language>this is lack of knowledge, other places have: responseBuilder.contentType(APPLICATION_JSON).entity(payload).status(OK); contentType() status() missing</technical_language>

Target:
private CompletionStage<RestResponse> getXSiteTakeOffline(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String site = request.variables().get("site"); XSiteAdminOperations xsiteAdmin = getxsiteAdmin(request); if (!xsiteAdmin.checkSite(site)) { return CompletableFuture.completedFuture(responseBuilder.status(NOT_FOUND.code()).build()); } OfflineStatus offlineStatus = xsiteAdmin.getOfflineStatus(site); try { byte[] payload = invocationHelper.getMapper().writeValueAsBytes(new TakeOffline(offlineStatus.getTakeOffline())); responseBuilder.entity(payload).contentType(APPLICATION_JSON_TYPE); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }
Source:
<code>protected SenderInfo getSenderInfoExtensionPoint(Message messageEntity) { <START> BuddyMessage responseMmessageEntity = (BuddyMessage) messageEntity; <END> return createSenderInfoForDetachedBuddy(responseMmessageEntity.getSenderUser(), responseMmessageEntity.getSenderNickname()); }</code><technical_language>Correct spelling of responseMmessageEntity</technical_language>

Target:
protected SenderInfo getSenderInfoExtensionPoint(Message messageEntity) { BuddyMessage buddyMessageEntity = (BuddyMessage) messageEntity; return createSenderInfoForDetachedBuddy(buddyMessageEntity.getSenderUser(), buddyMessageEntity.getSenderNickname()); }
Source:
<code>public TransitionEditor(Composite parent, int style) { <START> super("Advanced transition textual editor", parent, <END> style); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150).applyTo(xtextEditor.getTextControl()); }</code><technical_language>I prefer a constant (from plugin providing language) here, show plugin is missing a Manifest dependency plugin provide language org.eclipse.papyrus.uml.textedit.transition.xtext.ui</technical_language>

Target:
public TransitionEditor(Composite parent, int style) { super(TransitionEditorConfigurationContribution.LANGUAGE, parent, style); Label editorLabel = new Label(parent, SWT.NONE); editorLabel.setText("Edit transition:"); editorLabel.moveAbove(null); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150).applyTo(xtextEditor.getTextControl()); }
Source:
<code>public boolean lockForWriting( List<String> locks ) { TransactionsHolder.requireActiveTransaction(); if (locks.isEmpty()) { return false; <START> } <END> return runWithConnection(connection -> statements.lockForWriting(connection, locks), true); }</code><technical_language>this if block requireActiveTransaction() call</technical_language>

Target:
public boolean lockForWriting( List<String> locks ) { if (locks.isEmpty()) { return false; } TransactionsHolder.requireActiveTransaction(); return runWithConnection(connection -> statements.lockForWriting(connection, locks), true); }
Source:
<code><START> private Boolean segmentFree(final int ind, final SequenceSegment segment) { <END> for (int height = 0; height < segment.getSources().size(); height++) { if ((ind + height < lanes.size()) && (lanes.get(ind + height) > segment.getStart())) { return false; } } return true; }</code><technical_language>Minor inconsistency: Return type is Boolean primitive boolean</technical_language>

Target:
private boolean segmentFree(final int ind, final SequenceSegment segment) { for (int height = 0; height < segment.getSources().size(); height++) { if ((ind + height < lanes.size()) && (lanes.get(ind + height) > segment.getStart())) { return false; } } return true; }
Source:
<code>public String get(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); Property property = annotated.getAnnotation(Property.class); String key = property.value(); <START> if (isNullOrEmpty(key)) key = ip.getMember().getName(); <END> return environment.get(key); }</code><technical_language>conditions if braces new like</technical_language>

Target:
public String get(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); Property property = annotated.getAnnotation(Property.class); String key = property.value(); if (isNullOrEmpty(key)) { key = ip.getMember().getName(); } return environment.get(key); }
Source:
<code>public CommentDefaultAccessModifierRule() { definePropertyDescriptor(REGEX_DESCRIPTOR); <START> defaultSuppressionAnnotations(); <END> }</code><technical_language>is need call this method</technical_language>

Target:
public CommentDefaultAccessModifierRule() { definePropertyDescriptor(REGEX_DESCRIPTOR); }
Source:
<code><START> static SSLContext getSslContext() { <END> final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setNeedClientAuth(true); sslContext.getDefaultSSLParameters().setWantClientAuth(true); return sslContext; }</code><technical_language>is longer private</technical_language>

Target:
private SSLContext getSslContext() { if (!isSslConfigured()) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } KeyStore trustStore = getKeyStore(getProperty(TRUST_STORE), getProperty(TRUST_STORE_PASS)); KeyStore keyStore = getKeyStore(getProperty(KEY_STORE), getProperty(KEY_STORE_PASS)); SSLContext sslContext; try { sslContext = SSLContexts.custom() .loadKeyMaterial(keyStore, getProperty(KEY_STORE_PASS).toCharArray()) .loadTrustMaterial(trustStore) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setWantClientAuth(true); return sslContext; }
Source:
<code>private Object invokeReactiveToSuspend(Method methodToCall, Object instance, Object[] args) throws ReflectiveOperationException { Object[] invocationArguments = new Object[args.length - 1]; System.arraycopy(args, 0, invocationArguments, 0, invocationArguments.length); Object result = methodToCall.invoke(instance, invocationArguments); <START> Publisher<?> publisher; <END> if (result instanceof Publisher) { publisher = (Publisher<?>) result; } else { publisher = ReactiveWrapperConverters.toWrapper(result, Publisher.class); } return AwaitKt.awaitFirstOrNull(publisher, (Continuation) args[args.length - 1]); }</code><technical_language>Ternary if</technical_language>

Target:
private Object invokeReactiveToSuspend(Method methodToCall, Object instance, Object[] args) throws ReflectiveOperationException { Object[] invocationArguments = new Object[args.length - 1]; System.arraycopy(args, 0, invocationArguments, 0, invocationArguments.length); Object result = methodToCall.invoke(instance, invocationArguments); Publisher<?> publisher = result instanceof Publisher ? (Publisher<?>) result : ReactiveWrapperConverters.toWrapper(result, Publisher.class); return AwaitKt.awaitFirstOrNull(publisher, (Continuation) args[args.length - 1]); }
Source:
<code><START> public void filePage001_tabs() { <END> FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName); filePage.verifySelectedTab("about"); filePage.selectTab(1); filePage.verifySelectedTab("history"); filePage.selectTab(0); filePage.verifySelectedTab("about"); filePage.selectTab(2); filePage.verifySelectedTab("metadata"); }</code><technical_language>change method name filePageTests_001_tabs()</technical_language>

Target:
public void filePage001_tabs() { FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName001); filePage.verifySelectedTab("about"); filePage.selectTab(1); filePage.verifySelectedTab("history"); filePage.selectTab(0); filePage.verifySelectedTab("about"); filePage.selectTab(2); filePage.verifySelectedTab("metadata"); }
Source:
<code>private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { String[] itemStrings = new String[columns.size()]; TableColumn[] tableColumns = fTable.getColumns(); for (int i = 0; i < columns.size(); i++) { TmfEventTableColumn column = columns.get(i); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn tableColumn = tableColumns[fColumns.indexOf(column)]; if (passedEvent == null || (!tableColumn.getResizable() && tableColumn.getWidth() == 0)) { itemStrings[i] = EMPTY_STRING; } else { String s = column.getItemString(passedEvent); s = s.replaceAll("\\n", " "); s = s.replaceAll("\\r", " "); <START> if (s == EMPTY_STRING) { <END> String ColumnName = column.getHeaderName(); for (int j = 0; j < fColumnsDuplicate.size(); j++) { TmfEventTableColumn duplicateColumn = fColumnsDuplicate.get(j); if (duplicateColumn.getHeaderName() == ColumnName) { itemStrings[i] = duplicateColumn.getItemString(passedEvent); } } } else { itemStrings[i] = s; } } } return itemStrings; } }</code><technical_language>column's responsibility get proper string this kind of for loop. add a constructor column a set of aspects name</technical_language>

Target:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { String[] itemStrings = new String[columns.size()]; TableColumn[] tableColumns = fTable.getColumns(); for (int i = 0; i < columns.size(); i++) { TmfEventTableColumn column = columns.get(i); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn tableColumn = tableColumns[fColumns.indexOf(column)]; if (passedEvent == null || (!tableColumn.getResizable() && tableColumn.getWidth() == 0)) { itemStrings[i] = EMPTY_STRING; } else { String s = column.getItemString(passedEvent); s = s.replaceAll("\\n", " "); s = s.replaceAll("\\r", " "); itemStrings[i] = s; } } return itemStrings; } }
Source:
<code>public void mockAlternativeIsVetoed() { <START> Assert.assertEquals(getUniqueBean(PaymentProcessor.class).getName(), "paymentProcessorImpl"); <END> }</code><technical_language>swap method arguments I guess. Testng order JUnit. for other assertEquals mehtods</technical_language>

Target:
public void mockAlternativeIsVetoed() { Assert.assertEquals("paymentProcessorImpl", getUniqueBean(PaymentProcessor.class).getName()); }
Source:
<code>public void start() { if (mRunning) return; mRunning = true; new Thread() { <START> @Override public void run() { <END> while (mRunning) { listen(); } } }.start(); }</code><technical_language>nit: this a lambda</technical_language>

Target:
public void start() { if (mRunning) return; mRunning = true; new Thread(() -> { while (mRunning) { listen(); } }).start(); }
Source:
<code>private Composite createFixedComp(Composite parent) { Composite comp = createComposite(parent); GridLayoutFactory.fillDefaults().applyTo(comp); Control <START> l = <END> ControlFactory.create(comp, SHORT_CONTROL_WIDTH, 15); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(l); return comp; }</code><technical_language>this variable renamed control</technical_language>

Target:
private Composite createFixedComp(Composite parent) { Composite comp = createComposite(parent); GridLayoutFactory.fillDefaults().applyTo(comp); Control control = ControlFactory.create(comp, SHORT_CONTROL_WIDTH, 15); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(control); return comp; }
Source:
<code>public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String downloadHostNameOverride = config.getStringValue(DOWNLOAD_HOSTNAME_OVERRIDE); <START> if (StringUtil.isNotBlank(downloadHostNameOverride)) { <END> hostname = downloadHostNameOverride; } final String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); final String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }</code><technical_language>add a method forming uri. I setting a static variable here. private String getHostnameOrIp(Config config); call config.getString(key, defaultValue) need string util</technical_language>

Target:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); final String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); final String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", getHostNameOrIP(), getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }
Source:
<code>public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee) { return new Equal<P5<A, B, C, D, E>>(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4()) && ee.eq(p1._5(), p2._5())); <START> } <END></code><technical_language>Created #74 this simpler in future. _Update_ I missed static method Equal.equal, want. Please method</technical_language>

Target:
public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee) { return equal(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4()) && ee.eq(p1._5(), p2._5())); }
Source:
<code>public OutputDataStream[] getOutputDataStreams() { <START> final OutputDataStreamBuilder streamBuilder = OutputDataStreams.pushDataStream("character sets"); <END> streamBuilder.withColumn("Character set", ColumnType.STRING); for(InputColumn<String> column : _columns) { streamBuilder.withColumn(column.getName(), ColumnType.STRING); } return new OutputDataStream[]{streamBuilder.toOutputDataStream()}; }</code><technical_language>a constant</technical_language>

Target:
public OutputDataStream[] getOutputDataStreams() { final OutputDataStreamBuilder streamBuilder = OutputDataStreams.pushDataStream(CHARACTER_SETS); streamBuilder.withColumn(CHARACTER_SET_COLUMN, ColumnType.STRING); for(InputColumn<String> column : _columns) { streamBuilder.withColumn(column.getName(), ColumnType.STRING); } return new OutputDataStream[]{streamBuilder.toOutputDataStream()}; }
Source:
<code>public SystemConfigurationProvider(Map<String, String> variableValues) { <START> this(variableValues, new ObjectMapper()); <END> }</code><technical_language>pass 'null' for ObjectMapper create a default in AbstractObjectConfigurationProvider</technical_language>

Target:
public SystemConfigurationProvider(Map<String, String> variableValues) { this(variableValues, null); }
Source:
<code>public void updateEntity() { if (worldObj.isRemote) return; if (lightList.isEmpty()) { worldObj.setBlockToAir(new BlockPos(this.pos.getX(), this.pos.getY(), this.pos.getZ())); Utils.println("Destroy light at " + this.pos.getX() + " " + this.pos.getY() + " " + this.pos.getZ() + " "); return; } int light = 0; Iterator<LightHandle> iterator = lightList.iterator(); while (iterator.hasNext()) { LightHandle l = iterator.next(); if (light < l.value) light = l.value; l.timeout--; if (l.timeout <= 0) { iterator.remove(); } } <START> if (light != worldObj.getBlockState(this.pos).getBlock().getMetaFromState(worldObj.getBlockState(this.pos))) { <END> worldObj.getBlockState(this.pos).getBlock().setLightLevel(2); worldObj.updateLightByType(EnumSkyBlock.BLOCK, xCoord, yCoord, zCoord); } }</code><technical_language>Hold a sec. a minimum, fetching block state twice. Try do that</technical_language>

Target:
public void updateEntity() { if (worldObj.isRemote) return; if (lightList.isEmpty()) { worldObj.setBlockToAir(new BlockPos(this.pos.getX(), this.pos.getY(), this.pos.getZ())); Utils.println("Destroy light at " + this.pos.getX() + " " + this.pos.getY() + " " + this.pos.getZ() + " "); return; } int light = 0; Iterator<LightHandle> iterator = lightList.iterator(); while (iterator.hasNext()) { LightHandle l = iterator.next(); if (light < l.value) light = l.value; l.timeout--; if (l.timeout <= 0) { iterator.remove(); } } IBlockState state = worldObj.getBlockState(pos); Block block = state.getBlock(); if (light != block.getMetaFromState(state)) { block.setLightLevel(2); worldObj.notifyLightSet(pos); } }
Source:
<code>public boolean getBuildResult(String id) throws RestServiceException { ClientResponse response = null; try { LOGGER.info("Calling getById VCPENetworkManager service"); String url = getURL("vcpenetwork/getBuildResult/" + id); Client client = Client.create(); WebResource webResource = client.resource(url); response = webResource.accept(MediaType.APPLICATION_XML).get(ClientResponse.class); LOGGER.info("VCPENetwork recovered"); } catch (ClientHandlerException e) { LOGGER.error(e.getMessage()); throw e; } <START> String result; <END> result = (checkResponse(response) ? response.getEntity(String.class) : null); return Boolean.parseBoolean(result); }</code><technical_language>beginning of method</technical_language>

Target:
public boolean getBuildResult(String id) throws RestServiceException { String result; ClientResponse response = null; try { LOGGER.info("Calling getById VCPENetworkManager service"); String url = getURL("vcpenetwork/getBuildResult/" + id); Client client = Client.create(); WebResource webResource = client.resource(url); response = webResource.accept(MediaType.APPLICATION_XML).get(ClientResponse.class); LOGGER.info("VCPENetwork recovered"); } catch (ClientHandlerException e) { LOGGER.error(e.getMessage()); throw e; } result = (checkResponse(response) ? response.getEntity(String.class) : null); return Boolean.parseBoolean(result); }
Source:
<code><START> public static WifiInfo createWithRedisResult(final String wifiInfoString) { <END> final String[] wifiInfoList = wifiInfoString.split(":"); if (wifiInfoList.length < 2) { return new WifiInfo("", 0); } return new WifiInfo(wifiInfoList[0].trim(), Integer.valueOf(wifiInfoList[1].trim())); }</code><technical_language>this do Redis</technical_language>

Target:
public static WifiInfo createWithRedisResult(final String wifiInfoString) { final String[] wifiInfoList = wifiInfoString.split(":"); if (wifiInfoList.length < 2) { return new WifiInfo(DEFAULT_SSID, DEFAULT_RSSI, getCondition(DEFAULT_RSSI)); } return new WifiInfo(wifiInfoList[0].trim(), Integer.valueOf(wifiInfoList[1].trim()), getCondition(Integer.valueOf(wifiInfoList[1].trim()))); }
Source:
<code>public void setup() { try { <START> Connection espConn = new Connection("http://" + testClusterIp + ":8010?test"); <END> espConn.setUserName(""); espConn.setPassword(""); this.file = new HPCCFile(testIntegerKVDataset, espConn); this.file.setProjectList("key"); this.file2 = new HPCCFile(testAllTypesDataset, espConn); this.file2.setProjectList("str,bool,int8,uns4,flt4"); } catch (Exception e) { System.out.println("Setup failed with error: " + e.getMessage()); } }</code><technical_language>need ?test param more</technical_language>

Target:
public void setup() { try { Connection espConn = new Connection("http://" + testClusterIp + ":8010"); espConn.setUserName(""); espConn.setPassword(""); this.file = new HPCCFile(testIntegerKVDataset, espConn); this.file.setProjectList("key"); this.file2 = new HPCCFile(testAllTypesDataset, espConn); this.file2.setProjectList("str,qstr,uni10,bool,childdataset.childindex,childdataset.childstr"); } catch (Exception e) { System.out.println("Setup failed with error: " + e.getMessage()); } }
Source:
<code><START> public Response uploadEvents(EventUploadRequest eventUploadRequest, OkHttpClient client) throws IOException, IllegalArgumentException { <END> String apiVersionString = "" + eventUploadRequest.getApiVersion(); String timestampString = "" + eventUploadRequest.getUploadTime(); FormBody body = new FormBody.Builder() .add("v", apiVersionString) .add("client", eventUploadRequest.getApiKey()) .add("e", eventUploadRequest.getEvents()) .add("upload_time", timestampString) .add("checksum", eventUploadRequest.getChecksum()) .build(); Request request = new Request.Builder() .url(eventUploadRequest.getUrl()) .post(body) .build(); return client.newCall(request).execute(); }</code><technical_language>@danmalafaia I notice in API choice returning Okhttp3 response object. In custom client, Okhttp3 library? I cool network client decide networking protocol/library use, I feel strongly long Okhttp3 api well. In theory parent needs string response body int response code response do next part</technical_language>

Target:
public Response uploadEvents(EventUploadRequest eventUploadRequest, OkHttpClient client) throws IOException, IllegalArgumentException { String apiVersionString = "" + eventUploadRequest.getApiVersion(); String timestampString = "" + eventUploadRequest.getUploadTime(); FormBody body = new FormBody.Builder() .add("v", apiVersionString) .add("client", eventUploadRequest.getApiKey()) .add("e", eventUploadRequest.getEvents()) .add("upload_time", timestampString) .add("checksum", eventUploadRequest.getChecksum()) .build(); Request request = new Request.Builder() .url(eventUploadRequest.getUrl()) .post(body) .build(); okhttp3.Response response = client.newCall(request).execute(); return new Response(response.code(), response.body() == null ? "" : response.body().string()); }
Source:
<code>public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { if(refreshModel && entityliving.ticksExisted % 20 == 0) { <START> this.mainModel = new ModelDolphin(); <END> this.dolphin = new ModelDolphin(); refreshModel = false; } this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }</code><technical_language>do mainModel dolphin, dolphin is equal mainModel</technical_language>

Target:
public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }
Source:
<code>public void identity(String identity) { <START> setDimension("identity", identity); <END> }</code><technical_language>@gianm >emitted default if user authentication configured? in mind for "has authentication configured" check</technical_language>

Target:
public void identity(String identity) { }
Source:
<code>private static Token decode(String value) { try { <START> String mac = value.substring(0, 64); <END> String rest = new String(Util.fromHexString(value.substring(64)), StandardCharsets.UTF_8); if (!KEY.checkMac(rest, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split(":", 3); String authenticationName = Util.fixEmpty(splits[0]); String epoch = splits[1]; String browserUrl = splits[2]; return new Token(browserUrl, authenticationName, Long.parseLong(epoch)); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }</code><technical_language>Nit: magic number usage</technical_language>

Target:
private static Token decode(String value) { byte[] byteValue = Base64.getUrlDecoder().decode(value); try { byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split(":", 3); String authenticationName = Util.fixEmpty(splits[0]); String epoch = splits[1]; String browserUrl = splits[2]; return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }
Source:
<code>public Object call() throws Exception { ObjectReader or = block.templateReader.newReader(); try { for (;;) { Slice s; synchronized (this) { if (slices.isEmpty()) break; s = slices.removeFirst(); <START> } <END> runWorker(or, s); } for (Slice s = block.stealWork(); s != null; s = block.stealWork()) runWorker(or, s); } finally { or.release(); block.pm.endWorker(); } return null; }</code><technical_language>this point pulled slice dw is null, other thread steal work assign dw</technical_language>

Target:
public Object call() throws Exception { or = block.templateReader.newReader(); try { DeltaWindow w; for (;;) { synchronized (this) { if (slices.isEmpty()) break; w = initWindow(slices.removeFirst()); } runWindow(w); } while ((w = block.stealWork(this)) != null) runWindow(w); } finally { block.pm.endWorker(); or.release(); or = null; } return null; }
Source:
<code>private void saveZeroValueForResource(org.sonar.api.resources.File resource, SensorContext context) { Measure<Integer> nclocMeasure = context.getMeasure(resource, CoreMetrics.NCLOC); if (nclocMeasure != null) { <START> double ncloc = context.getMeasure(resource, CoreMetrics.NCLOC).getValue(); <END> context.saveMeasure(resource, getZeroCoverageLineHitsDataMetric(resource, context)); context.saveMeasure(resource, linesToCoverMetric, ncloc); context.saveMeasure(resource, uncoveredLinesMetric, ncloc); } }</code><technical_language>@pynicolas context.getMeasure(resource, CoreMetrics.NCLOC) again</technical_language>

Target:
private void saveZeroValueForResource(org.sonar.api.resources.File resource, SensorContext context) { Measure<Integer> nclocMeasure = context.getMeasure(resource, CoreMetrics.NCLOC); if (nclocMeasure != null) { double ncloc = nclocMeasure.getValue(); context.saveMeasure(resource, getZeroCoverageLineHitsDataMetric(resource, context)); context.saveMeasure(resource, linesToCoverMetric, ncloc); context.saveMeasure(resource, uncoveredLinesMetric, ncloc); } }
Source:
<code>public void testListenDomainSocketAddress() throws Exception { Vertx vx = Vertx.vertx(new VertxOptions().setPreferNativeTransport(true)); Assume.assumeTrue("Native transport must be enabled", vx.isNativeTransportEnabled()); NetClient netClient = vx.createNetClient(); HttpServer httpserver = vx.createHttpServer().requestHandler(req -> req.response().end()); File sockFile = TestUtils.tmpFile("vertx", ".sock"); SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath()); httpserver.listen(sockAddress, onSuccess(server -> { <START> netClient.connect(sockAddress, onSuccess(sock -> { <END> sock.handler(buf -> testComplete()); sock.write("GET / HTTP/1.1\r\n"); })); })); await(); }</code><technical_language>need close created vertx in a finally block leak resources in tests</technical_language>

Target:
public void testListenDomainSocketAddress() throws Exception { Vertx vx = Vertx.vertx(new VertxOptions().setPreferNativeTransport(true)); Assume.assumeTrue("Native transport must be enabled", vx.isNativeTransportEnabled()); NetClient netClient = vx.createNetClient(); HttpServer httpserver = vx.createHttpServer().requestHandler(req -> req.response().end()); File sockFile = TestUtils.tmpFile("vertx", ".sock"); SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath()); httpserver.listen(sockAddress, onSuccess(server -> { netClient.connect(sockAddress, onSuccess(sock -> { sock.handler(buf -> { assertTrue("Response is not an http 200", buf.toString("UTF-8").startsWith("HTTP/1.1 200 OK")); testComplete(); }); sock.write("GET / HTTP/1.1\r\n\r\n"); })); })); try { await(); } finally { vx.close(); } }
Source:
<code><START> public Tuple2<Integer, Integer> nodeCounts() { <END> int nodeCount = 0; int seedCount = 0; for (CassandraFrameworkProtos.CassandraNode n : nodes()) { nodeCount++; if (n.getSeed()) seedCount++; } return Tuple2.tuple2(nodeCount, seedCount); }</code><technical_language>items Integer confusing remember tuple is seeds is nodes. Create a more expressive type return type for this method</technical_language>

Target:
public NodeCounts nodeCounts() { int nodeCount = 0; int seedCount = 0; for (CassandraFrameworkProtos.CassandraNode n : nodes()) { nodeCount++; if (n.getSeed()) seedCount++; } return new NodeCounts(nodeCount, seedCount); }
Source:
<code><START> Row getMainSearchReq(String wiki, Row[] requests) { <END> if (requests.length == 0) { return null; } String prefix = wiki + "_"; for (Row request : requests) { if (!FULL_TEXT.equals(request.getString(queryTypeIdx))) { continue; } List<String> indices = request.getList(indicesIdx); for (String index : indices) { if (index != null && (index.equals(wiki) || index.startsWith(prefix))) { return request; } } } return null; }</code><technical_language>Then, mark @VisibleForTesting</technical_language>

Target:
Row getMainSearchReq(String wiki, Row[] requests) { if (requests == null || requests.length == 0) { return null; } String prefix = wiki + "_"; for (Row request : requests) { if (!FULL_TEXT.equals(request.getString(queryTypeIdx))) { continue; } List<String> indices = request.getList(indicesIdx); for (String index : indices) { if (index != null && (index.equals(wiki) || index.startsWith(prefix))) { return request; } } } return null; }
Source:
<code>public void grobidPerformSearchCorrectlySplitsStringTest() throws FetcherException { List<BibEntry> entries = grobidCitationFetcher.performSearch(example3 + ";;" + example4); <START> assertTrue(entries.size() == 2); <END> assertTrue(entries.get(0) != null); assertTrue(entries.get(1) != null); }</code><technical_language>"assertEquals(List.of(bibEntryExample3, bibEntryExample4), entries)". Hope, this works. Otherwise, a conversion a set comparing work</technical_language>

Target:
public void grobidPerformSearchCorrectlySplitsStringTest() { List<BibEntry> entries = grobidCitationFetcher.performSearch(example1 + "\n\n" + example2 + "\r\n\r\n" + example3 + "\r\r" + example4); assertEquals(List.of(example1AsBibEntry, example2AsBibEntry, example3AsBibEntry, example4AsBibEntry), entries); }
Source:
<code>public static URL getUrl(String value, Bundle definingBundle) { try { if (value != null) { return new URL(value); } } catch (MalformedURLException e) { if (definingBundle != null) { return FileLocator.find(definingBundle, new Path(value)); } } <START> return null; <END> }</code><technical_language>Optional</technical_language>

Target:
public static Optional<URL> getUrl(String value, Bundle definingBundle) { try { if (value != null) { return Optional.of(new URL(value)); } } catch (MalformedURLException e) { if (definingBundle != null) { URL bundlePath = FileLocator.find(definingBundle, new Path(value)); return Optional.of(bundlePath); } } return Optional.empty(); }
Source:
<code>private void build(URL modelsFile) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(modelsFile.openStream()); Element root = doc.getDocumentElement(); NodeList models = root.getElementsByTagName("model"); <START> for (int i=0; i<models.getLength(); i++) { <END> Element modelElem = (Element) models.item(i); ModelImpl model = new ModelImpl(modelElem); modelsMap.put(model.getName(), model); } } catch (ParserConfigurationException | SAXException | IOException e) { throw new IllegalStateException("Cannot parse sherpa xml models file", e); } }</code><technical_language>reason put try catch for-loop? if is invalid model in xml file</technical_language>

Target:
private void build(URL modelsFile) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(modelsFile.openStream()); Element root = doc.getDocumentElement(); NodeList models = root.getElementsByTagName("model"); for (int i=0; i<models.getLength(); i++) { Element modelElem = (Element) models.item(i); Model model = new DefaultModel(modelElem); modelsMap.put(model.getName(), model); } } catch (ParserConfigurationException | SAXException | IOException e) { throw new IllegalStateException("Cannot parse sherpa xml models file", e); } }
Source:
<code><START> public void clickWikiVideoCard() { wikiVideoCard.click(); } <END></code><technical_language>wait.forElementClickable()</technical_language>

Target:
public ArticlePageObject clickWikiVideoCard() { wait.forElementClickable(wikiVideoCard); wikiVideoCard.click(); return new ArticlePageObject(); }
Source:
<code>public void testReducingBuilderWithNamedNonExistentFunction() { try { entity.enrichers().add(Enrichers.builder() .reducing(Reducer.class, ImmutableList.<AttributeSensor<?>>of(STR1, STR2)) .from(entity) .computing("unknown function name", ImmutableMap.<String, Object>of("separator", "-")) .publishing(STR3) .build() ); Asserts.fail("Expected exception when adding reducing enricher with unknown named function"); } catch (Exception e) { <START> Throwable t = Exceptions.getFirstThrowableOfType(e, IllegalStateException.class); <END> Assert.assertNotNull(t); } }</code><technical_language>I prefer: if (Exceptions.getFirstThrowableOfType(e, IllegalStateException.class) == null) { throw e; } lose actual exception. This is ok, a real pain if a test fails non-deterministically in asfbot information wrong</technical_language>

Target:
public void testReducingBuilderWithNamedNonExistentFunction() { try { entity.enrichers().add(Enrichers.builder() .reducing(Reducer.class, ImmutableList.<AttributeSensor<?>>of(STR1, STR2)) .from(entity) .computing("unknown function name", ImmutableMap.<String, Object>of("separator", "-")) .publishing(STR3) .build() ); Asserts.fail("Expected exception when adding reducing enricher with unknown named function"); } catch (Exception e) { if (Exceptions.getFirstThrowableOfType(e, IllegalStateException.class) == null) { throw e; } } }
Source:
<code>protected void computeLayer(final int currentLayer, Set<Integer> dropoutNodes) { if (!isDropoutEnable(currentLayer - 1)) { computeLayer(currentLayer); return; <START> } <END> final int inputIndex = super.getLayerIndex()[currentLayer]; final int outputIndex = super.getLayerIndex()[currentLayer - 1]; final int inputSize = super.getLayerCounts()[currentLayer]; final int outputSize = super.getLayerFeedCounts()[currentLayer - 1]; int index = super.getWeightIndex()[currentLayer - 1]; final int limitX = outputIndex + outputSize; final int limitY = inputIndex + inputSize; for (int x = outputIndex; x < limitX; x++) { double sum = 0; for (int y = inputIndex; y < limitY; y++) { sum += super.getWeights()[index++] * super.getLayerOutput()[y]; } super.getLayerSums()[x] = sum; super.getLayerOutput()[x] = sum; } super.getActivationFunctions()[currentLayer - 1].activationFunction(super.getLayerOutput(), outputIndex, outputSize); final double nonDropoutRate = 1d - this.getLayerDropoutRates()[currentLayer - 1]; for (int x = outputIndex; x < limitX; x++) { if (dropoutNodes.contains(x)) { super.getLayerOutput()[x] = 0d; } else { super.getLayerOutput()[x] /= nonDropoutRate; } } final int offset = super.getContextTargetOffset()[currentLayer]; for(int x = 0; x < super.getContextTargetSize()[currentLayer]; x++) { super.getLayerOutput()[offset + x] = super.getLayerOutput()[outputIndex + x]; } }</code><technical_language>code refactored if(dropout) { compute(); } else { compute() }</technical_language>

Target:
protected void computeLayer(final int currentLayer, Set<Integer> dropoutNodes) { final int inputIndex = super.getLayerIndex()[currentLayer]; final int outputIndex = super.getLayerIndex()[currentLayer - 1]; final int inputSize = super.getLayerCounts()[currentLayer]; final int outputSize = super.getLayerFeedCounts()[currentLayer - 1]; int index = super.getWeightIndex()[currentLayer - 1]; final int limitX = outputIndex + outputSize; final int limitY = inputIndex + inputSize; for (int x = outputIndex; x < limitX; x++) { double sum = 0; for (int y = inputIndex; y < limitY; y++) { sum += super.getWeights()[index++] * super.getLayerOutput()[y]; } super.getLayerSums()[x] = sum; super.getLayerOutput()[x] = sum; } super.getActivationFunctions()[currentLayer - 1].activationFunction(super.getLayerOutput(), outputIndex, outputSize); if (isDropoutEnable(currentLayer - 1, dropoutNodes)) { final double nonDropoutRate = 1d - this.getLayerDropoutRates()[currentLayer - 1]; for (int x = outputIndex; x < limitX; x++) { if (dropoutNodes.contains(x)) { super.getLayerOutput()[x] = 0d; } else { super.getLayerOutput()[x] /= nonDropoutRate; } } } final int offset = super.getContextTargetOffset()[currentLayer]; for(int x = 0; x < super.getContextTargetSize()[currentLayer]; x++) { super.getLayerOutput()[offset + x] = super.getLayerOutput()[outputIndex + x]; } }
Source:
<code>private Function<PollingContext<OperationResult>, Mono<OperationResult>> contentStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType) { Objects.requireNonNull(data, "'data' is required and cannot be null."); final long[] bufferedDataSize = {0}; final List<ByteBuffer> cachedBuffers = new LinkedList<>(); final AtomicBoolean[] isGuessed = {new AtomicBoolean(true)}; final ContentType[] contentType = new ContentType[1]; <START> return pollingContext -> data.filter(ByteBuffer::hasRemaining) <END> .windowUntil(buffer -> { if (bufferedDataSize[0] >= length) { return false; } bufferedDataSize[0] += buffer.remaining(); if (formContentType == null && isGuessed[0].get() && bufferedDataSize[0] >= 4) { byte[] bytes = buffer.array(); contentType[0] = getContentType(ByteBuffer.wrap(bytes)); isGuessed[0].compareAndSet(true, false); } ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); if (bufferedDataSize[0] >= length) { return true; } return false; }, true, Integer.MAX_VALUE) .next() .flatMap(newData -> { final ContentType contentTypeFinal = formContentType == null ? contentType[0] : ContentType.fromString(formContentType.toString()); return service.analyzeLayoutAsyncWithResponseAsync(contentTypeFinal, Flux.fromIterable(cachedBuffers), length).map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))); }); }</code><technical_language>logic is close, a off. Right this cache entire data stream, this modified cache get number of bytes required determine content type, join cached buffers remaining buffers</technical_language>

Target:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> contentStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType) { Objects.requireNonNull(data, "'data' is required and cannot be null."); return pollingContext -> { if (formContentType != null) { try { return service.analyzeLayoutAsyncWithResponseAsync( ContentType.fromString(formContentType.toString()), data, length) .map(response -> new OperationResult(parseModelId( response.getDeserializedHeaders().getOperationLocation()))); } catch (RuntimeException ex) { return monoError(logger, ex); } } else { return detectContentType(data) .flatMap(contentType -> service.analyzeLayoutAsyncWithResponseAsync(contentType, data, length) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation())))); } }; }
Source:
<code>static <S, T> Map<S, T> mergeDisjunctMaps(Map<? extends S, ? extends T> map1, Map<? extends S, ? extends T> map2) { <START> Sets.SetView<? extends S> commonKeys = Sets.intersection(map1.keySet(), map2.keySet()); <END> checkArgument(commonKeys.isEmpty(), "Maps must be disjunct. Common keys: %s", commonKeys); HashMap<S, T> merged = new HashMap(map1); merged.putAll(map2); return merged; }</code><technical_language>suggestion Set<?> commonKeys = Sets.intersection(map1.keySet(), map2.keySet());</technical_language>

Target:
static <S, T> Map<S, T> mergeDisjunctMaps(Map<? extends S, ? extends T> map1, Map<? extends S, ? extends T> map2) { Sets.SetView<? extends S> commonKeys = Sets.intersection(map1.keySet(), map2.keySet()); checkArgument(commonKeys.isEmpty(), "Maps must be disjunct. Common keys: %s", commonKeys); Map<S, T> merged = new HashMap<>(map1); merged.putAll(map2); return merged; }
Source:
<code>public Action<?, ?> databaseRestoreFinished() { return new AbstractDatabaseRestoreAction<>(DatabaseRestoreSuccess.class) { @Override <START> protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, <END> DatabaseRestoreSuccess payload) { return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseRestoreSuccess payload, Map<Object, Object> variables) { backupRestoreStatusService.restoreDatabaseFinished(context.getStackId()); sendEvent(context); } @Override protected Selectable createRequest(BackupRestoreContext context) { return new StackEvent(DatabaseRestoreEvent.DATABASE_RESTORE_FINALIZED_EVENT.event(), context.getStackId()); } @Override protected Object getFailurePayload(DatabaseRestoreSuccess payload, Optional<BackupRestoreContext> flowContext, Exception ex) { return null; } }; }</code><technical_language>for backup, general context creation abstract</technical_language>

Target:
public Action<?, ?> databaseRestoreFinished() { return new AbstractBackupRestoreActions<>(DatabaseRestoreSuccess.class) { @Override protected void doExecute(BackupRestoreContext context, DatabaseRestoreSuccess payload, Map<Object, Object> variables) { backupRestoreStatusService.restoreDatabaseFinished(context.getStackId()); sendEvent(context); } @Override protected Selectable createRequest(BackupRestoreContext context) { return new StackEvent(DatabaseRestoreEvent.DATABASE_RESTORE_FINALIZED_EVENT.event(), context.getStackId()); } }; }
Source:
<code>public void testCacheConfigurationChangeFiresEvent () { Listener configurationListener = new Listener(); this.runtimeConfiguration.addCacheConfigurationListener(configurationListener); this.cache.getRuntimeConfiguration().updateResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10L, EntryUnit.ENTRIES).build()); <START> assertThat(configurationListener.eventSet.size(), is(lessThan(2)) ); <END> }</code><technical_language>lessThan(2)? is 0 a valid state in this test</technical_language>

Target:
public void testCacheConfigurationChangeFiresEvent () { Listener configurationListener = new Listener(); List<CacheConfigurationChangeListener> cacheConfigurationChangeListeners = new ArrayList<CacheConfigurationChangeListener>(); cacheConfigurationChangeListeners.add(configurationListener); this.runtimeConfiguration.addCacheConfigurationListener(cacheConfigurationChangeListeners); this.cache.getRuntimeConfiguration().updateResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10L, EntryUnit.ENTRIES).build()); assertThat(configurationListener.eventSet.size(), is(1) ); }
Source:
<code>public boolean attemptConnection() { boolean connected = false; try { <START> for (int i = 0; i < 3; i++) { <END> long timeout = Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout); FutureVDSCall<VDSReturnValue> task = Backend.getInstance().getResourceManager().runFutureVdsCommand(FutureVDSCommandType.TimeBoundPoll, new TimeBoundPollVDSCommandParameters(vds.getId(), timeout, TimeUnit.SECONDS)); VDSReturnValue returnValue = task.get(timeout, TimeUnit.SECONDS); connected = returnValue.getSucceeded(); if (connected) { break; } Thread.sleep(CONNECT_WAIT); } } catch (TimeoutException | InterruptedException ignored) { } return connected; }</code><technical_language>please this a constant (3)</technical_language>

Target:
public boolean attemptConnection() { boolean connected = false; try { for (int i = 0; i < NUMBER_OF_ATTEMPTS; i++) { long timeout = Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout); FutureVDSCall<VDSReturnValue> task = Backend.getInstance().getResourceManager().runFutureVdsCommand(FutureVDSCommandType.TimeBoundPoll, new TimeBoundPollVDSCommandParameters(vds.getId(), timeout, TimeUnit.SECONDS)); VDSReturnValue returnValue = task.get(timeout, TimeUnit.SECONDS); connected = returnValue.getSucceeded(); if (connected) { break; } Thread.sleep(CONNECT_WAIT); } } catch (TimeoutException | InterruptedException ignored) { } return connected; }