auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateRealTimeFootprint(FootPrint footprint) { List<LatLong> pathPoints = footprint == null ? Collections.<LatLong>emptyList() : footprint.getVertexInGlobalFrame(); if (pathPoints.isEmpty()) { if (mFootprintPoly != null) { mFootprintPoly.remove(); mFootprintPoly = null; } } else { if (mFootprintPoly == null) { PolygonOptions pathOptions = new PolygonOptions() .stroke(new Stroke(FOOTPRINT_DEFAULT_WIDTH, FOOTPRINT_DEFAULT_COLOR)) .fillColor(FOOTPRINT_FILL_COLOR); List<LatLng> list = new ArrayList<LatLng>(); for (LatLong vertex : pathPoints) { list.add(CoordToLatLang(vertex)); } pathOptions.points(list); mFootprintPoly = (Polygon)getBaiduMap().addOverlay(pathOptions); } else { List<LatLng> list = new ArrayList<LatLng>(); for (LatLong vertex : pathPoints) { list.add(CoordToLatLang(vertex)); } mFootprintPoly.setPoints(list); } } }

Target:
public void updateRealTimeFootprint(FootPrint footprint) { List<LatLong> pathPoints = footprint == null ? Collections.<LatLong>emptyList() : footprint.getVertexInGlobalFrame(); if (pathPoints.isEmpty()) { if (mFootprintPoly != null) { mFootprintPoly.remove(); mFootprintPoly = null; } } else { if (mFootprintPoly == null) { PolygonOptions pathOptions = new PolygonOptions() .stroke(mFootprintStroke) .fillColor(FOOTPRINT_FILL_COLOR); List<LatLng> list = new ArrayList<LatLng>(); for (LatLong vertex : pathPoints) { list.add(CoordToLatLng(vertex)); } pathOptions.points(list); mFootprintPoly = (Polygon)getBaiduMap().addOverlay(pathOptions); } else { List<LatLng> list = new ArrayList<LatLng>(); for (LatLong vertex : pathPoints) { list.add(CoordToLatLng(vertex)); } mFootprintPoly.setPoints(list); } } }
Source:
public void testRules() throws Exception { File customAttributeFile = File.createTempFile("tmp_", "customAttributeFile", null); customAttributeFile.deleteOnExit(); JGitTestUtil.write(customAttributeFile, "*.txt custom=value"); db.getConfig().setString("core", null, "attributesfile", customAttributeFile.getAbsolutePath()); writeAttributesFile(".git/info/attributes", "windows* eol=crlf"); writeAttributesFile(".gitattributes", "*.txt eol=lf"); writeTrashFile("windows.file", ""); writeTrashFile("windows.txt", ""); writeTrashFile("global.txt", ""); writeTrashFile("readme.txt", ""); writeAttributesFile("src/config/.gitattributes", "*.txt -delta"); writeTrashFile("src/config/readme.txt", ""); writeTrashFile("src/config/windows.file", ""); writeTrashFile("src/config/windows.txt", ""); walk = beginWalk(); assertIteration(F, ".gitattributes"); assertIteration(F, "global.txt", asList(EOL_LF), null, asList(CUSTOM_VALUE)); assertIteration(F, "readme.txt", asList(EOL_LF), null, asList(CUSTOM_VALUE)); assertIteration(D, "src"); assertIteration(D, "src/config"); assertIteration(F, "src/config/.gitattributes"); assertIteration(F, "src/config/readme.txt", asList(DELTA_UNSET), null, asList(CUSTOM_VALUE)); assertIteration(F, "src/config/windows.file", null, asList(EOL_CRLF), null); assertIteration(F, "src/config/windows.txt", asList(DELTA_UNSET), asList(EOL_CRLF), asList(CUSTOM_VALUE)); assertIteration(F, "windows.file", null, asList(EOL_CRLF), null); assertIteration(F, "windows.txt", asList(EOL_LF), asList(EOL_CRLF), asList(CUSTOM_VALUE)); }

Target:
public void testRules() throws Exception { File customAttributeFile = File.createTempFile("tmp_", "customAttributeFile", null); customAttributeFile.deleteOnExit(); JGitTestUtil.write(customAttributeFile, "*.txt custom=value"); db.getConfig().setString("core", null, "attributesfile", customAttributeFile.getAbsolutePath()); writeAttributesFile(".git/info/attributes", "windows* eol=crlf"); writeAttributesFile(".gitattributes", "*.txt eol=lf"); writeTrashFile("windows.file", ""); writeTrashFile("windows.txt", ""); writeTrashFile("global.txt", ""); writeTrashFile("readme.txt", ""); writeAttributesFile("src/config/.gitattributes", "*.txt -delta"); writeTrashFile("src/config/readme.txt", ""); writeTrashFile("src/config/windows.file", ""); writeTrashFile("src/config/windows.txt", ""); walk = beginWalk(); assertIteration(F, ".gitattributes"); assertIteration(F, "global.txt", asList(EOL_LF), null, asList(CUSTOM_VALUE)); assertIteration(F, "readme.txt", asList(EOL_LF), null, asList(CUSTOM_VALUE)); assertIteration(D, "src"); assertIteration(D, "src/config"); assertIteration(F, "src/config/.gitattributes"); assertIteration(F, "src/config/readme.txt", asList(DELTA_UNSET), null, asList(CUSTOM_VALUE)); assertIteration(F, "src/config/windows.file", null, asList(EOL_CRLF), null); assertIteration(F, "src/config/windows.txt", asList(DELTA_UNSET), asList(EOL_CRLF), asList(CUSTOM_VALUE)); assertIteration(F, "windows.file", null, asList(EOL_CRLF), null); assertIteration(F, "windows.txt", asList(EOL_LF), asList(EOL_CRLF), asList(CUSTOM_VALUE)); endWalk(); }
Source:
public void run() { shareFileClient.uploadFromFile(TEMP_FILE.toString()); }

Target:
public void run() { shareFileClient.uploadFromFile(TEMP_FILE_PATH); }
Source:
public RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException { if (!ScanUtil.isMaskTTLExpiredRows(scan) && !ScanUtil.isDeleteTTLExpiredRows(scan)) { return s; } if (ScanUtil.isMaskTTLExpiredRows(scan)) { metricSource.incrementMaskExpiredRequestCount(); } if (ScanUtil.isDeleteTTLExpiredRows(scan)) { metricSource.incrementDeleteExpiredRequestCount(); } scan.setAttribute(PhoenixTTLRegionScanner.MASK_PHOENIX_TTL_EXPIRED_REQUEST_ID_ATTR, Bytes.toBytes(metricSource.getMaskExpiredRequestCount())); LOG.debug(String.format( "********** PHOENIX-TTL: PhoenixTTLRegionObserver::postScannerOpen TTL for table = " + "[%s], scan = [%s], PHOENIX_TTL = %d ***************, numRequests=%d", s.getRegionInfo().getTable().getNameAsString(), scan.toJSON(Integer.MAX_VALUE), ScanUtil.getPhoenixTTL(scan), metricSource.getMaskExpiredRequestCount())); return new PhoenixTTLRegionScanner(c.getEnvironment(), scan, s); }

Target:
public RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException { if (!ScanUtil.isMaskTTLExpiredRows(scan) && !ScanUtil.isDeleteTTLExpiredRows(scan)) { return s; } else if (ScanUtil.isMaskTTLExpiredRows(scan) && ScanUtil.isDeleteTTLExpiredRows(scan)) { throw new IOException("Both mask and delete expired rows property cannot be set"); } else if (ScanUtil.isMaskTTLExpiredRows(scan)) { metricSource.incrementMaskExpiredRequestCount(); scan.setAttribute(PhoenixTTLRegionScanner.MASK_PHOENIX_TTL_EXPIRED_REQUEST_ID_ATTR, Bytes.toBytes(String.format("MASK-EXPIRED-%d", metricSource.getMaskExpiredRequestCount()))); } else if (ScanUtil.isDeleteTTLExpiredRows(scan)) { metricSource.incrementDeleteExpiredRequestCount(); scan.setAttribute(PhoenixTTLRegionScanner.MASK_PHOENIX_TTL_EXPIRED_REQUEST_ID_ATTR, Bytes.toBytes(String.format("DELETE-EXPIRED-%d", metricSource.getDeleteExpiredRequestCount()))); } LOG.trace(String.format( "********** PHOENIX-TTL: PhoenixTTLRegionObserver::postScannerOpen TTL for table = " + "[%s], scan = [%s], PHOENIX_TTL = %d ***************, " + "numMaskExpiredRequestCount=%d, " + "numDeleteExpiredRequestCount=%d", s.getRegionInfo().getTable().getNameAsString(), scan.toJSON(Integer.MAX_VALUE), ScanUtil.getPhoenixTTL(scan), metricSource.getMaskExpiredRequestCount(), metricSource.getDeleteExpiredRequestCount() )); return new PhoenixTTLRegionScanner(c.getEnvironment(), scan, s); }
Source:
private void waitForRunning(final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> observed) throws Exception { waitForCondition( () -> observed.get(observed.size() - 1).equals(new KeyValue<>(State.REBALANCING, State.RUNNING)), MAX_WAIT_TIME_MS, () -> "Client did not startup on time. Observers transitions: " + observed ); }

Target:
private void waitForRunning(final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> observed) throws Exception { waitForCondition( () -> !observed.isEmpty() && observed.get(observed.size() - 1).value.equals(State.RUNNING), MAX_WAIT_TIME_MS, () -> "Client did not startup on time. Observers transitions: " + observed ); }
Source:
protected void verifyAccessibleForStudentsOfTheSameCourse(String[] submissionParams) { ______TS("students of the same course can access"); InstructorAttributes instructor1OfCourse1 = data.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = data.students.get("student1InCourse1"); gaeSimulation.loginAsStudent(student1InCourse1.googleId); verifyCanAccess(addUserIdToParams(student1InCourse1.googleId, submissionParams)); verifyCannotMasquerade(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams)); }

Target:
protected void verifyAccessibleForStudentsOfTheSameCourse(String[] submissionParams) { ______TS("students of the same course can access"); InstructorAttributes instructor1OfCourse1 = data.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = data.students.get("student1InCourse1"); gaeSimulation.loginAsStudent(student1InCourse1.googleId); verifyCanAccess(submissionParams); verifyCannotMasquerade(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams)); }
Source:
public boolean isKeepAliveLimitReached(final IntStream keepAlive) { return batchKeepAliveIterations.map(it -> keepAlive.allMatch(v -> v >= it) && it > 0).orElse(false); }

Target:
public boolean isKeepAliveLimitReached(final IntStream keepAlive) { return batchKeepAliveIterations.map(it -> keepAlive.allMatch(v -> v >= it)).orElse(false); }
Source:
public void onPositiveClicked(@NonNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: case TAG_CHANGE_SITE_ICON_DIALOG: ActivityLauncher.showPhotoPickerForResult(getActivity(), MediaBrowserType.SITE_ICON_PICKER, getSelectedSite()); break; case TAG_EDIT_SITE_ICON_PERMISSIONS_DIALOG: break; case TAG_QUICK_START_DIALOG: startQuickStart(); AnalyticsTracker.track(AnalyticsTracker.Stat.QUICK_START_REQUEST_POSITIVE_TAPPED); break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }

Target:
public void onPositiveClicked(@NonNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: case TAG_CHANGE_SITE_ICON_DIALOG: ActivityLauncher.showPhotoPickerForResult(getActivity(), MediaBrowserType.SITE_ICON_PICKER, getSelectedSite()); break; case TAG_EDIT_SITE_ICON_PERMISSIONS_DIALOG: break; case TAG_QUICK_START_DIALOG: startQuickStart(); AnalyticsTracker.track(Stat.QUICK_START_REQUEST_DIALOG_POSITIVE_TAPPED); break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }
Source:
public void testShift() throws Exception { logger.info("To run this test, you need a SAMP Hub running with Sherpa-SAMP connected."); double[] y = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; double[] yerr = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; double[] x = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; controller = new SAMPController.Builder("SEDStacker").buildAndStart(30000); RedshiftPayload payload = (RedshiftPayload) SAMPFactory.get(RedshiftPayload.class); payload.setX(x); payload.setY(y); payload.setYerr(yerr); payload.setFromRedshift(1); payload.setToRedshift(0); SAMPMessage message = SAMPFactory.createMessage(REDSHIFT_MTYPE, payload, RedshiftPayload.class); SherpaClient client = SherpaClient.create(controller); Response rspns = client.sendMessage(message); RedshiftPayload response = (RedshiftPayload) SAMPFactory.get(rspns.getResult(), RedshiftPayload.class); double[] controlYerr = new double[]{ 1, 21, 11, 2, 22, 12, 3, 23, 13, 4, 24, 14, 25, 15, 5, 16, 6, 26, 17, 7, 27, 18, 8, 28, 29, 19, 9, 20, 10, 30 }; for (int i = 0; i < response.getY().length; i++) { assertEquals(controlYerr[i], response.getYerr()[i], 0.00001); } }

Target:
public void testShift() throws Exception { logger.info("To run this test, you need a SAMP Hub running with Sherpa-SAMP connected."); double[] y = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; double[] yerr = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; double[] x = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; RedshiftPayload payload = (RedshiftPayload) SAMPFactory.get(RedshiftPayload.class); payload.setX(x); payload.setY(y); payload.setYerr(yerr); payload.setFromRedshift(1); payload.setToRedshift(0); SAMPMessage message = SAMPFactory.createMessage(REDSHIFT_MTYPE, payload, RedshiftPayload.class); Response rspns = client.sendMessage(message); RedshiftPayload response = (RedshiftPayload) SAMPFactory.get(rspns.getResult(), RedshiftPayload.class); double[] controlYerr = new double[]{ 1, 21, 11, 2, 22, 12, 3, 23, 13, 4, 24, 14, 25, 15, 5, 16, 6, 26, 17, 7, 27, 18, 8, 28, 29, 19, 9, 20, 10, 30 }; for (int i = 0; i < response.getY().length; i++) { assertEquals(controlYerr[i], response.getYerr()[i], 0.00001); } }
Source:
private SessionScript getScriptInterface(ScriptWrapper script) { try { return getScriptsExtension().getInterface(script, SessionScript.class); } catch (Exception e) { getScriptsExtension() .handleFailedScriptInterface( script, Constant.messages.getString( "session.method.script.dialog.error.text.interface", script.getName())); } return null; }

Target:
private static SessionScript getScriptInterface(ScriptWrapper script) { try { return getScriptsExtension().getInterface(script, SessionScript.class); } catch (Exception e) { getScriptsExtension() .handleFailedScriptInterface( script, Constant.messages.getString( "session.method.script.dialog.error.text.interface", script.getName())); } return null; }
Source:
protected void init() { if (getVm() == null) { return; } super.init(); if (getParameters().getCustomCpuName() != null) { if (getVm().isUseHostCpuFlags()) { getVm().setUseHostCpuFlags(false); } getVm().setCustomCpuName(getParameters().getCustomCpuName()); } if (getParameters().getCustomEmulatedMachine() != null) { getVm().setEmulatedMachine(getParameters().getCustomEmulatedMachine()); } if (getParameters().getBootMenuEnabled() != null) { getVm().setBootMenuEnabled(getParameters().getBootMenuEnabled()); } if (getParameters().getSpiceFileTransferEnabled() != null) { getVm().setSpiceFileTransferEnabled(getParameters().getSpiceFileTransferEnabled()); } if (getParameters().getSpiceCopyPasteEnabled() != null) { getVm().setSpiceCopyPasteEnabled(getParameters().getSpiceCopyPasteEnabled()); } if (getParameters().getBootSequence() != null) { getVm().setBootSequence(getParameters().getBootSequence()); } getVm().setVolatileRun(getParameters().isVolatileRun()); getVm().setInitrdUrl(getParameters().getInitrdUrl()); getVm().setKernelUrl(getParameters().getKernelUrl()); getVm().setKernelParams(getParameters().getKernelParams()); getVm().setCustomProperties(getParameters().getCustomProperties()); getVm().setRunOnce(true); }

Target:
protected void init() { if (getVm() == null) { return; } super.init(); if (getParameters().getCustomCpuName() != null) { getVm().setUseHostCpuFlags(false); getVm().setCustomCpuName(getParameters().getCustomCpuName()); } if (getParameters().getCustomEmulatedMachine() != null) { getVm().setEmulatedMachine(getParameters().getCustomEmulatedMachine()); } if (getParameters().getBootMenuEnabled() != null) { getVm().setBootMenuEnabled(getParameters().getBootMenuEnabled()); } if (getParameters().getSpiceFileTransferEnabled() != null) { getVm().setSpiceFileTransferEnabled(getParameters().getSpiceFileTransferEnabled()); } if (getParameters().getSpiceCopyPasteEnabled() != null) { getVm().setSpiceCopyPasteEnabled(getParameters().getSpiceCopyPasteEnabled()); } if (getParameters().getBootSequence() != null) { getVm().setBootSequence(getParameters().getBootSequence()); } getVm().setVolatileRun(getParameters().isVolatileRun()); getVm().setInitrdUrl(getParameters().getInitrdUrl()); getVm().setKernelUrl(getParameters().getKernelUrl()); getVm().setKernelParams(getParameters().getKernelParams()); getVm().setCustomProperties(getParameters().getCustomProperties()); getVm().setRunOnce(true); }
Source:
public void updateFields() { Gist gist = new Gist(); assertEquals(3, gist.setComments(3).getComments()); assertEquals(new Date(5000), gist.setCreatedAt(new Date(5000)) .getCreatedAt()); assertEquals("desc", gist.setDescription("desc").getDescription()); assertEquals(Collections.emptyMap(), gist.setFiles(Collections.<String, GistFile> emptyMap()) .getFiles()); assertEquals("pull", gist.setGitPullUrl("pull").getGitPullUrl()); assertEquals("push", gist.setGitPushUrl("push").getGitPushUrl()); assertEquals(Collections.emptyList(), gist.setHistory(Collections.<GistRevision> emptyList()) .getHistory()); assertEquals("html", gist.setHtmlUrl("html").getHtmlUrl()); assertEquals("id", gist.setId("id").getId()); assertEquals(new Date(1000), gist.setUpdatedAt(new Date(1000)) .getUpdatedAt()); assertEquals("url", gist.setUrl("url").getUrl()); User user = new User().setLogin("use"); assertTrue(gist.setPublic(true).isPublic()); }

Target:
public void updateFields() { Gist gist = new Gist(); assertEquals(3, gist.setComments(3).getComments()); assertEquals(new Date(5000), gist.setCreatedAt(new Date(5000)) .getCreatedAt()); assertEquals("desc", gist.setDescription("desc").getDescription()); assertEquals(Collections.emptyMap(), gist.setFiles(Collections.<String, GistFile> emptyMap()) .getFiles()); assertEquals("pull", gist.setGitPullUrl("pull").getGitPullUrl()); assertEquals("push", gist.setGitPushUrl("push").getGitPushUrl()); assertEquals(Collections.emptyList(), gist.setHistory(Collections.<GistRevision> emptyList()) .getHistory()); assertEquals("html", gist.setHtmlUrl("html").getHtmlUrl()); assertEquals("id", gist.setId("id").getId()); assertEquals(new Date(1000), gist.setUpdatedAt(new Date(1000)) .getUpdatedAt()); assertEquals("url", gist.setUrl("url").getUrl()); User user = new User().setLogin("use"); assertEquals(user, gist.setOwner(user).getOwner()); assertTrue(gist.setPublic(true).isPublic()); }
Source:
private int computeAndSaveScores() { int processed = 0; for (String pillID: this.toProccessedIDs) { final Long accountID = this.pillAccountID.get(pillID); final SortedSet<SensorSample> data = this.pillData.get(pillID); if (data.isEmpty()) { LOGGER.error("No data for scoring {}", pillID); continue; } final List<SleepScore> scores = SleepScore.computeSleepScore(accountID, pillID, data, this.dateMinuteBucket); final Map<String, Integer> stats = this.sleepScoreDAO.saveScores(scores); final int saved = (stats.get("updated") + stats.get("inserted")); this.numUpdates += stats.get("updated"); this.numInserts += stats.get("inserted"); this.numScores += scores.size(); if (saved > 0) { this.numPillsProcessed++; this.pillData.removeAll(pillID); this.pillAccountID.remove(pillID); this.toProccessedIDs.remove(pillID); processed++; } } return processed; }

Target:
private int computeAndSaveScores() { int processed = 0; for (final String pillID: this.toProccessedIDs) { final Long accountID = this.pillAccountID.get(pillID); final SortedSet<PillSample> data = this.pillData.get(pillID); if (data.isEmpty()) { LOGGER.error("No data for scoring {}", pillID); continue; } final List<SleepScore> scores = SleepScore.computeSleepScore(accountID, pillID, data, this.dateMinuteBucket); final Map<String, Integer> stats = this.sleepScoreDAO.saveScores(scores); final int saved = (stats.get("updated") + stats.get("inserted")); this.numUpdates += stats.get("updated"); this.numInserts += stats.get("inserted"); this.numScores += scores.size(); if (saved > 0) { this.numPillsProcessed++; this.pillData.removeAll(pillID); this.pillAccountID.remove(pillID); this.toProccessedIDs.remove(pillID); processed++; } } return processed; }
Source:
protected void setSegmentMetadataHolder(final DataSegment segment, final SegmentMetadataHolder segmentMetadataHolder) { synchronized (lock) { TreeMap<DataSegment, SegmentMetadataHolder> dataSourceSegments = segmentMetadataInfo.computeIfAbsent( segment.getDataSource(), x -> new TreeMap<>(SEGMENT_ORDER) ); if (dataSourceSegments.put(segment, segmentMetadataHolder) == null) { totalSegments++; } } }

Target:
void setSegmentMetadataHolder(final DataSegment segment, final SegmentMetadataHolder segmentMetadataHolder) { synchronized (lock) { TreeMap<DataSegment, SegmentMetadataHolder> dataSourceSegments = segmentMetadataInfo.computeIfAbsent( segment.getDataSource(), x -> new TreeMap<>(SEGMENT_ORDER) ); if (dataSourceSegments.put(segment, segmentMetadataHolder) == null) { totalSegments++; } } }
Source:
public Object convert(String tuple) { try { return reader.readValue(tuple); } catch (JsonProcessingException e) { logger.error("Error while converting tuple ", tuple + " " + e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }

Target:
public Object convert(String tuple) { try { return reader.readValue(tuple); } catch (JsonProcessingException e) { logger.debug("Error while converting tuple {}",tuple,e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }
Source:
public void duplicatedBlocks_should_be_activated_by_default() { orchestrator.resetData(); Map<String, Rules.ActiveList> actives = newWsClient().rules().search(new SearchWsRequest() .setLanguages(singletonList("js")) .setRepositories(singletonList("common-js")) .setFields(singletonList("actives"))).getActives().getActives(); assertThat(actives.get("common-js:InsufficientCommentDensity").getActiveListList()).isEmpty(); assertThat(actives.get("common-js:DuplicatedBlocks").getActiveListList()).hasSize(1); }

Target:
public void duplicatedBlocks_should_be_activated_by_default() { orchestrator.resetData(); Map<String, Rules.ActiveList> actives = newWsClient().rules().search(new SearchWsRequest() .setLanguages(singletonList("js")) .setRepositories(singletonList("common-js")) .setFields(singletonList("actives"))).getActives().getActives(); Map<String, String> jsProfileNameById = jsProfileNamesById(); assertThat(ruleActivations(actives, jsProfileNameById, "common-js:InsufficientCommentDensity")).isEmpty(); assertThat(ruleActivations(actives, jsProfileNameById, "common-js:DuplicatedBlocks")).containsExactly("Sonar way"); }
Source:
public KeyMaterial materialize() throws IOException, InterruptedException { final FilePath tempCredsDir; if (credentials != null) { String key = credentials.getClientSecretKeyInPEM(); String cert = credentials.getClientCertificateInPEM(); String ca = credentials.getServerCaCertificateInPEM(); if (key != null && cert != null && ca != null) { tempCredsDir = new FilePath(baseDir, UUID.randomUUID().toString()); copyInto(tempCredsDir,"key.pem", key); copyInto(tempCredsDir,"cert.pem", cert); copyInto(tempCredsDir,"ca.pem", ca); tempCredsDir.chmod(0600); } else { tempCredsDir = null; } } else { tempCredsDir = null; } EnvVars e = new EnvVars(); if (host!=null) { e.put("DOCKER_HOST",host); } if (tempCredsDir !=null) { e.put("DOCKER_TLS_VERIFY", "1"); e.put("DOCKER_CERT_PATH", tempCredsDir.getRemote()); } return new KeyMaterial(e) { @Override public void close() throws IOException { try { if (tempCredsDir !=null) { tempCredsDir.deleteRecursive(); } } catch (InterruptedException e) { throw new IOException(e); } } }; }

Target:
public KeyMaterial materialize() throws IOException, InterruptedException { final FilePath tempCredsDir; if (credentials != null) { String key = credentials.getClientSecretKeyInPEM(); String cert = credentials.getClientCertificateInPEM(); String ca = credentials.getServerCaCertificateInPEM(); if (key != null && cert != null && ca != null) { tempCredsDir = new FilePath(baseDir, UUID.randomUUID().toString()); copyInto(tempCredsDir,"key.pem", key); copyInto(tempCredsDir,"cert.pem", cert); copyInto(tempCredsDir,"ca.pem", ca); tempCredsDir.chmod(0600); } else { tempCredsDir = null; } } else { tempCredsDir = null; } EnvVars e = new EnvVars(); if (host!=null) { e.put("DOCKER_HOST",host); } if (tempCredsDir !=null) { e.put("DOCKER_TLS_VERIFY", "1"); e.put("DOCKER_CERT_PATH", tempCredsDir.getRemote()); } return new ServerKeyMaterial(e, tempCredsDir); }
Source:
public void printBody(final OutputStream output) throws IOException { final InputStream body = this.body(); try { final byte[] buf = new byte[4096]; while (true) { final int actual = body.read(buf); if (actual < 0) { break; } output.write(buf, 0, actual); } } finally { body.close(); } }

Target:
public void printBody(final OutputStream output) throws IOException { final InputStream body = this.body(); try { final byte[] buf = new byte[4096]; while (true) { final int bytes = body.read(buf); if (bytes < 0) { break; } output.write(buf, 0, bytes); } } finally { body.close(); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Tuple5)) return false; Tuple5<?, ?, ?, ?, ?> tuple5 = (Tuple5<?, ?, ?, ?, ?>) o; if (!Objects.equals(first, tuple5.first)) return false; if (!Objects.equals(second, tuple5.second)) return false; if (!Objects.equals(third, tuple5.third)) return false; if (!Objects.equals(forth, tuple5.forth)) return false; return Objects.equals(fifth, tuple5.fifth); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Tuple5)) return false; Tuple5<?, ?, ?, ?, ?> tuple5 = (Tuple5<?, ?, ?, ?, ?>) o; if (!Objects.equals(first, tuple5.first)) return false; if (!Objects.equals(second, tuple5.second)) return false; if (!Objects.equals(third, tuple5.third)) return false; if (!Objects.equals(fourth, tuple5.fourth)) return false; return Objects.equals(fifth, tuple5.fifth); }
Source:
protected PropertyGenerator getPropertyGenerator(VariableElement field, DeclaredTypeName fieldType) { List<? extends TypeName> typeArgs = fieldType.getTypeArgs(); if (typeArgs != null && typeArgs.size() == 1) { TypeName enumType = typeArgs.get(0); if (enumType instanceof DeclaredTypeName) { return new EnumPropertyGenerator(modelSpec, field, utils, (DeclaredTypeName) enumType); } } return null; }

Target:
protected PropertyGenerator getPropertyGenerator(VariableElement field, DeclaredTypeName fieldType) { List<? extends TypeName> typeArgs = fieldType.getTypeArgs(); if (typeArgs != null && typeArgs.size() == 1 && typeArgs.get(0) instanceof DeclaredTypeName) { return new EnumPropertyGenerator(modelSpec, field, utils, (DeclaredTypeName) typeArgs.get(0)); } utils.getMessager().printMessage(Kind.WARNING, "EnumProperty must use a declared type argument; it cannot be raw or use a generic type argument", field); return null; }
Source:
public Void call() throws Exception { if (keys == null) { preIndex(); KeyValueFilter filter = getFilter(); try (Stream<CacheEntry<Object, Object>> stream = cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL) .cacheEntrySet().stream()) { Iterator<CacheEntry<Object, Object>> iterator = stream.filter(CacheFilters.predicate(filter)).iterator(); while (iterator.hasNext()) { CacheEntry<Object, Object> next = iterator.next(); Object value = extractValue(next.getValue()); if (value != null && value.getClass().equals(entity)) indexUpdater.updateIndex(next.getKey(), value); } } postIndex(); } else { for (Object key : keys) { Object value = extractValue(cache.get(key)); if (value != null) { indexUpdater.updateIndex(key, value); indexUpdater.flush(value.getClass()); } } } return null; }

Target:
public Void call() throws Exception { if (keys == null || keys.size() == 0) { preIndex(); KeyValueFilter filter = getFilter(); try (Stream<CacheEntry<Object, Object>> stream = cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL) .cacheEntrySet().stream()) { Iterator<CacheEntry<Object, Object>> iterator = stream.filter(CacheFilters.predicate(filter)).iterator(); while (iterator.hasNext()) { CacheEntry<Object, Object> next = iterator.next(); Object value = extractValue(next.getValue()); if (value != null && value.getClass().equals(entity)) indexUpdater.updateIndex(next.getKey(), value); } } postIndex(); } else { Set<Class<?>> classSet = new HashSet<>(); for (Object key : keys) { Object value = extractValue(cache.get(key)); if (value != null) { indexUpdater.updateIndex(key, value); classSet.add(value.getClass()); } } for (Class<?> clazz : classSet) indexUpdater.flush(clazz); } return null; }
Source:
public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) { List<Patient> patients = new Vector<Patient>(); List<Integer> patientIds = new Vector<Integer>(); if (attributes.size() > 0) { String sqlString = getDuplicatePatientsSQLString(attributes); try { SQLQuery sqlquery = sessionFactory.getCurrentSession().createSQLQuery(sqlString); patientIds = sqlquery.list(); if (patientIds.size() >= 1) { Query query = sessionFactory.getCurrentSession().createQuery( "from Patient p1 where p1.patientId in (:ids)"); query.setParameterList("ids", patientIds); patients = query.list(); } } catch (HibernateException ex) { log.warn("Hibernate exception: " + ex.getStackTrace().toString()); throw ex; } finally } sortDuplicatePatients(patients, patientIds); return patients; }

Target:
public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) { List<Patient> patients = new Vector<Patient>(); List<Integer> patientIds = new Vector<Integer>(); if (attributes.size() > 0) { String sqlString = getDuplicatePatientsSQLString(attributes); if(sqlString != null) { SQLQuery sqlquery = sessionFactory.getCurrentSession().createSQLQuery(sqlString); patientIds = sqlquery.list(); if (patientIds.size() >= 1) { Query query = sessionFactory.getCurrentSession().createQuery( "from Patient p1 where p1.patientId in (:ids)"); query.setParameterList("ids", patientIds); patients = query.list(); } } } sortDuplicatePatients(patients, patientIds); return patients; }
Source:
public Result submitRun() { DynamicForm bindedForm = new DynamicForm().bindFromRequest(); String configuration_id = bindedForm.get("configuration_id"); String url = bindedForm.get("url"); String author = bindedForm.get("author"); String repo = bindedForm.get("repo"); String comment = bindedForm.get("comment"); FrontEndDBInterface f = new FrontEndDBInterface(); String record_id = f.storeRunInfo(Integer.parseInt(configuration_id), url, author, repo, comment); WSResponse response = Core.startJob(configuration_id, url, record_id); if(response == null) return internalServerError("Server Not Found"); else if(response.getStatus()==500) return internalServerError(response.getBody()); else return redirect("/configuration?conf="+configuration_id); }

Target:
public Result submitRun() { DynamicForm bindedForm = new DynamicForm().bindFromRequest(); String configuration_id = bindedForm.get("configuration_id"); String url = bindedForm.get("url"); String author = bindedForm.get("author"); String repo = bindedForm.get("repo"); String comment = bindedForm.get("comment"); FrontEndDBInterface f = new FrontEndDBInterface(); String record_id = f.storeRunInfo(Integer.parseInt(configuration_id), url, author, repo, comment); WSResponse response = Core.startJob(configuration_id, url, record_id); if(response == null) { AddRunViewModel viewModel = new AddRunViewModel(); viewModel.configuration_id = configuration_id; viewModel.default_url = url; viewModel.default_author = author; viewModel.default_repo = repo; viewModel.default_comment = comment; viewModel.error_message = "Server at given address was not found"; return ok(addRun.render(viewModel)); } else if(response.getStatus()==500) return internalServerError(response.getBody()); else return redirect("/configuration?conf="+configuration_id); }
Source:
public Collection<ContentTypeFieldProperties> getFieldContentTypeProperties(){ return null; }

Target:
public Collection<ContentTypeFieldProperties> getFieldContentTypeProperties(){ return Collections.emptyList(); }
Source:
public void testCreateTasksStartedFromCLI() { doReturn(getTasks(JobExecutionStatus.STARTED)).when(provider).getTaskListForCluster(CLUSTER_GUIDS[1]); doReturn(mockVdcReturn(true, Guid.newGuid())). when(backend).runInternalAction(any(VdcActionType.class), any(VdcActionParametersBase.class)); prepareMocksForTasksFromCLI(); tasksSyncJob.updateGlusterAsyncTasks(); Mockito.verify(jobRepository, times(0)).updateStep(any(Step.class)); Mockito.verify(tasksSyncJob, times(0)).endStepJob(any(Step.class)); }

Target:
public void testCreateTasksStartedFromCLI() { doReturn(getTasks(JobExecutionStatus.STARTED)).when(provider).getTaskListForCluster(CLUSTER_GUIDS[1]); doReturn(mockVdcReturn(true, Guid.newGuid())). when(backend).runInternalAction(any(VdcActionType.class), any(VdcActionParametersBase.class)); prepareMocksForTasksFromCLI(); tasksSyncJob.updateGlusterAsyncTasks(); Mockito.verify(jobRepository, times(0)).updateStep(any(Step.class)); Mockito.verify(taskUtils, times(0)).endStepJob(any(Step.class)); }
Source:
private static Predicate<Location> isYouViewPlatform() { return new Predicate<Location>() { @Override public boolean apply(Location input) { Policy policy = input.getPolicy(); if (policy == null) { return false; } return Platform.YOUVIEW_IPLAYER.equals(policy.getPlatform()); } }; }

Target:
private static Predicate<Location> isYouViewPlatform() { return new Predicate<Location>() { @Override public boolean apply(Location input) { Policy policy = input.getPolicy(); return policy != null && Platform.YOUVIEW_IPLAYER.equals(policy.getPlatform()); } }; }
Source:
public void setPrisonerStatus(PrisonerStatus prisonerStatus, boolean log) { boolean freed = !this.prisonerStatus.isFree(); this.prisonerStatus = prisonerStatus; switch (prisonerStatus) { case PRISONER: case PRISONER_DEFECTOR: getCampaign().changeRank(this, Ranks.RANK_BONDSMAN, true); setRecruitment(null); setLastRankChangeDate(null); if (log) { ServiceLogger.madePrisoner(this, getCampaign().getDate(), getCampaign().getName(), ""); } break; case BONDSMAN: getCampaign().changeRank(this, Ranks.RANK_BONDSMAN, true); setRecruitment(null); setLastRankChangeDate(null); if (log) { ServiceLogger.madeBondsman(this, getCampaign().getDate(), getCampaign().getName(), ""); } break; case FREE: if (!isDependent()) { if (getCampaign().getCampaignOptions().getUseTimeInService()) { setRecruitment(getCampaign().getLocalDate()); } if (getCampaign().getCampaignOptions().getUseTimeInRank()) { setLastRankChangeDate(getCampaign().getLocalDate()); } } if (getRankNumeric() < 0) { getCampaign().changeRank(this, 0, false); } if (log) { if (freed) { ServiceLogger.freed(this, getCampaign().getDate(), getCampaign().getName(), ""); } else { ServiceLogger.joined(this, getCampaign().getDate(), getCampaign().getName(), ""); } } break; } if (!prisonerStatus.isFree()) { Unit u = getCampaign().getUnit(getUnitId()); if (u != null) { u.remove(this, true); } else { setUnitId(null); } } MekHQ.triggerEvent(new PersonChangedEvent(this)); }

Target:
public void setPrisonerStatus(PrisonerStatus prisonerStatus, boolean log) { if (getPrisonerStatus() == prisonerStatus) { return; } final boolean freed = !getPrisonerStatus().isFree(); final boolean isPrisoner = prisonerStatus.isPrisoner(); this.prisonerStatus = prisonerStatus; switch (prisonerStatus) { case PRISONER: case PRISONER_DEFECTOR: case BONDSMAN: getCampaign().changeRank(this, isPrisoner ? Ranks.RANK_PRISONER : Ranks.RANK_BONDSMAN, true); setRecruitment(null); setLastRankChangeDate(null); if (log) { if (isPrisoner) { ServiceLogger.madePrisoner(this, getCampaign().getDate(), getCampaign().getName(), ""); } else { ServiceLogger.madeBondsman(this, getCampaign().getDate(), getCampaign().getName(), ""); } } break; case FREE: if (!isDependent()) { if (getCampaign().getCampaignOptions().getUseTimeInService()) { setRecruitment(getCampaign().getLocalDate()); } if (getCampaign().getCampaignOptions().getUseTimeInRank()) { setLastRankChangeDate(getCampaign().getLocalDate()); } } if (getRankNumeric() < 0) { getCampaign().changeRank(this, 0, false); } if (log) { if (freed) { ServiceLogger.freed(this, getCampaign().getDate(), getCampaign().getName(), ""); } else { ServiceLogger.joined(this, getCampaign().getDate(), getCampaign().getName(), ""); } } break; } if (!prisonerStatus.isFree()) { Unit u = getCampaign().getUnit(getUnitId()); if (u != null) { u.remove(this, true); } else { setUnitId(null); } } MekHQ.triggerEvent(new PersonChangedEvent(this)); }
Source:
public SpatialRule lookupRule(double lat, double lon) { if (lon < bounds.minLon || lon > bounds.maxLon || lat < bounds.minLat || lat > bounds.maxLat) return EMPTY; int xIndex = getXIndexForLon(lon); int yIndex = getYIndexForLat(lat); int ruleIndex = getRuleContainerIndex(xIndex, yIndex); SpatialRuleContainer ruleContainer = ruleContainers.get(ruleIndex); if (ruleContainer.size() == 1) { if (!exact) return ruleContainer.first(); if (!isBorderTile(xIndex, yIndex, ruleIndex)) return ruleContainer.first(); } for (SpatialRule rule : ruleContainer.getRules()) { for (Polygon p : rule.getBorders()) { if (p.contains(lat, lon)) { return rule; } } } return EMPTY; }

Target:
public SpatialRule lookupRule(double lat, double lon) { if (lon < bounds.minLon || lon > bounds.maxLon || lat < bounds.minLat || lat > bounds.maxLat) return SpatialRule.EMPTY; int xIndex = getXIndexForLon(lon); int yIndex = getYIndexForLat(lat); int ruleIndex = getRuleContainerIndex(xIndex, yIndex); SpatialRuleContainer ruleContainer = ruleContainers.get(ruleIndex); if (ruleContainer.size() == 1) { if (!exact) return ruleContainer.first(); if (!isBorderTile(xIndex, yIndex, ruleIndex)) return ruleContainer.first(); } for (SpatialRule rule : ruleContainer.getRules()) { for (Polygon p : rule.getBorders()) { if (p.contains(lat, lon)) { return rule; } } } return SpatialRule.EMPTY; }
Source:
public void shouldCreateCorrectChallengeToken() { var gatewayAccount = new GatewayAccount(1L, WORLDPAY.getName(), validCredentials); String worldpayChallengeAcsUrl = "<LINK_0>"; String worldpayChallengePayload = "a-payload"; String worldpayChallengeTransactionId = "a-transaction-id"; Auth3dsDetailsEntity auth3dsDetailsEntity = anAuth3dsDetailsEntity() .withWorldpayChallengeAcsUrl(worldpayChallengeAcsUrl) .withWorldpayChallengePayload(worldpayChallengePayload) .withWorldpayChallengeTransactionId(worldpayChallengeTransactionId) .build(); String token = worldpay3dsFlexJwtService.generateChallengeToken(gatewayAccount, auth3dsDetailsEntity); Jws<Claims> jws = Jwts.parser() .setSigningKey(new SecretKeySpec(validCredentials.get("jwt_mac_id").getBytes(), "HmacSHA256")) .parseClaimsJws(token); assertThat(jws.getHeader().getAlgorithm(), is("HS256")); assertThat((Map<String, Object>)jws.getHeader(), hasEntry("typ", "JWT")); assertThat(jws.getBody(), hasKey("jti")); assertThat(jws.getBody(), hasKey("iat")); assertThat(jws.getBody(), hasEntry("iss", validCredentials.get("issuer"))); assertThat(jws.getBody(), hasEntry("OrgUnitId", validCredentials.get("organisational_unit_id"))); assertThat(jws.getBody(), hasEntry("ObjectifyPayload", true)); assertThat(jws.getBody(), hasEntry(is("Payload"), instanceOf(Map.class))); Map<String, Object> payload = (Map<String, Object>) jws.getBody().get("Payload"); assertThat(payload, hasEntry("ACSUrl", worldpayChallengeAcsUrl)); assertThat(payload, hasEntry("Payload", worldpayChallengePayload)); assertThat(payload, hasEntry("TransactionId", worldpayChallengeTransactionId)); }

Target:
public void shouldCreateCorrectChallengeToken() { GatewayAccountEntity gatewayAccountEntity = aGatewayAccountEntity() .withGatewayName(WORLDPAY.getName()) .withCredentials(VALID_CREDENTIALS) .build(); ChargeEntity chargeEntity = createValidChargeEntityForChallengeToken(gatewayAccountEntity); String token = worldpay3dsFlexJwtService.generateChallengeToken(chargeEntity); Jws<Claims> jws = Jwts.parser() .setSigningKey(new SecretKeySpec(VALID_CREDENTIALS.get("jwt_mac_id").getBytes(), "HmacSHA256")) .parseClaimsJws(token); assertThat(jws.getHeader().getAlgorithm(), is("HS256")); assertThat((Map<String, Object>)jws.getHeader(), hasEntry("typ", "JWT")); assertThat(jws.getBody(), hasKey("jti")); assertThat(jws.getBody(), hasKey("iat")); assertThat(jws.getBody(), hasEntry("iss", VALID_CREDENTIALS.get("issuer"))); assertThat(jws.getBody(), hasEntry("OrgUnitId", VALID_CREDENTIALS.get("organisational_unit_id"))); assertThat(jws.getBody(), hasEntry("ReturnUrl", format("%s/card_details/%s/3ds_required_in", FRONTEND_URL, CHARGE_EXTERNAL_ID))); assertThat(jws.getBody(), hasEntry("ObjectifyPayload", true)); assertThat(jws.getBody(), hasEntry(is("Payload"), instanceOf(Map.class))); Map<String, Object> payload = (Map<String, Object>) jws.getBody().get("Payload"); assertThat(payload, hasEntry("ACSUrl", WORLDPAY_CHALLENGE_ACS_URL)); assertThat(payload, hasEntry("Payload", WORLDPAY_CHALLENGE_PAYLOAD)); assertThat(payload, hasEntry("TransactionId", WORLDPAY_CHALLENGE_TRANSACTION_ID)); }
Source:
protected void addReplicationRule(ConfigBag ruleArgs) { Entity fromCluster = (Entity) ruleArgs.getStringKey("fromCluster"); Entity toCluster = (Entity) ruleArgs.getStringKey("toCluster"); if (fromCluster==null && toCluster==null) throw new IllegalArgumentException("At least one of 'fromCluster' or 'toCluster' must be supplied"); if (fromCluster==null) fromCluster = this; if (toCluster==null) toCluster = this; String fromBucket = (String)ruleArgs.getStringKey("fromBucket"); String toBucket = (String)ruleArgs.getStringKey("toBucket"); if (fromBucket==null && toBucket==null) throw new IllegalArgumentException("At least one of 'fromBucket' or 'toBucket' must be supplied"); if (fromBucket==null) fromBucket = toBucket; if (toBucket==null) toBucket = fromBucket; if (!ruleArgs.getUnusedConfig().isEmpty()) { throw new IllegalArgumentException("Unsupported replication rule data: "+ruleArgs.getUnusedConfig()); } getDriver().addReplicationRule(toCluster, fromBucket, toBucket); }

Target:
protected void addReplicationRule(ConfigBag ruleArgs) { Object toClusterO = Preconditions.checkNotNull(ruleArgs.getStringKey("toCluster"), "toCluster must not be null"); if (toClusterO instanceof String) { toClusterO = getManagementContext().lookup((String)toClusterO); } Entity toCluster = Tasks.resolving(toClusterO, Entity.class).context(getExecutionContext()).get(); String fromBucket = Preconditions.checkNotNull( (String)ruleArgs.getStringKey("fromBucket"), "fromBucket must be specified" ); String toBucket = (String)ruleArgs.getStringKey("toBucket"); if (toBucket==null) toBucket = fromBucket; if (!ruleArgs.getUnusedConfig().isEmpty()) { throw new IllegalArgumentException("Unsupported replication rule data: "+ruleArgs.getUnusedConfig()); } getDriver().addReplicationRule(toCluster, fromBucket, toBucket); }
Source:
private void checkBackTrace(ArtifactReadable art, Integer current, IAttributeType thisType, IRelationTypeSide relType, IAttributeType otherType) throws IOException { List<ArtifactReadable> tracedToRequirements = Lists.newArrayList(art.getRelated(relType)); int maxCritVal = 4; int parentCritVal = 4; for (ArtifactReadable parent : tracedToRequirements) { if (otherType.equals(CoreAttributeTypes.SeverityCategory)) { String intermediate = parent.getSoleAttributeAsString(otherType, "NH"); if ("Unspecified".equals(intermediate)) { intermediate = "NH"; } parentCritVal = SafetyCriticalityLookup.getSeverityLevel(intermediate); } else if (otherType.equals(CoreAttributeTypes.ItemDAL)) { parentCritVal = SafetyCriticalityLookup.getDALLevel(parent.getSoleAttributeAsString(otherType, "E")); } else { throw new OseeArgumentException("Invalid attribute type: %s", otherType.toString()); } maxCritVal = Integer.min(maxCritVal, parentCritVal); } if (current < maxCritVal) { writer.writeCell(String.format("%s [Error:<%s]", SafetyCriticalityLookup.getDALLevelFromInt(current), SafetyCriticalityLookup.getDALLevelFromInt(maxCritVal))); } else { writer.writeCell(SafetyCriticalityLookup.getDALLevelFromInt(current)); } }

Target:
private void checkBackTrace(ArtifactReadable art, Integer current, IAttributeType thisType, IRelationTypeSide relType, IAttributeType otherType) throws IOException { List<ArtifactReadable> tracedToRequirements = Lists.newArrayList(art.getRelated(relType)); int maxCritVal = 4; int parentCritVal = 4; for (ArtifactReadable parent : tracedToRequirements) { if (otherType.equals(CoreAttributeTypes.SeverityCategory)) { String intermediate = parent.getSoleAttributeAsString(otherType, "NH"); if (IAttribute.UNSPECIFIED.equals(intermediate)) { intermediate = "NH"; } parentCritVal = SafetyCriticalityLookup.getSeverityLevel(intermediate); } else if (otherType.equals(CoreAttributeTypes.ItemDAL)) { parentCritVal = SafetyCriticalityLookup.getDALLevel(parent.getSoleAttributeAsString(otherType, "E")); } else { throw new OseeArgumentException("Invalid attribute type: %s", otherType.toString()); } maxCritVal = Integer.min(maxCritVal, parentCritVal); } if (current < maxCritVal) { writer.writeCell(String.format("%s [Error:<%s]", SafetyCriticalityLookup.getDALLevelFromInt(current), SafetyCriticalityLookup.getDALLevelFromInt(maxCritVal))); } else { writer.writeCell(SafetyCriticalityLookup.getDALLevelFromInt(current)); } }
Source:
public void test( @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1 ) throws Exception { final EJBClientContext.Builder ejbClientBuilder = new EJBClientContext.Builder(); ejbClientBuilder.addTransportProvider(new RemoteTransportProvider()); final EJBClientConnection.Builder connBuilder = new EJBClientConnection.Builder(); connBuilder.setDestination(URI.create(String.format("remote+%s", baseURL1))); ejbClientBuilder.addClientConnection(connBuilder.build()); ejbClientBuilder.setClusterNodeSelector(new CustomClusterNodeSelector()); final EJBClientContext ejbCtx = ejbClientBuilder.build(); EJBClientContext.getContextManager().setThreadDefault(ejbCtx); Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, WildFlyInitialContextFactory.class.getName()); InitialContext ctx = new InitialContext(props); String lookupName = "ejb:/" + MODULE_NAME + "/" + HeartbeatBean.class.getSimpleName() + "!" + Heartbeat.class.getName(); Heartbeat bean = (Heartbeat) ctx.lookup(lookupName); Result<Date> res = bean.pulse(); Thread.sleep(CLIENT_TOPOLOGY_UPDATE_WAIT); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_2); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_1); callBeanOnNode(bean, NODE_3); ctx.close(); }

Target:
public void test( @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1 ) throws Exception { EJBClientContext BKP = null; try { final EJBClientContext.Builder ejbClientBuilder = new EJBClientContext.Builder(); ejbClientBuilder.addTransportProvider(new RemoteTransportProvider()); final EJBClientConnection.Builder connBuilder = new EJBClientConnection.Builder(); connBuilder.setDestination(URI.create(String.format("remote+%s", baseURL1))); ejbClientBuilder.addClientConnection(connBuilder.build()); ejbClientBuilder.setClusterNodeSelector(new CustomClusterNodeSelector()); BKP = EJBClientContext.getContextManager().getThreadDefault(); final EJBClientContext ejbCtx = ejbClientBuilder.build(); EJBClientContext.getContextManager().setThreadDefault(ejbCtx); Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, WildFlyInitialContextFactory.class.getName()); InitialContext ctx = new InitialContext(props); String lookupName = "ejb:/" + MODULE_NAME + "/" + HeartbeatBean.class.getSimpleName() + "!" + Heartbeat.class.getName(); Heartbeat bean = (Heartbeat) ctx.lookup(lookupName); Result<Date> res = bean.pulse(); Thread.sleep(CLIENT_TOPOLOGY_UPDATE_WAIT); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_2); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_4); callBeanOnNode(bean, NODE_1); callBeanOnNode(bean, NODE_3); ctx.close(); } finally { if ((BKP != null)) { EJBClientContext.getContextManager().setThreadDefault(BKP); } } }