auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<String,Map<String,MccMncRecord>> initOperatorMap(AssetManager assetManager) { Map<String,Map<String, MccMncRecord>> map = new HashMap<>(); String json = null; try { final InputStream stream = assetManager.open("mcc-mnc-dict.json"); MainActivity.info("operator stream: " + stream); int size = stream.available(); byte[] buffer = new byte[size]; <START> stream.read(buffer); <END> stream.close(); ObjectMapper mapper = new ObjectMapper(); json = new String(buffer, "UTF-8"); MainActivity.info("operator load complete."); JSONObject jObject = new JSONObject(json); Iterator<String> mccKeys = jObject.keys(); while( mccKeys.hasNext() ){ String key = (String)mccKeys.next(); JSONObject country = jObject.getJSONObject(key); Map<String, MccMncRecord> mccMap = null; if (map.containsKey(key)) { mccMap = map.get(key); } else { mccMap = new HashMap<>(); map.put(key, mccMap); } Iterator<String> mncKeys = country.keys(); while( mncKeys.hasNext() ) { String mncKey = (String)mncKeys.next(); MccMncRecord record = mapper.readValue(country.getJSONObject(mncKey).toString(), MccMncRecord.class); mccMap.put(mncKey, record); } } } catch (final IOException ex) { MainActivity.error("exception loading cell operators: " + ex, ex); } catch (final JSONException ex) { MainActivity.error("exception parsing cell operators: " + ex, ex); } return map; }</code><technical_language>read() returns bytes read, needs checked</technical_language>

Target:
private Map<String,Map<String,MccMncRecord>> initOperatorMap(AssetManager assetManager) { Map<String,Map<String, MccMncRecord>> map = new HashMap<>(); String json = null; try { final InputStream stream = assetManager.open("mcc-mnc-dict.json"); MainActivity.info("operator stream: " + stream); BufferedInputStream bis = new BufferedInputStream(stream); ByteArrayOutputStream buf = new ByteArrayOutputStream(); int result = bis.read(); while(result != -1) { buf.write((byte) result); result = bis.read(); } json = buf.toString("UTF-8"); if (null != bis) { bis.close(); } if (null != buf) { buf.close(); } if (null != stream) { stream.close(); } ObjectMapper mapper = new ObjectMapper(); MainActivity.info("operator load complete."); JSONObject jObject = new JSONObject(json); Iterator<String> mccKeys = jObject.keys(); while( mccKeys.hasNext() ){ String key = (String)mccKeys.next(); JSONObject country = jObject.getJSONObject(key); Map<String, MccMncRecord> mccMap = map.get(key); if (null == mccMap) { mccMap = new HashMap<>(); map.put(key, mccMap); } Iterator<String> mncKeys = country.keys(); while( mncKeys.hasNext() ) { String mncKey = (String)mncKeys.next(); MccMncRecord record = mapper.readValue(country.getJSONObject(mncKey).toString(), MccMncRecord.class); mccMap.put(mncKey, record); } } } catch (final IOException ex) { MainActivity.error("exception loading cell operators: " + ex, ex); } catch (final JSONException ex) { MainActivity.error("exception parsing cell operators: " + ex, ex); } return map; }
Source:
<code>void uriTagValueIsRootWhenBestMatchingPatternIsEmpty() { this.request.setAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, ""); this.response.setStatus(301); Tag tag = WebMvcTags.uri(this.request, this.response); <START> assertThat(tag.getValue()).isEqualTo("ROOT"); <END> }</code><technical_language>root instead of ROOT</technical_language>

Target:
void uriTagValueIsRootWhenBestMatchingPatternIsEmpty() { this.request.setAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, ""); this.response.setStatus(301); Tag tag = WebMvcTags.uri(this.request, this.response); assertThat(tag.getValue()).isEqualTo("root"); }
Source:
<code>public Iterator<T> iterator() { Preconditions.checkNotNull(delimeter); Preconditions.checkNotNull(path); Preconditions.checkNotNull(objectCreator); return new Iterator<T>() { private Scanner scanner; { init(); } private void init() { try { scanner = new Scanner(new File(path)).useDelimiter(delimeter); } catch (FileNotFoundException e) { throw Throwables.propagate(e); } } @Override public boolean hasNext() { return scanner.hasNextLine(); } @Override public T next() { <START> return objectCreator.createObject(new String []{ scanner.next() }); <END> } @Override public void remove() { throw new UnsupportedOperationException("Read only iterator!"); } }; }</code><technical_language>varargs this stuff</technical_language>

Target:
public Iterator<T> iterator() { Preconditions.checkNotNull(delimeter); Preconditions.checkNotNull(path); Preconditions.checkNotNull(objectCreator); return new AbstractIterator<T>() { private Scanner scanner; { init(); } private void init() { try { scanner = new Scanner(new File(path)).useDelimiter(delimeter); } catch (FileNotFoundException e) { throw Throwables.propagate(e); } } @Override protected T computeNext() { try { return objectCreator.createObject(scanner.next()); } catch (NoSuchElementException e) { return endOfData(); } } }; }
Source:
<code>@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSceneView = findViewById(R.id.sceneView); ArcGISScene scene = new ArcGISScene(Basemap.createImagery()); mSceneView.setScene(scene); Camera camera = new Camera(32.7321157, -117.150072, 452.282774, 25.481533, 78.0945859, 0.0); mSceneView.setViewpointCamera(camera); Surface surface = new Surface(); surface.getElevationSources().add(new ArcGISTiledElevationSource(getString(R.string.elevation_source_url))); scene.setBaseSurface(surface); mPointCloudLayer = new PointCloudLayer( getExternalFilesDir(null) + getString(R.string.scene_layer_package_location)); mPointCloudLayer.addDoneLoadingListener(() -> { if (mPointCloudLayer.getLoadStatus() == LoadStatus.LOADED) { <START> mSceneView.getScene().getOperationalLayers().add(mPointCloudLayer); <END> } else { String error = "Point cloud layer failed to load: " + mPointCloudLayer.getLoadError().getMessage(); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); mPointCloudLayer.loadAsync(); }</code><technical_language>add scene of done loading listener in scope</technical_language>

Target:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSceneView = findViewById(R.id.sceneView); ArcGISScene scene = new ArcGISScene(Basemap.createImagery()); mSceneView.setScene(scene); Camera camera = new Camera(32.7321157, -117.150072, 452.282774, 25.481533, 78.0945859, 0.0); mSceneView.setViewpointCamera(camera); Surface surface = new Surface(); surface.getElevationSources().add(new ArcGISTiledElevationSource(getString(R.string.elevation_source_url))); scene.setBaseSurface(surface); PointCloudLayer pointCloudLayer = new PointCloudLayer( getExternalFilesDir(null) + getString(R.string.scene_layer_package_location)); mSceneView.getScene().getOperationalLayers().add(pointCloudLayer); pointCloudLayer.addDoneLoadingListener(() -> { if (pointCloudLayer.getLoadStatus() != LoadStatus.LOADED) { String error = "Point cloud layer failed to load: " + pointCloudLayer.getLoadError().getMessage(); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }
Source:
<code>private List<String> getSecuritygroup(final String parameters) { if (parameters == null) { return null; } List<String> securityGroups = new ArrayList<>(); try { securityGroups = JsonPath.read(parameters, <START> "$.Test.instancesSet.items[*].networkInterfaceSet.items[*].groupSet.items[*].groupId"); <END> } catch( PathNotFoundException e) { LOG.error("could not fetch security groups from event"); } return securityGroups; }</code><technical_language>Test here! ;P</technical_language>

Target:
private List<String> getSecuritygroup(final String parameters) { if (parameters == null) { return null; } List<String> securityGroups = new ArrayList<>(); try { securityGroups = JsonPath.read(parameters, "$.instancesSet.items[*].networkInterfaceSet.items[*].groupSet.items[*].groupId"); } catch( PathNotFoundException e) { LOG.error("could not fetch security groups from event"); } return securityGroups; }
Source:
<code>public EmptyContainerDecoder(ObjectMapper mapper, Decoder delegate) { this.delegate = delegate; this.blankInstanceCache = Caffeine.newBuilder() <START> .maximumSize(10_000) <END> .expireAfterAccess(10, TimeUnit.MINUTES) .build(new BlankInstanceLoader(mapper)); }</code><technical_language>1000</technical_language>

Target:
public EmptyContainerDecoder(ObjectMapper mapper, Decoder delegate) { this.delegate = delegate; this.blankInstanceCache = Caffeine.newBuilder() .maximumSize(1000) .expireAfterAccess(10, TimeUnit.MINUTES) .build(new BlankInstanceLoader(mapper)); }
Source:
<code>public void testReadTableBeforeCreationCompleted() { assertThatNoTableIsCreated(); SchemaTableName tableName = new SchemaTableName("default", "temp_table"); ConnectorOutputTableHandle table = metadata.beginCreateTable( SESSION, new ConnectorTableMetadata(tableName, ImmutableList.of(), ImmutableMap.of()), Optional.empty()); List<SchemaTableName> tableNames = metadata.listTables(SESSION, null); <START> assertTrue(tableNames.size() == 1, "Expected exactly one table."); <END> ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, tableName); List<ConnectorTableLayoutResult> tableLayouts = metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()); assertTrue(tableLayouts.size() == 1, "Expected exactly one layout."); ConnectorTableLayout tableLayout = tableLayouts.get(0).getTableLayout(); ConnectorTableLayoutHandle tableLayoutHandle = tableLayout.getHandle(); assertTrue(tableLayoutHandle instanceof MemoryTableLayoutHandle); assertTrue(((MemoryTableLayoutHandle) tableLayoutHandle).getHosts().isEmpty(), "Hosts should be empty"); metadata.finishCreateTable(SESSION, table, ImmutableList.of()); }</code><technical_language>Remove period</technical_language>

Target:
public void testReadTableBeforeCreationCompleted() { assertNoTables(); SchemaTableName tableName = new SchemaTableName("default", "temp_table"); ConnectorOutputTableHandle table = metadata.beginCreateTable( SESSION, new ConnectorTableMetadata(tableName, ImmutableList.of(), ImmutableMap.of()), Optional.empty()); List<SchemaTableName> tableNames = metadata.listTables(SESSION, null); assertTrue(tableNames.size() == 1, "Expected exactly one table"); ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, tableName); List<ConnectorTableLayoutResult> tableLayouts = metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()); assertTrue(tableLayouts.size() == 1, "Expected exactly one layout."); ConnectorTableLayout tableLayout = tableLayouts.get(0).getTableLayout(); ConnectorTableLayoutHandle tableLayoutHandle = tableLayout.getHandle(); assertTrue(tableLayoutHandle instanceof MemoryTableLayoutHandle); assertTrue(((MemoryTableLayoutHandle) tableLayoutHandle).getDataFragments().isEmpty(), "Data fragments should be empty"); metadata.finishCreateTable(SESSION, table, ImmutableList.of()); }
Source:
<code>public void handleEvent(Event event) { <START> ReplicationAction action = ReplicationAction.fromEvent(event); <END> String[] paths = action.getPaths(); Set<String> tobeFlushedDomains = getListOfDomains(paths, action); for(String key : tobeFlushedDomains){ flushSiteMapXml(action); } }</code><technical_language>This pass event a Job provides more guarantees handling. IIRC long running events blacklisted</technical_language>

Target:
public void handleEvent(Event event) { if(isMaster){ ReplicationAction action = ReplicationAction.fromEvent(event); ValueMap jobProperties = getJobProperties(action); Job siteMapGenerationJob = jobManager.addJob(TOPIC, null, jobProperties); log.debug("event offloaded to the sitemap flush job"+siteMapGenerationJob.getId()); } }
Source:
<code>private void saveDownloadedFile() { OCFile file = mStorageManager.getFileById(mCurrentDownload.getFile().getFileId()); long syncDate = System.currentTimeMillis(); file.setLastSyncDateForProperties(syncDate); file.setLastSyncDateForData(syncDate); file.setNeedsUpdateThumbnail(true); file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp()); file.setModificationTimestampAtLastSyncForData(mCurrentDownload.getModificationTimestamp()); file.setEtag(mCurrentDownload.getEtag()); file.setMimetype(mCurrentDownload.getMimeType()); file.setStoragePath(mCurrentDownload.getSavePath()); file.setFileLength((new File(mCurrentDownload.getSavePath()).length())); file.setRemoteId(mCurrentDownload.getFile().getRemoteId()); mStorageManager.saveFile(file); FileDataStorageManager.triggerMediaScan(file.getStoragePath()); mStorageManager.saveConflict(file, null); <START> } <END></code><technical_language>Instead of triggerMediaScan static method, I delete static label instance method mStorageManager</technical_language>

Target:
private void saveDownloadedFile() { OCFile file = mStorageManager.getFileById(mCurrentDownload.getFile().getFileId()); long syncDate = System.currentTimeMillis(); file.setLastSyncDateForProperties(syncDate); file.setLastSyncDateForData(syncDate); file.setNeedsUpdateThumbnail(true); file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp()); file.setModificationTimestampAtLastSyncForData(mCurrentDownload.getModificationTimestamp()); file.setEtag(mCurrentDownload.getEtag()); file.setMimetype(mCurrentDownload.getMimeType()); file.setStoragePath(mCurrentDownload.getSavePath()); file.setFileLength((new File(mCurrentDownload.getSavePath()).length())); file.setRemoteId(mCurrentDownload.getFile().getRemoteId()); mStorageManager.saveFile(file); mStorageManager.triggerMediaScan(file.getStoragePath()); mStorageManager.saveConflict(file, null); }
Source:
<code>public GuiTab addTo(Class<? extends GuiContainer> parentContainer) { if (parentContainer == GuiContainerCreative.class) { throw new IllegalArgumentException("Cannot add tabs to creative inventory. Use CreativeTabs instead"); } <START> else if (parentContainer == InventoryEffectRenderer.class) <END> { throw new IllegalArgumentException(name + " tab has a parent that is ambiguous with the creative inventory. cannot proceed with registry."); } this.parentContainer = parentContainer; tabRegistry.put(parentContainer, this); return this; }</code><technical_language>Is worth checking for superclasses? Currently this bypassed adding GuiContainer.class</technical_language>

Target:
public GuiTab addTo(Class<? extends GuiContainer> parentContainer) { if (parentContainer == GuiContainerCreative.class) { throw new IllegalArgumentException("Cannot add tabs to creative inventory. Use CreativeTabs instead"); } else if (parentContainer.isAssignableFrom(InventoryEffectRenderer.class)) { throw new IllegalArgumentException(name + " tab has a parent that is ambiguous with the creative inventory. cannot proceed with registry."); } this.parentContainer = parentContainer; tabRegistry.put(parentContainer, this); return this; }
Source:
<code>public String evaluate(Run<?, ?> run, FilePath workspace, TaskListener listener, String macroName) { AbstractTestResultAction<?> testResult = run.getAction(AbstractTestResultAction.class); SummarizedTestResult result = prepareSummarizedTestResult(testResult); switch (outputFormat) { case "yaml": try { return result.toYamlString(); <START> } catch (Exception e) { } return "Bad format"; <END> default: return result.toString(); } }</code><technical_language>issues this: - exception is completely lost, a nightmare troubleshoot. - return incompatible expected YAML format. this: NOTE: in theory produce invalid YAML, if stacktrace some characters unexpected in long text, client get a decoding error losing information. consider generating a valid YAML result encoding library, reason I suggest is source of exception encoder (say, due some misconfiguration in system, e.g., classpath) if try for giving troubleshooting information, backfire. suggestion } catch (Exception e) { return "summary: |\n " + getStackTraceAsString(e) +"\ntests: []"; } \</technical_language>

Target:
public String evaluate(Run<?, ?> run, FilePath workspace, TaskListener listener, String macroName) throws MacroEvaluationException { AbstractTestResultAction<?> testResult = run.getAction(AbstractTestResultAction.class); SummarizedTestResult result = prepareSummarizedTestResult(testResult); switch (outputFormat) { case "yaml": try { return result.toYamlString(); } catch (JsonProcessingException e) { throw new MacroEvaluationException("Unable to serialize to yaml", MACRO_NAME, e.getCause()); } catch (Exception e) { throw e; } default: return result.toString(); } }
Source:
<code>public void failedWithBearerTokenFromConfiguration() throws Exception { SaslClient saslClient = createSaslClientFromConfiguration(URI.create("protocol://test3.org")); assertNotNull("OAuth2SaslClient is null", saslClient); SaslServer saslServer = new SaslServerBuilder(OAuth2SaslServerFactory.class, SaslMechanismInformation.Names.OAUTHBEARER) .setServerName("resourceserver.comn") .setProtocol("imap") .addRealm("oauth-realm", createSecurityRealmMock()) .setDefaultRealmName("oauth-realm") .build(); byte[] message = AbstractSaslParticipant.NO_BYTES; message = saslClient.evaluateChallenge(message); try { message = saslServer.evaluateResponse(message); } catch (SaslException e) { <START> assertTrue(e.getCause() instanceof IllegalArgumentException); <END> IllegalArgumentException cause = (IllegalArgumentException) e.getCause(); assertTrue(cause.getMessage().contains("ELY01114")); } }</code><technical_language>This part I completely about. SASL mechanism throwing SaslException is fine, is is supposed do this is relying Exception coming a SecurityRealm ServerAuthenticationContext handled mechanism</technical_language>

Target:
public void failedWithBearerTokenFromConfiguration() throws Exception { SaslClient saslClient = createSaslClientFromConfiguration(URI.create("protocol://test3.org")); assertNotNull("OAuth2SaslClient is null", saslClient); SaslServer saslServer = new SaslServerBuilder(OAuth2SaslServerFactory.class, SaslMechanismInformation.Names.OAUTHBEARER) .setServerName("resourceserver.comn") .setProtocol("imap") .addRealm("oauth-realm", createSecurityRealmMock()) .setDefaultRealmName("oauth-realm") .build(); byte[] message = AbstractSaslParticipant.NO_BYTES; message = saslClient.evaluateChallenge(message); message = saslServer.evaluateResponse(message); assertFalse(saslServer.isComplete()); assertEquals("{\"status\":\"invalid_token\"}", ByteIterator.ofBytes(message).base64Decode().asUtf8String().drainToString()); }
Source:
<code>public IdentityProvider buildAndCreate(Client client) { IdentityProvider createdIdp = client.createIdentityProvider(client.instantiate(IdentityProvider.class) .setType(IdentityProvider.TypeEnum.FACEBOOK) .setName(name) .setProtocol(client.instantiate(Protocol.class) .setType(Protocol.TypeEnum.OAUTH2) .setScopes(scopes) .setCredentials(client.instantiate(IdentityProviderCredentials.class) .setClient(client.instantiate(IdentityProviderCredentialsClient.class) .setClientId(clientId) .setClientSecret(clientSecret)))) .setPolicy(client.instantiate(IdentityProviderPolicy.class) .setProvisioning(client.instantiate(Provisioning.class) .setAction(Provisioning.ActionEnum.AUTO) .setProfileMaster(isProfileMaster) .setGroups(client.instantiate(ProvisioningGroups.class) .setAction(ProvisioningGroups.ActionEnum.NONE)) .setConditions(client.instantiate(ProvisioningConditions.class) .setDeprovisioned(client.instantiate(ProvisioningDeprovisionedCondition.class) .setAction(ProvisioningDeprovisionedCondition.ActionEnum.NONE)) .setSuspended(client.instantiate(ProvisioningSuspendedCondition.class) .setAction(ProvisioningSuspendedCondition.ActionEnum.NONE)))) .setAccountLink(client.instantiate(PolicyAccountLink.class) .setFilter(null) .setAction(PolicyAccountLink.ActionEnum.AUTO)) .setSubject(client.instantiate(PolicySubject.class) .setUserNameTemplate(client.instantiate(PolicyUserNameTemplate.class) .setTemplate(userNameTemplate)) .setMatchType(policySubjectMatchType)) <START> .setMaxClockSkew(maxClockSkew))); <END> return createdIdp; }</code><technical_language>a bunch of fields in IdP creation UI in this builder (or hard coded here)</technical_language>

Target:
public IdentityProvider buildAndCreate(Client client) { IdentityProvider createdIdp = client.createIdentityProvider(client.instantiate(IdentityProvider.class) .setType(IdentityProvider.TypeEnum.FACEBOOK) .setName(name) .setProtocol(client.instantiate(Protocol.class) .setType(Protocol.TypeEnum.OAUTH2) .setScopes(scopes) .setCredentials(client.instantiate(IdentityProviderCredentials.class) .setClient(client.instantiate(IdentityProviderCredentialsClient.class) .setClientId(clientId) .setClientSecret(clientSecret)))) .setPolicy(client.instantiate(IdentityProviderPolicy.class) .setProvisioning(client.instantiate(Provisioning.class) .setAction(Provisioning.ActionEnum.AUTO) .setProfileMaster(isProfileMaster) .setGroups(client.instantiate(ProvisioningGroups.class) .setAction(ProvisioningGroups.ActionEnum.NONE)) .setConditions(client.instantiate(ProvisioningConditions.class) .setDeprovisioned(client.instantiate(ProvisioningDeprovisionedCondition.class) .setAction(ProvisioningDeprovisionedCondition.ActionEnum.NONE)) .setSuspended(client.instantiate(ProvisioningSuspendedCondition.class) .setAction(ProvisioningSuspendedCondition.ActionEnum.NONE)))) .setAccountLink(client.instantiate(PolicyAccountLink.class) .setFilter(null) .setAction(PolicyAccountLink.ActionEnum.AUTO)) .setSubject(client.instantiate(PolicySubject.class) .setUserNameTemplate(client.instantiate(PolicyUserNameTemplate.class) .setTemplate(userName)) .setMatchType(matchType)) .setMaxClockSkew(maxClockSkew))); return createdIdp; }
Source:
<code>public Map<String, ColumnMetadata> extractData(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); <START> Map<String, ColumnMetadata> metadataMap = new LinkedHashMap<>(metadata.getColumnCount(), 1.0f); <END> for (int col = 1; col <= metadata.getColumnCount(); col++) { String columnName = metadata.getColumnName(col); String typeName = metadata.getColumnTypeName(col); int size = metadata.getColumnDisplaySize(col); metadataMap.put(columnName, new ColumnMetadata(columnName, resolveTypeAlias(typeName), size)); } return metadataMap; }</code><technical_language>add explicit fill factor? closer 1 is more is map linked list. save memory I deafult 0.75 is good here</technical_language>

Target:
public Map<String, ColumnMetadata> extractData(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); Map<String, ColumnMetadata> metadataMap = new LinkedHashMap<>(metadata.getColumnCount() * 2); for (int col = 1; col <= metadata.getColumnCount(); col++) { String columnName = metadata.getColumnName(col); String typeName = metadata.getColumnTypeName(col); int size = metadata.getColumnDisplaySize(col); metadataMap.put(columnName, new ColumnMetadata(columnName, resolveTypeAlias(typeName), size)); } return metadataMap; }
Source:
<code>protected List<String> getOutputTables() throws FalconException { List<String> tables = new ArrayList<String>(); try { JSONArray outputs = message.getJSONObject(ADFJsonConstants.ADF_REQUEST_ACTIVITY) .getJSONArray(ADFJsonConstants.ADF_REQUEST_OUTPUTS); for (int i = 0; i < outputs.length(); i++) { tables.add(outputs.getJSONObject(i).getString(ADFJsonConstants.ADF_REQUEST_NAME)); } } catch (JSONException e) { <START> throw new FalconException("Error while parsing output tables in ADF request."); <END> } return tables; }</code><technical_language>print output table name for error occurred while parsing</technical_language>

Target:
protected List<String> getOutputTables() throws FalconException { List<String> tables = new ArrayList<String>(); try { JSONArray outputs = message.getJSONObject(ADFJsonConstants.ADF_REQUEST_ACTIVITY) .getJSONArray(ADFJsonConstants.ADF_REQUEST_OUTPUTS); for (int i = 0; i < outputs.length(); i++) { tables.add(outputs.getJSONObject(i).getString(ADFJsonConstants.ADF_REQUEST_NAME)); } } catch (JSONException e) { throw new FalconException("Error while reading output table names in ADF request."); } return tables; }
Source:
<code>public void removeVariable() { TestSuiteModel testSuite = new TestSuiteModel(); <START> String variable_indentifier = "variable_indentifier"; <END> String variable_content = "variable_content"; String variable_description = "variable_description"; testSuite.setVariable(variable_indentifier, variable_content, variable_description); assertEquals(1, testSuite.getVariables().size()); assertEquals(variable_indentifier, testSuite.getVariables().get(0).getName()); assertEquals(variable_content, testSuite.getVariables().get(0).getContent()); assertEquals(variable_description, testSuite.getVariables().get(0).getDescription()); testSuite.removeVariable(variable_indentifier); assertNull(testSuite.getVariable(variable_indentifier)); testSuite.setVariable(variable_indentifier, variable_content, variable_description); assertEquals(1, testSuite.getVariables().size()); assertEquals(variable_indentifier, testSuite.getVariables().get(0).getName()); assertEquals(variable_content, testSuite.getVariables().get(0).getContent()); assertEquals(variable_description, testSuite.getVariables().get(0).getDescription()); testSuite.removeVariable(testSuite.getVariable(variable_indentifier)); assertNull(testSuite.getVariable(variable_indentifier)); }</code><technical_language>string literal times, consider constants set a variable object in a @setup section</technical_language>

Target:
public void removeVariable() { TestSuiteModel testSuite = new TestSuiteModel(); for (int index = 0; index < elements; index++) { testSuite.setVariable(variableIndentifier[index], variableContent[index], variableDescription[index]); } for (int index = 0; index < elements; index++) { testSuite.removeVariable(variableIndentifier[index]); } }
Source:
<code>public boolean isForwarded(String name) { final HaxeMacroClass forwardMeta = getMeta(FORWARD); if (forwardMeta != null) { HaxeCustomMeta customMeta = forwardMeta.getCustomMeta(); final HaxeExpressionList expressionList = customMeta.getExpressionList(); if (expressionList == null) return true; for (HaxeExpression expression : expressionList.getExpressionList()) { <START> if (expression.getText().equals(name)) return true; <END> } } return false; }</code><technical_language>this work @:forward() (empty list)? returning false in case OK? Actually, I think, yes. But... @:forward arguments forwards fields. @:forward() arguments fields. I this is user expect, flag error -- or, least, a warning</technical_language>

Target:
public boolean isForwarded(String name) { final HaxeMacroClass forwardMeta = getMeta(FORWARD); if (forwardMeta != null) { final HaxeCustomMeta customMeta = forwardMeta.getCustomMeta(); final HaxeExpressionList expressionList = customMeta.getExpressionList(); if (expressionList == null) return true; final List<HaxeExpression> list = expressionList.getExpressionList(); if (list.isEmpty()) return true; for (HaxeExpression expression : list) { if (expression.getText().equals(name)) return true; } } return false; }
Source:
<code>private void gainLeadershipWithRetry() { if (!gainLeadershipBlocking()) { try { Thread.sleep(GAIN_LEADERSHIP_BACKOFF_MILLIS); } catch (InterruptedException e) { log.warn("gain leadership backoff interrupted"); } <START> gainLeadershipWithRetry(); <END> } }</code><technical_language>I want submit task opposed recursively calling ourselves. tryToGainLeadershipAsync(), exits</technical_language>

Target:
private void gainLeadershipWithRetry() { while (!gainLeadershipBlocking()) { try { Thread.sleep(GAIN_LEADERSHIP_BACKOFF.toMillis()); } catch (InterruptedException e) { log.warn("gain leadership backoff interrupted"); } } }
Source:
<code>private static String getType(String metric, AggregatorFactory[] aggs, int i) { if(aggs[i].getName().equals(metric)) { return aggs[i].getTypeName(); } <START> for(AggregatorFactory agg : aggs) { <END> if(agg.getName().equals(metric)) { return agg.getTypeName(); } } return null; }</code><technical_language>please add a log.warn(..) if in a real case this fall backs for loop. nice a UT verifies if ordering of AggregatorFactory[] in serialization deserialization stayed for loop is run</technical_language>

Target:
private static String getType(String metric, AggregatorFactory[] aggs, int i) { if (aggs[i].getName().equals(metric)) { return aggs[i].getTypeName(); } log.warn("Aggs disordered, fall backs to loop."); for (AggregatorFactory agg : aggs) { if (agg.getName().equals(metric)) { return agg.getTypeName(); } } return null; }
Source:
<code>public void getBulkObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_bulk_object_with_sync_no_update"; try { Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_bulk", "-b", bucketName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: Synced all the objects from " + bucketName + " to ." + File.separator + "." + File.separator + "output")); final File destFolder = new File(Util.DOWNLOAD_BASE_NAME); <START> DateTime now = new DateTime(); <END> for( final File currentFile : destFolder.listFiles()) { currentFile.setLastModified(now.getMillis()); } response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: All files are up to date")); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFiles(); } }</code><technical_language>missing final</technical_language>

Target:
public void getBulkObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_bulk_object_with_sync_no_update"; try { Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_bulk", "-b", bucketName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: Synced all the objects from " + bucketName + " to ." + File.separator + "." + File.separator + "output")); final File destFolder = new File(Util.DOWNLOAD_BASE_NAME); final DateTime now = new DateTime(); for( final File currentFile : destFolder.listFiles()) { currentFile.setLastModified(now.getMillis()); } response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: All files are up to date")); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFiles(); } }
Source:
<code>public BasicBSONObject call() throws Exception { if (!entity.getAttribute(SERVICE_UP)) { <START> LOG.debug("No serverStatus data: Service not up"); <END> return null; } String hostname = entity.getAttribute(SoftwareProcessEntity.HOSTNAME); Integer port = entity.getAttribute(PORT); MongoClient client = null; try { client = new MongoClient(hostname, port); } catch (UnknownHostException e) { LOG.warn("No serverStatus data: " + e.getMessage()); return null; } String dbName = Iterables.getFirst(client.getDatabaseNames(), "test"); DB db = client.getDB(dbName); CommandResult statusResult = db.command("serverStatus"); client.close(); if (!statusResult.ok()) { LOG.warn("No serverStatus data: " + statusResult.getErrorMessage()); return null; } else { return statusResult; } }</code><technical_language>good entity in log message (for if running big app, obvious entity type entity instance this from). e.g. if (LOG.isDebugEnabled()) LOG.debug("No serverStatus data for {}: service up", entity);</technical_language>

Target:
public BasicBSONObject call() throws Exception { if (!entity.getAttribute(SERVICE_UP)) { LOG.debug("No serverStatus data for {}: Service not up", entity); return null; } String hostname = entity.getAttribute(SoftwareProcessEntity.HOSTNAME); Integer port = entity.getAttribute(PORT); MongoClient client = null; try { client = new MongoClient(hostname, port); } catch (UnknownHostException e) { LOG.warn("No serverStatus data for {}: {}", entity, e.getMessage()); return null; } String dbName = Iterables.getFirst(client.getDatabaseNames(), "test"); try { DB db = client.getDB(dbName); CommandResult statusResult = db.command("serverStatus"); if (!statusResult.ok()) { LOG.warn("No serverStatus data for {}: {}", entity, statusResult.getErrorMessage()); return null; } else { return statusResult; } } finally { client.close(); } }
Source:
<code>public void whenContextExistsInExlusivePIDCreateMultipleServicesUpdateWithDuplicate() throws IOException { String configDirectory = configBaseDirectory + SEP + "multiple_service_contexts_duplicates"; String servicesDirectory = "multiple_contexts"; initialize(null); String absoluteConfigDirectory = configDirectory + SEP + servicesDirectory; ConfigDispatcher cd = new ConfigDispatcher(bundleContext, configAdmin, Paths.get(absoluteConfigDirectory)); processConfigDirectory(absoluteConfigDirectory, cd); File srcDupFile = new File(configDirectory + SEP + "duplicate" + SEP + "service-ctx1duplicate.cfg"); cd.processConfigFile(srcDupFile); verifyValueOfConfigurationPropertyWithContext("service.pid#ctx1", "property1", "valueDup"); verifyValueOfConfigurationPropertyWithContext("service.pid#ctx2", "property1", "value2"); <START> <END> }</code><technical_language>empty line</technical_language>

Target:
public void whenContextExistsInExlusivePIDCreateMultipleServicesUpdateWithDuplicate() throws IOException { String configDirectory = configBaseDirectory + SEP + "multiple_service_contexts_duplicates"; String servicesDirectory = "multiple_contexts"; initialize(null); cd.processConfigFile(new File(getAbsoluteConfigDirectory(configDirectory, servicesDirectory))); File srcDupFile = new File(configDirectory + SEP + "duplicate" + SEP + "service-ctx1duplicate.cfg"); cd.processConfigFile(srcDupFile); verifyValueOfConfigurationPropertyWithContext("service.pid#ctx1", "property1", "valueDup"); verifyValueOfConfigurationPropertyWithContext("service.pid#ctx2", "property1", "value2"); }
Source:
<code>protected ItemUseHandler getItemUseHandler() { return e -> { Player p = e.getPlayer(); ItemStack item = e.getItem(); e.cancel(); int index = selectedMode.getOrDefault(p.getUniqueId(), 0); if (!p.isSneaking()) { SlimefunItem sfItem = modes.get(index).getItem(); <START> if (sfItem.getID().equals(SlimefunItems.STAFF_WIND.getItemId()) && (SlimefunUtils.isItemSimilar(p.getInventory().getItemInMainHand(), SlimefunItems.STAFF_WIND, false, false) || SlimefunUtils.isItemSimilar(p.getInventory().getItemInOffHand(), SlimefunItems.STAFF_WIND, false, false))) { return; } <END> if (removeItemCharge(item, COST)) { if (sfItem != null) { sfItem.callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(e)); } } } else { index = nextIndex(index); SlimefunItem selectedItem = modes.get(index).getItem(); String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown"; SlimefunPlugin.getLocalization().sendMessage(p, "messages.multi-tool.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName))); selectedMode.put(p.getUniqueId(), index); } }; }</code><technical_language>Also: add this? sense add</technical_language>

Target:
protected ItemUseHandler getItemUseHandler() { return e -> { Player p = e.getPlayer(); ItemStack item = e.getItem(); e.cancel(); int index = selectedMode.getOrDefault(p.getUniqueId(), 0); if (!p.isSneaking()) { if (removeItemCharge(item, COST)) { SlimefunItem sfItem = modes.get(index).getItem(); if (sfItem != null) { sfItem.callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(e)); } } } else { index = nextIndex(index); SlimefunItem selectedItem = modes.get(index).getItem(); String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown"; SlimefunPlugin.getLocalization().sendMessage(p, "messages.multi-tool.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName))); selectedMode.put(p.getUniqueId(), index); } }; }
Source:
<code>public ConflictKey(ObjectId commit, ObjectId otherCommit, SubmitType submitType, boolean contentMerge) { if (SubmitType.FAST_FORWARD_ONLY.equals(submitType) || <START> commit.getName().compareTo(otherCommit.getName()) < <END> 0) { this.commit = commit; this.otherCommit = otherCommit; } else { this.commit = otherCommit; this.otherCommit = commit; } this.submitType = submitType; this.contentMerge = contentMerge; }</code><technical_language>ObjectId is comparable. need convert String first</technical_language>

Target:
public ConflictKey(ObjectId commit, ObjectId otherCommit, SubmitType submitType, boolean contentMerge) { if (SubmitType.FAST_FORWARD_ONLY.equals(submitType) || commit.compareTo(otherCommit) < 0) { this.commit = commit; this.otherCommit = otherCommit; } else { this.commit = otherCommit; this.otherCommit = commit; } this.submitType = submitType; this.contentMerge = contentMerge; }
Source:
<code>public RemoteFileToHadoopTasklet(RemoteFileTemplate template, Configuration configuration, String hdfsDirectory) { template.setFileNameExpression(new SpelExpressionParser().parseExpression("payload")); try { <START> template.afterPropertiesSet(); <END> } catch (Exception e) { logger.error("Failed to initialize RemoteFileTemplate", e); } this.template = template; this.configuration = configuration; this.hdfsDirectory = hdfsDirectory.endsWith("/") ? hdfsDirectory : (hdfsDirectory + "/"); }</code><technical_language>call afterPropertiesSet() here? called context InitializingBean defined bean in xml. I assume of a setFileNameExpression(), handled template is created context, in a constructor of other bean</technical_language>

Target:
public RemoteFileToHadoopTasklet(RemoteFileTemplate template, Configuration configuration, String hdfsDirectory) { Assert.notNull(template, "'template' cannot be null"); Assert.notNull(configuration, "'configuration' cannot be null"); Assert.notNull(hdfsDirectory, "'hdfsDirectory' cannot be null"); this.template = template; this.configuration = configuration; this.hdfsDirectory = hdfsDirectory.endsWith("/") ? hdfsDirectory : (hdfsDirectory + "/"); }
Source:
<code>public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (t <= getSHT().getTreeEnd()) { super.doQuery(currentStateInfo, t); } else { <START> checkValidTime(t); <END> } if (isFinishedBuilding()) { return; } for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { ITmfStateInterval interval = doSingularQuery(t, i); currentStateInfo.set(i, interval); } } }</code><technical_language>This checked in cases, meant a IllegalArgumentException check for 't'</technical_language>

Target:
public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { super.doQuery(currentStateInfo, t); if (isFinishedBuilding()) { return; } for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { ITmfStateInterval interval = doSingularQuery(t, i); currentStateInfo.set(i, interval); } } }
Source:
<code>public static Object transformValue(int sqlColumnType, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlColumnType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: case Types.DECIMAL: return ((BigDecimal) original).doubleValue(); case Types.DATE: return resultSet.getDate(fieldName).getTime(); case Types.TIME: return resultSet.getTime(fieldName).getTime(); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName).getTime(); case Types.BLOB: Object toReturn; Blob blob = (Blob) original; try { toReturn = blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } return toReturn; case Types.CLOB: String s; StringBuilder sbf = new StringBuilder(); Clob clob = (Clob) original; try { <START> try (BufferedReader br = new BufferedReader(clob.getCharacterStream(1, (int) clob.length()))) { <END> if ((s = br.readLine()) != null) { sbf.append(s); } while ((s = br.readLine()) != null) { sbf.append(System.getProperty("line.separator")); sbf.append(s); } } } catch (IOException e) { throw new SQLException(e); } finally { clob.free(); } return sbf.toString(); } } return original; }</code><technical_language>complicated?? clob.getSubString(1, (int) clob.length())?</technical_language>

Target:
public static Object transformValue(int sqlColumnType, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlColumnType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: case Types.DECIMAL: return ((BigDecimal) original).doubleValue(); case Types.DATE: return resultSet.getDate(fieldName).getTime(); case Types.TIME: return resultSet.getTime(fieldName).getTime(); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName).getTime(); case Types.BLOB: Blob blob = (Blob) original; try { return blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } case Types.CLOB: Clob clob = (Clob) original; try { return clob.getSubString(1, (int) clob.length()); } finally { clob.free(); } } } return original; }
Source:
<code>public long getLastAddConfirmed(long ledgerId) throws IOException { TransientLedgerInfo ledgerInfo = transientLedgerInfoCache.getIfPresent(ledgerId); Long lac = null != ledgerInfo ? ledgerInfo.getLastAddConfirmed() : null; if (null == lac) { <START> ByteBuf bb = getEntry(ledgerId, BookieProtocol.LAST_ADD_CONFIRMED); <END> bb.skipBytes(2 * Long.BYTES); lac = bb.readLong(); lac = transientLedgerInfoCache.getUnchecked(ledgerId).setLastAddConfirmed(lac); } return lac; }</code><technical_language>do this in loader, rely a getLastAddConfirmed coming getExplicitLAC of other calls. If in loader, easier reason state. This method return transientLedgerInfoCache.getUnchecked(ledgerId).getLastAddConfirmed(); checking, assume ledger info cache is date</technical_language>

Target:
public long getLastAddConfirmed(long ledgerId) throws IOException { TransientLedgerInfo ledgerInfo = transientLedgerInfoCache.getIfPresent(ledgerId); Long lac = null != ledgerInfo ? ledgerInfo.getLastAddConfirmed() : null; if (null == lac) { ByteBuf bb = getEntry(ledgerId, BookieProtocol.LAST_ADD_CONFIRMED); try { bb.skipBytes(2 * Long.BYTES); lac = bb.readLong(); lac = transientLedgerInfoCache.getUnchecked(ledgerId).setLastAddConfirmed(lac); } finally { bb.release(); } } return lac; }
Source:
<code>KubernetesNamespace doCreateNamespaceAccess(String workspaceId, String name) { <START> return new KubernetesNamespace(clientFactory, executor, name, workspaceId); <END> }</code><technical_language>send KubernetesSharedPool here. wdyt</technical_language>

Target:
KubernetesNamespace doCreateNamespaceAccess(String workspaceId, String name) { return new KubernetesNamespace(clientFactory, sharedPool.getExecutor(), name, workspaceId); }
Source:
<code>private void removeFolderInternal(String id) { synchronized (mConfigLock) { Iterator<Folder> it = mConfig.folders.iterator(); while (it.hasNext()) { Folder f = it.next(); if (f.id.equals(id)) { <START> it.remove(); <END> } } } }</code><technical_language>This is related this change, feel free ignore this, noticed missing a break here</technical_language>

Target:
private void removeFolderInternal(String id) { synchronized (mConfigLock) { Iterator<Folder> it = mConfig.folders.iterator(); while (it.hasNext()) { Folder f = it.next(); if (f.id.equals(id)) { it.remove(); break; } } } }
Source:
<code>public Set<String> variants(String identity) throws IllegalStateException { Config config = configurations.get(identity); if (config == null) { <START> return null; <END> } else { return config.variants(); } }</code><technical_language>A weird return a null Set reference</technical_language>

Target:
public Set<String> variants(String identity) throws IllegalArgumentException { Config config = configurations.get(identity); if (config == null) { throw new IllegalArgumentException("Identity " + identity + " does not exist."); } else { return config.variants(); } }
Source:
<code>public <T extends DataSerializable> void registerBuilder(Class<T> clazz, DataBuilder<T> builder) { Preconditions.checkNotNull(clazz); Preconditions.checkNotNull(builder); <START> if (!this.builders.containsKey(clazz)) { <END> if (!(builder instanceof AbstractDataBuilder)) { SpongeImpl.getLogger().warn("A custom DataBuilder is not extending AbstractDataBuilder! It is recommended that " + "the custom data builder does extend it to gain automated content versioning updates and maintain " + "simplicity. The offending builder's class is: {}", builder.getClass()); } this.builders.put(clazz, builder); } else { SpongeImpl.getLogger().warn("A DataBuilder has already been registered for {}. Attempted to register instead.", clazz, builder.getClass()); } }</code><technical_language>replace contains + put putIfAbsent check return</technical_language>

Target:
public <T extends DataSerializable> void registerBuilder(Class<T> clazz, DataBuilder<T> builder) { Preconditions.checkNotNull(clazz); Preconditions.checkNotNull(builder); DataBuilder<?> previousBuilder = this.builders.putIfAbsent(clazz, builder); if (previousBuilder != null) { SpongeImpl.getLogger().warn("A DataBuilder has already been registered for {}. Attempted to register instead.", clazz, builder.getClass()); } else if (!(builder instanceof AbstractDataBuilder)) { SpongeImpl.getLogger().warn("A custom DataBuilder is not extending AbstractDataBuilder! It is recommended that " + "the custom data builder does extend it to gain automated content versioning updates and maintain " + "simplicity. The offending builder's class is: {}", builder.getClass()); } }
Source:
<code>private void killMuleProcesses() throws IOException { <START> commands = new String[16]; <END> commands[0] = "ps"; commands[1] = "-ax"; commands[2] = "|"; commands[3] = "grep"; commands[4] = "mule"; commands[5] = "|"; commands[6] = "grep"; commands[7] = "wrapper"; commands[8] = "|"; commands[9] = "cut"; commands[10] = "-c"; commands[11] = "1-5"; commands[12] = "|"; commands[13] = "xargs"; commands[14] = "kill"; commands[15] = "-9"; runtime.exec(commands); }</code><technical_language>do List<String> l= new ArrayList(); l.add() l.toArray</technical_language>

Target:
private void killMuleProcesses() throws IOException { commands.clear(); commands.add("ps"); commands.add("-ax"); commands.add("|"); commands.add("grep"); commands.add("mule"); commands.add("|"); commands.add("grep"); commands.add("wrapper"); commands.add("|"); commands.add("cut"); commands.add("-c"); commands.add("1-5"); commands.add("|"); commands.add("xargs"); commands.add("kill"); commands.add("-9"); runtime.exec(commands.toArray(new String[0])); }
Source:
<code>public DefaultDockerClient build() { if (registryAuthCalled && registryAuthCSupplierCalled) { <START> throw new RuntimeException("LOGIC ERROR: DefaultDockerClient does not support being built " <END> + "with both `registryAuth` and `registryAuthSupplier`. " + "Please build with at most one of these options."); } if (dockerAuth) { try { this.registryAuth = RegistryAuth.fromDockerConfig().build(); } catch (IOException e) { log.warn("Unable to use Docker auth info", e); } } return new DefaultDockerClient(this); }</code><technical_language>IllegalStateException a fit</technical_language>

Target:
public DefaultDockerClient build() { if (dockerAuth) { try { this.registryAuth = RegistryAuth.fromDockerConfig().build(); } catch (IOException e) { log.warn("Unable to use Docker auth info", e); } } return new DefaultDockerClient(this); }