auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>HttpUnsuccessfulResponseHandler getHttpUnsuccessfulResponseHandler(Message message) { return (request, response, supportsRetry) -> { String redirectLocation = response.getHeaders().getLocation(); if (isRedirect(request, response, redirectLocation)) { String method = (String) message.get(Message.HTTP_REQUEST_METHOD); HttpContent content = null; if (!isRedirectable(method)) { try (TemporaryFileBackedOutputStream tfbos = new TemporaryFileBackedOutputStream()) { message.setContent(OutputStream.class, tfbos); BodyWriter bodyWriter = new BodyWriter(); bodyWriter.handleMessage(message); ByteSource byteSource = tfbos.asByteSource(); content = <START> new InputStreamContent(method, byteSource.openStream()) <END> .setLength(byteSource.size()); } } request.setUrl(new GenericUrl(request.getUrl().toURL(redirectLocation))); request.setRequestMethod(method); request.setContent(content); request.getHeaders().setAuthorization((String) null); request.getHeaders().setIfMatch(null); request.getHeaders().setIfNoneMatch(null); request.getHeaders().setIfModifiedSince(null); request.getHeaders().setIfUnmodifiedSince(null); request.getHeaders().setIfRange(null); request .getHeaders() .setCookie((String) ((List) response.getHeaders().get("set-cookie")).get(0)); Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS); headers.forEach((key, value) -> request.getHeaders().set(key, value)); return true; } return false; }; }</code><technical_language>passing in HTTP Method "type" parameter instead of (String) message.get(Message.CONTENT_TYPE)</technical_language>

Target:
HttpUnsuccessfulResponseHandler getHttpUnsuccessfulResponseHandler(Message message) { return (request, response, supportsRetry) -> { String redirectLocation = response.getHeaders().getLocation(); if (isRedirect(request, response, redirectLocation)) { String method = (String) message.get(Message.HTTP_REQUEST_METHOD); HttpContent content = null; if (!isRedirectable(method)) { try (TemporaryFileBackedOutputStream tfbos = new TemporaryFileBackedOutputStream()) { message.setContent(OutputStream.class, tfbos); BodyWriter bodyWriter = new BodyWriter(); bodyWriter.handleMessage(message); ByteSource byteSource = tfbos.asByteSource(); content = new InputStreamContent( (String) message.get(Message.CONTENT_TYPE), byteSource.openStream()) .setLength(byteSource.size()); } } request.setUrl(new GenericUrl(request.getUrl().toURL(redirectLocation))); request.setRequestMethod(method); request.setContent(content); request.getHeaders().setAuthorization((String) null); request.getHeaders().setIfMatch(null); request.getHeaders().setIfNoneMatch(null); request.getHeaders().setIfModifiedSince(null); request.getHeaders().setIfUnmodifiedSince(null); request.getHeaders().setIfRange(null); request .getHeaders() .setCookie((String) ((List) response.getHeaders().get("set-cookie")).get(0)); Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS); headers.forEach((key, value) -> request.getHeaders().set(key, value)); return true; } return false; }; }
Source:
<code>public List<OskariLayer> cleanupLayerReferences(int layerId) throws ActionException { <START> List<OskariLayer> layers = mapLayerService.findAll(); <END> for (OskariLayer layer : layers) { JSONObject options = layer.getOptions(); try { if (options != null && options.has("timeseries")) { JSONObject timeseriesOptions = options.getJSONObject("timeseries"); JSONObject timeseriesMetadata = timeseriesOptions.optJSONObject("metadata"); if (timeseriesMetadata == null) { continue; } Integer metadataLayerId = timeseriesMetadata.getInt("layer"); if (metadataLayerId == layerId) { options.remove("timeseries"); layer.setOptions(options); mapLayerService.update(layer); } } } catch (JSONException e) { throw new ActionException("Cannot parse layer metadata options for layer: " + layer.getName() + ", id: " + layer.getId()); } } return layers; }</code><technical_language>duplicated code usage check handler. wondering if a helper in both. report report usage other handler LayerAdminHandler helper get a list of layers reference input layer id. Thoughts this</technical_language>

Target:
public List<OskariLayer> cleanupLayerReferences(int layerId) throws ActionException { Set<OskariLayer> layers = LayerAdminHelper.getTimeseriesReferencedLayers(layerId, mapLayerService.findAll()); for (OskariLayer layer : layers) { JSONObject options = layer.getOptions(); options.remove("timeseries"); layer.setOptions(options); mapLayerService.update(layer); } return new ArrayList<>(layers); }
Source:
<code>private IEMFCompareConfiguration createConfiguration(boolean leftEditable, boolean rightEditable) { CompareConfiguration cc = new CompareConfiguration(); <START> cc.setProperty("MIRRORED", Boolean.TRUE); END> cc.setLeftEditable(leftEditable); cc.setRightEditable(rightEditable); EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc); emfCC.setEditingDomain(editingDomain); return emfCC; }</code><technical_language>Create necessary constant. CompareConfiguration.MIRRORED of compatibility issues, redefine EMFCompareConfiguration.MIRRORED = "MIRRORED" mention this is property CompareConfiguration defines</technical_language>

Target:
private IEMFCompareConfiguration createConfiguration(boolean leftEditable, boolean rightEditable) { CompareConfiguration cc = new CompareConfiguration(); cc.setProperty(EMFCompareConfiguration.MIRRORED, Boolean.TRUE); cc.setLeftEditable(leftEditable); cc.setRightEditable(rightEditable); EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc); emfCC.setEditingDomain(editingDomain); return emfCC; }
Source:
<code>public String disableExtension(String extensionName, String currentUser) { validateExtensionName(extensionName); try { <START> return ExtensionStore.get().disableExtension(extensionName, currentUser); <END> } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }</code><technical_language>remove enable disableExtension call updateExtension enable disable parameter</technical_language>

Target:
public String disableExtension(String extensionName, String currentUser) { validateExtensionName(extensionName); try { return ExtensionStore.get().updateExtensionStatus(extensionName, currentUser, ExtensionStatus.DISABLED); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
<code>public void run() { <START> if (!CentralRepository.isEnabled()) <END> return; if (Case.Events.valueOf(event.getPropertyName()) == Case.Events.CONTENT_TAG_ADDED) { handleTagAdded((ContentTagAddedEvent) event); } else { handleTagDeleted((ContentTagDeletedEvent) event); } }</code><technical_language>braces conditionals. Please put braces adjust coding style accordingly</technical_language>

Target:
public void run() { if (!CentralRepository.isEnabled()) { return; } Case.Events curEventType = Case.Events.valueOf(event.getPropertyName()); if (curEventType == Case.Events.CONTENT_TAG_ADDED && event instanceof ContentTagAddedEvent) { handleTagAdded((ContentTagAddedEvent) event); } else if (curEventType == Case.Events.CONTENT_TAG_DELETED && event instanceof ContentTagDeletedEvent) { handleTagDeleted((ContentTagDeletedEvent) event); } else { LOGGER.log(Level.WARNING, String.format("Received an event %s of type %s and was expecting either CONTENT_TAG_ADDED or CONTENT_TAG_DELETED.", event, curEventType)); } }
Source:
<code>protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { _producer.send(datastreamProducerRecord, ((metadata, exception) -> { if (exception != null) { _logger.warn("Detect exception being throw from callback for src partition: while sending producer " <START> + "record, metadata: {}, exception: ", srcTopicPartition, metadata, exception); <END> rewindAndPausePartitionOnException(srcTopicPartition, exception); } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); }</code><technical_language>* nit: move " record, " previous line * please, add more exception: (for exception object)</technical_language>

Target:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { _producer.send(datastreamProducerRecord, ((metadata, exception) -> { if (exception != null) { String msg = String.format("Detect exception being thrown from callback for src partition: %s while " + "sending, metadata: %s , exception: ", srcTopicPartition, metadata); _logger.warn(msg, exception); rewindAndPausePartitionOnException(srcTopicPartition, exception); } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); }
Source:
<code>String getSignedUrl(RestRequest restRequest) throws RestServiceException; boolean isRequestSigned(RestRequest restRequest); void verifySignedRequest(RestRequest restRequest, Callback<Void> callback); <START> default Future<Void> verifySignedRequest(RestRequest restRequest) { <END> FutureResult<Void> futureResult = new FutureResult<>(); verifySignedRequest(restRequest, futureResult::done); return futureResult; }</code><technical_language>I encourage compatible original method. void verifySignedRequest(RestRequest restRequest); default void verifySignedRequest(RestRequest restRequest, Callback<Void> callback) { verifySignedRequest(restRequest). callback.onComplete(null, null); } default Future<Void> verifySignedRequest(RestRequest restRequest) { FutureResult<Void> futureResult = new FutureResult<>(); verifySignedRequest(restRequest, futureResult::done); return futureResult; }</technical_language>

Target:
String getSignedUrl(RestRequest restRequest) throws RestServiceException; boolean isRequestSigned(RestRequest restRequest); void verifySignedRequest(RestRequest restRequest) throws RestServiceException; default void verifySignedRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; try { verifySignedRequest(restRequest); } catch (Exception e) { exception = e; } finally { callback.onCompletion(null, exception); } }
Source:
<code>public void testSanity() throws Exception { List<Range<Double>> ranges = Arrays.asList( Range.create(0d, true, 10d, false), Range.create(10d, true, 20d, true)); StreamingSampleStats s1 = new StreamingSampleStats(); s1.setStatistic(Statistic.MEAN); s1.addRange(ranges.get(0)); s1.offer(10d); StreamingSampleStats s2 = new StreamingSampleStats(); s2.setStatistic(Statistic.MEAN); s2.addRange(ranges.get(0)); s2.offer(10d); StreamingSampleStats[] stats = new StreamingSampleStats[] {s1,s2}; ClassificationStats classStats = new FeatureClassStats.Results(ranges, stats); ClassificationStatsPPIO ppio = new ClassificationStatsPPIO(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); ppio.encode(classStats, bout); <START> System.out.println(new String(bout.toByteArray())); <END> Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bout.toByteArray())); assertEquals("Results", doc.getDocumentElement().getNodeName()); XMLAssert.assertXpathExists("/Results/Class[@lowerBound='0.0']", doc); XMLAssert.assertXpathExists("/Results/Class[@lowerBound='10.0']", doc); }</code><technical_language>Forgotten a sysout :-)</technical_language>

Target:
public void testSanity() throws Exception { List<Range<Double>> ranges = Arrays.asList( Range.create(0d, true, 10d, false), Range.create(10d, true, 20d, true)); StreamingSampleStats s1 = new StreamingSampleStats(); s1.setStatistic(Statistic.MEAN); s1.addRange(ranges.get(0)); s1.offer(10d); StreamingSampleStats s2 = new StreamingSampleStats(); s2.setStatistic(Statistic.MEAN); s2.addRange(ranges.get(0)); s2.offer(10d); StreamingSampleStats[] stats = new StreamingSampleStats[] {s1,s2}; ClassificationStats classStats = new FeatureClassStats.Results(ranges, stats); ClassificationStatsPPIO ppio = new ClassificationStatsPPIO(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); ppio.encode(classStats, bout); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bout.toByteArray())); assertEquals("Results", doc.getDocumentElement().getNodeName()); XMLAssert.assertXpathExists("/Results/Class[@lowerBound='0.0']", doc); XMLAssert.assertXpathExists("/Results/Class[@lowerBound='10.0']", doc); }
Source:
<code>protected void onPostExecute(Boolean result) { String media_message=media.getDisplayTitle(); String title_resource = context.getResources().getString(R.string.nominating_for_deletion); String success_resource = context.getResources().getString(R.string.success); String message_resource = context.getResources().getString(R.string.message,media_message); String failed_resource = context.getResources().getString(R.string.failed); String could_not_request_deletion_resource = context.getResources().getString(R.string.could_not_request_deletion); String message; String title = title_resource; if (result){ title += ":"+success_resource; message = message_resource; } else { <START> title += ":"+failed_resource; <END> message = could_not_request_deletion_resource; } notificationBuilder.setDefaults(DEFAULT_ALL) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setProgress(0,0,false) .setOngoing(false) .setPriority(PRIORITY_HIGH); String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/File:" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW , Uri.parse(urlForDelete)); PendingIntent pendingIntent = PendingIntent.getActivity(context , 1 , browserIntent , PendingIntent.FLAG_UPDATE_CURRENT); notificationBuilder.setContentIntent(pendingIntent); notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build()); }</code><technical_language>This work for right-to-left languages, %1$s/%2$s/etc syntax</technical_language>

Target:
protected void onPostExecute(Boolean result) { String mediaMessage=media.getDisplayTitle(); String fullColon=":"; String titleResource = context.getResources().getString(R.string.nominating_for_deletion); String successResource = context.getResources().getString(R.string.success,titleResource,fullColon); String messageResource = context.getResources().getString(R.string.message,mediaMessage); String failedResource = context.getResources().getString(R.string.failed,titleResource,fullColon); String couldRequest_deletion_resource = context.getResources().getString(R.string.could_not_request_deletion); String message; String title; if (result){ title = successResource; message = messageResource; } else { title = failedResource; message = couldRequest_deletion_resource; } notificationBuilder.setDefaults(DEFAULT_ALL) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setProgress(0,0,false) .setOngoing(false) .setPriority(PRIORITY_HIGH); String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/File:" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW , Uri.parse(urlForDelete)); PendingIntent pendingIntent = PendingIntent.getActivity(context , 1 , browserIntent , PendingIntent.FLAG_UPDATE_CURRENT); notificationBuilder.setContentIntent(pendingIntent); notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build()); }
Source:
<code>public SunriseSolutionInfo() { setName(""); <START> setVersion(BuildInfo.version()); <END> setWebsite(""); setEmergencyContact(""); }</code><technical_language>checked this yields correct build info for Sunrise? This coming JVM SDK</technical_language>

Target:
public SunriseSolutionInfo() { setName("commercetools-sunrise-java"); setVersion(BuildInfo.version()); }
Source:
<code>public void merge_TheSameFeatureTwiceById() { setUpWithJson(SAMPLE_JSON); List<Feature> features = new ArrayList<>(); features.addAll(reportResult.getAllFeatures()); features.addAll(reportResult.getAllFeatures()); List<Feature> merged = new ReportFeatureByIdMerger().merge(features); <START> assertThat(merged).hasSize(2); <END> }</code><technical_language>magic number</technical_language>

Target:
public void merge_TheSameFeatureTwiceById() { setUpWithJson(SAMPLE_JSON); Integer expectedSize = reportResult.getAllFeatures().size(); List<Feature> features = new ArrayList<>(); features.addAll(reportResult.getAllFeatures()); features.addAll(reportResult.getAllFeatures()); List<Feature> merged = new ReportFeatureByIdMerger().merge(features); assertThat(merged).hasSize(expectedSize); }
Source:
<code><START> public List<RefRight> getAllRights(final ApprovalCategory.Id id) { <END> List<RefRight> l = allRights.get(id); if (l == null) { l = new ArrayList<RefRight>(); l.addAll(getRefRights(id)); l.addAll(getWildcardRights(id)); Collections.sort(l, RefRight.REF_PATTERN_ORDER); l = Collections.unmodifiableList(l); allRights.put(id, l); } return l; }</code><technical_language>do filterMostSpecific here. SubmitFunction class CategoryFunction class this method determine if action</technical_language>

Target:
public List<RefRight> getAllRights(final ApprovalCategory.Id id) { List<RefRight> l = allRights.get(id); if (l == null) { l = new ArrayList<RefRight>(); l.addAll(getRefRights(id)); l.addAll(getWildcardRights(id)); Collections.sort(l, RefRight.REF_PATTERN_ORDER); l = Collections.unmodifiableList(RefControl.filterMostSpecific(l)); allRights.put(id, l); } return l; }
Source:
<code>public void shouldParseDateTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:DateTime\n" + "0,Mattias,2018-02-27T13:37\n" + "1,Johan,\"2018-03-01T16:20:01\"\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); <START> Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), <END> defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", DateTimeValue.datetime( 2018, 2, 27, 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", DateTimeValue.datetime( 2018, 3, 1, 16, 20, 1, 0, "+00:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }</code><technical_language>I need a case _does_ explicit timezone here, too</technical_language>

Target:
public void shouldParseDateTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:DateTime\n" + "0,Mattias,2018-02-27T13:37\n" + "1,Johan,\"2018-03-01T16:20:01\"\n" + "2,Bob,1981-05-11T07:30-05:00\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", DateTimeValue.datetime( 2018, 2, 27, 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", DateTimeValue.datetime( 2018, 3, 1, 16, 20, 1, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 2L, new Object[]{"name", "Bob", "time", DateTimeValue.datetime( 1981, 5, 11, 7, 30, 0, 0, "-05:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }
Source:
<code><START> public static List<AggregatedPayload> createBundleList(String json) throws JsonSyntaxException { <END> Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray jArray = parser.parse(json).getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = gson.fromJson( obj , AggregatedPayload.class); bundleList.add(bundle); } return bundleList; }</code><technical_language>JsonParseException</technical_language>

Target:
public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray jArray = parser.parse(json).getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = gson.fromJson( obj , AggregatedPayload.class); bundleList.add(bundle); } return bundleList; }
Source:
<code>public void consume(ParsableByteArray data) { while (data.bytesLeft() > 0) { switch (state) { case STATE_FINDING_SYNC: if (skipToNextSync(data)) { state = STATE_READING_HEADER; headerScratchBytes.data[0] = (byte)0xAC; <START> headerScratchBytes.data[1] = 0x40; <END> if (hasCRC) headerScratchBytes.data[1] = 0x41; bytesRead = 2; } break; case STATE_READING_HEADER: if (continueRead(data, headerScratchBytes.data, Ac4Util.HEADER_SIZE_FOR_PARSER)) { parseHeader(); headerScratchBytes.setPosition(0); output.sampleData(headerScratchBytes, Ac4Util.HEADER_SIZE_FOR_PARSER); state = STATE_READING_SAMPLE; } break; case STATE_READING_SAMPLE: int bytesToRead = Math.min(data.bytesLeft(), sampleSize - bytesRead); output.sampleData(data, bytesToRead); bytesRead += bytesToRead; if (bytesRead == sampleSize) { output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null); timeUs += sampleDurationUs; state = STATE_FINDING_SYNC; } break; default: break; } } }</code><technical_language>Nit: headerScratchBytes.data[1] = hasCRC ? 0x41 : 0x40;</technical_language>

Target:
public void consume(ParsableByteArray data) { while (data.bytesLeft() > 0) { switch (state) { case STATE_FINDING_SYNC: if (skipToNextSync(data)) { state = STATE_READING_HEADER; headerScratchBytes.data[0] = (byte)0xAC; headerScratchBytes.data[1] = (byte)(hasCRC ? 0x41 : 0x40); bytesRead = 2; } break; case STATE_READING_HEADER: if (continueRead(data, headerScratchBytes.data, Ac4Util.HEADER_SIZE_FOR_PARSER)) { parseHeader(); headerScratchBytes.setPosition(0); output.sampleData(headerScratchBytes, Ac4Util.HEADER_SIZE_FOR_PARSER); state = STATE_READING_SAMPLE; } break; case STATE_READING_SAMPLE: int bytesToRead = Math.min(data.bytesLeft(), sampleSize - bytesRead); output.sampleData(data, bytesToRead); bytesRead += bytesToRead; if (bytesRead == sampleSize) { output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null); timeUs += sampleDurationUs; state = STATE_FINDING_SYNC; } break; default: break; } } }
Source:
<code>public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.resultReference = new AtomicReference<>(); this.mockRestAdapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); <START> add(new retrofit.client.Header(key, value)); <END> } } }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); }</code><technical_language>Add a newline variable declarations</technical_language>

Target:
public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.resultReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.restAdapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); add(new retrofit.client.Header(key, value)); } } }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build(); this.mockRestAdapter.setAdapter(this.restAdapter); }
Source:
<code>public List<T> getClusterEndpoints() { if (!warmedUp) { updateTask.run(); <START> executorService.schedule(backgroundTask, 0, TimeUnit.SECONDS); <END> warmedUp = true; } return resultsRef.get(); }</code><technical_language>this delayed</technical_language>

Target:
public List<T> getClusterEndpoints() { if (warmedUp.compareAndSet(false, true)) { doWarmUp(); executorService.schedule( backgroundTask, transportConfig.getAsyncResolverRefreshIntervalMs(), TimeUnit.MILLISECONDS); } return resultsRef.get(); }
Source:
<code>protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } <START> asyncTask = volume.getAsyncTask(); <END> getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }</code><technical_language>remove asyncTask variable</technical_language>

Target:
protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }
Source:
<code>private void visitEnrollPage_forCourseWithoutResponses_noWarningMessage() throws Exception { ______TS("Typical case 1: open the enroll page of a course without existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor4"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor4", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals("", pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); <START> String expectedLogSegment = "instructorCourseEnroll Page Load<br>" <END> + "Enrollment for Course <span class=\"bold\">[" + courseId + "]</span>"; AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }</code><technical_language>This a const String formatting, easier maintain in future</technical_language>

Target:
private void visitEnrollPage_forCourseWithoutResponses_noWarningMessage() throws Exception { ______TS("Typical case 1: open the enroll page of a course without existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor4"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor4", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals("", pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = String.format( Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId); AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }
Source:
<code>private MappingType toMappingType(Attribute attribute, int depth, int maxDepth) { AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: return MappingType.BOOLEAN; case CATEGORICAL: case CATEGORICAL_MREF: case FILE: case MREF: case ONE_TO_MANY: <START> case XREF: <END> if (depth < maxDepth) { return MappingType.NESTED; } else { Attribute refLabelAttribute = attribute.getRefEntity().getLabelAttribute(); return toMappingType(refLabelAttribute, depth + 1, maxDepth); } case DATE: return MappingType.DATE; case DATE_TIME: return MappingType.DATE_TIME; case DECIMAL: return MappingType.DOUBLE; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return MappingType.TEXT; case INT: return MappingType.INTEGER; case LONG: return MappingType.LONG; case COMPOUND: throw new RuntimeException(format("Illegal attribute type '%s'", attributeType)); default: throw new RuntimeException(format("Unknown attribute type '%s'", attributeType)); } }</code><technical_language>Extract specific method reduce complexity</technical_language>

Target:
private MappingType toMappingType(Attribute attribute, int depth, int maxDepth) { AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: return MappingType.BOOLEAN; case CATEGORICAL: case CATEGORICAL_MREF: case FILE: case MREF: case ONE_TO_MANY: case XREF: return toMappingTypeReferenceAttribute(attribute, depth, maxDepth); case DATE: return MappingType.DATE; case DATE_TIME: return MappingType.DATE_TIME; case DECIMAL: return MappingType.DOUBLE; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return MappingType.TEXT; case INT: return MappingType.INTEGER; case LONG: return MappingType.LONG; case COMPOUND: throw new RuntimeException(format("Illegal attribute type '%s'", attributeType)); default: throw new RuntimeException(format("Unknown attribute type '%s'", attributeType)); } }
Source:
<code>public void removeRemoteSource(TaskId taskId, TaskId remoteSourceTaskId) { requireNonNull(taskId, "taskId is null"); requireNonNull(remoteSourceTaskId, "srcTaskId is null"); <START> tasks.getUnchecked(taskId).removeRemoteSource(remoteSourceTaskId); <END> }</code><technical_language>I is in theory removeRemoteSource is called task / exchange clients created. consider scenario</technical_language>

Target:
public void removeRemoteSource(TaskId taskId, TaskId remoteSourceTaskId) { requireNonNull(taskId, "taskId is null"); requireNonNull(remoteSourceTaskId, "remoteSourceTaskId is null"); tasks.getUnchecked(taskId).removeRemoteSource(remoteSourceTaskId); }
Source:
<code>public FlatFilterBuilder beginPropertyIsILikeType(String operator) { <START> return beginPropertyIsLikeType(operator); <END> }</code><technical_language>is beginPropertyIsILikeType calling beginPropertyIsLikeType</technical_language>

Target:
public FlatFilterBuilder beginPropertyIsILikeType(String operator) { return beginPropertyIsLikeOrIsILike(operator); }
Source:
<code>private List<List<Double>> getRubricWeightsForEachCell(Map<String, String[]> requestParameters, int numOfRubricChoices, int numOfRubricSubQuestions, boolean hasAssignedWeights) { List<List<Double>> rubricWeightsForEachCell = new ArrayList<>(); if (!hasAssignedWeights) { return rubricWeightsForEachCell; } int weightRows = -1; for (int i = 0; i < numOfRubricSubQuestions; i++) { String subQn = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-" + i); if (subQn == null || subQn.trim().isEmpty()) { continue; } boolean rowAdded = false; for (int j = 0; j < numOfRubricChoices; j++) { String choice = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-" + j); String paramName = Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-" + i + "-" + j; String weight = HttpRequestHelper.getValueFromParamMap(requestParameters, paramName); if (weight != null && choice != null) { if (!rowAdded) { weightRows++; rubricWeightsForEachCell.add(new ArrayList<Double>()); rowAdded = true; } try { rubricWeightsForEachCell.get(weightRows).add(Double.parseDouble(weight)); } catch (NumberFormatException e) { <START> log.warning("Failed to parse weight for rubric question " + weight); <END> } } } } return rubricWeightsForEachCell; }</code><technical_language>Do expect this exception happen? If no, log this severe level admin email if happen for some unexplained reason</technical_language>

Target:
private List<List<Double>> getRubricWeightsForEachCell(Map<String, String[]> requestParameters, int numOfRubricChoices, int numOfRubricSubQuestions, boolean hasAssignedWeights) { List<List<Double>> rubricWeightsForEachCell = new ArrayList<>(); if (!hasAssignedWeights) { return rubricWeightsForEachCell; } int weightRows = -1; for (int i = 0; i < numOfRubricSubQuestions; i++) { String subQn = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-" + i); if (subQn == null || subQn.trim().isEmpty()) { continue; } boolean rowAdded = false; for (int j = 0; j < numOfRubricChoices; j++) { String choice = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-" + j); String paramName = Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-" + i + "-" + j; String weight = HttpRequestHelper.getValueFromParamMap(requestParameters, paramName); if (weight != null && choice != null) { if (!rowAdded) { weightRows++; rubricWeightsForEachCell.add(new ArrayList<Double>()); rowAdded = true; } try { rubricWeightsForEachCell.get(weightRows).add(Double.parseDouble(weight)); } catch (NumberFormatException e) { log.severe("Failed to parse weight for rubric question " + weight); } } } } return rubricWeightsForEachCell; }
Source:
<code>public SubTabVirtualMachineNetworkInterfaceView( SearchableDetailModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel> modelProvider, EventBus eventBus, ClientStorage clientStorage, ApplicationConstants constants, ApplicationMessages messages, ApplicationTemplates templates) { super(new VmInterfaceListModelTable(modelProvider, eventBus, clientStorage, constants, messages, templates) { @Override public void initTable(final CommonApplicationConstants constants) { super.initTable(constants); getTable().enableColumnResizing(); BooleanColumn<VmNetworkInterface> portMirroringColumn = new BooleanColumn<VmNetworkInterface>(constants.portMirroringEnabled()) { @Override public Boolean getRawValue(VmNetworkInterface object) { return object.isPortMirroring(); } }; <START> portMirroringColumn.makeSortable(VmNetworkInterfaceComparator.BY_PORT_MIRRORING); <END> getTable().addColumnWithHtmlHeader(portMirroringColumn, constants.portMirroring(), "85px"); } }); ViewIdHandler.idHandler.generateAndSetIds(this); initTable(constants); initWidget(getModelBoundTableWidget()); }</code><technical_language>Again, default portMirroringColumn.makeSortable()</technical_language>

Target:
public SubTabVirtualMachineNetworkInterfaceView( SearchableDetailModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel> modelProvider, EventBus eventBus, ClientStorage clientStorage, ApplicationConstants constants, ApplicationMessages messages, ApplicationTemplates templates) { super(new VmInterfaceListModelTable(modelProvider, eventBus, clientStorage, constants, messages, templates) { @Override public void initTable(final CommonApplicationConstants constants) { super.initTable(constants); getTable().enableColumnResizing(); BooleanColumn<VmNetworkInterface> portMirroringColumn = new BooleanColumn<VmNetworkInterface>(constants.portMirroringEnabled()) { @Override public Boolean getRawValue(VmNetworkInterface object) { return object.isPortMirroring(); } }; portMirroringColumn.makeSortable(); getTable().addColumnWithHtmlHeader(portMirroringColumn, constants.portMirroring(), "85px"); } }); ViewIdHandler.idHandler.generateAndSetIds(this); initTable(constants); initWidget(getModelBoundTableWidget()); }
Source:
<code>public static long nextSequenceId(String counterNode) throws IOException{ RecoverableZooKeeper rzk=ZkUtils.getRecoverableZooKeeper(); int maxTries=Integer.MAX_VALUE; int tries=0; while(tries<=maxTries){ tries++; if (tries > 1) { try { <START> Thread.sleep(50); <END> } catch (Exception e) { throw new IOException(e); } } Stat version=new Stat(); long currentCount; byte[] data; try{ data=rzk.getData(counterNode,false,version); }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } currentCount=Bytes.toLong(data)+1; try{ rzk.setData(counterNode,Bytes.toBytes(currentCount),version.getVersion()); return currentCount; }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: case BADVERSION: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } } throw new IOException("Unable to get next conglomerate sequence, there is an issue "+ "speaking with ZooKeeper"); }</code><technical_language>If sleeping, PipelineUtils.getPauseTime() similar do exponential backoff add jitter</technical_language>

Target:
public static long nextSequenceId(String counterNode) throws IOException{ RecoverableZooKeeper rzk=ZkUtils.getRecoverableZooKeeper(); int maxTries=Integer.MAX_VALUE; int tries=0; while(tries<=maxTries){ tries++; if (tries > 1) { try { Thread.sleep(PipelineUtils.getPauseTime(tries,10)); } catch (Exception e) { throw new IOException(e); } } Stat version=new Stat(); long currentCount; byte[] data; try{ data=rzk.getData(counterNode,false,version); }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } currentCount=Bytes.toLong(data)+1; try{ rzk.setData(counterNode,Bytes.toBytes(currentCount),version.getVersion()); return currentCount; }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: case BADVERSION: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } } throw new IOException("Unable to get next conglomerate sequence, there is an issue "+ "speaking with ZooKeeper"); }
Source:
<code>public void updateItem(TurboIssue issue, boolean empty) { super.updateItem(issue, empty); if (issue == null) { return; } if (!issue.isOpen()){ if (!getStyleClass().contains("issue-cell-closed")) { getStyleClass().add("issue-cell-closed"); <START> } <END> } else { getStyleClass().remove("issue-cell-closed"); } this.issue = issue; Optional<Model> currentModel = model.getModelById(issue.getRepoId()); if (!currentModel.isPresent()) { logger.error("Model is not present for issue " + issue.getId() + " at " + issue.getRepoId()); setGraphic(getGraphic()); return; } setGraphic(new ListPanelCard(currentModel.get(), issue, parent, issuesWithNewComments)); this.setId(issue.getRepoId() + "_col" + parentPanelIndex + "_" + issue.getId()); }</code><technical_language>this statement do</technical_language>

Target:
public void updateItem(TurboIssue issue, boolean empty) { super.updateItem(issue, empty); if (issue == null) { return; } updateStyleToMatchStatus(issue); this.issue = issue; Optional<Model> currentModel = model.getModelById(issue.getRepoId()); if (!currentModel.isPresent()) { logger.error("Model is not present for issue " + issue.getId() + " at " + issue.getRepoId()); setGraphic(getGraphic()); return; } setGraphic(new ListPanelCard(currentModel.get(), issue, parent, issuesWithNewComments)); this.setId(issue.getRepoId() + "_col" + parentPanelIndex + "_" + issue.getId()); }
Source:
<code>ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); <START> Map<String, String> systemStreamConfigs = new HashMap<>(); <END> graphSpec.getInputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getOutputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getSystemDescriptors().forEach(sd -> systemStreamConfigs.putAll(sd.toConfig())); Map<String, String> appConfigs = new HashMap<>(cfg); appConfigs.putAll(systemStreamConfigs); Config generatedConfig = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(generatedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(generatedConfig, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }</code><technical_language>nit: I prefer consolidate streams, systems, tables configuration generation in planner, instead of planner. do in SAMZA-1811</technical_language>

Target:
ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); Map<String, String> systemStreamConfigs = new HashMap<>(); graphSpec.getInputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getOutputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getSystemDescriptors().forEach(sd -> systemStreamConfigs.putAll(sd.toConfig())); graphSpec.getDefaultSystemDescriptor().ifPresent(dsd -> systemStreamConfigs.put(JobConfig.JOB_DEFAULT_SYSTEM(), dsd.getSystemName())); Map<String, String> appConfigs = new HashMap<>(cfg); appConfigs.putAll(systemStreamConfigs); Config generatedConfig = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(generatedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(generatedConfig, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }
Source:
<code>public void commit() { if (marshalled == null) { throw ControllerLogger.ROOT_LOGGER.rollbackAlreadyInvoked(); } try(InputStream in = getMarshalledInputStream()) { doCommit(in); } catch (IOException ioex) { <START> ioex.printStackTrace(); <END> } }</code><technical_language>Stack trace printed. exception logged propagated</technical_language>

Target:
public void commit() { if (marshalled == null) { throw ControllerLogger.ROOT_LOGGER.rollbackAlreadyInvoked(); } try(InputStream in = getMarshalledInputStream()) { doCommit(in); } catch (IOException ioex) { MGMT_OP_LOGGER.errorf(ioex, ioex.getMessage()); } }
Source:
<code>public void testHumanPhenotypeOntologyDefaultLocation() { String location = ontologyService.getDefaultOntologyLocation(); <START> String expected = "<LINK_1>"; <END> Assert.assertTrue(location.equalsIgnoreCase(expected)); }</code><technical_language>account #694, this changed <LINK_0>. However, test better, instead of expecting a specific check that: Assert.assertNotNull(location); Assert.assertTrue(location.endsWith("hp.obo")); Assert.assertTrue(location.startsWith("http"));</technical_language>

Target:
public void testHumanPhenotypeOntologyDefaultLocation() { String location = ontologyService.getDefaultOntologyLocation(); Assert.assertNotNull(location); Assert.assertTrue(location.endsWith("hp.obo")); Assert.assertTrue(location.startsWith("http")); }
Source:
<code><START> public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { <END> return null; }</code><technical_language>Validation.OK</technical_language>

Target:
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { return ValidationResult.OK; }
Source:
<code>public void testAdd(){ long value = TestData.getLong(); long record = client.add("foo",value); Assert.assertEquals(value, client.get("foo", record)); <START> } <END></code><technical_language>assert record other data</technical_language>

Target:
public void testAdd(){ long value = TestData.getLong(); long record = client.add("foo",value); Assert.assertEquals(value, client.get("foo", record)); Assert.assertEquals("foo", Iterables.getOnlyElement(client.describe(record))); }
Source:
<code><START> public Integer findDatasetByName(String name) { <END> Integer result = dataSetDAO.getDataSetByName(name); if (result == null) { return -1; } return result; }</code><technical_language>This throw a NotFoundException if find it. Callers of this method understand handle appropriately</technical_language>

Target:
public DataSet findDatasetByName(String name) { return dataSetDAO.findDatasetByName(name); }
Source:
<code>public StreamGobbler(InputStream inStream) { <START> lines = new ArrayList<String>(); <END> is = new BufferedInputStream(inStream); inScanner = new Scanner(is); }</code><technical_language>new ArrayList<>();</technical_language>

Target:
public StreamGobbler(InputStream inStream) { lines = new ArrayList<>(); is = new BufferedInputStream(inStream); inScanner = new Scanner(is); }
Source:
<code><START> public void enterNameInput() { <END> String input = nameInputField.getText(); if (!input.isEmpty()) { this.playerName = nameInputField.getText(); } this.setVisible(false); Settings.names[number - 1] = this.playerName; if (number == 1 && StartController.getLimitOfPlayers() == 2) { namePlayer2(); } else { try { switchScreen("level.fxml"); } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>Is idea force a placer type name? necessarily input a name, P1 P2 is used. a bug, improvement? <feature</technical_language>

Target:
public void enterNameInput() { String input = nameInputField.getText(); if (!input.isEmpty()) { this.playerName = nameInputField.getText(); } this.setVisible(false); Settings.setName(this.playerName, number - 1); if (number == 1 && StartController.getLimitOfPlayers() == 2) { namePlayer2(); } else { try { switchScreen("level.fxml"); } catch (IOException e) { e.printStackTrace(); } } }