auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Command getCommand() { PapyrusClipboard.getInstance().resetTarget(); List<IGraphicalEditPart> selectedElements = getSelectedElements(); if (selectedElements.size() == 1) { <START> if (!(selectedElements.get(0) instanceof GraphicalEditPart)) { return UnexecutableCommand.INSTANCE; } <END> GraphicalEditPart targetOwnerEditPart = (GraphicalEditPart) selectedElements.get(0); org.eclipse.gef.commands.CompoundCommand compoundCommand = new org.eclipse.gef.commands.CompoundCommand("Paste all elements"); List<IStrategy> allStrategies = PasteStrategyManager.getInstance().getAllActiveStrategies(); for (IStrategy iStrategy : allStrategies) { IPasteStrategy iPasteStrategy = (IPasteStrategy) iStrategy; Command graphicalCommand = iPasteStrategy.getGraphicalCommand(getEditingDomain(), targetOwnerEditPart, PapyrusClipboard.getInstance()); if (graphicalCommand != null) { compoundCommand.add(graphicalCommand); } } return compoundCommand; } return UnexecutableCommand.INSTANCE; }</code><technical_language>merge 2 if a "true" test is unexecutable instance end need return a new :)</technical_language>

Target:
protected Command getCommand() { PapyrusClipboard.getInstance().resetTarget(); List<IGraphicalEditPart> selectedElements = getSelectedElements(); if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof GraphicalEditPart)) { GraphicalEditPart targetOwnerEditPart = (GraphicalEditPart) selectedElements.get(0); org.eclipse.gef.commands.CompoundCommand compoundCommand = new org.eclipse.gef.commands.CompoundCommand("Paste all elements"); List<IStrategy> allStrategies = PasteStrategyManager.getInstance().getAllActiveStrategies(); for (IStrategy iStrategy : allStrategies) { IPasteStrategy iPasteStrategy = (IPasteStrategy) iStrategy; Command graphicalCommand = iPasteStrategy.getGraphicalCommand(getEditingDomain(), targetOwnerEditPart, PapyrusClipboard.getInstance()); if (graphicalCommand != null) { compoundCommand.add(graphicalCommand); } } return compoundCommand; } return UnexecutableCommand.INSTANCE; }
Source:
<code>abstract protected ResultSet getColumns() throws SQLException; public Map<String, DbParameterAccessor> getParams() throws SQLException { Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); try (ResultSet rs = getColumns()) { while (rs.next()) { <START> String paramName = getColumnName(rs); <END> allParams.put(NameNormaliser.normaliseName(paramName), createColumnAccessor(paramName, rs)); } } return allParams; }</code><technical_language>good far. do moving getColumnName(rs) createColumnAccessor? closer other similar activities. name accessor creating it</technical_language>

Target:
abstract protected ResultSet getColumns() throws SQLException; public Map<String, DbParameterAccessor> getParams() throws SQLException { Map<String, DbParameterAccessor> allParams = new HashMap<>(); try (ResultSet rs = getColumns()) { while (rs.next()) { DbParameterAccessor accessor = createColumnAccessor(rs); allParams.put(normaliseName(accessor.getName()), accessor); } } return allParams; }
Source:
<code>private void loadData() { MyShowsClient client = MyShowsClientImpl.getInstance(); client.ratingShows() .compose(bindToLifecycle()) .subscribe(shows -> { ratingShows = shows; if (userShows != null) { setAdapter(); <START> } <END> } ); client.profileShows() .compose(bindToLifecycle()) .map(shows -> { Map<Integer, UserShow> userShows = new HashMap<>(); for (UserShow show : shows) { userShows.put(show.getShowId(), show); } return userShows; }) .subscribe(shows -> { userShows = shows; if (ratingShows != null) { setAdapter(); } }); }</code><technical_language>U want extract block in single block, u? Smth that: private void trySetAdapter() { if (userShows != null && ratingShows != null) { RatingShowAdapter adapter = new RatingShowAdapter(ratingShows, userShows); recyclerView.setAdapter(adapter); } }</technical_language>

Target:
private void loadData() { MyShowsClient client = MyShowsClientImpl.getInstance(); client.ratingShows() .compose(bindToLifecycle()) .subscribe(shows -> { ratingShows = shows; trySetAdapter(); } ); client.profileShows() .compose(bindToLifecycle()) .map(shows -> { Map<Integer, UserShow> userShows = new HashMap<>(); for (UserShow show : shows) { userShows.put(show.getShowId(), show); } return userShows; }) .subscribe(shows -> { userShows = shows; trySetAdapter(); }); }
Source:
<code>public TmfModelResponse<ITmfXyModel> fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { <START> boolean allCommon = true; List<P> providers = getProviders(); for (P dataProvider : providers) { if (!(dataProvider instanceof ITmfCommonXAxisModel)) { allCommon = false; break; } } <END> if (allCommon) { return getCommonXResponse(filter, monitor, providers); } return getXyResponse(filter, monitor, providers); }</code><technical_language>Iterables.all</technical_language>

Target:
public TmfModelResponse<ITmfXyModel> fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { List<P> providers = getProviders(); boolean allCommon = Iterables.all(providers, p -> p instanceof ITmfCommonXAxisModel); if (allCommon) { return getCommonXResponse(filter, monitor, providers); } return getXyResponse(filter, monitor, providers); }
Source:
<code>public void testDelete() throws StripeException { Coupon resource = Coupon.retrieve(RESOURCE_ID); <START> resource.delete(); <END> verifyRequest( APIResource.RequestMethod.DELETE, String.format("/v1/coupons/%s", resource.getId()) ); }</code><technical_language>test CouponDeleted for Card (if so, applies delete)</technical_language>

Target:
public void testDelete() throws StripeException { final Coupon coupon = getCouponFixture(); final DeletedCoupon deletedCoupon = coupon.delete(); assertNotNull(deletedCoupon); verifyRequest( APIResource.RequestMethod.DELETE, String.format("/v1/coupons/%s", coupon.getId()) ); }
Source:
<code>private LogicalVariable translateObjectConstructor(TranslationContext tCtx, ObjectConstructor obj) throws SystemException { List<ILogicalExpression> content = new ArrayList<ILogicalExpression>(); for (ASTNode aVal : obj.getContent()) { <START> if (aVal instanceof PairConstructor) { <END> ILogicalExpression ke = string(data(vre(translateExpression(((PairConstructor) aVal).getKey(), tCtx)))); content.add(ke); ILogicalExpression ve = vre(translateExpression(((PairConstructor) aVal).getValue(), tCtx)); content.add(ve); ILogicalExpression qmce = ce(SequenceType.create(BuiltinTypeRegistry.XS_BOOLEAN, Quantifier.QUANT_ONE), ((PairConstructor) aVal).isQuestionMarkColon()); content.add(qmce); } else { ILogicalExpression aExpr = aVal == null ? sfce(BuiltinOperators.CONCATENATE) : vre(translateExpression(aVal, tCtx)); return createAssignment(sfce(BuiltinOperators.SIMPLE_OBJECT_UNION, aExpr), tCtx); } } return createAssignment( sfce(BuiltinOperators.OBJECT_CONSTRUCTOR, content.toArray(new ILogicalExpression[content.size()])), tCtx); }</code><technical_language>Please ASTNode.getTag() here</technical_language>

Target:
private LogicalVariable translateObjectConstructor(TranslationContext tCtx, ObjectConstructor obj) throws SystemException { List<ILogicalExpression> content = new ArrayList<ILogicalExpression>(); PairConstructor pc; for (ASTNode aVal : obj.getContent()) { if (aVal.getTag()==ASTTag.PAIR_CONSTRUCTOR) { pc=(PairConstructor) aVal; ILogicalExpression ke = string(data(vre(translateExpression(pc.getKey(), tCtx)))); content.add(ke); ILogicalExpression ve = vre(translateExpression(pc.getValue(), tCtx)); content.add(ve); ILogicalExpression qmce = ce(SequenceType.create(BuiltinTypeRegistry.XS_BOOLEAN, Quantifier.QUANT_ONE), pc.isQuestionMarkColon()); content.add(qmce); } else { ILogicalExpression aExpr = aVal == null ? sfce(BuiltinOperators.CONCATENATE) : vre(translateExpression(aVal, tCtx)); return createAssignment(sfce(BuiltinOperators.SIMPLE_OBJECT_UNION, aExpr), tCtx); } } return createAssignment( sfce(BuiltinOperators.OBJECT_CONSTRUCTOR, content.toArray(new ILogicalExpression[content.size()])), tCtx); }
Source:
<code><START> public String createAgentRequestBody(String autoRegisterKey, String environment, Map<String, String> configuration, JobIdentifier jobIdentifier) { <END> final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("auto_register_key", autoRegisterKey); jsonObject.add("properties", mapToJsonObject(configuration)); jsonObject.addProperty("environment", environment); return jsonObject.toString(); }</code><technical_language>I see, bit passing job_identifier in createAgentRequestBody shouldAssignWorkRequestBody out in 18.1. if stop passing along, of plugins break? Wondering if need a v4 too</technical_language>

Target:
String createAgentRequestBody(String autoRegisterKey, String environment, Map<String, String> configuration, JobIdentifier jobIdentifier) { final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("auto_register_key", autoRegisterKey); jsonObject.add("properties", mapToJsonObject(configuration)); jsonObject.addProperty("environment", environment); return jsonObject.toString(); }
Source:
<code>public void shouldMapNonEmptyList() { final List<Integer> list = Collections.unmodifiableList(Arrays.asList(1, 3, 5, 7)); final List<Integer> actual = ListOps.map(list, x -> x + 1); <START> final List<Integer> expected <END> = Arrays.asList(2, 4, 6, 8); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>(redundant suggestion) this "literal" (as close get in Java) is short enough _could_ fit inline in assert, below. motivation, here, is bring declaration of close (in this case, reducing distance zero)</technical_language>

Target:
public void shouldMapNonEmptyList() { final List<Integer> list = Collections.unmodifiableList(Arrays.asList(1, 3, 5, 7)); final List<Integer> actual = ListOps.map(list, x -> x + 1); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(Arrays.asList(2, 4, 6, 8), actual); }
Source:
<code>public void actionPerformed(ActionEvent e) { ProxyConnection.ProxyType proxyType; if (schemaComboBox.getSelectedIndex() == 0) { <START> proxyType = ProxyConnection.ProxyType.NO_PROXY; <END> } else if (schemaComboBox.getSelectedIndex() == 1) { proxyType = ProxyConnection.ProxyType.HTTP; } else { proxyType = ProxyConnection.ProxyType.HTTPS; } try { BriefcasePreferences.setBriefcaseProxyProperty(new ProxyConnection(txtHost.getText(), Integer.parseInt(txtPort.getText()), proxyType)); txtHost.setEnabled(false); txtPort.setEnabled(false); } catch (NumberFormatException e1) { JOptionPane.showMessageDialog(new JFrame(), MessageStrings.PORT_ERROR_MESSAGE, "Dialog", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } }</code><technical_language>Set proxy null return immediately</technical_language>

Target:
public void actionPerformed(ActionEvent e) { ProxyConnection.ProxyType proxyType; if (schemaComboBox.getSelectedIndex() == 0) { BriefcasePreferences.setBriefcaseProxyProperty(null); txtHost.setEnabled(false); txtPort.setEnabled(false); return; } if (schemaComboBox.getSelectedIndex() == 1) { proxyType = ProxyConnection.ProxyType.HTTP; } else { proxyType = ProxyConnection.ProxyType.HTTPS; } try { BriefcasePreferences.setBriefcaseProxyProperty(new ProxyConnection(txtHost.getText(), Integer.parseInt(txtPort.getText()), proxyType)); txtHost.setEnabled(false); txtPort.setEnabled(false); } catch (NumberFormatException e1) { JOptionPane.showMessageDialog(new JFrame(), MessageStrings.PORT_ERROR_MESSAGE, "Dialog", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } }
Source:
<code>public Set<GAV> <START> getProjectGAVs() <END> { return Collections.unmodifiableSet(new LinkedHashSet<>(gavs)); }</code><technical_language>synchronized</technical_language>

Target:
public synchronized Set<GAV> getProjectGAVs() { return Collections.unmodifiableSet(new LinkedHashSet<>(gavs)); }
Source:
<code>public AsyncTask submit(Runnable task, String displayName, DataService dataService, long requestId) { synchronized(mutex) { String taskId = Long.toString(++counter); Fuseki.serverLog.info(format("Task : %s : %s",taskId, displayName)); Callable<Object> c = ()->{ try { task.run(); } catch (Throwable th) { Fuseki.serverLog.error(format("Exception in task %s execution", taskId), th); } return null; }; AsyncTask asyncTask = new AsyncTask(c, this, taskId, displayName, dataService, requestId); try { executor.submit(asyncTask); runningTasks.put(taskId, asyncTask); return asyncTask; } catch (RejectedExecutionException ex) { <START> ServletOps.errorBadRequest("Async task request rejected"); <END> return null; } } }</code><technical_language>this more specific users understand rejected e.g. add - <maxTasks> in progress</technical_language>

Target:
public AsyncTask submit(Runnable task, String displayName, DataService dataService, long requestId) { synchronized(mutex) { String taskId = Long.toString(++counter); Fuseki.serverLog.info(format("Task : %s : %s",taskId, displayName)); Callable<Object> c = ()->{ try { task.run(); } catch (Throwable th) { Fuseki.serverLog.error(format("Exception in task %s execution", taskId), th); } return null; }; AsyncTask asyncTask = new AsyncTask(c, this, taskId, displayName, dataService, requestId); try { executor.submit(asyncTask); runningTasks.put(taskId, asyncTask); return asyncTask; } catch (RejectedExecutionException ex) { ServletOps.errorBadRequest("Async task request rejected - exceeds the limit of "+nMaxThreads+" tasks"); return null; } } }
Source:
<code>@Override public URL getDiffLink(Path path) throws IOException { if (path.getEditType() != EditType.EDIT) { return null; } int r = path.getLogEntry().getRevision(); String value = String.format("%s/commit/r%d/head%s", url, r, path.getValue()); <START> LOGGER.fine("DiffLink URL: " + value); <END> return new URL(value); }</code><technical_language>formatter avoid non-required string concatenations</technical_language>

Target:
public URL getDiffLink(Path path) throws IOException { if (path.getEditType() != EditType.EDIT) { return null; } int r = path.getLogEntry().getRevision(); String value = String.format("%s/commit/r%d/head%s", url, r, path.getValue()); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("DiffLink URL: " + value); } return new URL(value); }
Source:
<code>private Object transformValue(final Object field) { <START> if (field instanceof GenericData.Array) { <END> return Lists.transform((List<?>) field, String::valueOf); } if (field instanceof ByteBuffer) { if (binaryAsString) { return StringUtils.fromUtf8(((ByteBuffer) field).array()); } else { return ((ByteBuffer) field).array(); } } if (field instanceof Utf8) { return field.toString(); } if (field instanceof List) { return ((List<?>) field).stream().filter(Objects::nonNull).collect(Collectors.toList()); } return field; }</code><technical_language>Is this right do flag anymore? removed me, behavior fromPigAvroStorage set skip this section, means get picked if (field instanceof List) { .. block below, a transformation</technical_language>

Target:
private Object transformValue(final Object field) { if (field instanceof ByteBuffer) { if (binaryAsString) { return StringUtils.fromUtf8(((ByteBuffer) field).array()); } else { return ((ByteBuffer) field).array(); } } else if (field instanceof Utf8) { return field.toString(); } else if (field instanceof List) { return ((List<?>) field).stream().filter(Objects::nonNull).collect(Collectors.toList()); } return field; }
Source:
<code>public void validate_shouldPassValidationForEqualObsPersonValueWithEncounterPatient() { EncounterService es = Context.getEncounterService(); PersonService ps = Context.getPersonService(); Obs obs = new Obs(); obs.setPerson(ps.getPerson(2)); <START> obs.setEncounter(es.getEncounter(2)); <END> Errors errors = new BindException(obs, "obs"); new ObsValidator().validate(obs, errors); assertFalse(errors.hasFieldErrors("person")); }</code><technical_language>nice assertion person objects in case test data changes</technical_language>

Target:
public void validate_shouldPassValidationForEqualObsPersonValueWithEncounterPatient() { EncounterService es = Context.getEncounterService(); PersonService ps = Context.getPersonService(); Obs obs = new Obs(); obs.setPerson(ps.getPerson(2)); obs.setEncounter(es.getEncounter( 3 )); obs.getEncounter().setPatient(new Patient( 3 ) ); assertFalse( Objects.equals(obs.getPerson(),obs.getEncounter().getPatient()) ); Errors errors = new BindException(obs, "obs"); new ObsValidator().validate(obs, errors); assertTrue(errors.hasFieldErrors("person")); }
Source:
<code>public SerializableVoid runTask(NoopPlanConfig config, SerializableVoid args, RunTaskContext runTaskContext) throws Exception { <START> throw new IllegalStateException("Should never get here."); <END> }</code><technical_language>NoopPlanDefinition run a task</technical_language>

Target:
public SerializableVoid runTask(NoopPlanConfig config, SerializableVoid args, RunTaskContext runTaskContext) throws Exception { throw new IllegalStateException("NoopPlanDefinition should never run a task"); }
Source:
<code>public void setCookieGeo(String countryCode) { String cookieName = "Geo"; try { JSONObject geo = new JSONObject(); geo.put("country", countryCode); <START> String value = geo.toString(); <END> setCookie(cookieName, value); } catch (JSONException ex) { PageObjectLogging.log("setCookieGeo", "Cannot set cookie ('" + cookieName + "')", true); } }</code><technical_language>This variable is necessary for next line</technical_language>

Target:
public void setCookieGeo(String countryCode) { String cookieName = "Geo"; try { JSONObject geo = new JSONObject(); geo.put("country", countryCode); setCookie(cookieName, geo.toString()); } catch (JSONException ex) { PageObjectLogging.log("setCookieGeo", "Cannot set cookie ('" + cookieName + "')", true); } }
Source:
<code>public void enterBlurryWord() { String word = getWordFromCaptcha(); blurryWordField.sendKeys(word); <START> PageObjectLogging.log("enterBlurryWord ", "Blurry word field populated", true, driver); <END> }</code><technical_language>remove driver</technical_language>

Target:
public void enterBlurryWord() { String word = getWordFromCaptcha(); blurryWordField.sendKeys(word); PageObjectLogging.log("enterBlurryWord ", "Blurry word field populated", true); }
Source:
<code>public Set<? extends NodeMetadata> listNodesByIds(Iterable<String> ids) { Multimap<String, String> idsByHandles = index(ids, splitHandle(1)); Multimap<String, String> idsByRegions = transformValues(idsByHandles, splitHandle(0)); Multimap<String, String> idsByConfiguredRegions = filterKeys(idsByRegions, in(regions.get())); Iterable<? extends RunningInstance> instances; if (idsByConfiguredRegions.isEmpty()) { return ImmutableSet.of(); } else { instances = pollRunningInstancesByRegionsAndIds(idsByConfiguredRegions); <START> } <END> Iterable<? extends NodeMetadata> nodes = transform(filter(instances, notNull()), runningInstanceToNodeMetadata); return ImmutableSet.copyOf(nodes); }</code><technical_language>if (idsByConfiguredRegions.isEmpty()) { return ImmutableSet.of(); } instances = pollRunningInstancesByRegionsAndIds(idsByConfiguredRegions); ... ? I agree this is basically a style preference, "special case" of isEmpty() clearer</technical_language>

Target:
public Set<? extends NodeMetadata> listNodesByIds(Iterable<String> ids) { Multimap<String, String> idsByHandles = index(ids, splitHandle(1)); Multimap<String, String> idsByRegions = transformValues(idsByHandles, splitHandle(0)); Multimap<String, String> idsByConfiguredRegions = filterKeys(idsByRegions, in(regions.get())); if (idsByConfiguredRegions.isEmpty()) { return ImmutableSet.of(); } Iterable<? extends RunningInstance> instances = pollRunningInstancesByRegionsAndIds(idsByConfiguredRegions); Iterable<? extends NodeMetadata> nodes = transform(filter(instances, notNull()), runningInstanceToNodeMetadata); return ImmutableSet.copyOf(nodes); }
Source:
<code><START> public TriggeredBuildSelector(boolean fallbackToLastSuccessful, UpstreamFilterStrategy upstreamFilterStrategy, boolean allowUpstreamDependencies) { <END> this.fallbackToLastSuccessful = fallbackToLastSuccessful ? Boolean.TRUE : null; this.upstreamFilterStrategy = upstreamFilterStrategy; this.allowUpstreamDependencies = allowUpstreamDependencies ? Boolean.TRUE : null; }</code><technical_language>Please add overloaded constructor comparibility (like TriggerredBuildSelector(boolean))</technical_language>

Target:
public TriggeredBuildSelector(boolean fallbackToLastSuccessful, UpstreamFilterStrategy upstreamFilterStrategy, boolean allowUpstreamDependencies) { this.fallbackToLastSuccessful = fallbackToLastSuccessful ? Boolean.TRUE : null; this.upstreamFilterStrategy = upstreamFilterStrategy; this.allowUpstreamDependencies = allowUpstreamDependencies; }
Source:
<code><START> public ChromeCommandExecutor(URL serviceUrl) { <END> super(chromeCommandsNameToUrl, serviceUrl); this.service = null; }</code><technical_language>add this constructor</technical_language>

Target:
public ChromeCommandExecutor(URL serviceUrl) { super(CHROME_COMMANDS_NAME_TO_URL, serviceUrl); this.service = null; }
Source:
<code>public void run() { SurfaceHolder holder = getHolder(); Canvas canvas = null; if (Build.VERSION.SDK_INT >= 18) { try { Thread.sleep(20); <START> } catch (Exception e) { <END> } } synchronized (holder) { try { canvas = holder.lockCanvas(); if (canvas != null && mSurfaceCanBeUsed == true) { doDraw(canvas); } } finally { if (canvas != null) { holder.unlockCanvasAndPost(canvas); } } } }</code><technical_language>empty catch clause is fancy in code. please handle exception if is caught side-effects this code have</technical_language>

Target:
public void run() { SurfaceHolder holder = getHolder(); Canvas canvas = null; if (Build.VERSION.SDK_INT >= 18) { try { Thread.sleep(20); } catch (InterruptedException e) { Log.w(PaintroidApplication.TAG, "DrawingSurface: sleeping thread was interrupted"); } } synchronized (holder) { try { canvas = holder.lockCanvas(); if (canvas != null && mSurfaceCanBeUsed == true) { doDraw(canvas); } } finally { if (canvas != null) { holder.unlockCanvasAndPost(canvas); } } } }
Source:
<code>private static ConnectorTableMetadata getTableMetadata(String schemaName, TpchTable<?> tpchTable, ColumnNaming columnNaming) { ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder(); for (TpchColumn<? extends TpchEntity> column : tpchTable.getColumns()) { <START> columns.add(new ColumnMetadata(columnNaming.getName(column), getPrestoType(column), null, null, false, false, emptyMap())); <END> } columns.add(new ColumnMetadata(ROW_NUMBER_COLUMN_NAME, BIGINT, null, true)); SchemaTableName tableName = new SchemaTableName(schemaName, tpchTable.getTableName()); return new ConnectorTableMetadata(tableName, columns.build()); }</code><technical_language>actually, tpch supports null columns, null values in tpch data</technical_language>

Target:
private static ConnectorTableMetadata getTableMetadata(String schemaName, TpchTable<?> tpchTable, ColumnNaming columnNaming) { ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder(); for (TpchColumn<? extends TpchEntity> column : tpchTable.getColumns()) { columns.add(new ColumnMetadata(columnNaming.getName(column), getPrestoType(column), false, null, null, false, emptyMap())); } columns.add(new ColumnMetadata(ROW_NUMBER_COLUMN_NAME, BIGINT, null, true)); SchemaTableName tableName = new SchemaTableName(schemaName, tpchTable.getTableName()); return new ConnectorTableMetadata(tableName, columns.build()); }
Source:
<code>public void handleConfigureDefinableLoadProfileResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleConfigureDefinableLoadProfileResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Configure Definable Load Profile Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } <START> this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleConfigureDefinableLoadProfileResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleConfigureDefinableLoadProfileResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Configure Definable Load Profile Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>protected boolean canAuthenticate(final WebContext context) { val grantType = context.getRequestParameter(OAuth20Constants.GRANT_TYPE); if (grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.PASSWORD)) { LOGGER.debug("Skipping Client credential authentication to use password authentication"); return false; } if (grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.REFRESH_TOKEN) && context.getRequestParameter(OAuth20Constants.CLIENT_ID).isPresent() && !context.getRequestParameter(OAuth20Constants.CLIENT_SECRET).isPresent()) { <START> LOGGER.debug("Skipping Client credential authentication to use refresh_token authentication"); <END> return false; } val code = context.getRequestParameter(OAuth20Constants.CODE); if (code.isPresent()) { LOGGER.debug("Checking if the OAuth code issued contains code challenge"); val token = this.ticketRegistry.getTicket(code.get(), OAuth20Code.class); if (token != null && StringUtils.isNotEmpty(token.getCodeChallenge())) { LOGGER.debug("The OAuth code issued contains code challenge which requires PKCE Authentication", code.get()); return false; } } return true; }</code><technical_language>Please correct capitalization of debug statement (i.e. Client), possibly remove *refresh_token authentication*</technical_language>

Target:
protected boolean canAuthenticate(final WebContext context) { val grantType = context.getRequestParameter(OAuth20Constants.GRANT_TYPE); if (grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.PASSWORD)) { LOGGER.debug("Skipping Client credential authentication to use password authentication"); return false; } if (grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.REFRESH_TOKEN) && context.getRequestParameter(OAuth20Constants.CLIENT_ID).isPresent() && !context.getRequestParameter(OAuth20Constants.CLIENT_SECRET).isPresent()) { LOGGER.debug("Skipping client credential authentication to use refresh token authentication"); return false; } val code = context.getRequestParameter(OAuth20Constants.CODE); if (code.isPresent()) { LOGGER.debug("Checking if the OAuth code issued contains code challenge"); val token = this.ticketRegistry.getTicket(code.get(), OAuth20Code.class); if (token != null && StringUtils.isNotEmpty(token.getCodeChallenge())) { LOGGER.debug("The OAuth code issued contains code challenge which requires PKCE Authentication", code.get()); return false; } } return true; }
Source:
<code>private void registerWithExistingTarget(DropTarget target) { Transfer[] transfers = target.getTransfer(); boolean exists = false; if (transfers != null) { for (Transfer transfer : transfers) { if (transfer instanceof URLTransfer) { exists = true; <START> break; <END> } } if (!exists) { Transfer[] newTransfers = new Transfer[transfers.length + 1]; System.arraycopy(transfers, 0, newTransfers, 0, transfers.length); newTransfers[transfers.length] = URLTransfer.getInstance(); target.setTransfer(newTransfers); } } }</code><technical_language>Personally, I a flag returned here</technical_language>

Target:
private void registerWithExistingTarget(DropTarget target) { Transfer[] transfers = target.getTransfer(); if (transfers != null) { for (Transfer transfer : transfers) { if (transfer instanceof URLTransfer) { return; } } Transfer[] newTransfers = new Transfer[transfers.length + 1]; System.arraycopy(transfers, 0, newTransfers, 0, transfers.length); newTransfers[transfers.length] = URLTransfer.getInstance(); target.setTransfer(newTransfers); } }
Source:
<code>public GoApiResponse process(GoPluginDescriptor pluginDescriptor, GoApiRequest goPluginApiRequest) { try { if (goPluginApiRequest.api().equals(GET_PLUGIN_SETTINGS)) { GoPluginExtension extension = extensionFor(pluginDescriptor.id()); PluginSettings pluginSettings = pluginSettingsFor(pluginDescriptor.id()); DefaultGoApiResponse response = new DefaultGoApiResponse(200); response.setResponseBody(extension.pluginSettingsJSON(pluginDescriptor.id(), pluginSettings.getSettingsAsKeyValuePair())); return response; } } catch (Exception e) { LOGGER.error(format("Error processing PluginSettings request from plugin: %s.", pluginDescriptor.id()), e); } <START> return new DefaultGoApiResponse(400); <END> }</code><technical_language>this show a useful message plugin</technical_language>

Target:
public GoApiResponse process(GoPluginDescriptor pluginDescriptor, GoApiRequest goPluginApiRequest) { try { GoPluginExtension extension = extensionFor(pluginDescriptor.id()); PluginSettings pluginSettings = pluginSettingsFor(pluginDescriptor.id()); DefaultGoApiResponse response = new DefaultGoApiResponse(200); response.setResponseBody(extension.pluginSettingsJSON(pluginDescriptor.id(), pluginSettings.getSettingsAsKeyValuePair())); return response; } catch (Exception e) { LOGGER.error(format("Error processing PluginSettings request from plugin: %s.", pluginDescriptor.id()), e); DefaultGoApiResponse errorResponse = new DefaultGoApiResponse(400); errorResponse.setResponseBody(format("Error while processing get PluginSettings request - %s", e.getMessage())); return errorResponse; } }
Source:
<code>public void verifyCanChangeIcon() throws IOException, InterruptedException { topologyUIPage.selectTopologyProvider(() -> LABEL); topologyUIPage.findVertex("North Region").contextMenu().click("Navigate To", "Markets (North Region)"); String label = "North 1"; topologyUIPage.findVertex(label).select(); topologyUIPage.findVertex(label).contextMenu().click("Change Icon"); String newIconName = "microwave_backhaul_1"; <START> findElementByXpath(" END> assertEquals(newIconName, topologyUIPage.findVertex(label).getIconName()); }</code><technical_language>move this a setIcon(...) method</technical_language>

Target:
public void verifyCanChangeIcon() throws IOException, InterruptedException { topologyUIPage.selectTopologyProvider(() -> LABEL); waitFor(1); topologyUIPage.findVertex("North Region").contextMenu().click("Navigate To", "Markets (North Region)"); String label = "North 1"; String oldIconName = topologyUIPage.findVertex(label).getIconName(); String newIconName = "microwave_backhaul_1"; if(newIconName.equals(oldIconName)){ newIconName = "IP_service"; } topologyUIPage.findVertex(label).changeIcon(newIconName); topologyUIPage.refreshNow(); assertEquals(newIconName, topologyUIPage.findVertex(label).getIconName()); }
Source:
<code>public <T> ParamConverter<T> getConverter(final Class<T> rawType, final Type genericType, final Annotation[] annotations) { final List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(genericType); final ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || ctp.rawClass() == String.class) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.fromNullable(value)); } @Override public String toString(final T value) throws IllegalArgumentException { return value.toString(); } }; } final Set<ParamConverterProvider> converterProviders = Providers.getProviders(locator, ParamConverterProvider.class); for (ParamConverterProvider provider : converterProviders) { <START> @SuppressWarnings("unchecked") <END> final ParamConverter<?> converter = provider.getConverter(ctp.rawClass(), ctp.type(), annotations); if (converter != null) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.fromNullable(value) .transform(new Function<String, Object>() { @Override public Object apply(final String s) { return converter.fromString(value); } })); } @Override public String toString(final T value) throws IllegalArgumentException { return value.toString(); } }; } } return null; }</code><technical_language>@SuppressWarnings effect? a unchecked warning right now</technical_language>

Target:
public <T> ParamConverter<T> getConverter(final Class<T> rawType, final Type genericType, final Annotation[] annotations) { if (Optional.class.equals(rawType)) { final List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(genericType); final ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || ctp.rawClass() == String.class) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.fromNullable(value)); } @Override public String toString(final T value) throws IllegalArgumentException { return value.toString(); } }; } final Set<ParamConverterProvider> converterProviders = Providers.getProviders(locator, ParamConverterProvider.class); for (ParamConverterProvider provider : converterProviders) { final ParamConverter<?> converter = provider.getConverter(ctp.rawClass(), ctp.type(), annotations); if (converter != null) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.fromNullable(value) .transform(new Function<String, Object>() { @Override public Object apply(final String s) { return converter.fromString(value); } })); } @Override public String toString(final T value) throws IllegalArgumentException { return value.toString(); } }; } } } return null; }
Source:
<code>public void findAll() { <START> Iterator<Product> iterator = repo.findAll().iterator(); <END> while (iterator.hasNext()) { System.out.println(iterator.next()); } }</code><technical_language>Simple for-each</technical_language>

Target:
public void findAll() { Iterator<Product> iterator = repo.findAll().iterator(); printResult(iterator); }
Source:
<code>private Person getPerson(Integer personId) { final Optional<Person> maybePerson; maybePerson = personService.getPersonByID(personId); if (maybePerson.isEmpty()) { throw new ResponseStatusException(BAD_REQUEST, "No person found for id = " + personId); } <START> return maybePerson.get(); <END> }</code><technical_language>java return personService.getPersonByID(personId) .orElseThrow(() -> new RespExc(...))</technical_language>

Target:
private Person getPerson(Integer personId) { return personService.getPersonByID(personId) .orElseThrow(() -> new ResponseStatusException(BAD_REQUEST, "No person found for id = " + personId)); }
Source:
<code>public boolean isThereAnInternalTraceBetween(EObject first, EObject second) { if (first.equals(second)) { return false; } else if (first instanceof INamed && second instanceof INamed) { <START> if (first.eCrossReferences().contains(second) || second.eCrossReferences().contains(first)) { <END> return true; } } return false; }</code><technical_language>lists initialised? worthwhile put in a null check here</technical_language>

Target:
public boolean isThereAnInternalTraceBetween(EObject first, EObject second) { if (first.equals(second)) { return false; } else if (first instanceof INamed && second instanceof INamed) { if (!first.eCrossReferences().isEmpty() && !second.eCrossReferences().isEmpty()) { if (first.eCrossReferences().contains(second) || second.eCrossReferences().contains(first)) { return true; } } } return false; }
Source:
<code>public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; String controller = handlerMethod.getMethod().getDeclaringClass().getSimpleName(); if (controllersToExclude.contains(controller)) { return; } Integer status = response.getStatus(); if (ex != null) { status = 500; } Id id = registry.createId(metricName) .withTag("controller", controller) .withTag("method", handlerMethod.getMethod().getName()) .withTag("status", status.toString().charAt(0) + "xx") .withTag("statusCode", status.toString()) <START> .withTag("reqContentLength", Long.toString(request.getContentLengthLong())); <END> Map variables = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); for (String pathVariable : pathVariablesToTag) { if (variables.containsKey(pathVariable)) { id = id.withTag(pathVariable, variables.get(pathVariable).toString()); } } if (ex != null) { id = id.withTag("success", "false").withTag("cause", ex.getClass().getSimpleName()); } else { id = id.withTag("success", "true"); } registry.timer(id).record( getNanoTime() - ((Long) request.getAttribute(TIMER_ATTRIBUTE)), TimeUnit.NANOSECONDS ); } }</code><technical_language>I need a separate metric (distribution summary probably?) adding a tag existing timer. Adding tag number of metrics explode discrete content length</technical_language>

Target:
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; String controller = handlerMethod.getMethod().getDeclaringClass().getSimpleName(); if (controllersToExclude.contains(controller)) { return; } Integer status = response.getStatus(); if (ex != null) { status = 500; } Id id = registry.createId(metricName) .withTag("controller", controller) .withTag("method", handlerMethod.getMethod().getName()) .withTag("status", status.toString().charAt(0) + "xx") .withTag("statusCode", status.toString()); Map variables = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); for (String pathVariable : pathVariablesToTag) { if (variables.containsKey(pathVariable)) { id = id.withTag(pathVariable, variables.get(pathVariable).toString()); } } if (ex != null) { id = id.withTag("success", "false").withTag("cause", ex.getClass().getSimpleName()); } else { id = id.withTag("success", "true"); } registry.timer(id).record( getNanoTime() - ((Long) request.getAttribute(TIMER_ATTRIBUTE)), TimeUnit.NANOSECONDS ); Id contentLengthId = registry.createId(contentLengthMetricName).withTags(id.tags()); registry.distributionSummary(contentLengthId).record(request.getContentLengthLong()); } }
Source:
<code>public ApplyDeferredLightingNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); SwappableFBO gBuffer = displayResolutionDependentFBOs.getGBuffer(); <START> gBuffer.swap(); <END> addDesiredStateChange(new BindFbo(gBuffer.getWriteFbo())); addDesiredStateChange(new EnableMaterial(DEFERRED_LIGHTING_MATERIAL)); FBO gBufferRead = displayResolutionDependentFBOs.getGBuffer().getReadFbo(); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, gBufferRead, ColorTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaque")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, gBufferRead, DepthStencilTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueDepth")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, gBufferRead, NormalsTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueNormals")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot, gBufferRead, LightAccumulationTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueLightBuffer")); }</code><technical_language>this happen frame</technical_language>

Target:
public ApplyDeferredLightingNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); SwappableFBO gBufferPair = displayResolutionDependentFBOs.getGBufferPair(); addDesiredStateChange(new BindFbo(gBufferPair.getStaleFbo())); addDesiredStateChange(new EnableMaterial(DEFERRED_LIGHTING_MATERIAL_URN)); FBO lastUpdatedGBuffer = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, ColorTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL_URN, "texSceneOpaque")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, DepthStencilTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL_URN, "texSceneOpaqueDepth")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, NormalsTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL_URN, "texSceneOpaqueNormals")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot, lastUpdatedGBuffer, LightAccumulationTexture, displayResolutionDependentFBOs, DEFERRED_LIGHTING_MATERIAL_URN, "texSceneOpaqueLightBuffer")); addDesiredStateChange(new SwapGBuffers(gBufferPair)); }
Source:
<code>public void getObs_ShouldPopulateModelAndViewWithObsForGivenObsAndGivenValidOrder() throws Exception { ModelAndView modelAndView = radiologyObsFormController.getObs(ValidorderId, ValidObsIdForOrder20); assertNotNull(modelAndView); <START> assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); <END> assertTrue(modelAndView.getModelMap().containsKey("obs")); Obs obs = (Obs) modelAndView.getModelMap().get("obs"); assertNotNull(obs); assertNotNull(obs.getPerson()); assertNotNull(obs.getOrder()); assertThat(obs.getOrder().getId(), is(mockOrder.getId())); assertThat(obs.getPerson().getId(), is(RadiologyTestData.getMockPatient1().getId())); }</code><technical_language>need repeat modelAndView asserts</technical_language>

Target:
public void getObs_ShouldPopulateModelAndViewWithObsForGivenObsAndGivenValidOrder() throws Exception { ModelAndView modelAndView = radiologyObsFormController.getObs(validorderId, validObsIdForOrder20); assertTrue(modelAndView.getModelMap().containsKey("obs")); Obs obs = (Obs) modelAndView.getModelMap().get("obs"); assertNotNull(obs); assertNotNull(obs.getPerson()); assertNotNull(obs.getOrder()); assertThat(obs.getOrder().getId(), is(mockOrder.getId())); assertThat(obs.getPerson().getId(), is(RadiologyTestData.getMockPatient1().getId())); }
Source:
<code>public DataSerializableFactory createFactory() { return new DataSerializableFactory() { @Override public IdentifiedDataSerializable create(int typeId) { switch (typeId) { case EVENT_JOURNAL_INITIAL_SUBSCRIBER_STATE: return new EventJournalInitialSubscriberState(); case DESERIALIZING_ENTRY: <START> return new DeserializingEntry<>(); <END> default: return null; } } }; }</code><technical_language>Remove diamond operator</technical_language>

Target:
public DataSerializableFactory createFactory() { return new DataSerializableFactory() { @Override public IdentifiedDataSerializable create(int typeId) { switch (typeId) { case EVENT_JOURNAL_INITIAL_SUBSCRIBER_STATE: return new EventJournalInitialSubscriberState(); case DESERIALIZING_ENTRY: return new DeserializingEntry(); default: return null; } } }; }
Source:
<code>public List<Pair<Guid, Integer>> score(List<VDS> hosts, VM vm, Map<String, String> parameters) { final VdsDynamic lastHost = getLastHost(vm, hosts); if (lastHost == null) { <START> return noWeights(hosts); <END> } final OS lastHostOs = OS.fromPackageVersionString(lastHost.getHostOs()); if (!lastHostOs.isValid()) { log.debug("Reference host provides an invalid or incomplete OS identifier. Found {}.", lastHost.getId(), lastHost.getHostOs()); return noWeights(hosts); } final List<Pair<Guid, Integer>> weights = new ArrayList<>(); for (final VDS host : hosts) { final OS hostOs = OS.fromPackageVersionString(host.getHostOs()); if (!hostOs.isValid()) { log.debug("Host does not provides an invalid or incomplete OS identifier. Found {}.", host.getId(), host.getHostOs()); weights.add(toWeight(host, BAD_WEIGHT)); } else if (!hostOs.isSameOs(lastHostOs)) { log.debug("Host does not run the same operating system. Expected {}, found {}", host.getId(), lastHostOs.getName(), hostOs.getName()); weights.add(toWeight(host, BAD_WEIGHT)); } else if (hostOs.isOlderThan(lastHostOs)) { weights.add(toWeight(host, BAD_WEIGHT)); } else if (!hostOs.isNewerThan(lastHostOs)) { weights.add(toWeight(host, BETTER_WEIGHT)); } else { weights.add(toWeight(host, BEST_WEIGHT)); } } return weights; }</code><technical_language>sort hosts version? A new VM started newest OS too, it? This replace host check, a VM start prefer newer hosts</technical_language>

Target:
public List<Pair<Guid, Integer>> score(List<VDS> hosts, VM vm, Map<String, String> parameters) { final VdsDynamic lastHost = getLastHost(vm); if (lastHost == null) { return noWeights(hosts); } final OS lastHostOs = OS.fromPackageVersionString(lastHost.getHostOs()); if (!lastHostOs.isValid()) { log.debug("Reference host provides an invalid or incomplete OS identifier. Found {}.", lastHost.getId(), lastHost.getHostOs()); return noWeights(hosts); } final List<Pair<Guid, Integer>> weights = new ArrayList<>(); for (final VDS host : hosts) { final OS hostOs = OS.fromPackageVersionString(host.getHostOs()); if (!hostOs.isValid()) { log.debug("Host does not provides an invalid or incomplete OS identifier. Found {}.", host.getId(), host.getHostOs()); weights.add(toWeight(host, BAD_WEIGHT)); } else if (!hostOs.isSameOs(lastHostOs)) { log.debug("Host does not run the same operating system. Expected {}, found {}", host.getId(), lastHostOs.getName(), hostOs.getName()); weights.add(toWeight(host, BAD_WEIGHT)); } else if (hostOs.isOlderThan(lastHostOs)) { weights.add(toWeight(host, BAD_WEIGHT)); } else if (!hostOs.isNewerThan(lastHostOs)) { weights.add(toWeight(host, BETTER_WEIGHT)); } else { weights.add(toWeight(host, BEST_WEIGHT)); } } return weights; }
Source:
<code>private static KMeansModel pmmlToKMeansModel(PMML pmml) { ClusteringModel clusteringModel = (ClusteringModel) pmml.getModels().get(0); List<Cluster> clusters = clusteringModel.getClusters(); Vector[] clusterCenters = new Vector[clusters.size()]; for (Cluster cluster : clusters) { clusterCenters[Integer.parseInt(cluster.getId())] = parseVector(TextUtils.parseDelimited(cluster.getArray().getValue(), ' ')); <START> } <END> return new KMeansModel(clusterCenters); }</code><technical_language>this change needs in KMeansPMMLUtils.read()</technical_language>

Target:
private static KMeansModel pmmlToKMeansModel(PMML pmml) { List<ClusterInfo> clusterInfos = KMeansPMMLUtils.read(pmml); Vector[] clusterCenters = new Vector[clusterInfos.size()]; for (ClusterInfo clusterInfo : clusterInfos) { clusterCenters[clusterInfo.getID()] = Vectors.dense(clusterInfo.getCenter()); } return new KMeansModel(clusterCenters); }