auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public FormValidation doCheckRawBuildsDir(@QueryParameter String value) { String replacedValue = Util.replaceMacro(value, ImmutableMap.of( "JENKINS_HOME", Jenkins.getInstance().getRootDir().getPath(), "ITEM_ROOTDIR", Jenkins.getInstance().getRootDir().getPath() + "/jobs/doCheckRawBuildsDir-Marker$foo", "ITEM_FULLNAME", "doCheckRawBuildsDir-Marker:foo", "ITEM_FULL_NAME", "doCheckRawBuildsDir-Marker$foo")); File replacedFile = new File(replacedValue); if (!replacedFile.isAbsolute()) { return FormValidation.error(value + " does not resolve to an absolute path"); } if (!replacedValue.contains("doCheckRawBuildsDir-Marker")) { return FormValidation.error(value + " does not contain ${ITEM_FULL_NAME} or ${ITEM_ROOTDIR}, cannot distinguish between projects"); } if (replacedValue.contains("doCheckRawBuildsDir-Marker:foo")) { try { File tmp = File.createTempFile("Jenkins-doCheckRawBuildsDir", "foo:bar"); tmp.delete(); } catch (IOException e) { return FormValidation.error(value + " contains ${ITEM_FULLNAME} but your system does not support it (JENKINS-12251). Use ${ITEM_FULL_NAME} instead"); } } File d = new File(replacedValue); if (!d.isDirectory()) { d = d.getParentFile(); while (!d.exists()) { d = d.getParentFile(); } if (!d.canWrite()) { return FormValidation.error(value + " does not exist and probably cannot be created"); } } return FormValidation.ok(); }

Target:
public FormValidation doCheckRawBuildsDir(@QueryParameter String value) { String replacedValue = expandVariablesForDirectory(value, "doCheckRawBuildsDir-Marker:foo", Jenkins.getInstance().getRootDir().getPath() + "/jobs/doCheckRawBuildsDir-Marker$foo"); File replacedFile = new File(replacedValue); if (!replacedFile.isAbsolute()) { return FormValidation.error(value + " does not resolve to an absolute path"); } if (!replacedValue.contains("doCheckRawBuildsDir-Marker")) { return FormValidation.error(value + " does not contain ${ITEM_FULL_NAME} or ${ITEM_ROOTDIR}, cannot distinguish between projects"); } if (replacedValue.contains("doCheckRawBuildsDir-Marker:foo")) { try { File tmp = File.createTempFile("Jenkins-doCheckRawBuildsDir", "foo:bar"); tmp.delete(); } catch (IOException e) { return FormValidation.error(value + " contains ${ITEM_FULLNAME} but your system does not support it (JENKINS-12251). Use ${ITEM_FULL_NAME} instead"); } } File d = new File(replacedValue); if (!d.isDirectory()) { d = d.getParentFile(); while (!d.exists()) { d = d.getParentFile(); } if (!d.canWrite()) { return FormValidation.error(value + " does not exist and probably cannot be created"); } } return FormValidation.ok(); }
Source:
private void lsRefsV2() throws IOException { PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); Map<String, Ref> refs = getAdvertisedOrDefaultRefs(); String line; adv.setUseProtocolV2(true); while ((line = pckIn.readString()) != PacketLineIn.END) { if (line.equals("peel")) { adv.setDerefTags(true); } else if (line.equals("symrefs")) { findSymrefs(adv, refs); } } adv.send(refs); adv.end(); }

Target:
private void lsRefsV2() throws IOException { PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); Map<String, Ref> refs = getAdvertisedOrDefaultRefs(); String line; adv.setUseProtocolV2(true); line = pckIn.readString(); END if not. if (line == PacketLineIn.DELIM) { while ((line = pckIn.readString()) != PacketLineIn.END) { if (line.equals("peel")) { adv.setDerefTags(true); } else if (line.equals("symrefs")) { findSymrefs(adv, refs); } else { throw new PackProtocolException("unexpected " + line); } } } else if (line != PacketLineIn.END) { throw new PackProtocolException("unexpected " + line); } adv.send(refs); adv.end(); }
Source:
public void sendRegisMsg(final String dataClassName, final long unitStartId, final long unitEndId, final TraceInfo parentTraceInfo) { final TraceScope sendRegisMsgScope = Trace.startSpan(SEND_REGIS_MSG, parentTraceInfo); try { LOG.entering(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRegisMsg", new Object[]{dataClassName, unitStartId, unitEndId}); final RegisMsg regisMsg = RegisMsg.newBuilder() .setDataClassName(dataClassName) .setIdRange(AvroLongRange.newBuilder() .setMin(unitStartId) .setMax(unitEndId) .build()) .build(); send(driverId, AvroElasticMemoryMessage.newBuilder() .setType(Type.RegisMsg) .setSrcId(networkService.getMyId().toString()) .setDestId(driverId) .setRegisMsg(regisMsg) .build()); LOG.entering(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRegisMsg", new Object[]{dataClassName, unitStartId, unitEndId}); } finally { sendRegisMsgScope.close(); } }

Target:
public void sendRegisMsg(final String dataClassName, final long unitStartId, final long unitEndId, final TraceInfo parentTraceInfo) { final TraceScope sendRegisMsgScope = Trace.startSpan(SEND_REGIS_MSG, parentTraceInfo); try { LOG.entering(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRegisMsg", new Object[]{dataClassName, unitStartId, unitEndId}); final RegisMsg regisMsg = RegisMsg.newBuilder() .setDataClassName(dataClassName) .setIdRange(AvroLongRange.newBuilder() .setMin(unitStartId) .setMax(unitEndId) .build()) .build(); send(driverId, AvroElasticMemoryMessage.newBuilder() .setType(Type.RegisMsg) .setSrcId(networkService.getMyId().toString()) .setDestId(driverId) .setRegisMsg(regisMsg) .build()); LOG.exiting(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRegisMsg", new Object[]{dataClassName, unitStartId, unitEndId}); } finally { sendRegisMsgScope.close(); } }
Source:
protected void ExecuteVdsBrokerCommand() { status = getBroker().desktopLogoff(mVmId.toString(), (Boolean.valueOf(mForce)).toString()); ProceedProxyReturnValue(); }

Target:
protected void ExecuteVdsBrokerCommand() { status = getBroker().desktopLogoff(mVmId.toString(), String.valueOf(mForce)); ProceedProxyReturnValue(); }
Source:
private String getResource(String resourceName) throws ServerException { try { InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(resourceName); return IOUtils.toString(resourceAsStream); } catch (Exception e) { throw new ServerException(e.getMessage()); } }

Target:
private String getResource(String resourceName) throws ServerException { try (InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(resourceName)) { return IOUtils.toString(resourceAsStream); } catch (Exception e) { throw new ServerException(e.getMessage()); } }
Source:
private void mpathwaysCall(HttpServletRequest request, HttpServletResponse response, PrintWriter out){ WAPIResultWrapper wrappedResult = null; String mpathwaysInstructor = request.getParameter(PARAMETER_INSTRUCTOR); String mpathwaysTermId = request.getParameter(PARAMETER_TERMID); if(mpathwaysInstructor == null || mpathwaysTermId == null){ response.setStatus(400); wrappedResult = new WAPIResultWrapper(400, "Parameter missing in Instructors request", new JSONObject()); } else{ if(appExtSecurePropertiesFile!=null) { HashMap<String, String> value = new HashMap<String, String>(); value.put("tokenServer", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_TOKEN_SERVER)); value.put("apiPrefix", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_PREFIX)); value.put("key", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_KEY)); value.put("secret", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_SECRET)); WAPI wapi = new WAPI(value); try { wrappedResult = wapi.getRequest(wapi.getApiPrefix() + mpathwaysInstructor + "/Terms/" + mpathwaysTermId + "/Classes"); } catch (UnirestException e) { e.printStackTrace(); } } } out.print(wrappedResult.toJson()); out.flush(); }

Target:
private void mpathwaysCall(HttpServletRequest request, HttpServletResponse response, PrintWriter out){ WAPIResultWrapper wrappedResult = null; String mpathwaysInstructor = request.getParameter(PARAMETER_INSTRUCTOR); String mpathwaysTermId = request.getParameter(PARAMETER_TERMID); if(mpathwaysInstructor == null || mpathwaysTermId == null){ response.setStatus(400); wrappedResult = new WAPIResultWrapper(400, "Parameter missing in Instructors request", new JSONObject()); M_log.error("Error in mpathwaysCall(), missing parameter in Instuctors request"); } else{ if(appExtSecurePropertiesFile!=null) { HashMap<String, String> wapiValuesMap = new HashMap<String, String>(); wapiValuesMap.put("tokenServer", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_TOKEN_SERVER)); wapiValuesMap.put("apiPrefix", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_PREFIX)); wapiValuesMap.put("key", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_KEY)); wapiValuesMap.put("secret", appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.ESB_SECRET)); WAPI wapi = new WAPI(wapiValuesMap); try { wrappedResult = wapi.getRequest(wapi.getApiPrefix() + mpathwaysInstructor + "/Terms/" + mpathwaysTermId + "/Classes"); } catch (UnirestException e) { M_log.error("MPathways API call did not complete successfully", e); } } } out.print(wrappedResult.toJson()); out.flush(); }
Source:
public static Slice crc32(@SqlType(StandardTypes.VARBINARY) Slice slice) { Slice hash = Slices.allocate(Long.BYTES); CRC32 crc32 = new CRC32(); crc32.update(slice.toByteBuffer()); long crc32Value = crc32.getValue(); hash.setLong(0, Long.reverseBytes(crc32Value)); return hash; }

Target:
public static long crc32(@SqlType(StandardTypes.VARBINARY) Slice slice) { CRC32 crc32 = new CRC32(); crc32.update(slice.toByteBuffer()); return crc32.getValue(); }
Source:
public void clearOldHistory(String machineId) { List<SingularityMachineStateHistoryUpdate> histories = getHistory(machineId); histories.sort(Comparator.comparingLong(SingularityMachineStateHistoryUpdate::getTimestamp)); histories.stream() .skip(maxHistoryEntries) .forEach((history) -> { delete(getHistoryUpdatePath(history)); }); }

Target:
public void clearOldHistory(String machineId) { List<SingularityMachineStateHistoryUpdate> histories = getHistory(machineId); histories.sort(Comparator.comparingLong(SingularityMachineStateHistoryUpdate::getTimestamp).reversed()); histories.stream() .skip(maxHistoryEntries) .forEach((history) -> { delete(getHistoryUpdatePath(history)); }); }
Source:
private void scheduleRelogin(Throwable error) { assert eventLoop.inEventLoop(); if (error instanceof FallbackDisallowedException) { return; } LOG.trace("Try scheduleRelogin."); if (!provider.canRetry()) { LOG.trace("SASL Provider does not support retries"); return; } if (reloginInProgress) { return; } reloginInProgress = true; RELOGIN_EXECUTOR.schedule(() -> { try { provider.relogin(); } catch (Throwable e) { LOG.warn("Relogin failed", e); } eventLoop.execute(() -> { reloginInProgress = false; }); }, ThreadLocalRandom.current().nextInt(reloginMaxBackoff), TimeUnit.MILLISECONDS); }

Target:
private void scheduleRelogin(Throwable error) { assert eventLoop.inEventLoop(); if (error instanceof FallbackDisallowedException) { return; } LOG.trace("Try scheduleRelogin."); if (!provider.canRetry()) { LOG.trace("SASL Provider does not support retries"); return; } if (reloginInProgress) { return; } reloginInProgress = true; RELOGIN_EXECUTOR.schedule(() -> { try { provider.relogin(); } catch (IOException e) { LOG.warn("Relogin failed", e); } eventLoop.execute(() -> { reloginInProgress = false; }); }, ThreadLocalRandom.current().nextInt(reloginMaxBackoff), TimeUnit.MILLISECONDS); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/copyToVRFrameBuffers"); FINAL.bindTexture(); if (!renderingConfig.isVrSupport()) { logger.warn("CopyToVRFrameBufferNode processed in non-VR mode."); } else { renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); } PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyImageToHMD"); FINAL.bindTexture(); renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); PerformanceMonitor.endActivity(); }
Source:
public boolean teleportToSpawn() { Location target = getBedSpawnLocation(); if (target == null) { target = server.getWorlds().get(0).getSpawnLocation(); } PlayerPortalEvent event = EventFactory.callEvent(new PlayerPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); spawnAt(target); teleported = true; awardAchievement(Achievement.THE_END); return true; }

Target:
protected boolean teleportToSpawn() { Location target = getBedSpawnLocation(); if (target == null) { target = server.getWorlds().get(0).getSpawnLocation(); } PlayerPortalEvent event = EventFactory.callEvent(new PlayerPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); spawnAt(target); teleported = true; awardAchievement(Achievement.THE_END, false); return true; }
Source:
public static void addLicenseTexts(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle("Heading2"); XWPFRun licenseRun = licenseParagraph.createRun(); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : "Unknown license name"; licenseRun.setText(licenseName); addNewLines(licenseRun, 1); XWPFParagraph licenseTextParagraph = document.createParagraph(); XWPFRun licenseTextRun = licenseTextParagraph.createRun(); addFormattedText(licenseTextRun, nullToEmptyString(lt.getLicenseText()), 12); addNewLines(licenseTextRun, 1); }); }

Target:
public static void addLicenseTexts(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle("Heading2"); XWPFRun licenseRun = licenseParagraph.createRun(); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : "Unknown license name"; licenseRun.setText(licenseName); addNewLines(licenseRun, 1); XWPFParagraph licenseTextParagraph = document.createParagraph(); XWPFRun licenseTextRun = licenseTextParagraph.createRun(); addFormattedText(licenseTextRun, nullToEmptyString(lt.getLicenseText()), FONT_SIZE); addNewLines(licenseTextRun, 1); }); }
Source:
public void checksJsonSchemaConstraints() throws Exception { final JSONArray invalidTestCases = new JSONArray( readFile("org/zalando/nakadi/validation/invalid-json-schema-examples.json")); for(final Iterator<Object> i = invalidTestCases.iterator(); i.hasNext();) { final JSONObject testCase = (JSONObject) i.next(); final Schema schema = SchemaLoader.load(testCase.getJSONObject("schema")); final List<String> errorMessages = testCase .getJSONArray("errors") .toList() .stream() .map(Object::toString) .collect(toList()); final String description = testCase.getString("description"); assertThat(description, service.checkConstraints(schema).stream().map(Object::toString).collect(toList()), is(errorMessages)); } }

Target:
public void checksJsonSchemaConstraints() throws Exception { final JSONArray invalidTestCases = new JSONArray( readFile("org/zalando/nakadi/validation/invalid-json-schema-examples.json")); for(final Object testCaseObject : invalidTestCases) { final JSONObject testCase = (JSONObject) testCaseObject; final Schema schema = SchemaLoader.load(testCase.getJSONObject("schema")); final List<String> errorMessages = testCase .getJSONArray("errors") .toList() .stream() .map(Object::toString) .collect(toList()); final String description = testCase.getString("description"); assertThat(description, service.checkConstraints(schema).stream().map(Object::toString).collect(toList()), is(errorMessages)); } }
Source:
private File createHandleServiceDeployCfg( final MongoController mongo, final String shockHost, final URL authURL, final AuthToken shockAdminToken, final String handleAdminRole, final String mongoDB) throws IOException { final File iniFile = tempDir.resolve("handleService.cfg").toFile(); if (iniFile.exists()) { iniFile.delete(); } final Ini ini = new Ini(); final Section hs = ini.add(HANDLE_SERVICE_NAME); hs.add("self-url", "http://localhost:" + handleServicePort); hs.add("service-port", "" + handleServicePort); hs.add("service-host", "localhost"); URL authServiceURL = new URL(authURL.toString() + "/api/legacy/KBase/Sessions/Login"); hs.add("auth-service-url", authServiceURL.toString()); hs.add("auth-url", authURL.toString()); hs.add("shock-url", shockHost); hs.add("admin-token", shockAdminToken.getToken().toString()); hs.add("admin-roles", handleAdminRole); hs.add("mongo-host", "127.0.0.1"); hs.add("mongo-port", "" + mongo.getServerPort()); hs.add("mongo-database", mongoDB); hs.add("mongo-user", ""); hs.add("mongo-password", ""); hs.add("start-local-mongo", 1); hs.add("namespace", "KBH"); ini.store(iniFile); return iniFile; }

Target:
private File createHandleServiceDeployCfg( final MongoController mongo, final String shockHost, final URL authURL, final AuthToken shockAdminToken, final String handleAdminRole, final String mongoDB) throws IOException { final File iniFile = tempDir.resolve("handleService.cfg").toFile(); if (iniFile.exists()) { iniFile.delete(); } final Ini ini = new Ini(); final Section hs = ini.add(HANDLE_SERVICE_NAME); hs.add("self-url", "http://localhost:" + handleServicePort); hs.add("service-port", "" + handleServicePort); hs.add("service-host", "localhost"); URL authServiceURL = new URL(authURL.toString() + "/api/legacy/KBase/Sessions/Login"); hs.add("auth-service-url", authServiceURL.toString()); hs.add("auth-url", authURL.toString()); hs.add("shock-url", shockHost); hs.add("admin-token", shockAdminToken.getToken().toString()); hs.add("admin-roles", handleAdminRole); hs.add("mongo-host", "127.0.0.1"); hs.add("mongo-port", "" + mongo.getServerPort()); hs.add("mongo-database", mongoDB); hs.add("mongo-user", ""); hs.add("mongo-password", ""); hs.add("start-local-mongo", 0); hs.add("namespace", "KBH"); ini.store(iniFile); return iniFile; }
Source:
public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child) { final IndentLevel childIndent; if (child.getMainAst().getType() == TokenTypes.OBJBLOCK) { childIndent = new IndentLevel(getIndent(), getBasicOffset()); } else { childIndent = new IndentLevel(getIndent(), getIndentCheck().getLineWrappingIndentation()); } return childIndent; }

Target:
public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child) { final int offset; if (TokenUtil.isOfType(child.getMainAst(), TokenTypes.OBJBLOCK)) { offset = getBasicOffset(); } else { offset = getLineWrappingIndent(); } return new IndentLevel(getIndent(), offset); }
Source:
public void theFirmwareVersionResultShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetFirmwareVersionAsyncRequest getFirmwareVersionAsyncRequest = FirmwareVersionRequestFactory .fromScenarioContext(); final GetFirmwareVersionResponse getFirmwareVersionResponse = this.smartMeteringConfigurationClient .retrieveGetFirmwareVersionResponse(getFirmwareVersionAsyncRequest); assertNotNull("Get firmware version response has result null", getFirmwareVersionResponse.getResult()); final List<FirmwareVersion> firmwareVersions = getFirmwareVersionResponse.getFirmwareVersion(); assertEquals(firmwareVersions.size(), 3); for (final FirmwareVersion receivedFirmwareVersion : firmwareVersions) { assertNotNull("The received firmware module type is null", receivedFirmwareVersion.getFirmwareModuleType()); LOGGER.info("The received firmware module type: {}", receivedFirmwareVersion.getFirmwareModuleType()); assertNotNull("The received firmware version is null", receivedFirmwareVersion.getVersion()); LOGGER.info("The received firmware version: {}", receivedFirmwareVersion.getVersion()); } }

Target:
public void theFirmwareVersionResultShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetFirmwareVersionAsyncRequest getFirmwareVersionAsyncRequest = FirmwareVersionRequestFactory .fromScenarioContext(); final int EXPECTED_FIRMWARE_VERSION_SIZE = 3; final GetFirmwareVersionResponse getFirmwareVersionResponse = this.smartMeteringConfigurationClient .retrieveGetFirmwareVersionResponse(getFirmwareVersionAsyncRequest); assertNotNull("Get firmware version response has result null", getFirmwareVersionResponse.getResult()); assertEquals("Response should be OK", OsgpResultType.OK, getFirmwareVersionResponse.getResult()); final List<FirmwareVersion> firmwareVersions = getFirmwareVersionResponse.getFirmwareVersion(); assertEquals(firmwareVersions.size(), EXPECTED_FIRMWARE_VERSION_SIZE); for (final FirmwareVersion receivedFirmwareVersion : firmwareVersions) { LOGGER.info("The received firmware module type: {}", receivedFirmwareVersion.getFirmwareModuleType()); assertNotNull("The received firmware module type is null", receivedFirmwareVersion.getFirmwareModuleType()); LOGGER.info("The received firmware version: {}", receivedFirmwareVersion.getVersion()); assertNotNull("The received firmware version is null", receivedFirmwareVersion.getVersion()); } }
Source:
protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder(){ DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL) .tokenCredential(new ClientSecretCredentialBuilder() .tenantId(TENANT_ID) .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .build()); if(interceptorManager.isPlaybackMode()){ builder.httpClient(interceptorManager.getPlaybackClient()); return builder; } if(!interceptorManager.isLiveMode()){ builder.addPolicy(interceptorManager.getRecordPolicy()); } return builder; }

Target:
protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder() { DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL); if (interceptorManager.isPlaybackMode()){ builder.httpClient(interceptorManager.getPlaybackClient()); builder.tokenCredential(new FakeCredentials()); return builder; } if (!interceptorManager.isLiveMode()){ builder.addPolicy(interceptorManager.getRecordPolicy()); } builder.tokenCredential(new ClientSecretCredentialBuilder() .tenantId(TENANT_ID) .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .build()); return builder; }
Source:
private List<String> getArguments() { List<String> args = executionContext.commandLine().allArguments(); if (systemProperties != null) { args.addAll( systemProperties.stream().map( entry -> "-D" + entry) .collect(Collectors.toList())); } args.add("-Dvertx.id=" + getId()); return args; }

Target:
private List<String> getArguments() { List<String> args = executionContext.commandLine().allArguments(); if (systemProperties != null) { systemProperties.stream().map(entry -> "-D" + entry).forEach(args::add); } args.add("-Dvertx.id=" + getId()); return args; }
Source:
public Iterable<Class<? extends ITmfTrace>> getValidTraceTypes() { return new ArrayList<>(); }

Target:
public Iterable<Class<? extends ITmfTrace>> getValidTraceTypes() { return Collections.EMPTY_SET; }
Source:
final Values addValuesSpecificForCacheType(Values generalCacheValues) { return generalCacheValues .andOptional("async-marshalling", asyncMarshalling) .andOptional("mode", mode != null ? mode.getMode() : null) .andOptional("queue-flush-interval", queueFlushInterval) .andOptional("remote-timeout", remoteTimeout) .andOptional("capacity-factor", capacityFactor) .andOptional("consistent-hash-strategy", consistentHashStrategy != null ? consistentHashStrategy.getType() : null) .andOptional("l1-lifespan", l1lifespan) .andOptional("owners", owners) .andOptional("segments", segments); }

Target:
Values addValuesSpecificForCacheType(Values generalCacheValues) { return generalCacheValues .andOptional("async-marshalling", asyncMarshalling) .andOptional("mode", mode != null ? mode.getMode() : null) .andOptional("queue-flush-interval", queueFlushInterval) .andOptional("remote-timeout", remoteTimeout) .andOptional("capacity-factor", capacityFactor) .andOptional("consistent-hash-strategy", consistentHashStrategy != null ? consistentHashStrategy.getType() : null) .andOptional("l1-lifespan", l1lifespan) .andOptional("owners", owners) .andOptional("segments", segments); }
Source:
synchronized private void removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); ConcurrentMap<Guid, SPMTask> activeTaskMap = new ConcurrentHashMap<Guid, SPMTask>(); for (SPMTask task : _tasks.values()) { if (!cachingOver(task)) { activeTaskMap.put(task.getVdsmTaskId(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (poolsOfClearedAndOldTasks.size() > 0) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } for (Guid storagePoolID : poolsOfClearedAndOldTasks) { log.infoFormat("Cleared all tasks of pool {0}.", storagePoolID); } }

Target:
synchronized private void removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); ConcurrentMap<Guid, SPMTask> activeTaskMap = new ConcurrentHashMap<>(); for (SPMTask task : _tasks.values()) { if (!cachingOver(task)) { activeTaskMap.put(task.getVdsmTaskId(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (poolsOfClearedAndOldTasks.size() > 0) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } for (Guid storagePoolID : poolsOfClearedAndOldTasks) { log.infoFormat("Cleared all tasks of pool {0}.", storagePoolID); } }
Source:
public OpenShiftWorkspaceFilesCleaner( OpenShiftPvcHelper openShiftPvcHelper, @Named("che.openshift.project") String projectNamespace, @Named("che.openshift.workspaces.pvc.name") String workspacesPvcName) { this.projectNamespace = projectNamespace; this.workspacesPvcName = workspacesPvcName; this.openShiftPvcHelper = openShiftPvcHelper; this.deleteQueue = ConcurrentHashMap.newKeySet(); this.executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat("OpenShiftWorkspaceFilesCleaner-%d") .setUncaughtExceptionHandler(LoggingUncaughtExceptionHandler.getInstance()) .setDaemon(true) .build()); }

Target:
public OpenShiftWorkspaceFilesCleaner( OpenShiftPvcHelper openShiftPvcHelper, @Named("che.openshift.project") String projectNamespace, @Named("che.openshift.workspaces.pvc.name") String workspacesPvcName) { this.projectNamespace = projectNamespace; this.workspacesPvcName = workspacesPvcName; this.openShiftPvcHelper = openShiftPvcHelper; this.deleteQueue = ConcurrentHashMap.newKeySet(); }
Source:
public @Nullable LanguageServer getLanguageClient() { return this.wrapper.getServer(); }

Target:
public @NonNull LanguageServer getLanguageClient() { return this.server; }
Source:
protected IStatus[] executeFullPublish(IModule[] module, IPath archiveDestination, IModulePathFilter filter, IProgressMonitor monitor) throws CoreException { undeployModuleAndWait(module, archiveDestination, 15000, monitor); return super.executeFullPublish(module, archiveDestination, filter, monitor); }

Target:
protected IStatus[] executeFullPublish(IModule[] module, IPath archiveDestination, IModulePathFilter filter, IProgressMonitor monitor) throws CoreException { boolean undeploySucceeded = undeployModuleAndWait(module, archiveDestination, 45000, monitor); if( !undeploySucceeded ) { ServerLogger.getDefault().log(getServer(), new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, NLS.bind("Safely halting deployment {0} on server {1} before publish has failed.", module[0].getName(), getServer().getName()))); } return super.executeFullPublish(module, archiveDestination, filter, monitor); }
Source:
protected boolean drawState(TimeGraphColorScheme colors, ITimeEvent event, Rectangle rect, GC gc, boolean selected, boolean timeSelected) { int colorIdx = fTimeGraphProvider.getStateTableIndex(event); if (colorIdx < 0 && colorIdx != ITimeGraphPresentationProvider.TRANSPARENT) { return false; } boolean visible = rect.width == 0 ? false : true; Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); gc.setForeground(black); if (visible) { if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) { gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y); gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); if (rect.width == 1) { gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); gc.drawPoint(rect.x, rect.y - 2); } return false; } Color stateColor = null; if (colorIdx < fEventColorMap.length) { stateColor = fEventColorMap[colorIdx]; } else { stateColor = black; } boolean reallySelected = timeSelected && selected; if (!reallySelected) { gc.setBackground(black); gc.fillRectangle(rect); gc.setBackground(stateColor); gc.fillRectangle(rect.x, rect.y+1, rect.width, rect.height-2); } else { gc.setBackground(stateColor); gc.fillRectangle(rect); } } else { gc.drawPoint(rect.x, rect.y - 2); } fTimeGraphProvider.postDrawEvent(event, rect, gc); return visible; }

Target:
protected boolean drawState(TimeGraphColorScheme colors, ITimeEvent event, Rectangle rect, GC gc, boolean selected, boolean timeSelected) { int colorIdx = fTimeGraphProvider.getStateTableIndex(event); if (colorIdx < 0 && colorIdx != ITimeGraphPresentationProvider.TRANSPARENT) { return false; } boolean visible = rect.width == 0 ? false : true; Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); gc.setForeground(black); if (visible) { if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) { gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y); gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); if (rect.width == 1) { gc.drawPoint(rect.x, rect.y - 2); } return false; } Color stateColor = null; if (colorIdx < fEventColorMap.length) { stateColor = fEventColorMap[colorIdx]; } else { stateColor = black; } boolean reallySelected = timeSelected && selected; gc.setBackground(stateColor); gc.fillRectangle(rect); if (reallySelected) { gc.drawRectangle(rect.x, rect.y - 1, rect.width -2, rect.height + 1); } } else { gc.drawPoint(rect.x, rect.y - 2); } fTimeGraphProvider.postDrawEvent(event, rect, gc); return visible; }
Source:
private void disconnect() { try { if (outputStream != null) { outputStream.close(); outputStream = null; } } catch (IOException e) { log.debug("Error while disconnecting to " + hostUrl + " : " + e.getMessage(), e); } try { if (clientSocket != null) { clientSocket.close(); clientSocket = null; } } catch (IOException e) { log.debug("Error while closing socket to " + hostUrl + " : " + e.getMessage(), e); } finally { if(connectionCallback != null){ connectionCallback.onCepReceiverDisconnect(); log.info("--------------------------TCPEventPublisher onclose invoked."); } } }

Target:
private void disconnect() { try { if (outputStream != null) { outputStream.close(); outputStream = null; } } catch (IOException e) { log.debug("Error while disconnecting to " + hostUrl + " : " + e.getMessage(), e); } try { if (clientSocket != null) { clientSocket.close(); clientSocket = null; } } catch (IOException e) { log.debug("Error while closing socket to " + hostUrl + " : " + e.getMessage(), e); } finally { if(connectionCallback != null){ connectionCallback.onCepReceiverDisconnect(); } } }
Source:
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Iterable<T> subjects ) throws E { E exception = null; for ( T subject : subjects ) { try { consumer.accept( subject ); } catch ( Exception caught ) { E castedException = (E) caught; if ( exception == null ) { exception = castedException; } else { exception.addSuppressed( castedException ); } } } if ( exception != null ) { throw exception; } }

Target:
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Iterable<T> subjects ) throws E { E exception = null; for ( T subject : subjects ) { try { consumer.accept( subject ); } catch ( Exception e ) { exception = Exceptions.chain( exception, (E) e ); } } if ( exception != null ) { throw exception; } }
Source:
private void refreshCoordinateData() throws CloudnameException { if (! zkClient.isConnected()) { throw new CloudnameException("No connection to storage."); } String oldDataSerialized = ""; synchronized (coordinateDataMonitor) { if (null != coordinateData) { oldDataSerialized = coordinateData.serialize(); } coordinateData = ZkCoordinateData.loadCoordinateData( path, zkClient.getZookeeper(), this).snapshot(); isSynchronizedWithZookeeper.set(true); if (! oldDataSerialized.equals(coordinateData.toString())) { client.stateChanged(); } } }

Target:
private void refreshCoordinateData() throws CloudnameException { if (! zkClient.isConnected()) { throw new CloudnameException("No connection to storage."); } synchronized (coordinateDataMonitor) { String oldDataSerialized = (null == coordinateData) ? "" : coordinateData.serialize(); coordinateData = ZkCoordinateData.loadCoordinateData( path, zkClient.getZookeeper(), this).snapshot(); isSynchronizedWithZookeeper.set(true); if (! oldDataSerialized.equals(coordinateData.toString())) { client.stateChanged(); } } }
Source:
public void onEvent(ClusterEvent event) { try { queue.put(event); } catch (InterruptedException e) { Throwables.propagate(e); } }

Target:
public void onEvent(ClusterEvent event) { try { queue.put(event); } catch (InterruptedException e) { } }
Source:
public SnapshotStatus[] getSnapshotListing(INodesInPath iip) throws IOException { INodeDirectory srcRoot = getSnapshottableRoot(iip); ReadOnlyList<Snapshot> snapshotList = srcRoot.getDirectorySnapshottableFeature(). getSnapshotList(); if (snapshotList.isEmpty()) { return null; } List<SnapshotStatus> statusList = new ArrayList<>(); for (Snapshot s : snapshotList) { Snapshot.Root dir = s.getRoot(); SnapshotStatus status = new SnapshotStatus(dir.getModificationTime() , dir.getAccessTime(), dir.getFsPermission(), EnumSet.noneOf(HdfsFileStatus.Flags.class), dir.getUserName(), dir.getGroupName(), dir.getLocalNameBytes(), dir.getId(), dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), s.getId(), DFSUtil.string2Bytes(dir.getParent().getFullPathName())); statusList.add(status); } return statusList.toArray( new SnapshotStatus[statusList.size()]); }

Target:
public SnapshotStatus[] getSnapshotListing(INodesInPath iip) throws IOException { INodeDirectory srcRoot = getSnapshottableRoot(iip); ReadOnlyList<Snapshot> snapshotList = srcRoot. getDirectorySnapshottableFeature().getSnapshotList(); SnapshotStatus[] statuses = new SnapshotStatus[snapshotList.size()]; for (int count = 0; count < snapshotList.size(); count++) { Snapshot s = snapshotList.get(count); Snapshot.Root dir = s.getRoot(); statuses[count] = new SnapshotStatus(dir.getModificationTime(), dir.getAccessTime(), dir.getFsPermission(), EnumSet.noneOf(HdfsFileStatus.Flags.class), dir.getUserName(), dir.getGroupName(), dir.getLocalNameBytes(), dir.getId(), dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), s.getId(), DFSUtil.string2Bytes(dir.getParent().getFullPathName())); } return statuses; }
Source:
public Optional<IgniteableData> build(DataView container) throws InvalidDataException { IgniteableData igniteableData = create(); igniteableData.set(Keys.FIRE_DAMAGE_DELAY, getData(container, Keys.FIRE_DAMAGE_DELAY)); igniteableData.set(Keys.FIRE_TICKS, getData(container, Keys.FIRE_TICKS)); return Optional.of(igniteableData); }

Target:
public Optional<IgniteableData> build(DataView container) throws InvalidDataException { int delay = getData(container, Keys.FIRE_DAMAGE_DELAY); int ticks = getData(container, Keys.FIRE_TICKS); IgniteableData igniteableData = new SpongeIgniteableData(ticks, delay); return Optional.of(igniteableData); }
Source:
private void verifyActiveCourseStatistics(InstructorCoursesPage coursesPage, CourseAttributes course) { int numSections = 0; int numTeams = 0; int numStudents = 0; int numUnregistered = 0; Set<String> sections = new HashSet<>(); Set<String> teams = new HashSet<>(); for (StudentAttributes student : testData.students.values()) { if (student.course.equals(course.getId())) { if (!sections.contains(student.section)) { sections.add(student.section); numSections++; } if (!teams.contains(student.team)) { teams.add(student.team); numTeams++; } if (student.googleId.isEmpty()) { numUnregistered++; } numStudents++; } } coursesPage.verifyActiveCourseStatistics(course, Integer.toString(numSections), Integer.toString(numTeams), Integer.toString(numStudents), Integer.toString(numUnregistered)); }

Target:
private void verifyActiveCourseStatistics(InstructorCoursesPage coursesPage, CourseAttributes course) { int numSections = 0; int numTeams = 0; int numStudents = 0; int numUnregistered = 0; Set<String> sections = new HashSet<>(); Set<String> teams = new HashSet<>(); for (StudentAttributes student : testData.students.values()) { if (!student.course.equals(course.getId())) { continue; } if (!sections.contains(student.section)) { sections.add(student.section); numSections++; } if (!teams.contains(student.team)) { teams.add(student.team); numTeams++; } if (student.googleId.isEmpty()) { numUnregistered++; } numStudents++; } coursesPage.verifyActiveCourseStatistics(course, Integer.toString(numSections), Integer.toString(numTeams), Integer.toString(numStudents), Integer.toString(numUnregistered)); }
Source:
public MessageSelector getSelector() { return selector; }

Target:
private MessageSelector getSelector() { return selector; }
Source:
public void addToVersionPreviouslyDownloaded(Version downloadedVersion) { if (listOfVersionsPreviouslyDownloaded == null) { listOfVersionsPreviouslyDownloaded = new ArrayList<>(); } listOfVersionsPreviouslyDownloaded.add(downloadedVersion); }

Target:
public void addToVersionPreviouslyDownloaded(Version downloadedVersion) { versionsPreviouslyDownloaded.add(downloadedVersion); }
Source:
public CodeActionCompletionProposal(Either<Command, CodeAction> command, LSPDocumentInfo info) { this.finfo = info; if (command.isLeft()) { fcommand = command.getLeft(); fdisplayString = fcommand.getTitle(); this.fcompletionProposal = new CompletionProposal(fdisplayString, 0, 0, 0); } else if (command.isRight()) { fcodeAction = command.getRight(); fdisplayString = fcodeAction.getTitle(); this.fcompletionProposal = new CompletionProposal(fdisplayString, 0, 0, 0); } }

Target:
public CodeActionCompletionProposal(Either<Command, CodeAction> command, LSPDocumentInfo info) { this.finfo = info; if (command.isLeft()) { fcommand = command.getLeft(); fdisplayString = fcommand.getTitle(); } else if (command.isRight()) { fcodeAction = command.getRight(); fdisplayString = fcodeAction.getTitle(); } }
Source:
public void initScene() { mMainQuadMaterial = new Material(); mMainQuadMaterial.setColorInfluence(0); mMiniQuadMaterial = new Material(); mMiniQuadMaterial.setColorInfluence(0); mMainQuad = new WorkaroundScreenQuad(); mMainQuad.setMaterial(mMainQuadMaterial); mMainQuad.setTransparent(true); setupMiniTouchLimits(); mMiniQuad = new WorkaroundScreenQuad(); mMiniQuad.setScale(pipScale); mMiniQuad.setX(.5 - pipScale / 2 - pipMarginX / (2 * mDefaultViewportWidth)); mMiniQuad.setY(.5 - pipScale / 2 - pipMarginY / (2 * mDefaultViewportHeight)); mMiniQuad.setMaterial(mMiniQuadMaterial); mMainRenderTarget = new RenderTarget("pipMainRT", mDefaultViewportWidth, mDefaultViewportHeight); mMainRenderTarget.setFullscreen(false); mMiniRenderTarget = new RenderTarget("pipMiniRT", mDefaultViewportWidth, mDefaultViewportHeight); mMiniRenderTarget.setFullscreen(false); addRenderTarget(mMainRenderTarget); addRenderTarget(mMiniRenderTarget); mCompositeScene = getCurrentScene(); mCompositeScene.addChild(mMainQuad); mCompositeScene.addChild(mMiniQuad); try { mMiniQuadMaterial.addTexture(mMiniRenderTarget.getTexture()); mMainQuadMaterial.addTexture(mMainRenderTarget.getTexture()); } catch (ATexture.TextureException e) { e.printStackTrace(); } mMainRenderer.initScene(); mMiniRenderer.initScene(); }

Target:
public void initScene() { mMainQuadMaterial = new Material(); mMainQuadMaterial.setColorInfluence(0); mMiniQuadMaterial = new Material(); mMiniQuadMaterial.setColorInfluence(0); mMainQuad = new WorkaroundScreenQuad(); mMainQuad.setMaterial(mMainQuadMaterial); mMainQuad.setTransparent(true); setupMiniTouchLimits(); mMiniQuad = new WorkaroundScreenQuad(); mMiniQuad.setScale(mPipScale); mMiniQuad.setX(.5d - mPipScale / 2d - mPipMarginX / mDefaultViewportWidth); mMiniQuad.setY(.5d - mPipScale / 2d - mPipMarginY / mDefaultViewportHeight); mMiniQuad.setMaterial(mMiniQuadMaterial); mMainRenderTarget = new RenderTarget("pipMainRT", mDefaultViewportWidth, mDefaultViewportHeight); mMainRenderTarget.setFullscreen(false); mMiniRenderTarget = new RenderTarget("pipMiniRT", mDefaultViewportWidth, mDefaultViewportHeight); mMiniRenderTarget.setFullscreen(false); addRenderTarget(mMainRenderTarget); addRenderTarget(mMiniRenderTarget); mCompositeScene = getCurrentScene(); mCompositeScene.addChild(mMainQuad); mCompositeScene.addChild(mMiniQuad); try { mMiniQuadMaterial.addTexture(mMiniRenderTarget.getTexture()); mMainQuadMaterial.addTexture(mMainRenderTarget.getTexture()); } catch (ATexture.TextureException e) { e.printStackTrace(); } mMainRenderer.initScene(); mMiniRenderer.initScene(); }
Source:
public TaskRepository repository() { if (repository != null) { return repository; } repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER); if (Boolean.parseBoolean(getProperty("api_key_enabled"))) { repository.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); switch (credentials.getUserName()) { case "admin@mylyn.eclipse.org": repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "XkjcuGGfDcoNx0U6uyMM8ZaNuBlEdjrmXd8In3no"); break; case "tests@mylyn.eclipse.org": repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "wvkz2SoBMBQEKv6ishp1j7NY1R9l711g5w2afXc6"); break; default: repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "No Defined Key"); break; } repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), ""), false); } else { repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), credentials.getPassword()), true); } return repository; }

Target:
public TaskRepository repository() { if (repository != null) { return repository; } repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER); if (Boolean.parseBoolean(getProperty("api_key_enabled"))) { repository.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, userAPIKeyMap.getOrDefault(credentials.getUserName(), "")); repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), ""), false); } else { repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), credentials.getPassword()), true); } return repository; }
Source:
public int hashCode() { return (_success ? 1 : 0); }

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_success ? 1 : 0); return result; }
Source:
public void CompleteUnknownPacketTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); PcapFile dummy = trace.getTrace(); ByteBuffer byteBuffer = fPacket; if (byteBuffer == null) { fail("CompleteUnknownPacketTest has failed!"); return; } UnknownPacket packet = new UnknownPacket(dummy, null, byteBuffer); assertEquals(PcapProtocol.UNKNOWN, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.UDP)); assertTrue(packet.validate()); assertEquals(1089, packet.hashCode()); assertFalse(packet.equals(null)); assertEquals(new UnknownPacket(dummy, null, byteBuffer), packet); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(fToString, packet.toString()); assertEquals("Len: 1 bytes", packet.getLocalSummaryString()); assertEquals("Data: 1 bytes", packet.getGlobalSummaryString()); assertFalse(packet.getSourceEndpoint().equals(new UnknownEndpoint(packet, true))); assertFalse(packet.getDestinationEndpoint().equals(new UnknownEndpoint(packet, false))); fPacket.position(0); byte[] payload = new byte[1]; fPacket.get(payload); ByteBuffer payloadBB = ByteBuffer.wrap(payload); payloadBB.flip(); assertEquals(payloadBB, packet.getPayload()); }

Target:
public void CompleteUnknownPacketTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); try (PcapFile dummy = trace.getTrace();) { ByteBuffer byteBuffer = fPacket; if (byteBuffer == null) { fail("CompleteUnknownPacketTest has failed!"); return; } UnknownPacket packet = new UnknownPacket(dummy, null, byteBuffer); assertEquals(PcapProtocol.UNKNOWN, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.UDP)); assertTrue(packet.validate()); assertEquals(1089, packet.hashCode()); assertFalse(packet.equals(null)); assertEquals(new UnknownPacket(dummy, null, byteBuffer), packet); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(fToString, packet.toString()); assertEquals("Len: 1 bytes", packet.getLocalSummaryString()); assertEquals("Data: 1 bytes", packet.getGlobalSummaryString()); assertFalse(packet.getSourceEndpoint().equals(new UnknownEndpoint(packet, true))); assertFalse(packet.getDestinationEndpoint().equals(new UnknownEndpoint(packet, false))); fPacket.position(0); byte[] payload = new byte[1]; fPacket.get(payload); ByteBuffer payloadBB = ByteBuffer.wrap(payload); payloadBB.flip(); assertEquals(payloadBB, packet.getPayload()); } }
Source:
protected void writeScalarProperty(Property entity, CSVPrinter printer) throws IOException { Object value = entity.getValue(); Type type = entity.getType(); if (type instanceof BinaryType) { writeUnsupported(type, printer); } else { String valueAsString = null; if (value == null) { printer.print(null); } else { valueAsString = type.encode(value); printer.print(valueAsString); } Directory vocabulary = getVocabulary(type); if (vocabulary != null) { writeScalarVocabularyProperty(valueAsString, vocabulary, printer); } } }

Target:
protected void writeScalarProperty(Property entity, CSVPrinter printer) throws IOException { Object value = entity.getValue(); Type type = entity.getType(); if (type instanceof BinaryType) { writeUnsupported(type, printer); } else { String valueAsString = null; if (value == null) { printer.print(null); } else { valueAsString = type.encode(value); printer.print(valueAsString); } Directory vocabulary = DocumentModelCSVHelper.getVocabulary(type); if (vocabulary != null) { writeScalarVocabularyProperty(valueAsString, vocabulary, printer); } } }
Source:
public com.twitter.heron.api.Config getHeronConfig() { return heronConfig; }

Target:
com.twitter.heron.api.Config getHeronConfig() { return heronConfig; }
Source:
public int hashCode() { int hash = 7; hash = 17 * hash + (this.id != null ? this.id.hashCode() : 0); return hash; }

Target:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(7, 17) .append(this.id); return builder.toHashCode(); }