auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ArrayList<ArrayList<Integer>> readEvents(String filename) { ArrayList<ArrayList<Integer>> events = new ArrayList<ArrayList<Integer>>(); String str = ""; try{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(TEST_PATH + filename + ".txt"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in)); if (in!=null) { if((str = bufferedReader.readLine()) != null) { String[] temp = str.split("="); int players = Integer.parseInt(temp[1].trim()); for(int i = 0 ; i != players ; i++){ events.add(new ArrayList<Integer>()); } } while ((str = bufferedReader.readLine()) != null) { int player = Integer.parseInt(str.substring(0, 2).trim()); String newString = str.substring(2).trim(); switch(newString){ <START> case "UP": events.get(player-1).add(VK_UP); <END> break; case "DOWN": events.get(player-1).add(VK_DOWN); break; case "LEFT": events.get(player-1).add(VK_LEFT); break; case "RIGHT": events.get(player-1).add(VK_RIGHT); break; default: break; } } } } catch (NumberFormatException | IOException e) { e.printStackTrace(); } return events; }</code><technical_language>"UP" "LEFT" strings bottom of testRunner too. static final strings reuse them</technical_language>

Target:
private ArrayList<ArrayList<Integer>> readEvents(String filename) { ArrayList<ArrayList<Integer>> events = new ArrayList<ArrayList<Integer>>(); String str = ""; try{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(TEST_PATH + filename + ".txt"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in)); if (in!=null) { if((str = bufferedReader.readLine()) != null) { String[] temp = str.split("="); int players = Integer.parseInt(temp[1].trim()); for(int i = 0 ; i != players ; i++){ events.add(new ArrayList<Integer>()); } } while ((str = bufferedReader.readLine()) != null) { int player = Integer.parseInt(str.substring(0, 2).trim()); String newString = str.substring(2).trim(); switch(newString){ case UP: events.get(player-1).add(VK_UP); break; case DOWN: events.get(player-1).add(VK_DOWN); break; case LEFT: events.get(player-1).add(VK_LEFT); break; case RIGHT: events.get(player-1).add(VK_RIGHT); break; default: break; } } } } catch (NumberFormatException | IOException e) { e.printStackTrace(); } return events; }
Source:
<code>public void deleteRange(TableReference tableRef, RangeRequest range) { maybeLog(() -> delegate.deleteRange(tableRef, range), <START> logTimeAndTableRangeOfIterator("deleteRange", tableRef, range)); <END> }</code><technical_language>this change</technical_language>

Target:
public void deleteRange(TableReference tableRef, RangeRequest range) { maybeLog(() -> delegate.deleteRange(tableRef, range), logTimeAndTableRange("deleteRange", tableRef, range)); }
Source:
<code>public static int parseGravity(String attributeValue) { String[] gravities = attributeValue.split("\\|"); int returnGravity = Gravity.NO_GRAVITY; for (String gravity : gravities) { gravity = gravity.trim().toLowerCase(); int gravityValue = Gravity.NO_GRAVITY; if ("center".equals(gravity)) { gravityValue = Gravity.CENTER; } else if ("center_horizontal".equals(gravity)) { gravityValue = Gravity.CENTER_HORIZONTAL; } else if ("center_vertical".equals(gravity)) { gravityValue = Gravity.CENTER_VERTICAL; } else if ("left".equals(gravity)) { gravityValue = Gravity.LEFT; } else if ("right".equals(gravity)) { gravityValue = Gravity.RIGHT; } else if ("top".equals(gravity)) { gravityValue = Gravity.TOP; } else if ("bottom".equals(gravity)) { gravityValue = Gravity.BOTTOM; <START> } <END> returnGravity |= gravityValue; } return returnGravity; }</code><technical_language>put</technical_language>

Target:
public static int parseGravity(String attributeValue) { String[] gravities = attributeValue.split("\\|"); int returnGravity = Gravity.NO_GRAVITY; for (String gravity : gravities) { gravity = gravity.trim().toLowerCase(); int gravityValue = Gravity.NO_GRAVITY; if ("center".equals(gravity)) { gravityValue = Gravity.CENTER; } else if ("center_horizontal".equals(gravity)) { gravityValue = Gravity.CENTER_HORIZONTAL; } else if ("center_vertical".equals(gravity)) { gravityValue = Gravity.CENTER_VERTICAL; } else if ("left".equals(gravity)) { gravityValue = Gravity.LEFT; } else if ("right".equals(gravity)) { gravityValue = Gravity.RIGHT; } else if ("top".equals(gravity)) { gravityValue = Gravity.TOP; } else if ("bottom".equals(gravity)) { gravityValue = Gravity.BOTTOM; }else if ("start".equals(gravity)) { gravityValue = Gravity.START; }else if ("end".equals(gravity)) { gravityValue = Gravity.END; } returnGravity |= gravityValue; } return returnGravity; }
Source:
<code>public void afterTaskStartedEvent(TaskEvent event) { String userId = event.getTaskContext().getUserId(); Task ti = event.getTask(); TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext()); try { persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.STARTED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId )); AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti); if (auditTaskImpl == null) { logger.warn("Unable find audit task entry for task id '{}', skipping audit task update", ti.getId(), ti.getName()); return; } auditTaskImpl.setStatus(ti.getTaskData().getStatus().name()); <START> auditTaskImpl.setActualOwner(getActualOnwer(ti)); <END> updateLastModifiedDate(auditTaskImpl); persistenceContext.merge(auditTaskImpl); } finally { cleanup(persistenceContext); } }</code><technical_language>Typo - "getActualOnwer" - "getActualOwner"</technical_language>

Target:
public void afterTaskStartedEvent(TaskEvent event) { String userId = event.getTaskContext().getUserId(); Task ti = event.getTask(); TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext()); try { persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.STARTED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId )); AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti); if (auditTaskImpl == null) { logger.warn("Unable find audit task entry for task id '{}', skipping audit task update", ti.getId(), ti.getName()); return; } auditTaskImpl.setStatus(ti.getTaskData().getStatus().name()); auditTaskImpl.setActualOwner(getActualOwner(ti)); updateLastModifiedDate(auditTaskImpl); persistenceContext.merge(auditTaskImpl); } finally { cleanup(persistenceContext); } }
Source:
<code>public Amount unmarshal(Amount amount) throws Exception { if (amount == null || amount.getValue() == null) { return amount; } <START> return amount.setValue(round(amount)); <END> }</code><technical_language>is reason modify data model unmarshaling invoice XML. In this case a guarantee read sender transmitted</technical_language>

Target:
public Amount unmarshal(Amount amount) throws Exception { return amount; }
Source:
<code>public Optional<String> getExportFileName() { <START> return exportFileName.map(filename -> filename.endsWith(".csv") ? filename : filename + ".csv"); <END> }</code><technical_language>upper mixed case "csv"</technical_language>

Target:
public Optional<String> getExportFileName() { return exportFileName.map(filename -> filename.toLowerCase().endsWith(".csv") ? filename : filename + ".csv"); }
Source:
<code>public HiveMetastoreClient createMetastoreClient() { List<HostAndPort> metastores = new ArrayList<>(addresses); Collections.shuffle(metastores.subList(1, metastores.size())); TException lastException = null; for (HostAndPort metastore : metastores) { try { HiveMetastoreClient hiveMetastoreClient = clientFactory.create(metastore); <START> if (!com.google.common.base.Strings.isNullOrEmpty(hiveUserName)) { <END> hiveMetastoreClient.setUGI(hiveUserName, new ArrayList<String>()); } return hiveMetastoreClient; } catch (TException e) { lastException = e; } } throw new PrestoException(HIVE_METASTORE_ERROR, format("Failed connecting to Hive metastore: %s use %s ", addresses, hiveUserName), lastException); }</code><technical_language>static import</technical_language>

Target:
public HiveMetastoreClient createMetastoreClient() { List<HostAndPort> metastores = new ArrayList<>(addresses); Collections.shuffle(metastores.subList(1, metastores.size())); TException lastException = null; for (HostAndPort metastore : metastores) { try { HiveMetastoreClient hiveMetastoreClient = clientFactory.create(metastore); if (!isNullOrEmpty(hiveUserName)) { hiveMetastoreClient.setUGI(hiveUserName, new ArrayList<String>()); } return hiveMetastoreClient; } catch (TException e) { lastException = e; } } if (!isNullOrEmpty(hiveUserName)) { throw new PrestoException(HIVE_METASTORE_ERROR, format("Failed connecting to Hive metastore: %s , HiveUserName is %s ", addresses, hiveUserName), lastException); } throw new PrestoException(HIVE_METASTORE_ERROR, "Failed connecting to Hive metastore: " + addresses, lastException); }
Source:
<code>private HttpURLConnection openHttpURLConnection(URI uri, MantaClient client) throws IOException { boolean tlsInsecure = client.getContext().tlsInsecure(); HttpURLConnection connection = (HttpsURLConnection)uri.toURL().openConnection(); if (tlsInsecure && connection instanceof HttpsURLConnection) { HttpsURLConnection sConn = (HttpsURLConnection)connection; TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted(X509Certificate[] certs, String authType) { } @Override public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; <START> HostnameVerifier hostnameVerifier = new HostnameVerifier() { <END> @Override public boolean verify(String hostname, SSLSession session) { return true; } }; try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new SecureRandom()); sConn.setSSLSocketFactory(sc.getSocketFactory()); sConn.setHostnameVerifier(hostnameVerifier); } catch (Exception e) { throw new RuntimeException(e); } } return connection; }</code><technical_language>This code block replaced a lambda HostnameVerifier hostnameVerifier = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }; HostnameVerifier hostnameVerifier = (hostname, session) -> true;</technical_language>

Target:
private HttpURLConnection openHttpURLConnection(URI uri, MantaClient client) throws IOException { boolean tlsInsecure = client.getContext().tlsInsecure(); HttpURLConnection connection = (HttpsURLConnection)uri.toURL().openConnection(); if (tlsInsecure && connection instanceof HttpsURLConnection) { HttpsURLConnection secureConn = (HttpsURLConnection)connection; TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted(X509Certificate[] certs, String authType) { } @Override public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; HostnameVerifier hostnameVerifier = (hostname, session) -> true; try { SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new SecureRandom()); secureConn.setSSLSocketFactory(sslContext.getSocketFactory()); secureConn.setHostnameVerifier(hostnameVerifier); } catch (Exception e) { throw new RuntimeException(e); } } return connection; }
Source:
<code><START> public String getCustomAuthorizerName() { <END> return customAuthorizerName; }</code><technical_language>Sorry, dumb question maybe, is this visibility difference intentional</technical_language>

Target:
String getCustomAuthorizerName() { return customAuthorizerName; }
Source:
<code>public String getSamlKeystoreUrl() { if (keystore == null) { String ks = overlordConfig.getString(SAML_KEYSTORE); if (ks == null) { throw new RuntimeException("Overlord configuration missing: " + SAML_KEYSTORE); } if (!ks.startsWith("profile:")) { try { File ksFile = new File(ks); if (ksFile.isFile()) { ks = ksFile.toURI().toURL().toString(); } else { throw new FileNotFoundException(ks); } } catch (Exception e) { throw new RuntimeException(e); } keystore = ks; } else { keystore = ks.substring("profile:".length()); StringBuilder builder = new StringBuilder(); String userHome = builder.append(System.getProperty("user.home")).append(File.separator).append("jbid-keystore").toString(); File f = new File(userHome); if (!f.exists()) { f.mkdir(); } builder = new StringBuilder(); String tempFile = builder.append(userHome).append(File.separator).append(keystore).toString(); File temp = new File(tempFile); if (!temp.exists()) { try { temp.createNewFile(); } catch (IOException e) { e.printStackTrace(); <START> return ""; <END> } } OutputStream os = null; try { os = new FileOutputStream(temp); byte[] keystoreContent = null; if (fabricService != null && fabricService.getCurrentContainer() != null && fabricService.getCurrentContainer().getOverlayProfile() != null) { Profile profile = fabricService.getCurrentContainer().getOverlayProfile(); keystoreContent = profile.getFileConfiguration(keystore); } if (keystoreContent != null) { os.write(keystoreContent); } } catch (Exception e) { e.printStackTrace(); return ""; } finally { if (os != null) { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } } } return keystore; }</code><technical_language>Please remove lines of code replace a re-throw of ioexception wrapped in a runtime exception</technical_language>

Target:
public String getSamlKeystoreUrl() { if (keystore == null) { String ks = overlordConfig.getString(SAML_KEYSTORE); if (ks == null) { throw new RuntimeException("Overlord configuration missing: " + SAML_KEYSTORE); } if (!ks.startsWith("profile:")) { try { File ksFile = new File(ks); if (ksFile.isFile()) { ks = ksFile.toURI().toURL().toString(); } else { throw new FileNotFoundException(ks); } } catch (Exception e) { throw new RuntimeException(e); } keystore = ks; } else { keystore = ks.substring("profile:".length()); StringBuilder builder = new StringBuilder(); File temp = null; try { temp = File.createTempFile(keystore, null); temp.deleteOnExit(); } catch (IOException e1) { throw new RuntimeException(e1); } OutputStream os = null; try { os = new FileOutputStream(temp); byte[] keystoreContent = null; if (fabricService != null && fabricService.getCurrentContainer() != null && fabricService.getCurrentContainer().getOverlayProfile() != null) { Profile profile = fabricService.getCurrentContainer().getOverlayProfile(); keystoreContent = profile.getFileConfiguration(keystore); } if (keystoreContent != null) { os.write(keystoreContent); } keystore = temp.toURI().toURL().toString(); } catch (Exception e) { throw new RuntimeException(e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } } return keystore; }
Source:
<code>private void executeNextOperation() { switch (getParameters().getVmBackup().getPhase()) { case STARTING: lockDisks(); VmBackup vmBackup = getParameters().getVmBackup(); vmBackup.setToCheckpointId(getParameters().getToCheckpointId()); Map<String, Object> disks = <START> startVmBackup(vmBackup); <END> if (disks != null) { TransactionSupport.executeInNewTransaction(() -> { vmBackupDao.update(vmBackup); return null; }); storeBackupsUrls(disks); } else { setCommandStatus(CommandStatus.FAILED); } break; case READY: log.info("Ready to start image transfers using backup URLs"); break; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } }</code><technical_language>redundant. I method signature work adding parameter. getParameters().getVmBackup(); vmBackup variable is changing getParameters().getVmBackup();</technical_language>

Target:
private void executeNextOperation() { switch (getParameters().getVmBackup().getPhase()) { case STARTING: lockDisks(); VmBackup vmBackup = getParameters().getVmBackup(); vmBackup.setToCheckpointId(getParameters().getToCheckpointId()); Map<String, Object> disks = startVmBackup(); if (disks != null) { TransactionSupport.executeInNewTransaction(() -> { vmBackupDao.update(vmBackup); return null; }); storeBackupsUrls(disks); } else { setCommandStatus(CommandStatus.FAILED); } break; case READY: log.info("Ready to start image transfers using backup URLs"); break; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } }
Source:
<code>public void updateWifiSsid() { mWifiSsid = null; WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); <START> if (wifiManager != null) { <END> WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo != null) { mWifiSsid = wifiInfo.getSSID(); } } }</code><technical_language>null check</technical_language>

Target:
public void updateWifiSsid() { mWifiSsid = null; WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo != null) { mWifiSsid = wifiInfo.getSSID(); } }
Source:
<code>protected RestResponse handleRequest(RestRequest req) throws Exception { ReportTaskRequest stReq = (ReportTaskRequest) req; String action = stReq.getAction(); Long id = stReq.getId(); log.info("action: " + action + " id: " + id); <START> if (action == null) { <END> return null; } switch (action) { case ReportTaskRequest.START_ACTION: Report r = rDao.getByKey(id); if (r != null) { if (!r.getState().equals(Report.QUEUED)) { log.warning("Cannot start report that is " + r.getState()); return null; } log.info(" ====Starting========"); try { final int sts = engage(r); log.info(" got " + sts); if (sts == 200) { return null; } else if ((sts % 100) == 4) { r.setState(Report.FINISHED_ERROR); r.setMessage("Unexpected result when starting report: " + sts); rDao.save(r); } else { requeueStart(r); } } catch (MalformedURLException e) { Log.error("Bad URL"); } catch (IOException e) { log.warning("====IOerror: " + e); requeueStart(r); } } break; case ReportTaskRequest.PROGRESS_ACTION: Report r2 = rDao.getByKey(id); if (r2 != null) { if (!r2.getState().equals(Report.QUEUED) && !r2.getState().equals(Report.IN_PROGRESS)) { log.warning("Cannot set progress on report that is " + r2.getState()); return null; } r2.setState(stReq.getState()); r2.setMessage(stReq.getMessage()); rDao.save(r2); } break; default: log.warning("Unknown action."); break; } return null; }</code><technical_language>this happen is a check for a missing action parameter initialising ReportTaskRequest object</technical_language>

Target:
protected RestResponse handleRequest(RestRequest req) throws Exception { ReportTaskRequest stReq = (ReportTaskRequest) req; String action = stReq.getAction(); Long id = stReq.getId(); log.log(Level.FINE, "action: " + action + " id: " + id); Report r = rDao.getByKey(id); switch (action) { case ReportTaskRequest.START_ACTION: if (r != null) { if (!r.getState().equals(Report.QUEUED)) { log.warning("Cannot start report " + id + " that is " + r.getState()); return null; } log.log(Level.FINE, " ====Starting========"); try { final int sts = startReportEngine(r); log.log(Level.FINE, " got " + sts); if (sts == 200) { return null; } else if ((sts % 100) == 4) { r.setState(Report.FINISHED_ERROR); r.setMessage("Unexpected result when starting report \" + id + \" : " + sts); rDao.save(r); } else { requeueStart(r); } } catch (MalformedURLException e) { log.log(Level.SEVERE, "Bad URL"); } catch (IOException e) { log.warning("====IOerror: " + e); requeueStart(r); } } break; case ReportTaskRequest.PROGRESS_ACTION: if (r != null) { if (!r.getState().equals(Report.QUEUED) && !r.getState().equals(Report.IN_PROGRESS)) { log.warning("Cannot set progress on report " + id + " that is " + r.getState()); return null; } r.setState(stReq.getState()); r.setMessage(stReq.getMessage()); rDao.save(r); } break; default: log.warning("Unknown action."); break; } return null; }
Source:
<code>private void open() throws IOException { RepositoryStreamContext ctx = getContext(); if (ctx.isOpened()) { return; } <START> RepositoryPath path = (RepositoryPath) ctx.getPath(); <END> logger.info(String.format("Locking [%s]", path)); ReadWriteLock lockSource = repositoryPathLock.lock(path); Lock lock; if (ctx instanceof RepositoryStreamWriteContext) { lock = lockSource.writeLock(); } else { lock = lockSource.readLock(); } ctx.setLock(lock); lock.lock(); logger.info(String.format("Locked [%s]", path)); doOpen(ctx); }</code><technical_language>Consider moving this logic (lines 61-79) .RepositoryStreamSupport#doOpen "before" logic in place ctx instanceof check twice</technical_language>

Target:
private void open() throws IOException { RepositoryStreamContext ctx = getContext(); if (ctx.isOpened()) { return; } RepositoryPath path = (RepositoryPath) ctx.getPath(); logger.debug(String.format("Locking [%s]", path)); ReadWriteLock lockSource = repositoryPathLock.lock(path); Lock lock; if (ctx instanceof RepositoryStreamWriteContext) { lock = lockSource.writeLock(); } else { lock = lockSource.readLock(); } ctx.setLock(lock); lock.lock(); logger.debug(String.format("Locked [%s]", path)); doOpen(ctx); }
Source:
<code>public SWTGridDescription getGridDescription(SWTGridDescription gridDescription) { if (rendererGridDescription == null) { if (getTableStyleProperty().getRenderMode() == RenderMode.COMPACT_VERTICALLY) { final boolean includeLabel = getVElement().getLabelAlignment() <START> != LabelAlignment.NONE; <END> rendererGridDescription = GridDescriptionFactory.INSTANCE.createCompactGrid(includeLabel, true, this); } else { rendererGridDescription = GridDescriptionFactory.INSTANCE.createSimpleGrid(1, 1, this); } } return rendererGridDescription; }</code><technical_language>Default, Left, Top options. I label created alignment is Default Left created is None. Top? I log a warning/info this configuration is supported compact mode</technical_language>

Target:
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription) { if (rendererGridDescription == null) { if (getTableStyleProperty().getRenderMode() == RenderMode.COMPACT_VERTICALLY) { final boolean includeLabel = getVElement().getLabelAlignment() != LabelAlignment.NONE; if (getVElement().getLabelAlignment() == LabelAlignment.TOP) { Activator.getInstance().log(IStatus.WARNING, MessageFormat.format( Messages.TableControlSWTRenderer_LabelAlignmentTopNotSupportForRenderModeCompactVertically, getVElement().getName())); } rendererGridDescription = GridDescriptionFactory.INSTANCE.createCompactGrid(includeLabel, true, this); } else { rendererGridDescription = GridDescriptionFactory.INSTANCE.createSimpleGrid(1, 1, this); } } return rendererGridDescription; }
Source:
<code>public String getQualifiedClusterName() { <START> return clusterName + dc; <END> }</code><technical_language>some kind of separator nice here</technical_language>

Target:
public String getQualifiedClusterName() { return clusterName + "-" + datacenter; }
Source:
<code>public Oscore(int instanceId, String masterSecret, String senderId, String recipientId, int aeadAlgorithm, int hkdfAlgorithm, String masterSalt) { <START> this.setId(instanceId); <END> this.masterSecret = masterSecret; this.senderId = senderId; this.recipientId = recipientId; this.aeadAlgorithm = aeadAlgorithm; this.hkdfAlgorithm = hkdfAlgorithm; this.masterSalt = masterSalt; this.idContext = ""; }</code><technical_language>a big deal super(id)</technical_language>

Target:
public Oscore(int instanceId, String masterSecret, String senderId, String recipientId, int aeadAlgorithm, int hkdfAlgorithm, String masterSalt) { super(instanceId); this.masterSecret = masterSecret; this.senderId = senderId; this.recipientId = recipientId; this.aeadAlgorithm = aeadAlgorithm; this.hkdfAlgorithm = hkdfAlgorithm; this.masterSalt = masterSalt; this.idContext = ""; }
Source:
<code>public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { Integer cpu = KernelEventHandlerUtils.getCpu(event); if (cpu == null) { return; } Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue(); int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss); int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString()); long timestamp = KernelEventHandlerUtils.getTimestamp(event); if (isSoftIrqRaised(ss.queryOngoingState(quark))) { ss.modifyAttribute(timestamp, StateValues.SOFT_IRQ_RAISED_VALUE, quark); } else { ss.modifyAttribute(timestamp, TmfStateValue.nullValue(), quark); } List<Integer> softIrqs = ss.getSubAttributes(ss.getParentAttributeQuark(quark), false); KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss); for (Integer softIrq : softIrqs) { if (!ss.queryOngoingState(softIrq).isNull()) { return; } } <START> KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss); <END> }</code><technical_language>Similarly, I want process running if a raised SoftIRQ left? careful, setProcessToRunning consider IRQ SoftIRQ state</technical_language>

Target:
public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { Integer cpu = KernelEventHandlerUtils.getCpu(event); if (cpu == null) { return; } Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue(); int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss); int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString()); long timestamp = KernelEventHandlerUtils.getTimestamp(event); if (isSoftIrqRaised(ss.queryOngoingState(quark))) { ss.modifyAttribute(timestamp, StateValues.SOFT_IRQ_RAISED_VALUE, quark); } else { ss.modifyAttribute(timestamp, TmfStateValue.nullValue(), quark); } KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss); List<Integer> softIrqs = ss.getSubAttributes(ss.getParentAttributeQuark(quark), false); for (Integer softIrq : softIrqs) { final @NonNull ITmfStateValue ongoingState = ss.queryOngoingState(softIrq); if (ongoingState.equals(StateValues.CPU_STATUS_SOFTIRQ_VALUE)) { return; } } KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss); }
Source:
<code><START> protected ConsoleQueryBlockedException(ActionRequest actionRequest) { <END> super(ErrorCode.CONSOLE_QUERY_BLOCKED, "Console Query blocked due to high load. Kindly run after sometime"); this.actionRequest = actionRequest; }</code><technical_language>public</technical_language>

Target:
public ConsoleQueryBlockedException(ActionRequest actionRequest) { super(ErrorCode.CONSOLE_QUERY_BLOCKED, "Console Query blocked due to high load. Kindly run after sometime"); this.actionRequest = actionRequest; }
Source:
<code><START> public IdToken(String tokenValue, JsonWebSignature jsonWebSignature) { <END> super(tokenValue, new Date(jsonWebSignature.getPayload().getExpirationTimeSeconds() * 1000)); this.jsonWebSignature = jsonWebSignature; }</code><technical_language>Consider making this private tokenValue jsonWebSignature content. unexpected behavior, possible, for a user set incompatible values</technical_language>

Target:
private IdToken(String tokenValue, JsonWebSignature jsonWebSignature) { super(tokenValue, new Date(jsonWebSignature.getPayload().getExpirationTimeSeconds() * 1000)); this.jsonWebSignature = jsonWebSignature; }
Source:
<code>public void testResolution() { builder = RandomDistributedScalarEncoder.builder() .name("enc") .resolution(1); rdse = builder.build(); int[] e23 = rdse.encode(23.0); int[] e23_1 = rdse.encode(23.1); int[] e22_9 = rdse.encode(22.9); int[] e24 = rdse.encode(24.0); assertEquals(rdse.getW(), getOnBits(e23)); assertArrayEquals("Numbers within resolution don't have the same encoding", e23_1, e23); assertArrayEquals("Numbers within resolution don't have the same encoding", e22_9, e23); <START> assertFalse("Numbers outside resolution have the same encoding", Arrays.equals(e23, e24)); <END> int[] e22_5 = rdse.encode(22.5); assertFalse("Numbers outside resolution have the same encoding", Arrays.equals(e23, e22_5)); }</code><technical_language>assertThat(e23, equalTo(e24));, feedback arrays different</technical_language>

Target:
public void testResolution() { builder = RandomDistributedScalarEncoder.builder() .name("enc") .resolution(1); rdse = builder.build(); int[] e23 = rdse.encode(23.0); int[] e23_1 = rdse.encode(23.1); int[] e22_9 = rdse.encode(22.9); int[] e24 = rdse.encode(24.0); assertEquals(rdse.getW(), getOnBits(e23)); assertThat("Numbers within resolution don't have the same encoding", e23_1, is(equalTo(e23))); assertThat("Numbers within resolution don't have the same encoding", e22_9, is(equalTo(e23))); assertThat("Numbers outside resolution have the same encoding", e23, is(not(equalTo(e24)))); int[] e22_5 = rdse.encode(22.5); assertThat("Numbers outside resolution have the same encoding", e23, is(not(equalTo(e22_5)))); }
Source:
<code>private void readNext() throws IOException { Preconditions.checkArgument(in.available() > 0, "Reading past RLE/BitPacking stream."); final int header = BytesUtils.readUnsignedVarInt(in); mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED; switch (mode) { case RLE: currentCount = header >>> 1; if (DEBUG) LOG.debug("reading " + currentCount + " values RLE"); currentValue = BytesUtils.readIntLittleEndianPaddedOnBitWidth(in, bitWidth); break; case PACKED: int numGroups = header >>> 1; currentCount = numGroups * 8; if (DEBUG) LOG.debug("reading " + currentCount + " values BIT PACKED"); currentBuffer = new int[currentCount]; byte[] bytes = new byte[numGroups * bitWidth]; int bytesToRead = (int)Math.ceil(currentCount * bitWidth / 8.0); bytesToRead = Math.min(bytesToRead, in.available()); new DataInputStream(in).readFully(bytes, 0, bytesToRead); for (int valueIndex = 0, byteIndex = 0; valueIndex < currentCount; valueIndex += 8, byteIndex += bitWidth) { <START> packer.unpack8Values(ByteBuffer.wrap(bytes), byteIndex, currentBuffer, valueIndex); <END> } break; default: throw new ParquetDecodingException("not a valid mode " + mode); } }</code><technical_language>in is wrapping a ByteBuffer pass buffer unpack8Values instead of reading a byte array wrap a ByteBuffer</technical_language>

Target:
private void readNext() throws IOException { Preconditions.checkArgument(in.available() > 0, "Reading past RLE/BitPacking stream."); final int header = BytesUtils.readUnsignedVarInt(in); mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED; switch (mode) { case RLE: currentCount = header >>> 1; if (DEBUG) LOG.debug("reading " + currentCount + " values RLE"); currentValue = BytesUtils.readIntLittleEndianPaddedOnBitWidth(in, bitWidth); break; case PACKED: int numGroups = header >>> 1; currentCount = numGroups * 8; if (DEBUG) LOG.debug("reading " + currentCount + " values BIT PACKED"); currentBuffer = new int[currentCount]; ByteBuffer buf = in.toByteBuffer(); int bytesToRead = (int)Math.ceil(currentCount * bitWidth / 8.0); bytesToRead = Math.min(bytesToRead, buf.remaining()); for (int valueIndex = 0, byteIndex = 0; valueIndex < currentCount; valueIndex += 8, byteIndex += bitWidth) { if (byteIndex + bitWidth <= buf.remaining()) { packer.unpack8Values(buf, byteIndex, currentBuffer, valueIndex); } else { byte[] bytes = new byte[bitWidth]; buf.get(bytes, byteIndex, buf.remaining() - byteIndex); packer.unpack8Values(ByteBuffer.wrap(bytes), 0, currentBuffer, valueIndex); } } in.skip(bytesToRead); break; default: throw new ParquetDecodingException("not a valid mode " + mode); } }
Source:
<code>public Map<String, DbParameterAccessor> getAllProcedureParameters( String procName) throws SQLException { String[] qualifiers = NameNormaliser.normaliseName(procName).split( "\\."); String qry = " select type,param_list,returns from mysql.proc where "; if (qualifiers.length == 2) { qry += " lower(db)=? and lower(name)=? "; } else { qry += " (db=database() and lower(name)=?)"; } String type; String paramList; String returns; try (PreparedStatement dc = currentConnection.prepareStatement(qry)) { for (int i = 0; i < qualifiers.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(qualifiers[i])); } ResultSet rs = dc.executeQuery(); if (!rs.next()) { throw new SQLException("Unknown procedure " + procName); } type = rs.getString(1); paramList = rs.getString(2); returns = rs.getString(3); rs.close(); } MySqlProcedureParametersParser parser = new MySqlProcedureParametersParser(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; for (ParamDescriptor pd: parser.parseParameters(paramList)) { DbParameterAccessor dbp = createDbParameterAccessor( pd.name, pd.direction, getSqlType(pd.type), getJavaClass(pd.type), position++); allParams.put(NameNormaliser.normaliseName(pd.name), dbp); } if ("FUNCTION".equals(type)) { ParamDescriptor rd = parser.parseReturnType(returns); <START> allParams.put("", new DbParameterAccessor("", <END> Direction.RETURN_VALUE, getSqlType(rd.type), getJavaClass(rd.type), -1, dbfitToJdbcTransformerFactory)); } return allParams; }</code><technical_language>accessing c-tor new DbParameterAccessor instead of createDbParameterAccessor. Is intentional</technical_language>

Target:
public Map<String, DbParameterAccessor> getAllProcedureParameters( String procName) throws SQLException { String[] qualifiers = NameNormaliser.normaliseName(procName).split( "\\."); String qry = " select type,param_list,returns from mysql.proc where "; if (qualifiers.length == 2) { qry += " lower(db)=? and lower(name)=? "; } else { qry += " (db=database() and lower(name)=?)"; } String type; String paramList; String returns; try (PreparedStatement dc = currentConnection.prepareStatement(qry)) { for (int i = 0; i < qualifiers.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(qualifiers[i])); } ResultSet rs = dc.executeQuery(); if (!rs.next()) { throw new SQLException("Unknown procedure " + procName); } type = rs.getString(1); paramList = rs.getString(2); returns = rs.getString(3); rs.close(); } MySqlProcedureParametersParser parser = new MySqlProcedureParametersParser(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; for (ParamDescriptor pd: parser.parseParameters(paramList)) { DbParameterAccessor dbp = createDbParameterAccessor( pd.name, pd.direction, getSqlType(pd.type), getJavaClass(pd.type), position++); allParams.put(NameNormaliser.normaliseName(pd.name), dbp); } if ("FUNCTION".equals(type)) { ParamDescriptor rd = parser.parseReturnType(returns); allParams.put("", createDbParameterAccessor( "", Direction.RETURN_VALUE, getSqlType(rd.type), getJavaClass(rd.type), -1)); } return allParams; }
Source:
<code>public Observable<ProgressStatus> getNetworkRequestStatusText() { <START> return networkRequestStatusText; <END> }</code><technical_language>hide()</technical_language>

Target:
public Observable<ProgressStatus> getNetworkRequestStatusText() { return networkRequestStatusText.hide(); }
Source:
<code>public void init() { this.taskSideInputStorageManager.init(); <START> Map<SystemStreamPartition, String> fileOffsets = taskSideInputStorageManager.getFileOffsets(); this.lastProcessedOffsets.putAll(fileOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); } <END></code><technical_language>info logs for in original code. reason remove them</technical_language>

Target:
public void init() { this.taskSideInputStorageManager.init(); Map<SystemStreamPartition, String> fileOffsets = this.taskSideInputStorageManager.getFileOffsets(); LOG.info("File offsets for the task {}: {}", taskName, fileOffsets); this.lastProcessedOffsets.putAll(fileOffsets); LOG.info("Last processed offsets for the task {}: {}", taskName, lastProcessedOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); LOG.info("Starting offsets for the task {}: {}", taskName, startingOffsets); }
Source:
<code>public static <C extends Credentials> List<C> trackAll(@NonNull Run build, @NonNull List<C> credentials) { if (CredentialsProviderManager.isFingerprintEnabledOrDefault()) { for (Credentials c : credentials) { if (c != null) { try { getOrCreateFingerprintOf(c).addFor(build); } catch (IOException e) { LOGGER.log(Level.FINEST, "Could not track usage of " + c, e); } } } } else { <START> LOGGER.log(Level.FINEST, "TrackAll(Run) called but fingerprints disabled in the global configuration."); <END> } return credentials; }</code><technical_language>a odd parameter type is mentioned other isn't</technical_language>

Target:
public static <C extends Credentials> List<C> trackAll(@NonNull Run build, @NonNull List<C> credentials) { if (CredentialsProvider.FINGERPRINT_ENABLED) { for (Credentials c : credentials) { if (c != null) { try { getOrCreateFingerprintOf(c).addFor(build); } catch (IOException e) { LOGGER.log(Level.FINEST, "Could not track usage of " + c, e); } } } } else { LOGGER.log(Level.FINEST, "TrackAll method (Run variant) called but fingerprints disabled by {0}", FINGERPRINT_ENABLED_NAME); } return credentials; }
Source:
<code>private Object toPrintableResult(JsonNode result) { Class<Map<String, String>> clazz = (Class) Map.class; Map<String, String> resultMap = null; try { resultMap = MAPPER.convertValue(result, <START> clazz); <END> } catch(IllegalArgumentException e) { return result; } if (resultMap.containsKey("password")) { resultMap.put("password", "*****"); } return resultMap; }</code><technical_language>try detect type checking node isArray providing proper class type here</technical_language>

Target:
private Object toPrintableResult(JsonNode result) { if (result.isArray()) { return result; } Class<Map<String, String>> clazz = (Class) Map.class; Map<String, String> resultMap = MAPPER.convertValue(result, clazz); if (resultMap.containsKey("password")) { resultMap.put("password", "*****"); } return resultMap; }
Source:
<code>public String toString() { <START> return "CommandSpec{" <END> + "args=" + this.args + ", executor=" + this.executor + ", description=" + this.description + ", extendedDescription=" + this.extendedDescription + ", permission='" + this.permission + '\'' + ", argumentParser=" + this.argumentParser + '}'; }</code><technical_language>for toString(): <LINK_0></technical_language>

Target:
public String toString() { return Objects.toStringHelper(this) .add("args", this.args) .add("executor", this.executor) .add("description", this.description) .add("extendedDescription", this.extendedDescription) .add("permission", this.permission) .add("argumentParser", this.argumentParser) .toString(); }
Source:
<code><START> public AbstractBlockFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) { <END> }</code><technical_language>constructors set protected properties base class. called super below</technical_language>

Target:
protected AbstractBlockFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) { }
Source:
<code>protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); Direction facing = world.getBlockState(source.getBlockPos()).get(DispenserBlock.FACING); BlockPos pos = source.getBlockPos().offset(facing); if (ItemObedienceStick.applyStick(world, pos)) { return stack; } <START> return super.dispenseStack(source, stack); <END> }</code><technical_language>this launches stick out of dispenser if fails? pretty vanilla behaviour is do if target is eligible (like buckets) OptionalDispenseBehaviour called. a setSuccess method</technical_language>

Target:
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); Direction facing = world.getBlockState(source.getBlockPos()).get(DispenserBlock.FACING); BlockPos pos = source.getBlockPos().offset(facing); setSuccessful(ItemObedienceStick.applyStick(world, pos)); return stack; }
Source:
<code>public void convertLocalizedStringSet() { <START> assertThat(converting(ATTR_NAME_LOC_TEXT_SET)).isEqualTo(""); <END> }</code><technical_language>empty</technical_language>

Target:
public void convertLocalizedStringSet() { assertThat(converting(ATTR_NAME_LOC_TEXT_SET)).isEqualTo("localized bar, localized foo"); }
Source:
<code>private void setVmStyleByStatus(boolean mouseOver) { if (isSelected()) { getView().setItemSelectedStyle(); } else { getView().setVmStatusUnselectedStyle(); if (mouseOver) { getView().setItemMouseOverStyle(); } else { if (model.isVmUp() && !consoleInUse()) { getView().setItemRunningStyle(); } else { getView().setItemNotRunningOrConsoleTakenStyle(); } } } if <START> (!model.isPool() && model.getVmConsoles().canConnectToConsole()) { <END> getView().showDoubleClickBanner(); } else { getView().hideDoubleClickBanner(); } }</code><technical_language>miss "&& mouseOver"</technical_language>

Target:
private void setVmStyleByStatus(boolean mouseOver) { if (isSelected()) { getView().setItemSelectedStyle(); } else { getView().setVmStatusUnselectedStyle(); if (mouseOver) { getView().setItemMouseOverStyle(); } else { if (model.isVmUp() && !consoleInUse()) { getView().setItemRunningStyle(); } else { getView().setItemNotRunningOrConsoleTakenStyle(); } } } if (mouseOver && !model.isPool() && model.getVmConsoles().canConnectToConsole()) { getView().showDoubleClickBanner(); } else { getView().hideDoubleClickBanner(); } }
Source:
<code>public List<ITimeGraphRowModel> getRowModel(ITmfStateSystem ss, SelectionTimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { TreeMultimap<Integer, ITmfStateInterval> intervals = TreeMultimap.create(Comparator.naturalOrder(), Comparator.comparing(ITmfStateInterval::getStartTime)); Map<@NonNull Long, @NonNull Integer> entries = getSelectedEntries(filter); Collection<Long> times = getTimes(filter, ss.getStartTime(), ss.getCurrentEndTime()); for (ITmfStateInterval interval : ss.query2D(entries.values(), times)) { if (monitor != null && monitor.isCanceled()) { return null; } intervals.put(interval.getAttribute(), interval); } List<ITimeGraphRowModel> rows = new ArrayList<>(); <START> synchronized (fExecNamesCache) { fExecNamesCache.clear(); <END> } for (Map.Entry<Long, Integer> entry : entries.entrySet()) { if (monitor != null && monitor.isCanceled()) { return null; } List<ITimeGraphState> eventList = new ArrayList<>(); for (ITmfStateInterval interval : intervals.get(entry.getValue())) { eventList.add(createTimeGraphState(interval, ss)); } rows.add(new TimeGraphRowModel(entry.getKey(), eventList)); } if (!ss.waitUntilBuilt(0)) { fTimeEventNames.invalidateAll(); } return rows; }</code><technical_language>is ss is complete</technical_language>

Target:
public List<ITimeGraphRowModel> getRowModel(ITmfStateSystem ss, SelectionTimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { TreeMultimap<Integer, ITmfStateInterval> intervals = TreeMultimap.create(Comparator.naturalOrder(), Comparator.comparing(ITmfStateInterval::getStartTime)); Map<@NonNull Long, @NonNull Integer> entries = getSelectedEntries(filter); Collection<Long> times = getTimes(filter, ss.getStartTime(), ss.getCurrentEndTime()); for (ITmfStateInterval interval : ss.query2D(entries.values(), times)) { if (monitor != null && monitor.isCanceled()) { return null; } intervals.put(interval.getAttribute(), interval); } List<ITimeGraphRowModel> rows = new ArrayList<>(); for (Map.Entry<Long, Integer> entry : entries.entrySet()) { if (monitor != null && monitor.isCanceled()) { return null; } List<ITimeGraphState> eventList = new ArrayList<>(); for (ITmfStateInterval interval : intervals.get(entry.getValue())) { eventList.add(createTimeGraphState(interval, ss)); } rows.add(new TimeGraphRowModel(entry.getKey(), eventList)); } if (!ss.waitUntilBuilt(0)) { fTimeEventNames.invalidateAll(); fExecNamesCache.clear(); } return rows; }
Source:
<code>public NodeAndInitialCredentials<Device> createNodeWithGroupEncodedIntoName(String group, String name, Template template) { PacketTemplateOptions templateOptions = template.getOptions().as(PacketTemplateOptions.class); <START> checkNotNull(templateOptions.getLoginPrivateKey(), "login privateKey must not be null"); <END> Map<String, String> features = templateOptions.getFeatures(); BillingCycle billingCycle = BillingCycle.fromValue(templateOptions.getBillingCycle()); boolean locked = templateOptions.isLocked(); String userdata = templateOptions.getUserData(); Set<String> tags = templateOptions.getTags(); String plan = template.getHardware().getId(); String facility = template.getLocation().getId(); String operatingSystem = template.getImage().getId(); Device device = api.deviceApi(projectId).create( Device.CreateDevice.builder() .hostname(name) .plan(plan) .billingCycle(billingCycle.value()) .facility(facility) .features(features) .operatingSystem(operatingSystem) .locked(locked) .userdata(userdata) .tags(tags) .build() ); nodeRunningPredicate.apply(device.id()); device = api.deviceApi(projectId).get(device.id()); LoginCredentials defaultCredentials = LoginCredentials.builder() .user("root") .privateKey(templateOptions.getLoginPrivateKey()) .build(); return new NodeAndInitialCredentials<Device>(device, device.id(), defaultCredentials); }</code><technical_language>packet a password based login</technical_language>

Target:
public NodeAndInitialCredentials<Device> createNodeWithGroupEncodedIntoName(String group, String name, Template template) { PacketTemplateOptions templateOptions = template.getOptions().as(PacketTemplateOptions.class); Map<String, String> features = templateOptions.getFeatures(); BillingCycle billingCycle = BillingCycle.fromValue(templateOptions.getBillingCycle()); boolean locked = templateOptions.isLocked(); String userdata = templateOptions.getUserData(); Set<String> tags = templateOptions.getTags(); String plan = template.getHardware().getId(); String facility = template.getLocation().getId(); String operatingSystem = template.getImage().getId(); Device device = api.deviceApi(projectId).create( Device.CreateDevice.builder() .hostname(name) .plan(plan) .billingCycle(billingCycle.value()) .facility(facility) .features(features) .operatingSystem(operatingSystem) .locked(locked) .userdata(userdata) .tags(tags) .build() ); return new NodeAndInitialCredentials<Device>(device, device.id(), null); }
Source:
<code>public static String generateStructMemberParserLine(final StructMember structMember, final String parserFunction) throws ParseException { <START> final StringBuilder outputBuilder = new StringBuilder(); <END> outputBuilder.append(indent(3)). append("response->"). append(Helper.camelToUnderscore(structMember.getName())). append(" = "). append(parserFunction).append("\n"); return outputBuilder.toString(); }</code><technical_language>Intellij display a message this plain string concatenation a string builder</technical_language>

Target:
public static String generateStructMemberParserLine(final StructMember structMember, final String parserFunction) throws ParseException { return indent(3) + "response->" + Helper.camelToUnderscore(structMember.getName()) + " = " + parserFunction + "\n"; }