auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String encodeSCIMException(AbstractCharonException exception) { JSONObject rootErrorObject = new JSONObject(); JSONObject errorObject = new JSONObject(); try { JSONArray arrSchemas = new JSONArray(Arrays.asList(new String[]{exception.getSchemas()})); errorObject.put(ResponseCodeConstants.SCHEMAS, arrSchemas); errorObject.put(ResponseCodeConstants.SCIM_TYPE, String.valueOf(exception.getScimType())); errorObject.put(ResponseCodeConstants.DETAIL, String.valueOf(exception.getDetail())); errorObject.put(ResponseCodeConstants.STATUS, String.valueOf(exception.getStatus())); rootErrorObject = errorObject; } catch (JSONException e) { logger.error("SCIMException encoding error"); } return rootErrorObject.toString(); }

Target:
public String encodeSCIMException(AbstractCharonException exception) { JSONObject rootErrorObject = new JSONObject(); JSONObject errorObject = new JSONObject(); try { JSONArray arrSchemas = new JSONArray(Collections.singletonList(exception.getSchemas())); errorObject.put(ResponseCodeConstants.SCHEMAS, arrSchemas); errorObject.put(ResponseCodeConstants.SCIM_TYPE, String.valueOf(exception.getScimType())); errorObject.put(ResponseCodeConstants.DETAIL, String.valueOf(exception.getDetail())); errorObject.put(ResponseCodeConstants.STATUS, String.valueOf(exception.getStatus())); rootErrorObject = errorObject; } catch (JSONException e) { logger.error("SCIMException encoding error"); } return rootErrorObject.toString(); }
Source:
public void start() throws Exception { CompletableFuture future = startRunnableBase(); runnableBase.start(solution); Thread.sleep(1000); assertTrue(runnableBase.isStarted()); verify(solver).addEventListener(eventListenerCaptor.capture()); eventListenerCaptor.getValue().bestSolutionChanged(event); verify(eventListener).bestSolutionChanged(event); runnableBase.destroy(); future.get(); }

Target:
public void start() throws Exception { CompletableFuture future = startRunnableBase(); runnableBase.start(solution); startFinished.await(); assertTrue(runnableBase.isStarted()); verify(solver).addEventListener(eventListenerCaptor.capture()); eventListenerCaptor.getValue().bestSolutionChanged(event); verify(eventListener).bestSolutionChanged(event); runnableBase.destroy(); future.get(); assertTrue(runnableBase.isDestroyed()); }
Source:
private void setupListView() { setVgrow(listView, Priority.ALWAYS); setupKeyboardShortcuts(); setupContextMenu(); listView.setOnItemSelected((i, e) -> { updateContextMenu(contextMenu); TurboIssue issue = listView.getItems().get(i).getIssue(); if (e.booleanValue() == listView.SHOULD_LOAD_BVIEW_ISSUE) { ui.triggerEvent( new IssueSelectedEvent(issue.getRepoId(), issue.getId(), panelIndex, issue.isPullRequest()) ); } issueCommentCounts.put(issue.getId(), issue.getCommentCount()); issueNonSelfCommentCounts.put(issue.getId(), issue.getMetadata().getNonSelfCommentCount()); refreshItems(); }); }

Target:
private void setupListView() { setVgrow(listView, Priority.ALWAYS); setupKeyboardShortcuts(); setupContextMenu(); listView.setOnItemSelected(i -> { updateContextMenu(contextMenu); TurboIssue issue = listView.getItems().get(i).getIssue(); ui.triggerEvent( new IssueSelectedEvent(issue.getRepoId(), issue.getId(), panelIndex, issue.isPullRequest()) ); issueCommentCounts.put(issue.getId(), issue.getCommentCount()); issueNonSelfCommentCounts.put(issue.getId(), issue.getMetadata().getNonSelfCommentCount()); refreshItems(); }); }
Source:
private void startUploadService(MediaModel media) { final ArrayList<MediaModel> mediaList = new ArrayList<>(); if (MediaUploadState.QUEUED.toString().equals(media.getUploadState())) { mediaList.add(media); } if (!mediaList.isEmpty()) { savePostAsync(new AfterSavePostListener() { @Override public void onPostSave() { UploadService.uploadMedia(EditPostActivity.this, mediaList); } }); } }

Target:
private void startUploadService(MediaModel media) { if (!MediaUploadState.QUEUED.toString().equals(media.getUploadState())) { return; } final ArrayList<MediaModel> mediaList = new ArrayList<>(); mediaList.add(media); savePostAsync(new AfterSavePostListener() { @Override public void onPostSave() { UploadService.uploadMedia(EditPostActivity.this, mediaList); } }); }
Source:
public void testDefaultLogPerNRowsArgument() throws Exception { String[] args = {"-listFiles"}; Pherf pherf = new Pherf(args); Properties prop = pherf.getProperties(); assertEquals(Long.valueOf(PherfConstants.LOG_PER_NROWS), Long.valueOf(prop.getProperty(PherfConstants.LOG_PER_N_ROWS))); }

Target:
public void testDefaultLogPerNRowsArgument() throws Exception { String[] args = {"-listFiles"}; assertEquals(Long.valueOf(PherfConstants.LOG_PER_NROWS), getLogPerNRowsValue(new Pherf(args).getProperties())); }
Source:
protected TransactionManager getManager() { return new SerializableTransactionManager( keyValueService, timestampService, lockClient, lockService, transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictDetectionManager, SweepStrategyManagers.createDefault(keyValueService), NoOpCleaner.INSTANCE, GET_RANGES_CONCURRENCY, GET_RANGES_CONCURRENT_REQUEST_TIMEOUT); }

Target:
protected TransactionManager getManager() { return new SerializableTransactionManager( keyValueService, timestampService, lockClient, lockService, transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictDetectionManager, SweepStrategyManagers.createDefault(keyValueService), NoOpCleaner.INSTANCE, AbstractTransactionTest.GET_RANGES_CONCURRENCY); }
Source:
public void validate(ValidationContext validationContext) { for (EnvironmentPipelineConfig pipelineRefConfig : this.pipelines) { PipelineConfig pipelineConfig = validationContext.getPipelineConfigByName(pipelineRefConfig.getName()); if (pipelineConfig == null) continue; if (validationContext.shouldCheckConfigRepo()) { if (!validationContext.getConfigRepos().isReferenceAllowed(this.origin, pipelineConfig.getOrigin())) pipelineRefConfig.addError(EnvironmentPipelineConfig.ORIGIN, String.format("Environment defined in %s cannot reference a pipeline in %s", this.origin, displayNameFor(pipelineConfig.getOrigin()))); } } }

Target:
public void validate(ValidationContext validationContext) { for (EnvironmentPipelineConfig pipelineRefConfig : this.pipelines) { ConfigReposConfig configRepos = validationContext.getConfigRepos(); PipelineConfig pipelineConfig = validationContext.getPipelineConfigByName(pipelineRefConfig.getName()); if (pipelineConfig == null) { continue; } if (validationContext.shouldCheckConfigRepo()) { if (!configRepos.isReferenceAllowed(this.origin, pipelineConfig.getOrigin())) pipelineRefConfig.addError(EnvironmentPipelineConfig.ORIGIN, String.format("Environment defined in %s cannot reference a pipeline in %s", this.origin, displayNameFor(pipelineConfig.getOrigin()))); } } }
Source:
public int getConsumptionRate(State state) { return GeneralConfig.panelDisplayBaseConsumption; }

Target:
public int getConsumptionRate(State state) { return state.hasVariable() ? GeneralConfig.panelDisplayBaseConsumptionEnabled : GeneralConfig.panelDisplayBaseConsumptionDisabled; }
Source:
public void support_custom_timeouts() { int readTimeout = 2000; System.setProperty("sonar.ws.timeout", String.valueOf(readTimeout)); Logger logger = mock(Logger.class); OkHttpClient underTest = OkHttpClientFactory.create(logger); assertThat(underTest.readTimeoutMillis()).isEqualTo(readTimeout); }

Target:
public void support_custom_timeouts() { int readTimeout = 2000; System.setProperty(SONAR_WS_TIMEOUT, String.valueOf(readTimeout)); Logger logger = mock(Logger.class); OkHttpClient underTest = OkHttpClientFactory.create(logger); assertThat(underTest.readTimeoutMillis()).isEqualTo(readTimeout); }
Source:
public void select_by_organization_and_name() { OrganizationDto organization = db.organizations().insert(); QualityGateDto sonarWay = db.qualityGates().insertQualityGate(organization, g -> g.setName("Sonar way")); QualityGateDto veryStrict = db.qualityGates().insertQualityGate(organization, g -> g.setName("Very strict")); OrganizationDto otherOrganization = db.organizations().insert(); QualityGateDto otherSonarWay = db.qualityGates().insertQualityGate(otherOrganization, g -> g.setName("Sonar way")); assertThat(underTest.selectByOrganizationAndName(dbSession, organization, sonarWay.getName()).getUuid()).isEqualTo(sonarWay.getUuid()); assertThat(underTest.selectByOrganizationAndName(dbSession, otherOrganization, sonarWay.getName()).getUuid()).isEqualTo(otherSonarWay.getUuid()); assertThat(underTest.selectByOrganizationAndName(dbSession, organization, "Unknown")).isNull(); }

Target:
public void select_by_organization_and_name() { OrganizationDto organization = db.organizations().insert(); QGateWithOrgDto qualityGate1 = db.qualityGates().insertQualityGate(organization); QGateWithOrgDto qualityGate2 = db.qualityGates().insertQualityGate(organization); OrganizationDto otherOrganization = db.organizations().insert(); QGateWithOrgDto qualityGate3 = db.qualityGates().insertQualityGate(otherOrganization); assertThat(underTest.selectByOrganizationAndName(dbSession, organization, qualityGate1.getName()).getUuid()).isEqualTo(qualityGate1.getUuid()); assertThat(underTest.selectByOrganizationAndName(dbSession, otherOrganization, qualityGate3.getName()).getUuid()).isEqualTo(qualityGate3.getUuid()); assertThat(underTest.selectByOrganizationAndName(dbSession, organization, "Unknown")).isNull(); }
Source:
public void pushDirectory(IPath dir) { if (dir != null) { URI uri; URI workingDirectoryURI = getWorkingDirectoryURI(); if (!dir.isAbsolute()) uri = URIUtil.append(workingDirectoryURI, dir.toString()); else { uri = toURI(dir); if (uri == null) return; } pushDirectoryURI(uri); } }

Target:
public void pushDirectory(IPath dir) { if (dir != null) { URI uri; URI workingDirectoryURI = getWorkingDirectoryURI(); if (!dir.isAbsolute()) { uri = URIUtil.append(workingDirectoryURI, dir.toString()); } else { uri = toURI(dir); if (uri == null) { return; } } pushDirectoryURI(uri); } }
Source:
public String toString() { int[] types = getTransportTypes(); String transports = (types.length > 0) ? " Transports: " + transportNamesOf(types) : ""; types = getCapabilities(); String capabilities = (types.length > 0 ? " Capabilities: " : ""); for (int i = 0; i < types.length; ) { capabilities += capabilityNameOf(types[i]); if (++i < types.length) capabilities += "&"; } String upBand = ((mLinkUpBandwidthKbps > 0) ? " LinkUpBandwidth>=" + mLinkUpBandwidthKbps + "Kbps" : ""); String dnBand = ((mLinkDownBandwidthKbps > 0) ? " LinkDnBandwidth>=" + mLinkDownBandwidthKbps + "Kbps" : ""); String specifier = (mNetworkSpecifier == null ? "" : " Specifier: <" + mNetworkSpecifier + ">"); String signalStrength = (hasSignalStrength() ? " SignalStrength: " + mSignalStrength : ""); final String uids; if (null == mUids) { uids = ""; } else if (1 == mUids.size() && mUids.valueAt(0).isSingleUid()) { uids = " Uid: " + mUids.valueAt(0).start; } else { uids = " Uids: <" + mUids + ">"; } String establishingAppUid = 0 > mEstablishingVpnAppUid ? "" : " EstablishingAppUid: " + mEstablishingVpnAppUid; return "[" + transports + capabilities + upBand + dnBand + specifier + signalStrength + uids + establishingAppUid + "]"; }

Target:
public String toString() { final StringBuilder sb = new StringBuilder("["); if (0 != mTransportTypes) { sb.append(" Transports: "); appendStringRepresentationOfBitMaskToStringBuilder(sb, mTransportTypes, NetworkCapabilities::transportNameOf, "|"); } if (0 != mNetworkCapabilities) { sb.append(" Capabilities: "); appendStringRepresentationOfBitMaskToStringBuilder(sb, mNetworkCapabilities, NetworkCapabilities::capabilityNameOf, "&"); } if (mLinkUpBandwidthKbps > 0) { sb.append(" LinkUpBandwidth>=" + mLinkUpBandwidthKbps + "Kbps"); } if (mLinkDownBandwidthKbps > 0) { sb.append(" LinkDnBandwidth>=" + mLinkDownBandwidthKbps + "Kbps"); } if (mNetworkSpecifier != null) { sb.append(" Specifier: <" + mNetworkSpecifier + ">"); } if (hasSignalStrength()) { sb.append(" SignalStrength: " + mSignalStrength); } if (null != mUids) { if (1 == mUids.size() && mUids.valueAt(0).isSingleUid()) { sb.append(" Uid: " + mUids.valueAt(0).start); } else { sb.append(" Uids: <" + mUids + ">"); } } if (mEstablishingVpnAppUid > 0) { sb.append(" EstablishingAppUid: " + mEstablishingVpnAppUid); } sb.append("]"); return sb.toString(); }
Source:
private static Map<String, Set<AssignableReplica>> parseAllReplicas( ResourceControllerDataProvider dataProvider, Map<String, Resource> resourceMap, int instanceCount) { Map<String, Set<AssignableReplica>> totalReplicaMap = new HashMap<>(); for (String resourceName : resourceMap.keySet()) { ResourceConfig config = dataProvider.getResourceConfig(resourceName); IdealState is = dataProvider.getIdealState(resourceName); if (is == null) { throw new HelixException( "Cannot find the resource ideal state for resource: " + resourceName); } String defName = is.getStateModelDefRef(); StateModelDefinition def = dataProvider.getStateModelDef(defName); if (def == null) { throw new IllegalArgumentException(String .format("Cannot fine state model definition %s for resource %s.", is.getStateModelDefRef(), resourceName)); } Map<String, Integer> stateCountMap = def.getStateCountMap(instanceCount, is.getReplicaCount(instanceCount)); for (String partition : is.getPartitionSet()) { for (Map.Entry<String, Integer> entry : stateCountMap.entrySet()) { String state = entry.getKey(); for (int i = 0; i < entry.getValue(); i++) { totalReplicaMap.computeIfAbsent(resourceName, key -> new HashSet<>()).add( new AssignableReplica(config, partition, state, def.getStatePriorityMap().get(state))); } } } } return totalReplicaMap; }

Target:
private static Map<String, Set<AssignableReplica>> parseAllReplicas( ResourceControllerDataProvider dataProvider, Map<String, Resource> resourceMap, int instanceCount) { Map<String, Set<AssignableReplica>> totalReplicaMap = new HashMap<>(); for (String resourceName : resourceMap.keySet()) { ResourceConfig config = dataProvider.getResourceConfig(resourceName); IdealState is = dataProvider.getIdealState(resourceName); if (is == null) { throw new HelixException( "Cannot find the resource ideal state for resource: " + resourceName); } String defName = is.getStateModelDefRef(); StateModelDefinition def = dataProvider.getStateModelDef(defName); if (def == null) { throw new IllegalArgumentException(String .format("Cannot find state model definition %s for resource %s.", is.getStateModelDefRef(), resourceName)); } Map<String, Integer> stateCountMap = def.getStateCountMap(instanceCount, is.getReplicaCount(instanceCount)); for (String partition : is.getPartitionSet()) { for (Map.Entry<String, Integer> entry : stateCountMap.entrySet()) { String state = entry.getKey(); for (int i = 0; i < entry.getValue(); i++) { totalReplicaMap.computeIfAbsent(resourceName, key -> new HashSet<>()).add( new AssignableReplica(config, partition, state, def.getStatePriorityMap().get(state))); } } } } return totalReplicaMap; }
Source:
private JSONObject getReplicas(String blobId) throws RestServiceException { try { PartitionId partitionId = BlobId.fromStringId(blobId, clusterMap).getPartition(); if (partitionId == null) { adminMetrics.invalidBlobIdError.inc(); logger.warn("Partition for blob id is null. The blob id might be invalid", blobId); throw new RestServiceException("Partition for blob id " + blobId + " is null. The id might be invalid", RestServiceErrorCode.NotFound); } return packageResult(partitionId.getReplicaIds()); } catch (IllegalArgumentException e) { adminMetrics.invalidBlobIdError.inc(); throw new RestServiceException("Invalid blob id received for getReplicasForBlob request - " + blobId, e, RestServiceErrorCode.NotFound); } catch (IOException | JSONException e) { adminMetrics.responseConstructionError.inc(); throw new RestServiceException("Could not create response for GET of replicas for " + blobId, e, RestServiceErrorCode.InternalServerError); } }

Target:
private JSONObject getReplicas(String blobId) throws RestServiceException { try { PartitionId partitionId = new BlobId(blobId, clusterMap).getPartition(); if (partitionId == null) { adminMetrics.invalidBlobIdError.inc(); logger.warn("Partition for blob id is null. The blob id might be invalid", blobId); throw new RestServiceException("Partition for blob id " + blobId + " is null. The id might be invalid", RestServiceErrorCode.NotFound); } return packageResult(partitionId.getReplicaIds()); } catch (IllegalArgumentException e) { adminMetrics.invalidBlobIdError.inc(); throw new RestServiceException("Invalid blob id received for getReplicasForBlob request - " + blobId, e, RestServiceErrorCode.NotFound); } catch (IOException | JSONException e) { adminMetrics.responseConstructionError.inc(); throw new RestServiceException("Could not create response for GET of replicas for " + blobId, e, RestServiceErrorCode.InternalServerError); } }
Source:
public static int countItems(NLSSubstitution[] elems, int task) { Assert.isTrue(task == NLSSubstitution.EXTERNALIZED || task == NLSSubstitution.IGNORED || task == NLSSubstitution.INTERNALIZED); int result= 0; for (NLSSubstitution elem : elems) { if (elem.fState == task) { result++; } } return result; }

Target:
public static int countItems(NLSSubstitution[] elems, int task) { Assert.isTrue(task == NLSSubstitution.EXTERNALIZED || task == NLSSubstitution.IGNORED || task == NLSSubstitution.INTERNALIZED); int result= 0; for (NLSSubstitution substitution : elems) { if (substitution.fState == task) { result++; } } return result; }
Source:
public void processingReferenceSection() throws Exception { String text = "(1) Ahrens, M. Home fires that began with upholstered furniture; National Fire Protection Association: Quincy, Massachusetts, 2011.\n" + "(2) Evarts, B. Home fires that began with matresses and bedding; National Fire Protection Association: Quincy, Massachusetts, 2011.\n" + "(3) Kramer, R. H.; Zammarano, M.; Linteris, G. T.; Gedde, U. W.; Gilman, J. W. Polym. Degrad. Stab. 2010, 95, 1115−1122.\n" + "(4) Underwriter Laboratories, UL test: Legacy home contents and new content fires, YouTube online video clip, 2011.\n" + "(5) Gallagher, S.; Campbell, J. In Siloxane-Phosphonate Finishes on Cellulose: Thermal Characterization and Flammability Data; Proceed-ings of the Beltwide Cotton Conference, San Antonio, TX, 2004; pp 2443-2847.\n" + "(6) Watanabe, I.; Sakai, S. Environ. Int. 2003, 29, 665−682. (7) Babrauskas, V.; Blum,\n"; List<BibDataSet> res = engine.getParsers().getCitationParser().processingReferenceSection(text, engine.getParsers().getReferenceSegmenterParser()); assertNotNull(res); System.out.println(res); assertTrue(res.size() > 2); }

Target:
public void processingReferenceSection() throws Exception { String text = "(1) Ahrens, M. Home fires that began with upholstered furniture; National Fire Protection Association: Quincy, Massachusetts, 2011.\n" + "(2) Evarts, B. Home fires that began with matresses and bedding; National Fire Protection Association: Quincy, Massachusetts, 2011.\n" + "(3) Kramer, R. H.; Zammarano, M.; Linteris, G. T.; Gedde, U. W.; Gilman, J. W. Polym. Degrad. Stab. 2010, 95, 1115−1122.\n" + "(4) Underwriter Laboratories, UL test: Legacy home contents and new content fires, YouTube online video clip, 2011.\n" + "(5) Gallagher, S.; Campbell, J. In Siloxane-Phosphonate Finishes on Cellulose: Thermal Characterization and Flammability Data; Proceed-ings of the Beltwide Cotton Conference, San Antonio, TX, 2004; pp 2443-2847.\n" + "(6) Watanabe, I.; Sakai, S. Environ. Int. 2003, 29, 665−682. (7) Babrauskas, V.; Blum,\n"; List<BibDataSet> res = engine.getParsers().getCitationParser().processingReferenceSection(text, engine.getParsers().getReferenceSegmenterParser()); assertNotNull(res); assertTrue(res.size() > 2); }
Source:
public T getAckCheckpoint(String source, int sourcePartition) { CallbackStatus status = _callbackStatusMap.get(new SourcePartition(source, sourcePartition)); return status != null ? status.getAckCheckpoint() : null; }

Target:
public Optional<T> getAckCheckpoint(String source, int sourcePartition) { CallbackStatus status = _callbackStatusMap.get(new SourcePartition(source, sourcePartition)); return Optional.ofNullable(status).map(CallbackStatus::getAckCheckpoint); }
Source:
private void syncLocator() { if (!locator.isValid()) synchronized (this) { if (!locator.isValid()) locator = getLocatorFunction.getLocator(); } }

Target:
private TabletLocator syncLocator() { TabletLocator loc = this.locator; if (!loc.isValid()) synchronized (this) { if (locator == loc) try { loc = locator = getLocatorFunction.call(); } catch (Exception e) { log.error("Problem obtaining TabletLocator", e); throw new RuntimeException(e); } } return loc; }
Source:
public static String getClassName(String filePath) { if (filePath == null) { return null; } String fileName = Paths.get(filePath).getFileName().toString(); return fileName.substring(0, fileName.indexOf('.')); }

Target:
public static String getClassName(String filePath) { if (filePath == null) { System.err.println("File path should not be null."); System.exit(1); } String fileName = Paths.get(filePath).getFileName().toString(); return fileName.substring(0, fileName.indexOf('.')); }
Source:
public Map<Integer, Long> pagesCount(CacheGroupContext grp) throws IgniteCheckedException { Map<Integer, Long> partStates = new HashMap<>(); ctx.cache().context().database().checkpointReadLock(); try { forEachPageStore(grp, new IgniteInClosureX<Integer>() { @Override public void applyx(Integer partId) throws IgniteCheckedException { int pagesCnt = ctx.cache().context().pageStore().pages(grp.groupId(), partId); partStates.put(partId, (long)pagesCnt); } }); } finally { ctx.cache().context().database().checkpointReadUnlock(); } return partStates; }

Target:
public long[] pagesCount(CacheGroupContext grp) throws IgniteCheckedException { long[] partStates = new long[grp.affinity().partitions() + 1]; ctx.cache().context().database().checkpointReadLock(); try { forEachPageStore(grp, new IgniteInClosureX<Integer>() { @Override public void applyx(Integer partId) throws IgniteCheckedException { int pagesCnt = ctx.cache().context().pageStore().pages(grp.groupId(), partId); partStates[Math.min(partId, partStates.length - 1)] = pagesCnt; } }); } finally { ctx.cache().context().database().checkpointReadUnlock(); } return partStates; }
Source:
public boolean supportsScroll() { StorageConfiguration conf = coreFeature.getStorageConfiguration(); return conf.isDBSMongoDB() || conf.isVCS(); }

Target:
public boolean supportsScroll() { StorageConfiguration conf = coreFeature.getStorageConfiguration(); return (conf.isDBSMongoDB() || conf.isVCS()); }
Source:
public void postGetHeadDeleteTest() throws ExecutionException, InterruptedException, JSONException { ByteBuffer content = ByteBuffer.wrap(getRandomBytes(1024)); String serviceId = "postGetHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "postGetHeadDeleteOwnerID"; HttpHeaders headers = new DefaultHttpHeaders(); setAmbryHeaders(headers, content.capacity(), 7200, false, serviceId, contentType, ownerId); headers.set(HttpHeaders.Names.CONTENT_LENGTH, content.capacity()); headers.add(RestUtils.Headers.UserMetaData_Header_Prefix + "key1", "value1"); headers.add(RestUtils.Headers.UserMetaData_Header_Prefix + "key2", "value2"); String blobId = postBlobAndVerify(headers, content); getBlobAndVerify(blobId, headers, content); getHeadAndVerify(blobId, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId); }

Target:
public void postGetHeadDeleteTest() throws ExecutionException, InterruptedException, JSONException { ByteBuffer content = ByteBuffer.wrap(RestTestUtils.getRandomBytes(1024)); String serviceId = "postGetHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "postGetHeadDeleteOwnerID"; HttpHeaders headers = new DefaultHttpHeaders(); setAmbryHeaders(headers, content.capacity(), 7200, false, serviceId, contentType, ownerId); headers.set(HttpHeaders.Names.CONTENT_LENGTH, content.capacity()); headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key1", "value1"); headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key2", "value2"); String blobId = postBlobAndVerify(headers, content); getBlobAndVerify(blobId, headers, content); getHeadAndVerify(blobId, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId); }
Source:
public void resetInput(Block block) { requireNonNull(block, "block is null"); this.columnarMap = toColumnarMap(block); currentPosition = 0; keyUnnestBlockBuilder.resetInputBlock(columnarMap.getKeysBlock()); valueUnnestBlockBuilder.resetInputBlock(columnarMap.getValuesBlock()); }

Target:
public void resetInput(Block block) { requireNonNull(block, "block is null"); columnarMap = toColumnarMap(block); keyUnnestBlockBuilder.resetInputBlock(columnarMap.getKeysBlock()); valueUnnestBlockBuilder.resetInputBlock(columnarMap.getValuesBlock()); int positionCount = block.getPositionCount(); lengths = ensureCapacity(lengths, positionCount); for (int i = 0; i < positionCount; i++) { lengths[i] = columnarMap.getEntryCount(i); } }
Source:
@Test public void responseBodyBuffers() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.getUrl("/").toString()) .converterFactory(new ToStringConverterFactory()) .build(); Service example = retrofit.create(Service.class); server.enqueue(new MockResponse() .setBody("1234") .setSocketPolicy(DISCONNECT_DURING_RESPONSE_BODY)); try { example.getBody().execute(); } catch (IOException e) { assertThat(e).hasMessage("unexpected end of stream"); } }

Target:
@Test public void responseBodyBuffers() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.getUrl("/").toString()) .converterFactory(new ToStringConverterFactory()) .build(); Service example = retrofit.create(Service.class); server.enqueue(new MockResponse() .setBody("1234") .setSocketPolicy(DISCONNECT_DURING_RESPONSE_BODY)); Call<ResponseBody> buffered = example.getBody(); try { buffered.execute(); fail(); } catch (IOException e) { assertThat(e).hasMessage("unexpected end of stream"); } }
Source:
public static ICommonXAxisResponse create(String title, double[] xValues, Map<String, IYSeries> ySeries, long currentEnd, boolean isComplete) { ICommonXAxisModel model = new CommonXAxisModel(title, xValues, ySeries); if (isComplete) { return new CommonXAxisResponse(model, ICommonXAxisResponse.Status.COMPLETED, "Completed", currentEnd); } return new CommonXAxisResponse(model, ICommonXAxisResponse.Status.RUNNING, "Running", currentEnd); }

Target:
public static ICommonXAxisResponse create(String title, double[] xValues, Map<String, IYSeries> ySeries, long currentEnd, boolean isComplete) { ICommonXAxisModel model = new CommonXAxisModel(title, xValues, ySeries); if (isComplete) { return new CommonXAxisResponse(model, ICommonXAxisResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED, currentEnd); } return new CommonXAxisResponse(model, ICommonXAxisResponse.Status.RUNNING, CommonStatusMessage.RUNNING, currentEnd); }
Source:
private void analyzeIfRequired(Session session) { synchronized (this) { if (++changesSinceAnalyze <= nextAnalyze) { return; } changesSinceAnalyze = 0; if (nextAnalyze <= Integer.MAX_VALUE / 2) { nextAnalyze *= 2; } } session.markTableForAnalyze(this); }

Target:
private void analyzeIfRequired(Session session) { if (changesUnitlAnalyze != null) { if (changesUnitlAnalyze.decrementAndGet() == 0) { if (nextAnalyze <= Integer.MAX_VALUE / 2) { nextAnalyze *= 2; } changesUnitlAnalyze.set(nextAnalyze); session.markTableForAnalyze(this); } } }
Source:
private void storeFile(History histNew, File file, Repository repo, boolean mergeHistory) throws HistoryException { File cacheFile = getCachedFile(file); History history = histNew; File dir = cacheFile.getParentFile(); if (!dir.isDirectory() && !dir.mkdirs()) { throw new HistoryException( "Unable to create cache directory '" + dir + "'."); } if (mergeHistory && cacheFile.exists()) { history = mergeOldAndNewHistory(cacheFile, histNew, repo); } writeHistoryToFile(dir, history, cacheFile); }

Target:
private void storeFile(History histNew, File file, Repository repo, boolean mergeHistory) throws HistoryException { File cacheFile = getCachedFile(file); History history = histNew; File dir = cacheFile.getParentFile(); if (!dir.isDirectory() && !dir.mkdirs()) { throw new HistoryException( "Unable to create cache directory '" + dir + "'."); } if (mergeHistory && cacheFile.exists()) { history = mergeOldAndNewHistory(cacheFile, histNew, repo); } if (history != null) { writeHistoryToFile(dir, history, cacheFile); } else { writeHistoryToFile(dir, histNew, cacheFile); } }
Source:
synchronized public Instance getInstance() { if (cachedInstance == null) { if (mock) { cachedInstance = DeprecationUtil.makeMockInstance(instance); } else { try { cachedInstance = getConnector().getInstance(); } catch (AccumuloSecurityException | AccumuloException e) { throw new RuntimeException(e); } } } return cachedInstance; }

Target:
synchronized public Instance getInstance() { if (cachedInstance == null) { try { cachedInstance = getConnector().getInstance(); } catch (AccumuloSecurityException | AccumuloException e) { throw new IllegalStateException(e); } } return cachedInstance; }
Source:
private List<Cluster> getClustersWithOvsSwitchType(Guid networkId) { List<NetworkCluster> physicalNetworkClusters = networkClusterDao.getAllForNetwork(networkId); return physicalNetworkClusters.stream() .map(networkCluster -> clusterDao.get(networkCluster.getClusterId())) .filter(cluster -> cluster.getRequiredSwitchTypeForCluster().equals(SwitchType.OVS)) .collect(Collectors.toList()); }

Target:
private List<Cluster> getClustersWithOvsSwitchType(Guid networkId) { List<NetworkCluster> physicalNetworkClusters = networkClusterDao.getAllForNetwork(networkId); return physicalNetworkClusters.stream() .map(networkCluster -> clusterDao.get(networkCluster.getClusterId())) .filter(cluster -> cluster.hasRequiredSwitchType(SwitchType.OVS)) .collect(Collectors.toList()); }
Source:
public String toString() { if (getName() == null) { return getPersonId(); } else { if (getPersonId() == null) { return getName(); } else { if (getName().equals(getPersonId())) { return getName(); } else { return getName() + " <" + getPersonId() + ">"; } } } }

Target:
public String toString() { if (getName() == null) { return getPersonId(); } else if (getPersonId() == null) { return getName(); } else if (getName().equals(getPersonId())) { return getName(); } else { return getName() + " <" + getPersonId() + ">"; } }
Source:
public void onDisconnected() { Log.i("Location_info", "onDisconnected"); }

Target:
public void onDisconnected() { Log.i("Location_info", "onDisconnected"); isConnected = false; }
Source:
private DataSpacesFileObject resolveToExisting(DataSpacesFileObject space, String spaceName, boolean input) { if (space == null) { logger.info(spaceName + " space is disabled"); return null; } logger.debug("Resolving " + spaceName + ": " + space.getAllRealURIs()); try { space = space.ensureExistingOrSwitch(!input); } catch (Exception e) { logger.info("Error occurred when switching to alternate space root", e); logger.info(spaceName + " space is disabled"); return null; } if (space == null) { logger.info("No existing " + spaceName + " space found"); logger.info(spaceName + " space is disabled"); } else { logger.debug(spaceName + " space is " + space.getRealURI()); logger.debug("(other available urls for " + spaceName + " space are " + space.getAllRealURIs() + " )"); } return space; }

Target:
private DataSpacesFileObject resolveToExisting(DataSpacesFileObject space, String spaceName, boolean input) { if (space == null) { logger.info(spaceName + " space is disabled"); return null; } if (logger.isDebugEnabled()) { logger.debug("Resolving " + spaceName + ": " + space.getAllRealURIs()); } try { space = space.ensureExistingOrSwitch(!input); } catch (Exception e) { logger.info("Error occurred when switching to alternate space root", e); logger.info(spaceName + " space is disabled"); return null; } if (space == null) { logger.info("No existing " + spaceName + " space found"); logger.info(spaceName + " space is disabled"); } else { logger.debug(spaceName + " space is " + space.getRealURI()); logger.debug("(other available urls for " + spaceName + " space are " + space.getAllRealURIs() + " )"); } return space; }
Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Command command = (Command) msg; command.setChannelHandlerContext(ctx); synchronized (commandQueue) { boolean isEmpty = commandQueue.isEmpty(); boolean isAsync = command.getCommandType().isAsync(); if (!isAsync && isEmpty) { executeCommand(command); return; } commandQueue.offer(command); if (isAsync && isEmpty) { startAsyncCommandExecution(command); } } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Command command = (Command) msg; command.setChannelHandlerContext(ctx); synchronized (commandQueue) { if (!commandQueue.isEmpty()) { commandQueue.offer(command); return; } if (command.getCommandType().isAsync()) { commandQueue.offer(command); startAsyncCommandExecution(command); return; } executeCommand(command); } }
Source:
protected VDSParametersBase getVDSParameters() { HashMap<String,String> httpHeaders = new HashMap<>(); String XAuthToken = getProviderProxy().getXAuthToken(); if (XAuthToken != null) { httpHeaders.put("X-Auth-Token", XAuthToken); } String imageUrl = getProviderProxy().getImageUrl(getEnclosingCommand().getParameters().getSourceRepoImageId()); return new DownloadImageVDSCommandParameters( getEnclosingCommand().getParameters().getStoragePoolId(), getEnclosingCommand().getParameters().getStorageDomainId(), getEnclosingCommand().getParameters().getImageGroupID(), getEnclosingCommand().getParameters().getDestinationImageId(), new HttpLocationInfo(imageUrl, httpHeaders) ); }

Target:
protected VDSParametersBase getVDSParameters() { return new DownloadImageVDSCommandParameters( getEnclosingCommand().getParameters().getStoragePoolId(), getEnclosingCommand().getParameters().getStorageDomainId(), getEnclosingCommand().getParameters().getImageGroupID(), getEnclosingCommand().getParameters().getDestinationImageId(), new HttpLocationInfo( getProviderProxy().getImageUrl(getEnclosingCommand().getParameters().getSourceRepoImageId()), getProviderProxy().getDownloadHeaders()) ); }
Source:
public void markGroupSeen(GroupKey<?> groupKey, boolean seen, long examinerID) throws TskCoreException { String cacheKey = groupKey.getDataSourceObjId() + "_" + groupKey.getValueDisplayName() + "_" + groupKey.getAttribute().getDisplayName(); Boolean cachedValue = groupSeenCache.getIfPresent(cacheKey); if (cachedValue != null && cachedValue == seen) { return; } String innerQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' and data_source_obj_id = %d )", SleuthkitCase.escapeSingleQuotes(groupKey.getAttribute().attrName.toString()), SleuthkitCase.escapeSingleQuotes(groupKey.getValueDisplayName()), groupKey.getAttribute() == DrawableAttribute.PATH ? groupKey.getDataSourceObjId() : 0); String insertSQL = String.format(" (group_id, examiner_id, seen) VALUES (%s, %d, %d)", innerQuery, examinerID, seen ? 1 : 0); if (DbType.POSTGRESQL == tskCase.getDatabaseType()) { insertSQL += String.format(" ON CONFLICT (group_id, examiner_id) DO UPDATE SET seen = %d", seen ? 1 : 0); } tskCase.getCaseDbAccessManager().insertOrUpdate(GROUPS_SEEN_TABLENAME, insertSQL); groupSeenCache.put(cacheKey, seen); }

Target:
public void markGroupSeen(GroupKey<?> groupKey, boolean seen, long examinerID) throws TskCoreException { Boolean cachedValue = groupSeenCache.getIfPresent(groupKey); if (cachedValue != null && cachedValue == seen) { return; } String innerQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' and data_source_obj_id = %d )", SleuthkitCase.escapeSingleQuotes(groupKey.getAttribute().attrName.toString()), SleuthkitCase.escapeSingleQuotes(groupKey.getValueDisplayName()), groupKey.getAttribute() == DrawableAttribute.PATH ? groupKey.getDataSourceObjId() : 0); String insertSQL = String.format(" (group_id, examiner_id, seen) VALUES (%s, %d, %d)", innerQuery, examinerID, seen ? 1 : 0); if (DbType.POSTGRESQL == tskCase.getDatabaseType()) { insertSQL += String.format(" ON CONFLICT (group_id, examiner_id) DO UPDATE SET seen = %d", seen ? 1 : 0); } tskCase.getCaseDbAccessManager().insertOrUpdate(GROUPS_SEEN_TABLENAME, insertSQL); groupSeenCache.put(groupKey, seen); }
Source:
public void shouldBeAbleToRemoveHealthMetricConfiguredGlobally() throws Exception { List<FolderHealthMetric> healthMetrics = new ArrayList<>(1); healthMetrics.add(new WorstChildHealthMetric(true)); AbstractFolderConfiguration.get().setHealthMetrics(healthMetrics); assertThat("by default, global configuration should not have any folder health metrics", AbstractFolderConfiguration.get().getHealthMetrics(), hasSize((int) FolderHealthMetricDescriptor.all().stream().filter(d -> d.createDefault() != null).count())); HtmlForm cfg = r.createWebClient().goTo("configure").getFormByName("config"); for (HtmlElement element : cfg.getElementsByAttribute("div", "name", "healthMetrics")) { element.remove(); } r.submit(cfg); assertThat("deleting all global metrics should result in an empty list", AbstractFolderConfiguration.get().getHealthMetrics(), hasSize(0)); }

Target:
public void shouldBeAbleToRemoveHealthMetricConfiguredGlobally() throws Exception { List<FolderHealthMetric> healthMetrics = new ArrayList<>(1); healthMetrics.add(new WorstChildHealthMetric(true)); AbstractFolderConfiguration.get().setHealthMetrics(healthMetrics); HtmlForm cfg = r.createWebClient().goTo("configure").getFormByName("config"); for (HtmlElement element : cfg.getElementsByAttribute("div", "name", "healthMetrics")) { element.remove(); } r.submit(cfg); assertThat("deleting all global metrics should result in an empty list", AbstractFolderConfiguration.get().getHealthMetrics(), hasSize(0)); }
Source:
private boolean isISOCompatible( File iso, RpmVersion ovirtHostOsVersion ) { boolean ret = false; log.debugFormat("Check if ISO compatible: {0}", iso); String FileName = iso.getName(); Path path = Paths.get(iso.toString()); try { if (Files.isSymbolicLink(path)) { FileName = Files.readSymbolicLink(path).getFileName().toString(); } } catch(java.nio.file.NotLinkException e) { } catch(IOException e) { log.errorFormat( "Cannot find iso [{0}] [{1}]", path, ExceptionUtils.getMessage(e) ); } for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) { if (info.path.equals(iso.getParentFile())) { Matcher matcher = info.isoPattern.matcher(FileName); if (matcher.find()) { String rpmLike = matcher.group(1).replaceAll("-", "."); log.debugFormat("ISO version: {0} {1} {2}", iso, rpmLike, ovirtHostOsVersion); RpmVersion isoVersion = new RpmVersion(rpmLike, "", true); if (VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) { log.debugFormat("ISO compatible: {0}", iso); ret = true; break; } } } } return ret; }

Target:
private boolean isISOCompatible( File iso, RpmVersion ovirtHostOsVersion ) { boolean ret = false; log.debugFormat("Check if ISO compatible: {0}", iso); for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) { if (info.path.equals(iso.getParentFile())) { try { Matcher matcher = info.isoPattern.matcher( iso.getCanonicalPath().substring(iso.getCanonicalPath().lastIndexOf("/")+1) ); if (matcher.find()) { String rpmLike = matcher.group(1).replaceAll("-", "."); log.debugFormat("ISO version: {0} {1} {2}", iso, rpmLike, ovirtHostOsVersion); RpmVersion isoVersion = new RpmVersion(rpmLike, "", true); if (VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) { log.debugFormat("ISO compatible: {0}", iso); ret = true; break; } } } catch (IOException e) { log.errorFormat( "Cannot get canonical path to {0} with error {1}", iso.getName(), ExceptionUtils.getMessage(e) ); } } } return ret; }
Source:
public void saveFile() throws IOException { File file = new File(pathOfOldMetaFormat); testMetaOldFormat = FileReader.readFileToByteArray(file); file = new File("src/test/resources/testmetaUnsupportedFormat.xml"); testmetaUnsupportedFormat = FileReader.readFileToByteArray(file); }

Target:
public void saveFile() throws IOException { File file = new File(pathOfOldMetaFormat); testMetaOldFormat = IOUtils.toByteArray(file.toURI()); file = new File("src/test/resources/testmetaUnsupportedFormat.xml"); testmetaUnsupportedFormat = IOUtils.toByteArray(file.toURI()); }
Source:
private Tracer getTracer() { return tracerRegistry.getTracer(minionIdentity.getId()+"@"+minionIdentity.getLocation()); }

Target:
private Tracer getTracer() { return tracerRegistry.getTracer(minionIdentity.getLocation() + "@" + minionIdentity.getId()); }
Source:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } if (!glusterVolume.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED); } GlusterAsyncTask asyncTask = glusterVolume.getAsyncTask(); if (asyncTask != null && asyncTask.getType() == GlusterTaskType.REMOVE_BRICK) { GlusterVolumeRemoveBricksParameters params = (GlusterVolumeRemoveBricksParameters)getParameters(); if (params.getBricks().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); List<GlusterBrickEntity> paramBricks = params.getBricks(); if (paramBricks.size() != bricksForTask.size()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_SIZE_DOES_NOT_MATCH); } int counter = 0; for (GlusterBrickEntity paramBrick : paramBricks) { for (GlusterBrickEntity brick : bricksForTask) { if (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory())) { break; } counter++; if (counter == bricksForTask.size()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } } } } return true; }

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } if (!glusterVolume.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED); } return true; }
Source:
public void test_init() throws IOException, InterruptedException { Run runSrc = Mockito.mock(Run.class); AbstractBuild abDst = Mockito.mock(AbstractBuild.class); for (C c : new C[] {new C1(), new C2(), new C3()}) { c.init(runSrc, abDst, null, null); Assert.assertEquals(1, c.callCnt); } C4 c4 = new C4(); c4.init(runSrc, abDst, null, null); Assert.assertEquals(2, c4.callCnt); testRunDst(new C1(), 1); testRunDst(new C2(), 1); testRunDst(new C4(), 1); try { testRunDst(new C3(), 0); Assert.fail("expected AbstractMethodError"); } catch (AbstractMethodError e) { Assert.assertEquals("Invalid call to Copier.init(Run src, Run dst, FilePath, FilePath), passing an AbstractBuild " + "instance for the 'dst' arg when hudson.plugins.copyartifact.CopierTest$C3 does not implement the deprecated " + "version of 'init' that takes an AbstractBuild. Please supply a Run instance for the 'dst' arg.", e.getMessage()); } }

Target:
public void test_init() throws IOException, InterruptedException { Run runSrc = Mockito.mock(Run.class); AbstractBuild abDst = Mockito.mock(AbstractBuild.class); for (C c : new C[] {new C1(), new C2(), new C3()}) { c.init(runSrc, abDst, null, null); Assert.assertEquals(1, c.callCnt); } C4 c4 = new C4(); c4.init(runSrc, abDst, null, null); Assert.assertEquals(2, c4.callCnt); testRunDst(new C1(), 1); testRunDst(new C2(), 1); testRunDst(new C4(), 1); try { testRunDst(new C3(), 0); Assert.fail("expected AbstractMethodError"); } catch (AbstractMethodError e) { Assert.assertEquals("Invalid call to Copier.initialize(Run src, Run dst, FilePath, FilePath), passing an AbstractBuild " + "instance for the 'dst' arg when hudson.plugins.copyartifact.CopierTest$C3 does not implement the deprecated " + "version of 'init' that takes an AbstractBuild. Please supply a Run instance for the 'dst' arg.", e.getMessage()); } }
Source:
public CauseOfBlockage getCauseOfBlockage() { ResourceActivity r = getBlockingActivity(task); if (r != null) { if (r == task) return CauseOfBlockage.fromMessage(Messages._Queue_InProgress()); return CauseOfBlockage.fromMessage(Messages._Queue_BlockedBy(r.getDisplayName())); } if (causeOfBlockage != null) { return causeOfBlockage; } return task.getCauseOfBlockage(); }

Target:
public CauseOfBlockage getCauseOfBlockage() { if (causeOfBlockage != null) { return causeOfBlockage; } return getCauseOfBlockageForItem(this); }
Source:
public QueryImplementor createQuery(String queryString) { SessionImpl session = (SessionImpl) delegate; QueryImpl queryImplementor = (QueryImpl) session.createQuery( queryString ); OgmQueryImplFacade ogmQueryImplFacade = new OgmQueryImplFacade( queryImplementor ); return ogmQueryImplFacade; }

Target:
public QueryImplementor createQuery(String queryString) { QueryImpl queryImplementor = (QueryImpl) super.createQuery( queryString ); return new OgmQueryImpl( queryImplementor ); }
Source:
public ActivityLogEntry(String servlet, String act, AccountAttributes acc, String params, String link){ time = System.currentTimeMillis(); servletName = servlet; action = act; toShow = true; message = params; url = link; if (acc == null){ role = "Unknown"; name = "Unknown"; googleId = "Unknown"; email = "Unknown"; } else { role = acc.isInstructor ? "Instructor" : "Student"; name = acc.name; googleId = acc.googleId; email = acc.email; } id = googleId + time; role = changeRoleToAutoIfAutomatedActions(servletName, role); }

Target:
public ActivityLogEntry(String servlet, String act, AccountAttributes acc, String params, String link){ time = System.currentTimeMillis(); servletName = servlet; action = act; toShow = true; message = params; url = link; if (acc == null){ role = "Unknown"; name = "Unknown"; googleId = "Unknown"; email = "Unknown"; } else { role = acc.isInstructor ? "Instructor" : "Student"; name = acc.name; googleId = acc.googleId; email = acc.email; } id = googleId + formatTimeForId(new Date(time)); role = changeRoleToAutoIfAutomatedActions(servletName, role); }
Source:
public AgentInstance buildEntityFromRequestBody(Request req) { return null; }

Target:
public AgentInstance buildEntityFromRequestBody(Request req) { throw new UnsupportedOperationException(); }
Source:
protected void format() throws EmailException { formatBranch(); appendText(velocifyFile("BranchFooter.vm")); for (Account.Id thisOwner : owners) { appendText("Gerrit-Owner: " + getNameEmailFor(thisOwner) + "\n"); } }

Target:
protected void format() throws EmailException { formatBranch(); appendText(velocifyFile("BranchFooter.vm")); }
Source:
protected String getNonCompilablePath(String filename) throws IOException { return new File("src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/" + filename).getCanonicalPath(); }

Target:
protected final String getNonCompilablePath(String filename) throws IOException { return new File("src/test/resources-noncompilable/" + getPackageLocation() + filename).getCanonicalPath(); }
Source:
public Response status(@Context ServletContext servletContext) { final Map<String, String> status = new HashMap<>(); status.putAll(manifestUtil.getFrom()); if (inventoryService.isRunning()) { status.put("status", "UP"); return Response.ok(status).build(); } else { status.put("status", "DOWN"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(status).build(); } }

Target:
public Response status(@Context ServletContext servletContext) { final Map<String, String> status = new HashMap<>(); status.putAll(manifestUtil.getFrom()); if (inventoryService.isRunning()) { status.put("status", "UP"); return Response.ok(status).build(); } else { status.put("status", "DOWN"); return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(status).build(); } }