auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Collection<ContainerSpec> listContainerSpec(String serverTemplateId) { ContainerSpecList containerSpecList = makeGetRequestAndCreateCustomResponse(controllerBaseUrl + "/management/servers" + serverTemplateId + "/containers", ContainerSpecList.class); if (containerSpecList != null && containerSpecList.getContainerSpecs() != null) { return Arrays.asList(containerSpecList.getContainerSpecs()); } return Collections.emptyList(); }

Target:
public Collection<ContainerSpec> listContainerSpec(String serverTemplateId) { ContainerSpecList containerSpecList = makeGetRequestAndCreateCustomResponse(controllerBaseUrl + MANAGEMENT_URI_PART + serverTemplateId + CONTAINERS_LAST_URI_PART, ContainerSpecList.class); if (containerSpecList != null && containerSpecList.getContainerSpecs() != null) { return Arrays.asList(containerSpecList.getContainerSpecs()); } return Collections.emptyList(); }
Source:
public void close() { if (transactor != null) { try { transactor.close(); } catch (IOException e) { throw new RuntimeException(e); } } if (cache != null) { try { cache.close(); } catch (IOException e) { throw new RuntimeException(e); } } cw.close(); sbw.close(); try { bw.close(); } catch (MutationsRejectedException e) { throw new RuntimeException(e); } curator.close(); }

Target:
public synchronized void close() { isClosed = true; if (tid != null) { try { tid.close(); } catch (IOException e) { throw new RuntimeException(e); } } if (cache != null) { try { cache.close(); } catch (IOException e) { throw new RuntimeException(e); } } cw.close(); sbw.close(); try { bw.close(); } catch (MutationsRejectedException e) { throw new RuntimeException(e); } curator.close(); }
Source:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (bus == null) { registerBus(); } if (requestCode == SettingsActivity.ACTIVITY_REQUEST_SHOW_SETTINGS) { if (resultCode == SettingsActivity.ACTIVITY_RESULT_LANGUAGE_CHANGED) { Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { displayMainPage(true); Intent widgetIntent = new Intent(getApplicationContext(), WidgetProviderFeaturedPage.class); widgetIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); int[] ids = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds( new ComponentName(getApplication(), WidgetProviderFeaturedPage.class)); widgetIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids); sendBroadcast(widgetIntent); } }, DateUtils.SECOND_IN_MILLIS); } else if (resultCode == SettingsActivity.ACTIVITY_RESULT_LOGOUT) { doLogout(); } } if ((requestCode == ACTIVITY_REQUEST_LANGLINKS && resultCode == LangLinksActivity.ACTIVITY_RESULT_LANGLINK_SELECT)) { fragmentContainerView.post(new Runnable() { @Override public void run() { handleIntent(data); } }); } else if ((requestCode == ACTIVITY_REQUEST_GALLERY && resultCode == GalleryActivity.ACTIVITY_RESULT_FILEPAGE_SELECT)) { fragmentContainerView.post(new Runnable() { @Override public void run() { handleIntent(data); } }); } else { super.onActivityResult(requestCode, resultCode, data); } }

Target:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (bus == null) { registerBus(); } if (settingsActivityRequested(requestCode)) { handleSettingsActivityResult(resultCode); } else if (newArticleLanguageSelected(requestCode, resultCode) || galleryFilePageSelected(requestCode, resultCode)) { handleLangLinkOrFilePageResult(data); } else { super.onActivityResult(requestCode, resultCode, data); } }
Source:
int offer(FragmentResponseMessage message) { if (message instanceof FragmentResponseMessage) { FragmentResponseMessage msg = (FragmentResponseMessage)message; long hash = 0; for (int i = 0; i < msg.getTableCount(); i++) { int depId = msg.getTableDependencyIdAtIndex(i); VoltTable dep = msg.getTableAtIndex(i); List<VoltTable> tables = m_alldeps.get(depId); if (tables == null) { tables = new ArrayList<VoltTable>(); m_alldeps.put(depId, tables); } if (!msg.isRecovering()) { if (!tables.isEmpty() && tables.get(0).getStatusCode() == VoltTableUtil.NULL_DEPENDENCY_STATUS) { tables.clear(); } hash ^= MiscUtils.cheesyBufferCheckSum(dep.getBuffer()); } else { if (!tables.isEmpty()) { continue; } } tables.add(dep); } int[] hashes = new int[] { (int) hash, 0, 0 }; return checkCommon(hashes, msg.isRecovering(), message, false); } return super.offer(message); }

Target:
int offer(FragmentResponseMessage message) { long hash = 0; for (int i = 0; i < message.getTableCount(); i++) { int depId = message.getTableDependencyIdAtIndex(i); VoltTable dep = message.getTableAtIndex(i); List<VoltTable> tables = m_alldeps.get(depId); if (tables == null) { tables = new ArrayList<VoltTable>(); m_alldeps.put(depId, tables); } if (!message.isRecovering()) { if (!tables.isEmpty() && tables.get(0).getStatusCode() == VoltTableUtil.NULL_DEPENDENCY_STATUS) { tables.clear(); } hash ^= MiscUtils.cheesyBufferCheckSum(dep.getBuffer()); } else { if (!tables.isEmpty()) { continue; } } tables.add(dep); } int[] hashes = new int[] { (int) hash, 0, 0 }; return checkCommon(hashes, message.isRecovering(), message, false); }
Source:
public void close(String namespace) { level1.close(namespace); level2.close(namespace); }

Target:
public void close(String namespace) { Throwable t = null; try { level1.close(namespace); } catch (Throwable t1) { t = t1; throw t1; } finally { if (t != null) { try { level2.close(namespace); } catch (Throwable t2) { t.addSuppressed(t2); } } else { level2.close(namespace); } } }
Source:
HealthStatus getHealthStatusForMetric(String serviceName, EndpointStatistics endpointStatistics, String metricName, double rateThreshold, long steadyStateP99Limit, long quietP99Limit, double errorRateProportion) { if (endpointStatistics.getP99() > quietP99Limit && endpointStatistics.getOneMin() > 0) { log.info("[Service - {}] | Point health status for is UNHEALTHY as the quiet state p99 is very high - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("quietP99Limit", endpointStatistics.getP99())); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getOneMin() < rateThreshold) { log.info("[Service - {}] | Point health status for is UNKNOWN as the request rate is low - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("oneMinRate", endpointStatistics.getOneMin())); return HealthStatus.UNKNOWN; } double errorProportion = getErrorProportion(endpointStatistics); if (errorProportion > errorRateProportion) { log.info("[Service - {}] | Point health status for is UNHEALTHY due to high error proportion - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("errorProportion", errorProportion)); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getP99() > steadyStateP99Limit) { log.info("[Service - {}] | Point health status for is UNHEALTHY due to high p99 - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("p99", endpointStatistics.getP99())); return HealthStatus.UNHEALTHY; } return HealthStatus.HEALTHY; }

Target:
HealthStatus getHealthStatusForMetric(String serviceName, EndpointStatistics endpointStatistics, String metricName, double rateThreshold, long steadyStateP99Limit, long quietP99Limit, double errorRateProportion) { if (endpointStatistics.getP99() > quietP99Limit && endpointStatistics.getOneMin() > 0) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "higher p99 than what we allow in quiet state", endpointStatistics); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getOneMin() < rateThreshold) { logHealthInfo(serviceName, metricName, HealthStatus.UNKNOWN, "low request rate", endpointStatistics); return HealthStatus.UNKNOWN; } double errorProportion = getErrorProportion(endpointStatistics); if (errorProportion > errorRateProportion) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "high error proportion", endpointStatistics); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getP99() > steadyStateP99Limit) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "high p99", endpointStatistics); return HealthStatus.UNHEALTHY; } return HealthStatus.HEALTHY; }
Source:
private void mockFlowDoesNotExist() throws Exception { final Map<String, Object> executionMap = mockUpdateResponse(); executionMap.put("error", "Flow does not exist"); }

Target:
private void mockFlowDoesNotExist() throws Exception { final Map<String, Object> executionMap = mockUpdateResponse(); executionMap.put(ConnectorParams.RESPONSE_ERROR, "Flow does not exist"); }
Source:
protected void unsetWorkflowImplServiceListener(WorkflowImplServiceListener workflowListener) { if(workflowListener !=null) { WorkflowImplServiceDataHolder.getInstance().getWorkflowListenerList() .remove(workflowListener); } }

Target:
protected void unsetWorkflowImplServiceListener(WorkflowImplServiceListener workflowListener) { WorkflowImplServiceDataHolder.getInstance().getWorkflowListenerList().remove(workflowListener); }
Source:
public void testDemo() { parseCode(TEST_DEMO); ASTMethodDeclaration node = acu.findDescendantsOfType(ASTMethodDeclaration.class).get(0); Scope s = node.getScope(); Map<NameDeclaration, List<NameOccurrence>> m = s.getDeclarations(); for (Map.Entry<NameDeclaration, List<NameOccurrence>> entry : m.entrySet()) { assertEquals("buz", entry.getKey().getImage()); assertEquals("ArrayList", ((TypedNameDeclaration) entry.getKey()).getTypeImage()); List<NameOccurrence> u = m.get(entry.getKey()); assertEquals(1, u.size()); NameOccurrence o = u.get(0); int beginLine = o.getLocation().getBeginLine(); assertEquals(3, beginLine); } }

Target:
public void testDemo() { parseCode(TEST_DEMO); ASTMethodDeclaration node = acu.findDescendantsOfType(ASTMethodDeclaration.class).get(0); Scope s = node.getScope(); Map<NameDeclaration, List<NameOccurrence>> m = s.getDeclarations(); for (Map.Entry<NameDeclaration, List<NameOccurrence>> entry : m.entrySet()) { assertEquals("buz", entry.getKey().getImage()); assertEquals("ArrayList", ((TypedNameDeclaration) entry.getKey()).getTypeImage()); List<NameOccurrence> u = entry.getValue(); assertEquals(1, u.size()); NameOccurrence o = u.get(0); int beginLine = o.getLocation().getBeginLine(); assertEquals(3, beginLine); } }
Source:
CryptographyAsyncClient(JsonWebKey key, HttpPipeline pipeline, CryptographyServiceVersion version) { Objects.requireNonNull(key); if (!key.isValid()) { throw new IllegalArgumentException("Json Web Key is not valid"); } if (key.getKeyOps() == null) { throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); } if (key.getKeyType() == null) { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; service = RestProxy.create(CryptographyService.class, pipeline); if (!Strings.isNullOrEmpty(key.getKeyId())) { unpackAndValidateId(key.getKeyId()); cryptographyServiceClient = new CryptographyServiceClient(key.getKeyId(), service); } else { cryptographyServiceClient = null; } initializeCryptoClients(); }

Target:
CryptographyAsyncClient(JsonWebKey key, HttpPipeline pipeline, CryptographyServiceVersion version) { Objects.requireNonNull(key); if (!key.isValid()) { throw new IllegalArgumentException("Json Web Key is not valid"); } if (key.getKeyOps() == null) { throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); } if (key.getKeyType() == null) { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; service = RestProxy.create(CryptographyService.class, pipeline); if (!Strings.isNullOrEmpty(key.getId())) { unpackAndValidateId(key.getId()); cryptographyServiceClient = new CryptographyServiceClient(key.getId(), service); } else { cryptographyServiceClient = null; } initializeCryptoClients(); }
Source:
private boolean supportsConditionProviders() { ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); return !am.isLowRamDevice() || mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); }

Target:
private boolean supportsConditionProviders() { ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); return !am.isLowRamDevice(); }
Source:
public void setAsText(String string) throws IllegalArgumentException { Focus val = (Focus) super.getValue(); if (val == null) { val = new Focus(); super.setValue(val); } val.setStringValue(string); }

Target:
public void setAsText(String string) throws IllegalArgumentException { setValue(new Focus(string)); }
Source:
public void whenEventIsTooLargeThenResultIsAborted() throws Exception { final EventType eventType = buildDefaultEventType(); final JSONArray batch = buildLargeBatch(1); mockSuccessfulValidation(eventType); final EventPublishResult result = publisher.publish(batch, eventType.getName(), FULL_ACCESS_CLIENT); assertThat(result.getStatus(), equalTo(EventPublishingStatus.ABORTED)); verify(enrichment, times(0)).enrich(any(), any()); verify(partitionResolver, times(0)).resolvePartition(any(), any()); verify(topicRepository, times(0)).syncPostBatch(any(), any()); }

Target:
public void whenEventIsTooLargeThenResultIsAborted() throws Exception { final EventType eventType = buildDefaultEventType(); final JSONArray batch = buildLargeBatch(1); mockSuccessfulValidation(eventType); final EventPublishResult result = publisher.publish(batch.toString(), eventType.getName(), FULL_ACCESS_CLIENT); assertThat(result.getStatus(), equalTo(EventPublishingStatus.ABORTED)); verify(enrichment, times(0)).enrich(any(), any()); verify(partitionResolver, times(0)).resolvePartition(any(), any()); verify(topicRepository, times(0)).syncPostBatch(any(), any()); }
Source:
static String minimize(String name) { int maxMnemonic = Math.max(PATH_MAX - 44, 1); String result = name.replaceAll("(%[0-9A-F]{2}|[^a-zA-Z0-9-_.])+", "_"). replaceFirst(".*?(.{0," + maxMnemonic + "}$)", "$1") + "-" + uniqueSuffix(name); assert result.length() <= PATH_MAX : result + " does not fit inside " + PATH_MAX; return result; }

Target:
static String minimize(String name) { String mnemonic = name.replaceAll("(%[0-9A-F]{2}|[^a-zA-Z0-9-_.])+", "_"); int maxMnemonic = Math.max(PATH_MAX - 53, 1); String result = StringUtils.right(mnemonic, maxMnemonic) + "-" + uniqueSuffix(name); assert result.length() <= PATH_MAX : result + " does not fit inside " + PATH_MAX; return result; }
Source:
public QueuableTask nextTaskToLaunch() throws TaskQueueException { ResAllocs remaining = null; for (QueueBucket bucket : sortedBuckets.getSortedList()) { final QueuableTask task = bucket.nextTaskToLaunch(); if (task != null) { if (bucket.isBelowGuaranteedConsumption()) { return task; } if (remaining == null) { ResAllocs totalTierResources = availableTierResGetter.get(); ResAllocs used = ResAllocsUtil.addAll(sortedBuckets.getSortedList().stream().map(QueueBucket::getUsedOrGuaranteed).collect(Collectors.toList())); remaining = ResAllocsUtil.subtract(totalTierResources, used); } if (!ResAllocsUtil.isLess(task, remaining)) { return task; } } } return null; }

Target:
public QueuableTask nextTaskToLaunch() throws TaskQueueException { ResAllocs remaining = ResAllocsUtil.subtract(tierSla.getTierAlloc(), tierUsage.getUsage().getEffective()); for (QueueBucket bucket : sortedBuckets.getSortedList()) { final QueuableTask task = bucket.nextTaskToLaunch(); if (task != null) { if (bucket.isBelowGuaranteedConsumption()) { return task; } if (!ResAllocsUtil.isLess(task, remaining)) { return task; } } } return null; }
Source:
public Choices getBestMatch(String field, String text, Collection collection, String locale) { String formName; try { formName = Utils.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getBestMatch(field, text, collection, locale); } catch (DCInputsReaderException e) { e.printStackTrace(); } return null; }

Target:
public Choices getBestMatch(String field, String text, Collection collection, String locale) { String formName; try { init(); if(collection==null) { Set<Choice> choices = new HashSet<Choice>(); for(ChoiceAuthority ca : delegates.values()) { Choices tmp = ca.getBestMatch(field, text, null, locale); if(tmp.total>0) { Set<Choice> mySet = new HashSet<Choice>(Arrays.asList(tmp.values)); choices.addAll(mySet); } } if(!choices.isEmpty()) { Choice[] results = new Choice[choices.size()-1]; choices.toArray(results); return new Choices(results, 0, choices.size(), Choices.CF_UNCERTAIN, false); } } else { formName = dci.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getBestMatch(field, text, collection, locale); } } catch (DCInputsReaderException e) { log.error(e.getMessage(), e); } return new Choices(Choices.CF_NOTFOUND); }
Source:
private List<String> getOrderedDimValues(ServiceMetricEvent event) { String prefixKey = getPrefixKey(event.getMetric(), whiteListDimsMapper); if (prefixKey == null) { return null; } ImmutableList.Builder<String> outputList = new ImmutableList.Builder(); Set<String> dimensions = whiteListDimsMapper.get(prefixKey); if (dimensions == null) { return Collections.emptyList(); } for (String dimKey : dimensions) { String dimValue = (String) event.getUserDims().get(dimKey); if (dimValue != null) { outputList.add(NoopGraphiteEventConverter.sanitize(dimValue)); } } return outputList.build(); }

Target:
private List<String> getOrderedDimValues(ServiceMetricEvent event) { String prefixKey = getPrefixKey(event.getMetric(), whiteListDimsMapper); if (prefixKey == null) { return null; } ImmutableList.Builder<String> outputList = new ImmutableList.Builder(); Set<String> dimensions = whiteListDimsMapper.get(prefixKey); if (dimensions == null) { return Collections.emptyList(); } for (String dimKey : dimensions) { String dimValue = (String) event.getUserDims().get(dimKey); if (dimValue != null) { outputList.add(GraphiteEmitter.sanitize(dimValue)); } } return outputList.build(); }
Source:
private void navigateMySite() { clickOn(R.id.nav_sites); waitForElementToBeDisplayedWithoutFailure(R.id.row_blog_posts); takeScreenshot("4-screenshot-my-site"); }

Target:
private void navigateMySite() { clickOn(R.id.nav_sites); waitForElementToBeDisplayedWithoutFailure(R.id.row_blog_posts); takeScreenshot("4-keep-tabs-on-your-site"); }
Source:
private void generateResult() throws DbException { for (TupleBatch tb : groupStates.getData().getAll()) { List<Column<?>> columns = new ArrayList<Column<?>>(); for (int i = 0; i < gfields.length; ++i) { columns.add(tb.getDataColumns().get(i)); } for (Aggregator agg : emitAggs) { columns.addAll(agg.emitOutput(tb)); } resultBuffer.absorb(new TupleBatch(getSchema(), columns), true); } groupStates.cleanup(); }

Target:
protected void generateResult() throws DbException { if (groupStates.numTuples() == 0) { return; } int stateOffset = gfields.length; for (Aggregator agg : internalAggs) { if (agg instanceof UserDefinedAggregator) { ((UserDefinedAggregator) agg).finalizePythonUpdaters(groupStates.getData(), stateOffset); } stateOffset += agg.getStateSize(); } Schema inputSchema = getChild().getSchema(); for (TupleBatch tb : groupStates.getData().getAll()) { List<Column<?>> columns = new ArrayList<Column<?>>(); columns.addAll(tb.getDataColumns().subList(0, gfields.length)); stateOffset = gfields.length; int emitOffset = 0; for (AggregatorFactory factory : factories) { int stateSize = factory.generateStateSchema(inputSchema).numColumns(); int emitSize = factory.generateSchema(inputSchema).numColumns(); TupleBatch state = tb.selectColumns(MyriaArrayUtils.range(stateOffset, stateSize)); for (GenericEvaluator eval : emitEvals.subList(emitOffset, emitOffset + emitSize)) { columns.add(eval.evalTupleBatch(state, getSchema()).getResultColumns().get(0)); } stateOffset += stateSize; emitOffset += emitSize; } addToResult(columns); } groupStates.cleanup(); }
Source:
public CalendarSet<?> getCalendarSet(PortletRequest request) { final Set<UserDefinedCalendarConfiguration> calendars = new HashSet<UserDefinedCalendarConfiguration>(); final CalendarSet<UserDefinedCalendarConfiguration> set = new CalendarSet<UserDefinedCalendarConfiguration>(calendars); final String username = getUsername(request); if (username != null) { final List<UserDefinedCalendarConfiguration> cals = calendarStore .getCalendarConfigurations(username); calendars.addAll(cals); } return set; }

Target:
public CalendarSet<?> getCalendarSet(PortletRequest request) { final Set<UserDefinedCalendarConfiguration> calendars = new HashSet<UserDefinedCalendarConfiguration>(); final CalendarSet<UserDefinedCalendarConfiguration> set = new CalendarSet<UserDefinedCalendarConfiguration>(calendars); final String username = getUsername(request); if (username != null) { final List<UserDefinedCalendarConfiguration> cals = calendarStore .getCalendarConfigurations(username); calendars.addAll(cals); } else { log.warn("username is null -- returning empty calendar set"); } return set; }
Source:
public boolean isRegistered(VeluxProduct product) { logger.trace("isRegistered(VeluxProduct {}) called.", product.toString()); if (product.isV2()) { return isRegistered(product.getSerialNumber()); } else { return isRegistered(product.getProductUniqueIndex()); } }

Target:
public boolean isRegistered(VeluxProduct product) { logger.trace("isRegistered(VeluxProduct {}) called.", product.toString()); if (product.isV2()) { return isRegistered(product.getSerialNumber()); } return isRegistered(product.getProductUniqueIndex()); }
Source:
private void doResolveAllUncached0(String hostname, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) { try { handler.supressFlushes(); final DnsServerAddressStream nameServerAddrs = dnsServerAddressStreamProvider.nameServerAddressStream(hostname); new DnsAddressResolveContext(this, hostname, additionals, nameServerAddrs, resolveCache, authoritativeDnsServerCache).resolve(promise); } finally { handler.mayFlush(); } }

Target:
private void doResolveAllUncached0(String hostname, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) { assert executor().inEventLoop(); final DnsServerAddressStream nameServerAddrs = dnsServerAddressStreamProvider.nameServerAddressStream(hostname); new DnsAddressResolveContext(this, hostname, additionals, nameServerAddrs, resolveCache, authoritativeDnsServerCache).resolve(promise); }
Source:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); long time = System.currentTimeMillis(); Map<String, Ref> refsBefore = getAllRefs(); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { nonHeads.addAll(listRefLogObjects(ref, 0)); if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } Set<PackIndex> excluded = new HashSet<PackIndex>(); for (PackFile f : repo.getObjectDatabase().getPacks()) if (new File(f.getPackFile().getPath() + ".keep").exists()) excluded.add(f.getIndex()); tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, excluded); if (heads != null) { ret.add(heads); excluded.add(heads.getIndex()); } } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, excluded); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); lastPackedRefs = refsBefore; lastRepackTime = time; return ret; }

Target:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); long time = System.currentTimeMillis(); Map<String, Ref> refsBefore = getAllRefs(); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { nonHeads.addAll(listRefLogObjects(ref, 0)); if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } List<PackIndex> excluded = new LinkedList<PackIndex>(); for (PackFile f : repo.getObjectDatabase().getPacks()) if (f.shouldBeKept()) excluded.add(f.getIndex()); tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, excluded); if (heads != null) { ret.add(heads); excluded.add(0, heads.getIndex()); } } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, excluded); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); lastPackedRefs = refsBefore; lastRepackTime = time; return ret; }
Source:
public Response<?> apply(ChangeResource resource, Post.Input input) throws AuthException, InvalidChangeOperationException, IOException, ResourceConflictException, OrmException { Optional<ChangeEdit> edit = editUtil.byChange(resource.getChange()); if (!edit.isPresent()) { edit = createEdit(resource.getChange()); } if (input != null && !Strings.isNullOrEmpty(input.path) && input.restore != null && input.restore) { editModifier.restoreFile(edit.get(), input.path); } return Response.none(); }

Target:
public Response<?> apply(ChangeResource resource, Post.Input input) throws AuthException, InvalidChangeOperationException, IOException, ResourceConflictException, BadRequestException, OrmException { Optional<ChangeEdit> edit = editUtil.byChange(resource.getChange()); if (!edit.isPresent()) { edit = createEdit(resource.getChange()); } if (input != null && input.restore != null && input.restore) { if (Strings.isNullOrEmpty(input.path)) { throw new BadRequestException("no path provided"); } editModifier.restoreFile(edit.get(), input.path); } return Response.none(); }
Source:
private void handleZoom(MotionEvent event, Camera.Parameters params) { int maxZoom = params.getMaxZoom(); int zoom = params.getZoom(); float newDist = getFingerSpacing(event); if (newDist > mDist) { if (zoom < maxZoom) zoom+=6; } else if (newDist < mDist) { if (zoom > 0) zoom-=6; } mDist = newDist; params.setZoom(zoom); mCamera.setParameters(params); }

Target:
private void handleZoom(MotionEvent event, Camera.Parameters params) { int maxZoom = params.getMaxZoom(); int zoom = params.getZoom(); float newDist = getFingerSpacing(event); if (newDist > mDist && zoom < maxZoom) { zoom+=6; } else if (newDist < mDist && zoom > 0) { zoom-=6; } mDist = newDist; params.setZoom(zoom); mCamera.setParameters(params); }
Source:
private void applyDelete(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { messageInfo = new MessageInfo(messageInfo.getStoreKey(), messageInfo.getSize(), false, messageInfo.isTtlUpdated(), false, messageInfo.getExpirationTimeInMs(), messageInfo.getCrc(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs(), messageInfo.getLifeVersion()); remoteReplicaInfo.getLocalStore().delete(Collections.singletonList(messageInfo)); logger.trace("Remote node: Thread name: Remote replica: Key delete: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted) { logger.trace("Remote node: Thread name: Remote replica: Key already deleted: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaDeleted(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED); } }

Target:
private void applyDelete(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { messageInfo = new MessageInfo(messageInfo.getStoreKey(), messageInfo.getSize(), true, messageInfo.isTtlUpdated(), false, messageInfo.getExpirationTimeInMs(), messageInfo.getCrc(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs(), messageInfo.getLifeVersion()); remoteReplicaInfo.getLocalStore().delete(Collections.singletonList(messageInfo)); logger.trace("Remote node: Thread name: Remote replica: Key delete: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted) { logger.trace("Remote node: Thread name: Remote replica: Key already deleted: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaDeleted(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED); } }
Source:
private boolean validationEnabled(VariableTree variable) { Type type = variable.symbol().type(); boolean result = variable.symbol().metadata().isAnnotatedWith(JAVAX_VALIDATION_VALID); if (type instanceof ParametrizedTypeJavaType) { result = result || typeArgumentAnnotationNames(variable).anyMatch(name -> name.equals(JAVAX_VALIDATION_VALID)); } return result; }

Target:
private static boolean validationEnabled(VariableTree variable) { if (variable.symbol().metadata().isAnnotatedWith(JAVAX_VALIDATION_VALID)) { return true; } Type type = variable.symbol().type(); return type instanceof ParametrizedTypeJavaType && typeArgumentAnnotations(variable).anyMatch(annotation -> annotation.is(JAVAX_VALIDATION_VALID)); }
Source:
private ZonedDateTime readFromFile() { if (!lastEventPollingPath.toFile().isFile()) { return null; } try ( FileInputStream fis = new FileInputStream(lastEventPollingPath.toFile()); ObjectInputStream ois = new ObjectInputStream(fis)) { return (ZonedDateTime) ois.readObject(); } catch (Exception e) { } return null; }

Target:
private ZonedDateTime readFromFile() { if (!lastEventPollingPath.toFile().isFile()) { return null; } try { long millis = Long.parseLong(new String(Files.readAllBytes(lastEventPollingPath), Charset.defaultCharset())); return ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneOffset.systemDefault()); } catch (IOException | NumberFormatException e) { } return null; }
Source:
private synchronized void reserveNextBlock(long nextTS) throws TimestampIOException { while (nextTS > _maxReservedTimestamp) { long nextMax = _maxReservedTimestamp + blockSize; timestampBlockManager.reserveNextBlock(nextMax); _maxReservedTimestamp = nextMax; _numBlocksReserved.incrementAndGet(); SpliceLogUtils.debug(LOG, "Next timestamp block reserved with max = %s", _maxReservedTimestamp); } }

Target:
private synchronized void reserveNextBlock(long nextTS) throws TimestampIOException { if (nextTS > _maxReservedTimestamp) { long blockCount = (nextTS - _maxReservedTimestamp) / blockSize + 1; long nextMax = _maxReservedTimestamp + blockSize * blockCount; timestampBlockManager.persistMaxTimestamp(nextMax); _maxReservedTimestamp = nextMax; _numBlocksReserved.addAndGet(blockCount); SpliceLogUtils.debug(LOG, "Next timestamp block reserved with max = %s", _maxReservedTimestamp); } }
Source:
public Map<Long, Set<TObject>> chronologize(Text key, long start, long end) { read.lock(); try { Map<Long, Set<TObject>> context = Maps.newLinkedHashMap(); List<CompactRevision<Value>> revisions = history.get(key); Set<TObject> set = Sets.newLinkedHashSet(); if(revisions != null) { Iterator<CompactRevision<Value>> it = revisions.iterator(); while (it.hasNext()) { CompactRevision<Value> revision = it.next(); long timeStamp = revision.getVersion(); if(timeStamp >= start && timeStamp <= end) { Action action = revision.getType(); set = Sets.newLinkedHashSet(set); Value newValue = revision.getValue(); if(action == Action.ADD) { set.add(newValue.getTObject()); } else if(action == Action.REMOVE) { set.remove(newValue.getTObject()); } context.put(timeStamp, set); } else if(timeStamp > end) { break; } } } return context; } finally { read.unlock(); } }

Target:
public Map<PrimaryKey, Set<Value>> chronologize(Text key, long start, long end) { read.lock(); try { Map<PrimaryKey, Set<Value>> context = Maps.newLinkedHashMap(); List<CompactRevision<Value>> revisions = history.get(key); Set<Value> snapshot = Sets.newLinkedHashSet(); if(revisions != null) { Iterator<CompactRevision<Value>> it = revisions.iterator(); while (it.hasNext()) { CompactRevision<Value> revision = it.next(); long timestamp = revision.getVersion(); if(timestamp >= end) { break; } else { Action action = revision.getType(); snapshot = Sets.newLinkedHashSet(snapshot); Value value = revision.getValue(); if(action == Action.ADD) { snapshot.add(value); } else if(action == Action.REMOVE) { snapshot.remove(value); } if(timestamp >= start && !snapshot.isEmpty()) context.put(PrimaryKey.wrap(timestamp), snapshot); } } } return context; } finally { read.unlock(); } }
Source:
public static GraphTraversal<?, ?> transform(final E_Equals e, List<Triple> triples) { GraphTraversal traversal = null; for(final Triple triple : triples){ String subject = ""; if( triple.getSubject().isVariable()) { subject = triple.getSubject().getName().toString(); } else { subject = triple.getSubject().getLiteralValue().toString(); } String object = ""; if( triple.getObject().isVariable()) { object = triple.getObject().getName().toString(); } else { object = triple.getObject().getLiteralValue().toString(); } String uri = Prefixes.getURIValue(triple.getPredicate().getURI()); String arg1 = e.getArg1().getExprVar().getVarName(); final Object value = e.getArg2().getConstant().getNode().getLiteralValue(); if (object.equals(arg1)){ traversal = __.as(subject).has(uri, P.eq(value)); } } return traversal; }

Target:
public static GraphTraversal<?, ?> transform(final E_Equals e, List<Triple> triples) { GraphTraversal traversal = null; for(final Triple triple : triples){ String subject = ""; if( triple.getSubject().isVariable()) { subject = triple.getSubject().getName().toString(); } else { subject = triple.getSubject().getLiteralValue().toString(); } String object = ""; if( triple.getObject().isVariable()) { object = triple.getObject().getName().toString(); } else { object = triple.getObject().getLiteralValue().toString(); } String uri = Prefixes.getURIValue(triple.getPredicate().getURI()); String arg1 = e.getArg1().getExprVar().getVarName(); final Object value = e.getArg2().getConstant().getNode().getLiteralValue(); if (object.equals(arg1)){ return __.as(subject).has(uri, P.eq(value)); } } return traversal; }
Source:
public void serveDevModeRequest_prepareTasksThrows_serveDevModeReturnsFalseAndDoesNotThrow() throws IOException { CompletableFuture<Void> throwFuture = new CompletableFuture<>(); throwFuture.completeExceptionally(new CustomRuntimeException()); DevModeHandler handler = DevModeHandler.start(0, configuration, npmFolder, throwFuture); try { handler.handleRequest(Mockito.mock(VaadinSession.class), Mockito.mock(VaadinRequest.class), Mockito.mock(VaadinResponse.class)); } catch (CustomRuntimeException ignore) { } HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); handler.serveDevModeRequest(request, response); }

Target:
public void serveDevModeRequest_prepareTasksThrows_serveDevModeReturnsFalseAndDoesNotThrow() throws IOException { CompletableFuture<Void> throwFuture = new CompletableFuture<>(); throwFuture.completeExceptionally(new CustomRuntimeException()); DevModeHandler handler = DevModeHandler.start(0, configuration, npmFolder, throwFuture); try { handler.handleRequest(Mockito.mock(VaadinSession.class), Mockito.mock(VaadinRequest.class), Mockito.mock(VaadinResponse.class)); } catch (CustomRuntimeException ignore) { } HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); Assert.assertFalse(handler.serveDevModeRequest(request, response)); }
Source:
public static boolean isPluginPrefixAndArtifactIdEquals( Plugin p1, Plugin p2 ) { if ( StringUtils.equals( p1.getArtifactId(), p2.getArtifactId() ) && StringUtils.equals( p1.getPrefix(), p2.getPrefix() ) ) { return true; } return false; }

Target:
public static boolean isPluginPrefixAndArtifactIdEquals( Plugin p1, Plugin p2 ) { return StringUtils.equals( p1.getArtifactId(), p2.getArtifactId() ) && StringUtils.equals( p1.getPrefix(), p2.getPrefix() ); }
Source:
public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { Log.d("BasicDispatcher", "dispatching " + traversal); final Object leaving = traversal.origin == null ? null : traversal.origin.top(); final Object entering = traversal.destination.top(); ViewGroup frame = (ViewGroup) activity.findViewById(R.id.basic_activity_frame); @LayoutRes final int layout; if (entering instanceof LandscapeScreen) { layout = R.layout.landscape_screen; } else if (entering instanceof LooseScreen) { layout = R.layout.loose_screen; } else { throw new AssertionError("Unrecognized screen " + entering); } boolean outgoingWasLocked = leaving instanceof LandscapeScreen; boolean incomingNeedsLock = entering instanceof LandscapeScreen; boolean waitForOrientationChange = incomingNeedsLock && requestLandscapeLock(); if (waitForOrientationChange) { hangingCallback = callback; } else { View incomingView = LayoutInflater.from(traversal.createContext(entering, activity)) .inflate(layout, frame, false); frame.removeAllViews(); frame.addView(incomingView); if (outgoingWasLocked && !incomingNeedsLock) { requestUnlock(); } callback.onTraversalCompleted(); } }

Target:
public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { Log.d("BasicDispatcher", "dispatching " + traversal); final OrientationSampleScreen destScreen = traversal.destination.top(); final boolean incomingNeedsLock = destScreen.requiresLandscape(); final boolean waitForOrientationChange = incomingNeedsLock && requestLandscapeLock(); if (waitForOrientationChange) { hangingCallback = callback; } else { ViewGroup frame = (ViewGroup) activity.findViewById(R.id.basic_activity_frame); View destView = LayoutInflater.from(traversal.createContext(destScreen, activity)) .inflate(destScreen.getLayoutId(), frame, false); frame.removeAllViews(); frame.addView(destView); if (!incomingNeedsLock) { requestUnlock(); } callback.onTraversalCompleted(); } }
Source:
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields("output")); }

Target:
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields(OUTPUTFIELDNAME)); }
Source:
public static final void addSearchPathSuffix(String libraryName, String pathSuffix) { File ps = new File(pathSuffix); if (!ps.isAbsolute()) { synchronized (pathSuffixes) { List customPaths = (List) pathSuffixes.get(libraryName); if (customPaths == null) { customPaths = Collections.synchronizedList(new LinkedList()); pathSuffixes.put(libraryName, customPaths); } customPaths.add(pathSuffix); } } }

Target:
public static final void addSearchPathSuffix(String libraryName, String pathSuffix) { File ps = new File(pathSuffix); if (!ps.isAbsolute()) { synchronized (pathSuffixes) { List<String> customPaths = pathSuffixes.get(libraryName); if (customPaths == null) { customPaths = Collections.synchronizedList(new LinkedList<String>()); pathSuffixes.put(libraryName, customPaths); } customPaths.add(pathSuffix); } } }
Source:
public void partDeactivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { fActive = false; } }

Target:
public void partDeactivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { fActive = false; deactivateParticipants(fActiveConsole); } }
Source:
private EventBookingDTO convertToDTO(final EventBooking eb, final IsaacEventPageDTO eventInformation) throws SegueDatabaseException { EventBookingDTO result = new EventBookingDTO(); try { UserSummaryWithEmailAddressDTO user = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(eb .getUserId()), UserSummaryWithEmailAddressDTO.class); Long reservedById = eb.getReservedBy(); if (!reservedById.equals(0L)) { UserSummaryWithEmailAddressDTO reservingUser = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(reservedById), UserSummaryWithEmailAddressDTO.class); result.setReservedBy(reservingUser); } result.setBookingId(eb.getId()); result.setEventDate(eventInformation.getDate()); result.setEventId(eventInformation.getId()); result.setEventTitle(eventInformation.getTitle()); result.setBookingDate(eb.getCreationDate()); result.setUpdated(eb.getUpdateDate()); result.setBookingStatus(eb.getBookingStatus()); result.setUserBooked(user); result.setAdditionalInformation(eb.getAdditionalInformation()); return result; } catch (NoUserException e) { log.error("Unable to create event booking dto as user is unavailable"); throw new SegueDatabaseException("Unable to create event booking dto as user is unavailable", e); } }

Target:
private EventBookingDTO convertToDTO(final EventBooking eb, final IsaacEventPageDTO eventInformation) throws SegueDatabaseException { EventBookingDTO result = new EventBookingDTO(); try { UserSummaryWithEmailAddressDTO user = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(eb .getUserId(), true), UserSummaryWithEmailAddressDTO.class); result.setReservedById(eb.getReservedById()); result.setUserBooked(user); result.setBookingId(eb.getId()); result.setEventDate(eventInformation.getDate()); result.setEventId(eventInformation.getId()); result.setEventTitle(eventInformation.getTitle()); result.setBookingDate(eb.getCreationDate()); result.setUpdated(eb.getUpdateDate()); result.setBookingStatus(eb.getBookingStatus()); result.setAdditionalInformation(eb.getAdditionalInformation()); return result; } catch (NoUserException e) { log.error("Unable to create event booking dto as user is unavailable"); throw new SegueDatabaseException("Unable to create event booking dto as user is unavailable", e); } }
Source:
private Map<String, String> initializeApplicationTableProps() { Map<String, String> ntcProps = new HashMap<>(); ntcProps.put("table.group.notify", encodeColumnFamily(ColumnConstants.NOTIFY_CF)); ntcProps.put("table.groups.enabled", "notify"); IteratorSetting gcIter2 = new IteratorSetting(10, "gc", GarbageCollectionIterator.class); GarbageCollectionIterator.setZookeepers(gcIter2, config.getAppZookeepers()); IteratorSetting ntfyIter = new IteratorSetting(11, "ntfy", NotificationIterator.class); for (IteratorSetting setting : new IteratorSetting[] {gcIter2, ntfyIter}) { for (IteratorScope scope : EnumSet.of(IteratorUtil.IteratorScope.majc, IteratorUtil.IteratorScope.minc)) { String root = String.format("table.iterator.%s.%s", scope.name().toLowerCase(), setting.getName()); for (Entry<String, String> prop : setting.getOptions().entrySet()) { ntcProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } ntcProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } } return ntcProps; }

Target:
private Map<String, String> initializeApplicationTableProps() { Map<String, String> ntcProps = new HashMap<>(); ntcProps.put(AccumuloProps.TABLE_GROUP_PREFIX + ColumnConstants.NOTIFY_LOCALITY_GROUP_NAME, encodeColumnFamily(ColumnConstants.NOTIFY_CF)); ntcProps.put(AccumuloProps.TABLE_GROUPS_ENABLED, ColumnConstants.NOTIFY_LOCALITY_GROUP_NAME); IteratorSetting gcIter = new IteratorSetting(10, ColumnConstants.GC_CF.toString(), GarbageCollectionIterator.class); GarbageCollectionIterator.setZookeepers(gcIter, config.getAppZookeepers()); IteratorSetting ntfyIter = new IteratorSetting(11, ColumnConstants.NOTIFY_CF.toString(), NotificationIterator.class); for (IteratorSetting setting : new IteratorSetting[] {gcIter, ntfyIter}) { for (IteratorScope scope : EnumSet.of(IteratorUtil.IteratorScope.majc, IteratorUtil.IteratorScope.minc)) { String root = String.format("%s%s.%s", AccumuloProps.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String, String> prop : setting.getOptions().entrySet()) { ntcProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } ntcProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } } return ntcProps; }
Source:
private void backupDnsFile(CommandExecutorService executorService) throws KuraException { File file = new File(DNS_FILE_NAME); if (file.exists()) { Command command = new Command(new String[] { "mv", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME }); command.setTimeout(60); CommandStatus status = executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() != 0) { logger.error("Failed to move the file to {}. The 'mv' command has failed ...", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME); throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, "Failed to backup DNS file " + DNS_FILE_NAME); } else { logger.info("successfully backed up {}", DNS_FILE_NAME); } } }

Target:
private void backupDnsFile(CommandExecutorService executorService) throws KuraException { File file = new File(DNS_FILE_NAME); if (file.exists()) { Command command = new Command(new String[] { "mv", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME }); command.setTimeout(COMMAND_TIMEOUT); CommandStatus status = executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() != 0) { logger.error("Failed to move the file to {}. The 'mv' command has failed ...", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME); throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, "Failed to backup DNS file " + DNS_FILE_NAME); } else { logger.info("successfully backed up {}", DNS_FILE_NAME); } } }
Source:
public void testClassAnnotation() { assertGeneratedMatches( Lists.<String>newArrayList(), Lists.newArrayList("@" + TEST_ANNOTATION_FULLNAME + "(testClass = String.class)"), Lists.newArrayList("@" + TEST_ANNOTATION_FULLNAME + "(testClass = java.lang.String.class)")); }

Target:
public void testClassAnnotation() { assertGeneratedMatches( ImmutableList.<String>of(), ImmutableList.of(TEST_ANNOTATION + "(testClass = String.class)"), ImmutableList.of(TEST_ANNOTATION + "(testClass = java.lang.String.class)")); }
Source:
public SESSION_INFO_10(Pointer p) { super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT); read(); }

Target:
public SESSION_INFO_10(Pointer p) { super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE); read(); }
Source:
protected Set<String> getApplicableColos(String type, Entity entity) { try { if (DeploymentUtil.isEmbeddedMode()) { return DeploymentUtil.getDefaultColos(); } if (EntityType.getEnum(type) == EntityType.CLUSTER) { return getAllColos(); } Set<String> clusters = EntityUtil.getClustersDefined(entity); Set<String> colos = new HashSet<String>(); for (String cluster : clusters) { try{ Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster); colos.add(clusterEntity.getColo()); } catch (EntityNotRegisteredException e){ e.printStackTrace(); } } if (colos.size() == 0) { throw new EntityNotRegisteredException(entity.getName() + " (" + type + ") not found"); } return colos; } catch (FalconException e) { throw FalconWebException.newAPIException(e); } }

Target:
protected Set<String> getApplicableColos(String type, Entity entity) { try { if (DeploymentUtil.isEmbeddedMode()) { return DeploymentUtil.getDefaultColos(); } if (EntityType.getEnum(type) == EntityType.CLUSTER) { return getAllColos(); } Set<String> clusters = EntityUtil.getClustersDefined(entity); Set<String> colos = new HashSet<String>(); for (String cluster : clusters) { try{ Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster); colos.add(clusterEntity.getColo()); } catch (EntityNotRegisteredException e){ LOG.warn(e.getMessage(), e); } } if (colos.isEmpty()) { throw new EntityNotRegisteredException(entity.getName() + " (" + type + ") not found"); } return colos; } catch (FalconException e) { throw FalconWebException.newAPIException(e); } }