auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testSignalNewProcessWithAlias() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("nullAccepted", false); Long oldProcessInstanceId = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_SIGNAL_PROCESS, params); assertNotNull(oldProcessInstanceId); assertTrue(oldProcessInstanceId > 0); createExtraContainer(); Long processInstanceId = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_SIGNAL_PROCESS_2, params); assertNotNull(processInstanceId); assertTrue(processInstanceId > 0); List<String> availableSignals = processClient.getAvailableSignals(CONTAINER_ALIAS, processInstanceId); assertNotNull(availableSignals); assertEquals(2, availableSignals.size()); <START> assertTrue(availableSignals.contains("Signal1")); <END> assertTrue(availableSignals.contains("Signal2")); Object person = createPersonInstance(USER_JOHN); processClient.signalProcessInstance(CONTAINER_ALIAS, processInstanceId, "Signal1", person); processClient.signalProcessInstances(CONTAINER_ALIAS, Collections.singletonList(processInstanceId), "Signal2", "My custom string event"); ProcessInstance pi = processClient.getProcessInstance(CONTAINER_ALIAS, processInstanceId); assertNotNull(pi); assertEquals(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED, pi.getState().intValue()); pi = processClient.getProcessInstance(CONTAINER_ALIAS, oldProcessInstanceId); assertNotNull(pi); assertEquals(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE, pi.getState().intValue()); }</code><technical_language>Another assertions benefit AssertJ - offers nice assertion methods for collections</technical_language>

Target:
public void testSignalNewProcessWithAlias() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("nullAccepted", false); Long oldPid = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_SIGNAL_PROCESS, params); assertThat(oldPid).isNotNull().isGreaterThan(0); createExtraContainer(); Long pid = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_SIGNAL_PROCESS_2, params); assertThat(pid).isNotNull().isGreaterThan(0); List<String> availableSignals = processClient.getAvailableSignals(CONTAINER_ALIAS, pid); assertThat(availableSignals).isNotNull().hasSize(2); assertThat(availableSignals).contains("Signal1"); assertThat(availableSignals).contains("Signal2"); Object person = createPersonInstance(USER_JOHN); processClient.signalProcessInstance(CONTAINER_ALIAS, pid, "Signal1", person); processClient.signalProcessInstances(CONTAINER_ALIAS, Collections.singletonList(pid), "Signal2", "My custom string event"); ProcessInstance pi = processClient.getProcessInstance(CONTAINER_ALIAS, pid); assertThat(pi).isNotNull(); assertThat(pi.getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED); pi = processClient.getProcessInstance(CONTAINER_ALIAS, oldPid); assertThat(pi).isNotNull(); assertThat(pi.getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE); }
Source:
<code>public Collection<IAtsWorkPackage> getWorkPackageOptions(IAtsObject object, List<IAtsWorkPackage> workPackageOptions) throws OseeCoreException { if (object instanceof IAtsConfigObject) { IAtsConfigObject configObj = (IAtsConfigObject) object; Artifact artifact = AtsClientService.get().getArtifact(configObj); if (artifact != null) { for (Artifact workPackageArt : artifact.getRelatedArtifacts(AtsRelationTypes.WorkPackage_WorkPackage)) { workPackageOptions.add(new WorkPackageArtifact(workPackageArt)); } } } <START> if (object instanceof IAtsTeamWorkflow) { <END> IAtsTeamWorkflow teamWf = (IAtsTeamWorkflow) object; getWorkPackageOptions(teamWf.getTeamDefinition(), workPackageOptions); for (IAtsActionableItem ai : teamWf.getActionableItems()) { getWorkPackageOptions(ai, workPackageOptions); } } else if (object instanceof IAtsWorkItem) { IAtsWorkItem workItem = (IAtsWorkItem) object; IAtsTeamWorkflow teamWf = workItem.getParentTeamWorkflow(); if (teamWf != null) { getWorkPackageOptions(teamWf, workPackageOptions); } else if (workItem instanceof IAtsAbstractReview) { IAtsAbstractReview review = (IAtsAbstractReview) workItem; for (IAtsActionableItem ai : review.getActionableItems()) { getWorkPackageOptions(ai, workPackageOptions); if (ai.getTeamDefinition() != null) { getWorkPackageOptions(ai.getTeamDefinition(), workPackageOptions); } } } } return workPackageOptions; }</code><technical_language>this else if? performance difference, is a lot more readable. is implies IAtsTeamWorkflow implements IAtsConfigObject occur</technical_language>

Target:
public Collection<IAtsWorkPackage> getWorkPackageOptions(IAtsObject object, List<IAtsWorkPackage> workPackageOptions) throws OseeCoreException { if (object instanceof IAtsConfigObject) { IAtsConfigObject configObj = (IAtsConfigObject) object; Artifact artifact = AtsClientService.get().getArtifact(configObj); if (artifact != null) { for (Artifact workPackageArt : artifact.getRelatedArtifacts(AtsRelationTypes.WorkPackage_WorkPackage)) { workPackageOptions.add(new WorkPackageArtifact(workPackageArt)); } } } else if (object instanceof IAtsTeamWorkflow) { IAtsTeamWorkflow teamWf = (IAtsTeamWorkflow) object; getWorkPackageOptions(teamWf.getTeamDefinition(), workPackageOptions); for (IAtsActionableItem ai : teamWf.getActionableItems()) { getWorkPackageOptions(ai, workPackageOptions); } } else if (object instanceof IAtsWorkItem) { IAtsWorkItem workItem = (IAtsWorkItem) object; IAtsTeamWorkflow teamWf = workItem.getParentTeamWorkflow(); if (teamWf != null) { getWorkPackageOptions(teamWf, workPackageOptions); } else if (workItem instanceof IAtsAbstractReview) { IAtsAbstractReview review = (IAtsAbstractReview) workItem; for (IAtsActionableItem ai : review.getActionableItems()) { getWorkPackageOptions(ai, workPackageOptions); if (ai.getTeamDefinition() != null) { getWorkPackageOptions(ai.getTeamDefinition(), workPackageOptions); } } } } return workPackageOptions; }
Source:
<code>public boolean canConsumeBandwidth() { if (!isBandwidthRestricted()) { return true; } synchronized (lock) { <START> if (currentBandwidthConsumption >= 0) { <END> return true; } } return false; }</code><technical_language>return currentBandwidthConsumption >= 0</technical_language>

Target:
public boolean canConsumeBandwidth() { if (!isBandwidthRestricted()) { return true; } synchronized (lock) { return currentBandwidthConsumption >= 0; } }
Source:
<code>public static EmailConfiguration getByProps(final Properties props) { EmailConfiguration configuration = new EmailConfiguration(); configuration.setHost(props.getProperty("email.host")); <START> configuration.setPort(Integer.parseInt(props.getOrDefault("email.port", "25").toString())); <END> configuration.setProtocol(props.getOrDefault("email.protocol", "smtp").toString()); configuration.setUsername(props.getProperty("email.username")); configuration.setPassword(props.getProperty("email.password")); configuration.setUseSsl(Boolean.parseBoolean(props.getOrDefault("email.useSsl", "false").toString())); configuration.setSubject(props.getOrDefault("email.subject", "ElasticJob error message").toString()); configuration.setFrom(props.getProperty("email.form")); configuration.setTo(props.getProperty("email.to")); configuration.setCc(props.getProperty("email.cc")); configuration.setBcc(props.getProperty("email.bcc")); configuration.setDebug(Boolean.parseBoolean(props.getOrDefault("email.debug", "false").toString())); return configuration; }</code><technical_language>SMTP servers required secure connection. I is users declare port explicitly</technical_language>

Target:
public static EmailConfiguration getByProps(final Properties props) { EmailConfiguration configuration = new EmailConfiguration(); configuration.setHost(props.getProperty(EmailConstants.EMAIL_HOST)); configuration.setPort(Integer.parseInt(props.getProperty(EmailConstants.EMAIL_PORT))); configuration.setProtocol(props.getProperty(EmailConstants.EMAIL_PROTOCOL)); configuration.setUsername(props.getProperty(EmailConstants.EMAIL_USERNAME)); configuration.setPassword(props.getProperty(EmailConstants.EMAIL_PASSWORD)); configuration.setUseSsl(Boolean.parseBoolean(props.getOrDefault(EmailConstants.EMAIL_USE_SSL, Boolean.FALSE.toString()).toString())); configuration.setSubject(props.getOrDefault(EmailConstants.EMAIL_SUBJECT, EmailConstants.DEFAULT_EMAIL_SUBJECT).toString()); configuration.setFrom(props.getProperty(EmailConstants.EMAIL_FROM)); configuration.setTo(props.getProperty(EmailConstants.EMAIL_TO)); configuration.setCc(props.getProperty(EmailConstants.EMAIL_CC)); configuration.setBcc(props.getProperty(EmailConstants.EMAIL_BCC)); configuration.setDebug(Boolean.parseBoolean(props.getOrDefault(EmailConstants.EMAIL_DEBUG, Boolean.FALSE.toString()).toString())); return configuration; }
Source:
<code>private void serverStopping( FMLServerStoppingEvent event ) { <START> WorldData.onServerAboutToStart(); <END> TickHandler.INSTANCE.shutdown(); }</code><technical_language>onServerAboutToStart for stopping event? Is incorrectly named wrong place</technical_language>

Target:
private void serverStopping( FMLServerStoppingEvent event ) { WorldData.instance().onServerStopping(); TickHandler.INSTANCE.shutdown(); }
Source:
<code>public void testSrcDstAs() { long value1 = 2147483648L; long value2 = 2147483649L; final BsonDocument bson = getBsonDocument("bgpSourceAsNumber", value1, "bgpDestinationAsNumber", value2); final IpfixFlow flow = new IpfixFlow(bson); <START> Assert.assertTrue(flow.getSrcAs() > 0); <END> Assert.assertEquals(value1, flow.getSrcAs().longValue()); Assert.assertTrue(flow.getDstAs() > 0); Assert.assertEquals(value2, flow.getDstAs().longValue()); }</code><technical_language>verifying exact bellow, checking > 0 redudant</technical_language>

Target:
public void testSrcDstAs() { long value1 = 2147483648L; long value2 = 2147483649L; final BsonDocument bson = getBsonDocument("bgpSourceAsNumber", value1, "bgpDestinationAsNumber", value2); final IpfixFlow flow = new IpfixFlow(bson); assertThat(flow.getSrcAs(), is(equalTo(value1))); assertThat(flow.getDstAs(), is(equalTo(value2))); }
Source:
<code><START> public Optional<Collection<VirtualGatewayInterface>> getGatewayInterfaces(VirtualGatewayInstance gateway) { <END> return l3manager.getGatewayInterfaces(gateway); }</code><technical_language>want avoid returning optional collection. return empty collection</technical_language>

Target:
public Collection<VirtualGatewayInterface> getGatewayInterfaces(VirtualGatewayInstance gateway) { return l3manager.getGatewayInterfaces(gateway); }
Source:
<code>public boolean toggleProfile(Boolean enabled) { <START> Map<String,String> params = new HashMap<>(); <END> params.put("active", enabled.toString()); try { String uri = BASE_PROFILE + uriEncode(this._profileName) + "/" + BASE_CLIENTS + "/"; if (_clientId == null) { uri += "-1"; } else { uri += _clientId; } JSONObject response = new JSONObject(doPost(uri, params)); System.out.println("Response is :"+ response.toString()); } catch (Exception e) { System.out.println(e.getMessage()); return false; } return true; }</code><technical_language>final</technical_language>

Target:
public boolean toggleProfile(Boolean enabled) { final Map<String,String> params = new HashMap<>(); params.put("active", enabled.toString()); try { String uri = BASE_PROFILE + uriEncode(this._profileName) + "/" + BASE_CLIENTS + "/"; if (_clientId == null) { uri += "-1"; } else { uri += _clientId; } JSONObject response = new JSONObject(doPost(uri, params)); } catch (Exception e) { return false; } return true; }
Source:
<code>public String getAmbassadorContainerImage() { <START> return String.valueOf(properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest")).trim(); <END> }</code><technical_language>pre-process inputs in constructor instead</technical_language>

Target:
public String getAmbassadorContainerImage() { return (String) properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest"); }
Source:
<code>public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { if (super.handles(columnElement, rowElement, tableManager)) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); if (objects.size() == <START> 2) { <END> final EObject object = (EObject) objects.get(0); if (object instanceof Port) { String propertyQualifiedName = (String) objects.get(1); propertyQualifiedName = propertyQualifiedName.substring(Constants.PROPERTY_OF_STEREOTYPE_PREFIX.length(), propertyQualifiedName.length()); return propertyQualifiedName.equals(org.eclipse.papyrus.sysml14.nattable.common.utils.Constants.STEREOTYPE_FLOWPORT_DIRECTION); } } } return false; }</code><technical_language>Magic number, extract a constant explain 2</technical_language>

Target:
public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { if (super.handles(columnElement, rowElement, tableManager)) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); if (2 == objects.size()) { final EObject object = (EObject) objects.get(0); if (object instanceof Port) { final Object propertyQualifiedName = objects.get(1); if (propertyQualifiedName instanceof String) { final String propertyQualifiedNameString = ((String) propertyQualifiedName).substring(Constants.PROPERTY_OF_STEREOTYPE_PREFIX.length(), ((String) propertyQualifiedName).length()); return org.eclipse.papyrus.sysml14.nattable.common.utils.Constants.STEREOTYPE_FLOWPORT_DIRECTION.equals(propertyQualifiedNameString); } } } } return false; }
Source:
<code>public void destroyNode(String id) { VirtualGuest guest = getNode(id); if (guest == null) return; logger.debug(">> awaiting virtualGuest(%s) without active transactions", guest.getId()); checkState(retry(new Predicate<VirtualGuest>() { public boolean apply(VirtualGuest guest) { <START> guest = getNode(guest.getId() + ""); <END> return guest.getActiveTransactionCount() == 0; } }, activeTransactionsDelay).apply(guest), "%s still has active transactions!", guest); logger.debug(">> canceling virtualGuest with globalIdentifier(%s)", id); checkState(api.getVirtualGuestApi().deleteObject(guest.getId()), "server(%s) still there after deleting!?", id); }</code><technical_language>do re-assigning variable passed a parameter</technical_language>

Target:
public void destroyNode(String id) { VirtualGuest guest = getNode(id); if (guest == null) return; logger.debug(">> awaiting virtualGuest(%s) without active transactions", guest.getId()); checkState(retry(new Predicate<VirtualGuest>() { public boolean apply(VirtualGuest guest) { return getNode(guest.getId() + "").getActiveTransactionCount() == 0; } }, activeTransactionsDelay).apply(guest), "%s still has active transactions!", guest); logger.debug(">> canceling virtualGuest with globalIdentifier(%s)", id); checkState(api.getVirtualGuestApi().deleteVirtualGuest(guest.getId()), "server(%s) still there after deleting!?", id); }
Source:
<code>public void testMakeWriterForSamExtension() throws IOException { <START> final File tmpFile = File.createTempFile("testMakeWriterForSamExtension", ".sam"); <END> tmpFile.deleteOnExit(); final SAMFileWriter samFileWriter = new SAMFileWriterFactory().makeWriter(new SAMFileHeader(), true, tmpFile, null); samFileWriter.close(); final FileInputStream fis = new FileInputStream(tmpFile); for (byte b:"@HD\tVN:".getBytes()) { Assert.assertEquals((byte)(fis.read() & 0xFF), b); } fis.close(); }</code><technical_language>writing ".sam", SamReader.Type.SAM_TYPE.fileExtension()</technical_language>

Target:
public void testMakeWriterForSamExtension() throws IOException { final File tmpFile = File.createTempFile("testMakeWriterForSamExtension", "." + SAM_TYPE.fileExtension()); tmpFile.deleteOnExit(); try (SAMFileWriter ignored = new SAMFileWriterFactory().makeWriter(new SAMFileHeader(), true, tmpFile, null)) try (FileInputStream fis = new FileInputStream(tmpFile)) { for (byte b : "@HD\tVN:".getBytes()) { Assert.assertEquals((byte) (fis.read() & 0xFF), b); } } }
Source:
<code><START> private boolean ownedByDeploymentGroup(final Deployment deployment, <END> final DeploymentGroup deploymentGroup) { if (Objects.equals(deployment.getDeploymentGroupName(), deploymentGroup.getName())) { return true; } if (deploymentGroup.getRolloutOptions().getMigrate() && deployment.getJobId().equals(deploymentGroup.getJobId())) { return true; } return false; }</code><technical_language>name of this method is pretty misleading -- return true if deployment is owned DG</technical_language>

Target:
private boolean ownedByDeploymentGroup(final Deployment deployment, final DeploymentGroup deploymentGroup) { return Objects.equals(deployment.getDeploymentGroupName(), deploymentGroup.getName()); }
Source:
<code><START> public QueryResponse executeQuery(SolrQuery query) { <END> QueryResponse response = null; try { response = solrServer.query(query); } catch (SolrServerException e) { throw new SolrSearchExecutionException("Couldn't execute query", e); } return response; }</code><technical_language>if query is null</technical_language>

Target:
public QueryResponse executeQuery(SolrQuery query) { Preconditions.checkNotNull(query); QueryResponse response = null; try { response = solrServer.query(query); } catch (SolrServerException e) { throw new SolrSearchExecutionException("Couldn't execute query", e); } return response; }
Source:
<code>public void shouldTransform() { <START> String transformed = of(42).transform(v -> String.valueOf(v.get())); <END> assertThat(transformed).isEqualTo("42"); }</code><technical_language>* please local variables final, @danieldietrich prefers :) * chose slightly simpler values, e.g. of(1)</technical_language>

Target:
public void shouldTransform() { final String transformed = of(1).transform(v -> String.valueOf(v.get())); assertThat(transformed).isEqualTo("1"); }
Source:
<code>public void toJSONString(JSONStringer stringer) throws JSONException { super.toJSONString(stringer); stringer.key("AGGREGATE_COLUMNS") .array(); for (int ii = 0; ii < m_aggregateTypes.size(); ii++) { stringer.object(); <START> stringer.key(Members.AGGREGATE_TYPE.name()).value(m_aggregateTypes.get(ii).name()); <END> boolean isDistinct = m_aggregateDistinct.get(ii); stringer.key(Members.AGGREGATE_DISTINCT.name()).value(isDistinct ? 1 : 0); stringer.key(Members.AGGREGATE_OUTPUT_COLUMN.name()).value(m_aggregateOutputColumns.get(ii)); AbstractExpression.toJSONArray(stringer, Members.AGGREGATE_EXPRESSIONS.name(), m_aggregateExpressions.get(ii)); stringer.endObject(); } stringer.endArray(); AbstractExpression.toJSONArray(stringer, Members.PARTITIONBY_EXPRESSIONS.name(), m_partitionByExpressions); AbstractExpression.toJSONArrayFromSortList(stringer, m_orderByExpressions, null); }</code><technical_language>idiom: stringer.key(Members...name()).value( replaced faster: stringer.keySymbolValuePair(Members...name(),. missed this in a merge master refactor</technical_language>

Target:
public void toJSONString(JSONStringer stringer) throws JSONException { super.toJSONString(stringer); stringer.key("AGGREGATE_COLUMNS") .array(); for (int ii = 0; ii < m_aggregateTypes.size(); ii++) { stringer.object(); stringer.keySymbolValuePair(Members.AGGREGATE_TYPE.name(), m_aggregateTypes.get(ii).name()); boolean isDistinct = m_aggregateDistinct.get(ii); stringer.keySymbolValuePair(Members.AGGREGATE_DISTINCT.name(), isDistinct ? 1 : 0); stringer.keySymbolValuePair(Members.AGGREGATE_OUTPUT_COLUMN.name(), m_aggregateOutputColumns.get(ii)); AbstractExpression.toJSONArray(stringer, Members.AGGREGATE_EXPRESSIONS.name(), m_aggregateExpressions.get(ii)); stringer.endObject(); } stringer.endArray(); AbstractExpression.toJSONArray(stringer, Members.PARTITIONBY_EXPRESSIONS.name(), m_partitionByExpressions); AbstractExpression.toJSONArrayFromSortList(stringer, m_orderByExpressions, null); }
Source:
<code>public String getConfigurationValue(String miimonValue){ <START> String extraOption = ""; <END> if (value.equals(BondMode.BOND4.value)) { extraOption = " xmit_hash_policy=" + BOND_XMIT_POLICY_LAYER23; } return MODE + value + " miimon=" + miimonValue + extraOption; }</code><technical_language>instead of setting setting of extraOption, move assignment "" else part of condition below</technical_language>

Target:
public String getConfigurationValue(String miimonValue){ String extraOption; if (value.equals(BondMode.BOND4.value)) { extraOption = " xmit_hash_policy=" + BOND_XMIT_POLICY_LAYER23; } else { extraOption = ""; } return MODE + value + " miimon=" + miimonValue + extraOption; }
Source:
<code>protected static ExecCredential getExecCredentialFromExecConfig(ExecConfig exec, File configFile) throws IOException, InterruptedException { String apiVersion = exec.getApiVersion(); if ("client.authentication.k8s.io/v1alpha1".equals(apiVersion) || "client.authentication.k8s.io/v1beta1".equals(apiVersion)) { List<ExecEnvVar> env = exec.getEnv(); ProcessBuilder pb = new ProcessBuilder(getAuthenticatorCommandFromExecConfig(exec, configFile, Utils.getSystemPathVariable())); pb.redirectErrorStream(true); if (env != null) { Map<String, String> environment = pb.environment(); env.forEach(var -> environment.put(var.getName(), var.getValue())); } Process p = pb.start(); <START> StringBuilder sb = new StringBuilder(); try (BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()))) { String line; while ((line = in.readLine()) != null) { sb.append(line); } } if (p.waitFor() != 0) { LOGGER.warn(sb.toString()); } ExecCredential ec = Serialization.unmarshal(sb.toString(), ExecCredential.class); <END> if (!apiVersion.equals(ec.apiVersion)) { LOGGER.warn("Wrong apiVersion vs. {}", ec.apiVersion, apiVersion); } else { return ec; } } else { LOGGER.warn("Unsupported apiVersion: {}", apiVersion); } return null; }</code><technical_language>In this excerpt longer considering error stream. this work solution? suggestion final String errorOutput = IOHelpers.readFully(p.getErrorStream()); final String standardOutput = IOHelpers.readFully(p.getInputStream()); if (p.waitFor() != 0) { LOGGER.warn(errorOutput); } ExecCredential ec = Serialization.unmarshal(standardOutput, ExecCredential.class);</technical_language>

Target:
protected static ExecCredential getExecCredentialFromExecConfig(ExecConfig exec, File configFile) throws IOException, InterruptedException { String apiVersion = exec.getApiVersion(); if ("client.authentication.k8s.io/v1alpha1".equals(apiVersion) || "client.authentication.k8s.io/v1beta1".equals(apiVersion)) { List<ExecEnvVar> env = exec.getEnv(); ProcessBuilder pb = new ProcessBuilder(getAuthenticatorCommandFromExecConfig(exec, configFile, Utils.getSystemPathVariable())); pb.redirectErrorStream(true); if (env != null) { Map<String, String> environment = pb.environment(); env.forEach(var -> environment.put(var.getName(), var.getValue())); } Process p = pb.start(); String output; try (InputStream is = p.getInputStream()) { output = IOHelpers.readFully(is); } if (p.waitFor() != 0) { LOGGER.warn(output); } ExecCredential ec = Serialization.unmarshal(output, ExecCredential.class); if (!apiVersion.equals(ec.apiVersion)) { LOGGER.warn("Wrong apiVersion vs. {}", ec.apiVersion, apiVersion); } else { return ec; } } else { LOGGER.warn("Unsupported apiVersion: {}", apiVersion); } return null; }
Source:
<code>public void checkIndentation() { final DetailAST firstChild = getMainAst().getFirstChild(); <START> final DetailAST mainAst = getMainAst(); <END> if (isOnStartOfLine(mainAst) && !getMainAst().getParent().getParent().getText().equals(ASSIGNMENT)) { final int columnNo = expandedTabsColumnNo(mainAst); final IndentLevel level = getIndentImpl(); if (columnNo < level.getFirstIndentLevel()) { logError(mainAst, "", columnNo, level); } } if (firstChild != null) { checkExpressionSubtree(firstChild, getIndent(), false, false); } final DetailAST lparen = mainAst.findFirstToken(TokenTypes.LPAREN); checkLeftParen(lparen); }</code><technical_language>final DetailAST mainAst = getMainAst(); final DetailAST firstChild = mainAst.getFirstChild();</technical_language>

Target:
public void checkIndentation() { if (isOnStartOfLine(mainAst) && !isNewKeywordFollowedByAssign()) { final int columnNo = expandedTabsColumnNo(mainAst); final IndentLevel level = getIndentImpl(); if (columnNo < level.getFirstIndentLevel()) { logError(mainAst, "", columnNo, level); } } final DetailAST firstChild = mainAst.getFirstChild(); if (firstChild != null) { checkExpressionSubtree(firstChild, getIndent(), false, false); } final DetailAST lparen = mainAst.findFirstToken(TokenTypes.LPAREN); checkLeftParen(lparen); }
Source:
<code>public Iterable<TaskSummary> children(String taskId) { Task<?> t = mgmt().getExecutionManager().getTask(taskId); if (t==null) throw WebResourceUtils.notFound("Cannot find task '%s'", taskId); if (!(t instanceof HasTaskChildren)) return Collections.emptyList(); return Collections2.transform(Lists.<Task<?>>newArrayList( <START> (Iterable<Task<?>>)(Iterable<?>)((HasTaskChildren)t).getChildren() ), TaskTransformer.FROM_TASK); <END> }</code><technical_language>some casting! Doe need (Iterable<?>) in well</technical_language>

Target:
public Iterable<TaskSummary> children(String taskId) { Task<?> t = mgmt().getExecutionManager().getTask(taskId); if (t==null) throw WebResourceUtils.notFound("Cannot find task '%s'", taskId); if (!(t instanceof HasTaskChildren)) return Collections.emptyList(); return Collections2.transform(Lists.newArrayList(((HasTaskChildren)t).getChildren()), TaskTransformer.FROM_TASK); }
Source:
<code>private NonBlockingRouter getNonBlockingRouter() throws IOException { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", "DC1"); properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(chunkSize)); properties.setProperty("router.put.request.parallelism", Integer.toString(requestParallelism)); properties.setProperty("router.put.success.target", Integer.toString(successTarget)); VerifiableProperties vProps = new VerifiableProperties(properties); <START> router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), <END> new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); return router; }</code><technical_language>minor: variable needed</technical_language>

Target:
private NonBlockingRouter getNonBlockingRouter() throws IOException { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", "DC1"); properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(chunkSize)); properties.setProperty("router.put.request.parallelism", Integer.toString(requestParallelism)); properties.setProperty("router.put.success.target", Integer.toString(successTarget)); VerifiableProperties vProps = new VerifiableProperties(properties); router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(mockClusterMap.getMetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); return router; }
Source:
<code>public void testGetStrippedVdsUniqueIdWithUnacceptedChars() { RegisterVdsParameters paramsMock = getQueryParameters(); when(paramsMock.getVdsUniqueId()).thenReturn("Test_^123^"); <START> String result = getQuery().getStrippedVdsUniqueId(); <END> assertEquals("Vds id doesn't equal to the expected value", "Test_123", result); }</code><technical_language>lines repeating in tests. consider extracting a method, getStrippedVdsUniqueId(String)</technical_language>

Target:
public void testGetStrippedVdsUniqueIdWithUnacceptedChars() { String result = this.gerStrippedVdsUniqueId("Test_123"); assertEquals("Vds id doesn't equal to the expected value", "Test_123", result); }
Source:
<code>public void aadAwareClientRepository() { AnnotationConfigApplicationContext context = getContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "azure.activedirectory.authorization.graph.scopes = Calendars.Read"); context.refresh(); AzureClientRegistrationRepository clientRepo = context.getBean(AzureClientRegistrationRepository.class); ClientRegistration azure = clientRepo.findByRegistrationId("azure"); ClientRegistration graph = clientRepo.findByRegistrationId("graph"); assertDefaultScopes( clientRepo.getAzureClient(), "openid", "profile", "offline_access", "<LINK_0>" ); assertEquals(clientRepo.getAzureClient().getClient(), azure); assertFalse(clientRepo.isAuthzClient(azure)); assertTrue(clientRepo.isAuthzClient(graph)); assertFalse(clientRepo.isAuthzClient("azure")); assertTrue(clientRepo.isAuthzClient("graph")); List<ClientRegistration> clients = collectClients(clientRepo); <START> assertEquals(2, clients.size()); <END> assertEquals("graph", clients.get(0).getRegistrationId()); assertEquals("azure", clients.get(1).getRegistrationId()); }</code><technical_language>changing this</technical_language>

Target:
public void aadAwareClientRepository() { contextRunner .withPropertyValues( "azure.activedirectory.client-id = fake-client-id", "azure.activedirectory.client-secret = fake-client-secret", "azure.activedirectory.tenant-id = fake-tenant-id", "azure.activedirectory.user-group.allowed-groups = group1, group2", "azure.activedirectory.authorization.graph.scopes = Calendars.Read" ) .run(context -> { AzureClientRegistrationRepository clientRepo = context.getBean(AzureClientRegistrationRepository.class); ClientRegistration azure = clientRepo.findByRegistrationId("azure"); ClientRegistration graph = clientRepo.findByRegistrationId("graph"); assertDefaultScopes( clientRepo.getAzureClient(), "openid", "profile", "offline_access", "<LINK_0>" ); assertEquals(clientRepo.getAzureClient().getClient(), azure); assertFalse(clientRepo.isAuthzClient(azure)); assertTrue(clientRepo.isAuthzClient(graph)); assertFalse(clientRepo.isAuthzClient("azure")); assertTrue(clientRepo.isAuthzClient("graph")); List<ClientRegistration> clients = collectClients(clientRepo); assertEquals(2, clients.size()); assertEquals("graph", clients.get(0).getRegistrationId()); assertEquals("azure", clients.get(1).getRegistrationId()); }); }
Source:
<code>public Iterable<Row> evaluate(TransactionContext txnCtx, Input<List<Object>>... args) { return () -> Identifiers.KEYWORDS.stream() .map(keyword -> (Row) new RowN( keyword.getWord().toLowerCase(Locale.ENGLISH), keyword.isReserved() ? "R" : "U", keyword.isReserved() ? "reserved" : "unreserved" <START> )) <END> .iterator(); }</code><technical_language>sense store this map result a static var</technical_language>

Target:
public Iterable<Row> evaluate(TransactionContext txnCtx, Input<List<Object>>... args) { return () -> Identifiers.KEYWORDS.stream() .map(new Function<Identifiers.Keyword, Row>() { final Object[] columns = new Object[3]; final RowN row = new RowN(columns); @Override public Row apply(Identifiers.Keyword keyword) { columns[0] = keyword.getWord().toLowerCase(Locale.ENGLISH); if (keyword.isReserved()) { columns[1] = "R"; columns[2] = "reserved"; } else { columns[1] = "U"; columns[2] = "unreserved"; } return row; } }).iterator(); }
Source:
<code>private RemoveSnapshotSingleDiskParameters buildRemoveSnapshotSingleDiskLiveParameters(Guid imageId, int completedChildren) { DiskImage dest = getDiskImageDao().getAllSnapshotsForParent(imageId).get(0); RemoveSnapshotSingleDiskParameters parameters = new RemoveSnapshotSingleDiskParameters(imageId, getVmId()); parameters.setDestinationImageId(dest.getImageId()); parameters.setEntityInfo(getParameters().getEntityInfo()); parameters.setParentParameters(getParameters()); parameters.setParentCommand(getActionType()); parameters.setCommandType(VdcActionType.RemoveSnapshotSingleDiskLive); parameters.setVdsId(getVm().getRunOnVds()); parameters.setSessionId(getParameters().getSessionId()); if (getParameters().getChildImageIds() == null) { getParameters().setChildImageIds(Arrays.asList(new Guid[getParameters().getImageIds().size()])); } <START> getParameters().getChildImageIds().set(completedChildren, parameters.getDestinationImageId()); <END> return parameters; }</code><technical_language>this (and persistIfNeeded() call) in a separate function (can called updateParameters() that)</technical_language>

Target:
private RemoveSnapshotSingleDiskParameters buildRemoveSnapshotSingleDiskLiveParameters(Guid imageId, int completedChildren) { DiskImage dest = getDiskImageDao().getAllSnapshotsForParent(imageId).get(0); RemoveSnapshotSingleDiskParameters parameters = new RemoveSnapshotSingleDiskParameters(imageId, getVmId()); parameters.setDestinationImageId(dest.getImageId()); parameters.setEntityInfo(getParameters().getEntityInfo()); parameters.setParentParameters(getParameters()); parameters.setParentCommand(getActionType()); parameters.setCommandType(VdcActionType.RemoveSnapshotSingleDiskLive); parameters.setVdsId(getVm().getRunOnVds()); parameters.setSessionId(getParameters().getSessionId()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); return parameters; }
Source:
<code><START> protected Intent getDefaultIntent() { <END> return context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); }</code><technical_language>suggestion /* package */ Intent getDefaultIntent() {</technical_language>

Target:
Intent getDefaultIntent() { return mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName()); }
Source:
<code>public void testHostWithNul() throws Exception { URL url = new URL("http://host\u0000/"); try { url.openStream(); fail(); <START> } catch (Exception expected) <END> }</code><technical_language>more specific expected exception</technical_language>

Target:
public void testHostWithNul() throws Exception { URL url = new URL("http://host\u0000/"); try { url.openStream(); fail(); } catch (IllegalArgumentException expected) }
Source:
<code>public Roaring64NavigableMap getAddressesInRange(StreamAddressRange range) { Roaring64NavigableMap addressesInRange = new Roaring64NavigableMap(); LongIterator iterator = addressMap.getReverseLongIterator(); while (iterator.hasNext()) { long val = iterator.next(); if (val > range.getEnd() && val <= range.getStart()) { addressesInRange.add(val); <START> } else if (val < range.getEnd()) { <END> break; } } log.trace("getAddressesInRange[{}]: address map in range [{}-{}] has a total of addresses.", Utils.toReadableId(range.getStreamID()), range.getEnd(), range.getStart(), addressesInRange.getLongCardinality()); return addressesInRange; }</code><technical_language>change for if-else, break while iterating range (end, start] ----BREAK FOR THIS SPACE--- miss range..</technical_language>

Target:
public Roaring64NavigableMap getAddressesInRange(StreamAddressRange range) { Roaring64NavigableMap addressesInRange = new Roaring64NavigableMap(); if (range.getStart() > range.getEnd()) { LongIterator iterator = getAddressMap().getReverseLongIterator(); while (iterator.hasNext()) { long curr = iterator.next(); if (curr > range.getEnd()) { addressesInRange.addLong(curr); } else if (curr > range.getStart()) { continue; } else { break; } } } log.trace("getAddressesInRange[{}]: address map in range [{}-{}] has a total of addresses.", Utils.toReadableId(range.getStreamID()), range.getEnd(), range.getStart(), addressesInRange.getLongCardinality()); return addressesInRange; }
Source:
<code>private String extractIdentityStream() { <START> Map beatsData = (Map)this.getData().get("beat"); <END> if(beatsData != null) { String id = (String) beatsData.get("id"); String resourceId = (String) beatsData.get("resource_id"); if(id != null && resourceId != null) { return id + "-" + resourceId; } else { return beatsData.get("name") + "-" + beatsData.get("source"); } } return null; }</code><technical_language>@robbavey drop type information here? this Map<String, String></technical_language>

Target:
private String extractIdentityStream() { Map beatsData = (Map<String, String>)this.getData().get("beat"); if(beatsData != null) { String id = (String) beatsData.get("id"); String resourceId = (String) beatsData.get("resource_id"); if(id != null && resourceId != null) { return id + "-" + resourceId; } else { return beatsData.get("name") + "-" + beatsData.get("source"); } } return null; }
Source:
<code>public void validateItemType(final Item item, final String bindingConfig) throws BindingConfigParseException { logger.trace("validateItemType({},{}) called.", item.getName(), bindingConfig); VeluxGenericBindingParser thisBinding = null; try { thisBinding = new VeluxGenericBindingParser(bindingConfig); } catch (IllegalArgumentException e) { <START> logger.error("validateItemType() {}", e.getMessage()); <END> throw new BindingConfigParseException(e.getMessage()); } VeluxItemType thisType = VeluxItemType.getByThingAndChannel(thisBinding.thingIdentifier, thisBinding.channelIdentifier); if (thisType == null) { String errorMessage = "Velux binding must contain a valid thing/channel combination (found thing '" + thisBinding.thingIdentifier + "', channel '" + thisBinding.channelIdentifier + "'; ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } if (!thisType.getItemClass().getSimpleName().equals(item.getClass().getSimpleName())) { String errorMessage = "Velux binding: item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', '" + thisType.getItemClass().getSimpleName() + "' is allowed - please check your *.items configuration (ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } else { logger.trace("found config '" + bindingConfig + "': " + "item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', which is allowed."); } logger.debug("validateItemType() returned w/o exception."); }</code><technical_language>This a WARN, ERROR</technical_language>

Target:
public void validateItemType(final Item item, final String bindingConfig) throws BindingConfigParseException { logger.trace("validateItemType({},{}) called.", item.getName(), bindingConfig); VeluxGenericBindingParser thisBinding = null; try { thisBinding = new VeluxGenericBindingParser(bindingConfig); } catch (IllegalArgumentException e) { throw new BindingConfigParseException(e.getMessage()); } VeluxItemType thisType = VeluxItemType.getByThingAndChannel(thisBinding.thingIdentifier, thisBinding.channelIdentifier); if (thisType == null) { String errorMessage = "Velux binding must contain a valid thing/channel combination (found thing '" + thisBinding.thingIdentifier + "', channel '" + thisBinding.channelIdentifier + "'; ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } if (!thisType.getItemClass().getSimpleName().equals(item.getClass().getSimpleName())) { String errorMessage = "Velux binding: item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', '" + thisType.getItemClass().getSimpleName() + "' is allowed - please check your *.items configuration (ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } else { logger.trace("found config '{}': Item is of type '{}', which is allowed.", bindingConfig, item.getName(), item.getClass().getSimpleName()); } logger.debug("validateItemType() returned w/o exception."); }
Source:
<code>protected void executeIrsBrokerCommand() { log.info("-- executeIrsBrokerCommand: calling 'SPMGetVolumeInfo', parameters:"); log.info("++ spUUID={}", getParameters().getStoragePoolId()); log.info("++ sdUUID={}", getParameters().getStorageDomainId()); log.info("++ imageGroupGUID={}", getParameters().getImageGroupId()); log.info("++ volUUID={}", <START> getParameters().getImageId()); <END> GetVolumeInfoVDSCommandParameters params = new GetVolumeInfoVDSCommandParameters( getCurrentIrsProxyData().getCurrentVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId()); setVDSReturnValue(resourceManager.runVdsCommand(VDSCommandType.GetVolumeInfo, params)); }</code><technical_language>logging is unneeded a temporary wrapper</technical_language>

Target:
protected void executeIrsBrokerCommand() { log.info("Executing GetVolumeInfo using the current SPM"); GetVolumeInfoVDSCommandParameters params = new GetVolumeInfoVDSCommandParameters( getCurrentIrsProxyData().getCurrentVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId()); setVDSReturnValue(resourceManager.runVdsCommand(VDSCommandType.GetVolumeInfo, params)); }
Source:
<code><START> public Builder loadSource(File srcFile) throws IOException { <END> return loadSource(srcFile, defaultCharset()); }</code><technical_language>public Builder source(String scriptSource) more enough (as in other actions) concerned responsibility of user's streams files this point</technical_language>

Target:
public Builder loadSource(File srcFile) throws IOException { return loadSource(srcFile, Charset.forName(AbstractAction.CHARSET)); }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); outSchema = config.getOutputSchema(collector); if (!this.config.containsMacro(INPUT) <START> && pipelineConfigurer.getStageConfigurer().getInputSchema().getField(this.config.inputField) == null) { <END> collector.addFailure(String.format("Input field '%s' must exist in input schema.", this.config.inputField), null) .withConfigProperty(INPUT); } try { validateXpathAndSchema(collector); } catch (UnsupportedEncodingException e) { collector.addFailure(String.format("Failed to parse XPath mappings: %s.", e.getMessage()), null) .withConfigProperty(XPATH_MAPPINGS); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outSchema); }</code><technical_language>this is difficult read, a separate variable for input schema. Also, input schema null. This check skipped if null</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); outSchema = config.getOutputSchema(collector); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (!this.config.containsMacro(Config.INPUT) && inputSchema != null && inputSchema.getField(this.config.inputField) == null) { collector.addFailure( String.format("Input field '%s' must exist in the input schema.", this.config.inputField), null) .withConfigProperty(Config.INPUT); } validateXpathAndSchema(collector); pipelineConfigurer.getStageConfigurer().setOutputSchema(outSchema); }
Source:
<code>public static LinkedList<String> getGreatestCommonScopes(LinkedList<Configuration> configurationList){ LinkedList<Configuration> includeConfigList = getIncludeConfigurationList(configurationList); HashMap<String, LinkedList<Filter>> includeFiltersByDomain = getIncludeFiltersByDomain(includeConfigList); HashMap<String, Set<String>> parametersIntersectionByDomain = getCommonBeanKeysByDomain(includeFiltersByDomain); HashMap<String, LinkedHashMap<String, String>> commonBeanScopeByDomain = getCommonScopeByDomain(parametersIntersectionByDomain, includeFiltersByDomain); LinkedList<String> result = new LinkedList<String>(); Iterator<Entry<String, LinkedHashMap<String, String>>> commonBeanScopeItr = commonBeanScopeByDomain.entrySet().iterator(); while(commonBeanScopeItr.hasNext()){ <START> Entry<String, LinkedHashMap<String, String>> beanScopeEntry = commonBeanScopeItr.next(); <END> String domain = (String) beanScopeEntry.getKey(); LinkedHashMap<String, String> beanScope = (LinkedHashMap<String, String>) beanScopeEntry.getValue(); result.add(beanScopeToString(domain, beanScope)); } return result; }</code><technical_language>modify HashMap is iterated a for loop :wink: for (Entry<String, LinkedHashMap<String, String>> beanScopeEntry: commonBeanScopeByDomain.entrySet()) { applies lines 129, 164 215</technical_language>

Target:
public static LinkedList<String> getGreatestCommonScopes(LinkedList<Configuration> configurationList){ LinkedList<Configuration> includeConfigList = getIncludeConfigurationList(configurationList); HashMap<String, LinkedList<Filter>> includeFiltersByDomain = getIncludeFiltersByDomain(includeConfigList); HashMap<String, Set<String>> parametersIntersectionByDomain = getCommonBeanKeysByDomain(includeFiltersByDomain); HashMap<String, LinkedHashMap<String, String>> commonBeanScopeByDomain = getCommonScopeByDomain(parametersIntersectionByDomain, includeFiltersByDomain); LinkedList<String> result = new LinkedList<String>(); for (Entry<String, LinkedHashMap<String, String>> beanScopeEntry: commonBeanScopeByDomain.entrySet()) { String domain = beanScopeEntry.getKey(); LinkedHashMap<String, String> beanScope = beanScopeEntry.getValue(); result.add(beanScopeToString(domain, beanScope)); } return result; }
Source:
<code>protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { <START> this.tableName = dictionary.getJsonAliasFor(tableClass); <END> this.id = tableName + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); Meta meta = dictionary.getAttributeOrRelationAnnotation(tableClass, Meta.class, fieldName); if (meta != null) { this.longName = meta.longName(); this.description = meta.description(); } if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "." + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH), relationshipName); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(tableName + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }</code><technical_language>I is a good idea push dictionary of POJO classes</technical_language>

Target:
protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { this.tableName = dictionary.getJsonAliasFor(tableClass); this.id = tableName + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); Meta meta = dictionary.getAttributeOrRelationAnnotation(tableClass, Meta.class, fieldName); if (meta != null) { this.longName = meta.longName(); this.description = meta.description(); } if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "[" + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH) + "]"); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(tableName + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }