auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ExpiredObject getExpiredObject(String key) { try { ExpiredObject expiredObject = getExpiredObject(key, null); expiredObject.setType(ExpiredObjectType.fromValue(expiredObject.getTypeString())); if (expiredObject != null) { LOG.debug("Found ExpiredObject id: , ExpiredObject : ", key, expiredObject); return expiredObject; } LOG.error("Failed to fetch ExpiredObject by id: ", key); return null; } catch (Exception e) { if (((e instanceof EntryPersistenceException)) && (e.getMessage().contains("Failed to find entry"))) { LOG.warn("Failed to fetch ExpiredObject by id: {}. ", key, e.getMessage()); return null; } LOG.error("Failed to fetch ExpiredObject by id: ", key, e); } return null; }

Target:
public ExpiredObject getExpiredObject(String key) { try { ExpiredObject expiredObject = (ExpiredObject) this.persistenceEntryManager.find(getDnForExpiredObj(key), ExpiredObject.class, null); if (expiredObject != null) { expiredObject.setType(ExpiredObjectType.fromValue(expiredObject.getTypeString())); LOG.debug("Found ExpiredObject id: , ExpiredObject : ", key, expiredObject); return expiredObject; } LOG.error("Failed to fetch ExpiredObject by id: ", key); return null; } catch (Exception e) { if (((e instanceof EntryPersistenceException)) && (e.getMessage().contains("Failed to find entry"))) { LOG.warn("Failed to fetch ExpiredObject by id: {}. ", key, e.getMessage()); return null; } LOG.error("Failed to fetch ExpiredObject by id: ", key, e); } return null; }
Source:
public void testVendorReturnGreaterMinor() { String testString = "1.2.0"; ShadowExtenderVersioningImpl.setTestApiVersion(testString); assertFalse(ExtensionVersion.isExtensionVersionSupported()); assertNull(ExtensionVersion.getRuntimeVersion()); }

Target:
public void testVendorReturnGreaterMinor() { String testString = "1.2.0"; ShadowExtenderVersioningImpl.setTestApiVersion(testString); assertTrue(ExtensionVersion.isExtensionVersionSupported()); assertEquals(ExtensionVersion.getRuntimeVersion(), Version.parse(testString)); }
Source:
private static void setScanFilter(StatementContext context, Expression whereClause, boolean disambiguateWithFamily) { Filter filter = null; Scan scan = context.getScan(); assert scan.getFilter() == null; if (LiteralExpression.FALSE_EXPRESSION == whereClause) { context.setScanKey(ScanKey.DEGENERATE_SCAN_KEY); } else if (whereClause != null && whereClause != LiteralExpression.TRUE_EXPRESSION) { final Counter counter = new Counter(); whereClause.accept(new KeyValueExpressionVisitor() { @Override public Iterator<Expression> defaultIterator(Expression node) { if (counter.getCount() == Counter.Count.MULTIPLE) { return Iterators.emptyIterator(); } return super.defaultIterator(node); } @Override public Void visit(KeyValueColumnExpression expression) { counter.increment(expression); return null; } }); switch (counter.getCount()) { case NONE: filter = new RowKeyComparisonFilter(whereClause); break; case SINGLE: filter = disambiguateWithFamily ? new SingleCFCQKeyValueComparisonFilter(whereClause) : new SingleCQKeyValueComparisonFilter(whereClause); break; case MULTIPLE: filter = disambiguateWithFamily ? new MultiCFCQKeyValueComparisonFilter(whereClause) : new MultiCQKeyValueComparisonFilter(whereClause); break; } } if (context.hasCnf()) { SkipScanFilter skip = new SkipScanFilter(); context.getCnf(skip); FilterListWithEquals list; if (filter != null) { list = new FilterListWithEquals(Operator.MUST_PASS_ALL, skip, filter); } else { list = new FilterListWithEquals(Operator.MUST_PASS_ALL, skip); } filter = list; } scan.setFilter(filter); }

Target:
private static void setScanFilter(StatementContext context, Expression whereClause, boolean disambiguateWithFamily) { Filter filter = null; Scan scan = context.getScan(); assert scan.getFilter() == null; if (LiteralExpression.FALSE_EXPRESSION == whereClause) { context.setScanKey(ScanKey.DEGENERATE_SCAN_KEY); } else if (whereClause != null && whereClause != LiteralExpression.TRUE_EXPRESSION) { final Counter counter = new Counter(); whereClause.accept(new KeyValueExpressionVisitor() { @Override public Iterator<Expression> defaultIterator(Expression node) { if (counter.getCount() == Counter.Count.MULTIPLE) { return Iterators.emptyIterator(); } return super.defaultIterator(node); } @Override public Void visit(KeyValueColumnExpression expression) { counter.increment(expression); return null; } }); switch (counter.getCount()) { case NONE: filter = new RowKeyComparisonFilter(whereClause); break; case SINGLE: filter = disambiguateWithFamily ? new SingleCFCQKeyValueComparisonFilter(whereClause) : new SingleCQKeyValueComparisonFilter(whereClause); break; case MULTIPLE: filter = disambiguateWithFamily ? new MultiCFCQKeyValueComparisonFilter(whereClause) : new MultiCQKeyValueComparisonFilter(whereClause); break; } } if (context.hasCnf()) { SkipScanFilter skip = context.newSkipScanFilter(); if (skip != null) { if (filter == null) { filter = skip; } else { filter = new FilterList(Operator.MUST_PASS_ALL, skip, filter); } } } scan.setFilter(filter); }
Source:
public void onActivate(ActivateEvent event, EntityRef entity) { BlockItemFactory blockFactory = new BlockItemFactory(entityManager); inventoryManager = new InventoryAuthoritySystem(); BlockComponent blockComponent = entity.getComponent(BlockComponent.class); LASTeam flagTeamComponent = entity.getComponent(LASTeam.class); EntityRef flagTaker = event.getInstigator(); LASTeam playerTeamComponent = flagTaker.getComponent(LASTeam.class); if (flagTeamComponent.team.equals("red") && playerTeamComponent.team.equals("black")) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:redFlag"))); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); } if (flagTeamComponent.team.equals("black") && playerTeamComponent.team.equals("red")) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:blackFlag"))); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); } }

Target:
public void onActivate(ActivateEvent event, EntityRef entity) { BlockItemFactory blockFactory = new BlockItemFactory(entityManager); inventoryManager = new InventoryAuthoritySystem(); BlockComponent blockComponent = entity.getComponent(BlockComponent.class); LASTeam flagTeamComponent = entity.getComponent(LASTeam.class); EntityRef flagTaker = event.getInstigator(); LASTeam playerTeamComponent = flagTaker.getComponent(LASTeam.class); if (flagTeamComponent.team.equals(flagTeamComponent.RED) && playerTeamComponent.team.equals(playerTeamComponent.BLACK)) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:redFlag"))); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); } if (flagTeamComponent.team.equals(flagTeamComponent.BLACK) && playerTeamComponent.team.equals(playerTeamComponent.RED)) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:blackFlag"))); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); } }
Source:
public void testSelection() throws Throwable { this.testClearFilter(); ListView lv = ((ListActivity) this.activity).getListView(); int index = (int) (Math.random()*(lv.getChildCount()-1)) + 1; final CheckedTextView ctv = (CheckedTextView) lv.getChildAt(index).findViewById(R.id.checkmark); this.runTestOnUiThread(new Runnable() { @Override public void run() { Assert.assertTrue(ctv.performClick()); } }); Assert.assertTrue(this.inst.invokeMenuActionSync(this.activity, R.id.delete_menu, 0)); }

Target:
public void testSelection() throws Throwable { ListView lv = ((ListActivity) this.activity).getListView(); int index = (int) (Math.random()*(lv.getChildCount()-1)) + 1; final CheckedTextView ctv = (CheckedTextView) lv.getChildAt(index).findViewById(R.id.checkmark); this.runTestOnUiThread(new Runnable() { @Override public void run() { Assert.assertTrue(ctv.performClick()); } }); Assert.assertTrue(this.inst.invokeMenuActionSync(this.activity, R.id.delete_menu, 0)); }
Source:
public static void deleteBucketTags_test() throws Exception { if (!mintEnv) { System.out.println("Test: deleteBucketTags(DeleteBucketTagsArgs args)"); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); try { client.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket(bucketName).build()); Map<String, String> map = new HashMap<>(); map.put("Project", "Project One"); map.put("User", "jsmith"); client.setBucketTags(SetBucketTagsArgs.builder().bucket(bucketName).tags(map).build()); client.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket(bucketName).build()); mintSuccessLog("deleteBucketTags(DeleteBucketTagsArgs args)", null, startTime); } finally { client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } } catch (Exception e) { ErrorResponse errorResponse = null; if (e instanceof ErrorResponseException) { ErrorResponseException exp = (ErrorResponseException) e; errorResponse = exp.errorResponse(); } if (errorResponse != null && errorResponse.errorCode() == ErrorCode.NOT_IMPLEMENTED) { mintIgnoredLog("deleteBucketTags(DeleteBucketTagsArgs args)", null, startTime); } else { mintFailedLog( "deleteBucketTags(DeleteBucketTagsArgs args)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } }

Target:
public static void deleteBucketTags_test() throws Exception { String methodName = "deleteBucketTags(DeleteBucketTagsArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); try { client.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket(bucketName).build()); Map<String, String> map = new HashMap<>(); map.put("Project", "Project One"); map.put("User", "jsmith"); client.setBucketTags(SetBucketTagsArgs.builder().bucket(bucketName).tags(map).build()); client.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket(bucketName).build()); Tags tags = client.getBucketTags(GetBucketTagsArgs.builder().bucket(bucketName).build()); if (tags.get().size() != 0) { throw new Exception("expected: <empty map>" + ", got: " + tags.get()); } mintSuccessLog(methodName, null, startTime); } finally { client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } } catch (Exception e) { handleException(methodName, startTime, e); } }
Source:
public String toString() { return toStringHelper(this) .add("filteringSymbolAlias", filteringSymbolAlias) .add("sourceSymbolAlias", sourceSymbolAlias) .add("outputAlias", outputAlias) .add("distributionType", distributionType.orElse(null)) .toString(); }

Target:
public String toString() { return toStringHelper(this) .add("filteringSymbolAlias", filteringSymbolAlias) .add("sourceSymbolAlias", sourceSymbolAlias) .add("outputAlias", outputAlias) .add("distributionType", distributionType) .toString(); }
Source:
public static void InitDictionaries() { log.info("Start initializing " + CpuFlagsManagerHandler.class.getSimpleName()); _managersDictionary.clear(); for (Version ver : Config.<HashSet<Version>> GetValue(ConfigValues.SupportedClusterLevels)) { _managersDictionary.put(ver, new CpuFlagsManager(ver)); } log.info("Finished initializing " + CpuFlagsManagerHandler.class.getSimpleName()); }

Target:
public static void InitDictionaries() { log.info("Start initializing dictionaries"); _managersDictionary.clear(); for (Version ver : Config.<HashSet<Version>> GetValue(ConfigValues.SupportedClusterLevels)) { _managersDictionary.put(ver, new CpuFlagsManager(ver)); } log.info("Finished initializing dictionaries" + CpuFlagsManagerHandler.class.getSimpleName()); }
Source:
public void run() { while (alive) { try { PackResponse packResponse = exchangeClient.exchange(); long newPollRate = packResponse != null ? packResponse.getNewPollRate() : 0; if (newPollRate > 0 && pollRate != newPollRate) { log.info("Poll rate changed to ms", pollRate, newPollRate); pollRate = newPollRate; } } catch (IOException e) { log.error("Error in exchange client", e); throw new TechnicalException("IOException", e); } catch (NodeNotFound e) { log.warn("Agent didn't registered on current coordinator! Reset agent registration.", nodeContext.getId()); exchangeClient.getPackExchanger().clean(); AgentStarter.resetAgent(Agent.this); } catch (Throwable e) { alive = false; log.error("Agent got an exception from coordinator", nodeContext.getId()); } log.debug("Pack exchange completed. Poll rate on agent is ms", nodeContext.getId(), pollRate); TimeUtils.sleepMillis(pollRate); } }

Target:
public void run() { while (alive) { try { PackResponse packResponse = exchangeClient.exchange(); long newPollRate = packResponse != null ? packResponse.getNewPollRate() : 0; if (newPollRate > 0 && pollRate != newPollRate) { log.info("Poll rate changed to ms", pollRate, newPollRate); pollRate = newPollRate; } } catch (IOException e) { log.error("Error in exchange client", e); throw new TechnicalException("IOException", e); } catch (NodeNotFound e) { log.warn("Agent didn't registered on current coordinator! Reset agent registration.", nodeContext.getId()); exchangeClient.getPackExchanger().clean(); AgentStarter.resetAgent(Agent.this); } catch (Throwable e) { alive = false; log.error("Agent "+nodeContext.getId()+" got an exception from coordinator", e); } log.debug("Pack exchange completed. Poll rate on agent is ms", nodeContext.getId(), pollRate); TimeUtils.sleepMillis(pollRate); } }
Source:
public static long getSnapshotMemorySizeInBytes(VM vm) { long videoRam = (long)VideoDeviceSettings.totalVideoRAMSizeMb(vm) * 1024 * 1024; return vm.getVmMemSizeMb() + 200 + videoRam; }

Target:
public static long getSnapshotMemorySizeInBytes(VM vm) { long videoRam = (long)VideoDeviceSettings.totalVideoRAMSizeMb(vm); return (vm.getVmMemSizeMb() + 200 + videoRam) * 1024 * 1024; }
Source:
public CommandImpl(Command command) { this.name = command.getName(); this.commandLine = command.getCommandLine(); this.type = command.getType(); this.attributes = new HashMap<>(command.getAttributes()); }

Target:
public CommandImpl(Command command) { this(command.getName(), command.getCommandLine(), command.getType(), unmodifiableMap(command.getAttributes())); }
Source:
private OptionalInt getJoinOperatorsCountForSpill(LocalExecutionPlanContext context, Session session) { OptionalInt driverInstanceCount = context.getDriverInstanceCount(); if (isSpillEnabled(session)) { checkState(driverInstanceCount.isPresent(), "Indeterminate number of LookupJoinOperator-s when using spill to disk. This is a bug."); } return driverInstanceCount; }

Target:
private OptionalInt getJoinOperatorsCountForSpill(LocalExecutionPlanContext context, Session session) { OptionalInt driverInstanceCount = context.getDriverInstanceCount(); if (isSpillEnabled(session)) { checkState(driverInstanceCount.isPresent(), "A fixed distribution is required for JOIN when spilling is enabled"); } return driverInstanceCount; }
Source:
private CommandEntityCleanupManager() { log.info("Start initializing " + getClass().getSimpleName()); Calendar calendar = new GregorianCalendar(); Date mCommandEntityCleanupTime = Config.<DateTime> getValue(ConfigValues.CommandEntityCleanupTime); calendar.setTimeInMillis(mCommandEntityCleanupTime.getTime()); String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY)); log.info("Setting command entity cleanup manager to run at: {}" + cronExpression); SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "onTimer", new Class[] {}, new Object[] {}, cronExpression); log.info("Finished initializing {}", getClass().getSimpleName()); }

Target:
private CommandEntityCleanupManager() { log.info("Start initializing " + getClass().getSimpleName()); Calendar calendar = new GregorianCalendar(); Date mCommandEntityCleanupTime = Config.<DateTime> getValue(ConfigValues.CommandEntityCleanupTime); calendar.setTimeInMillis(mCommandEntityCleanupTime.getTime()); String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY)); log.info("Setting command entity cleanup manager to run at: {}", cronExpression); SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "onTimer", new Class[] {}, new Object[] {}, cronExpression); log.info("Finished initializing {}", getClass().getSimpleName()); }
Source:
public static boolean isAuthorizationException(Throwable exception) { return exception.getMessage() != null && exception.getMessage().startsWith("401"); }

Target:
public static boolean isAuthorizationException(Throwable exception) { boolean flag = false; if (exception instanceof ClientException) { ClientException e = (ClientException) exception; if (e.getHttpCode() != null && e.getHttpCode() == 401) { flag = true; } } return flag; }
Source:
protected void updatePortIfAbsent(Integer value) { if (value != null && port == null) { this.port = value; } }

Target:
protected void updatePortIfAbsent(Integer value) { if (value != null && value > 0 && port == null) { this.port = value; } }
Source:
protected boolean validate() { DiskExistenceValidator diskExistenceValidator = createDiskExistenceValidator(getDiskIds()); if (!validate(diskExistenceValidator.disksNotExist())) { return false; } DiskImagesValidator diskImagesValidator = createDiskImagesValidator(getDisks()); if (!validate(diskImagesValidator.incrementalBackupEnabled())) { return false; } if (!getVm().getStatus().isQualifiedForVmBackup()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_VM_SHOULD_BE_IN_PAUSED_OR_UP_STATUS); } if (!vmBackupDao.getAllForVm(getVmId()).isEmpty()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_ALREADY_IN_PROGRESS); } if (!getVds().isBackupEnabled()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_NOT_SUPPORTED_BY_VDS, String.format("$vdsName %s", getVdsName())); } return true; }

Target:
protected boolean validate() { DiskExistenceValidator diskExistenceValidator = createDiskExistenceValidator(getDiskIds()); if (!validate(diskExistenceValidator.disksNotExist())) { return false; } DiskImagesValidator diskImagesValidator = createDiskImagesValidator(getDisks()); if (!validate(diskImagesValidator.incrementalBackupEnabled())) { return false; } if (!getVm().getStatus().isQualifiedForVmBackup()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_VM_SHOULD_BE_IN_UP_STATUS); } if (!vmBackupDao.getAllForVm(getVmId()).isEmpty()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_ALREADY_IN_PROGRESS); } if (!getVds().isBackupEnabled()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_NOT_SUPPORTED_BY_VDS, String.format("$vdsName %s", getVdsName())); } return true; }
Source:
private SqlFieldsQueryEx makeQuery(String schema, String sql, Object[] args, int timeout, boolean autoCommit) { SqlFieldsQueryEx qry = makeQuery(schema, sql); qry.setArgs(args); qry.setAutoCommit(autoCommit); if (timeout >= 0) { qry.setTimeout(timeout, TimeUnit.SECONDS); } return qry; }

Target:
private SqlFieldsQueryEx makeQuery(String schema, String sql, Object[] args, int timeout, boolean autoCommit) { SqlFieldsQueryEx qry = makeQuery(schema, sql); qry.setArgs(args); qry.setAutoCommit(autoCommit); if (timeout >= 0) qry.setTimeout(timeout, TimeUnit.SECONDS); return qry; }
Source:
public CompilationUnitTree COMPILATION_UNIT() { return b.<CompilationUnitTree>nonterminal(PHPLexicalGrammar.COMPILATION_UNIT).is( f.compilationUnit(b.optional(SCRIPT()), b.token(PHPLexicalGrammar.EOF)) ); }

Target:
public CompilationUnitTree COMPILATION_UNIT() { return b.<CompilationUnitTree>nonterminal(PHPLexicalGrammar.COMPILATION_UNIT).is( f.compilationUnit(b.optional(SCRIPT()), b.optional(b.token(PHPLexicalGrammar.SPACING)), b.token(PHPLexicalGrammar.EOF))); }
Source:
private static String buildEventSparql(String eventType, String beginDate, String endDate) throws ParseException { String searchEndDate = endDate; if (StringUtils.isNotBlank(endDate)) { Calendar eCal = Calendar.getInstance(); eCal.setTime(dateFormat.parse(endDate)); eCal.add(Calendar.DATE, 1); searchEndDate = dateFormat.format(eCal.getTime()); } String sparql = "SELECT ?e WHERE {?e <<LINK_0>> '\"" + eventType + "\"' . ?e <<LINK_1>> ?date . FILTER (?date > '\"" + beginDate + "\"'"; if (StringUtils.isNotBlank(endDate)) { sparql += " && ?date < '\"" + searchEndDate + "\"'"; } sparql += ")}"; return sparql; }

Target:
private static String buildEventSparql(String eventType, String beginDate, String endDate) throws ParseException { String searchEndDate = endDate; if (StringUtils.isNotBlank(endDate)) { Calendar eCal = Calendar.getInstance(); eCal.setTime(dateFormat.parse(endDate)); eCal.add(Calendar.DATE, 1); searchEndDate = dateFormat.format(eCal.getTime()); } String sparql = "SELECT ?e WHERE {?e <" + DAMSClient.PREDICATE_EVENT_TYPE + "> '\"" + eventType + "\"' . ?e <" + DAMSClient.PREDICATE_EVENT_DATE + "> ?date . FILTER (?date > '\"" + beginDate + "\"'"; if (StringUtils.isNotBlank(endDate)) { sparql += " && ?date < '\"" + searchEndDate + "\"'"; } sparql += ")}"; return sparql; }
Source:
public HazelcastTimerStore(HazelcastCore core) throws Exception { if (!core.isEnabled()) { throw new Exception("Hazelcast MUST be enabled when using the HazelcastTimerStore"); } pkCache = core.getInstance().getMap(EJB_TIMER_CACHE_NAME); containerCache = core.getInstance().getMap(EJB_TIMER_CONTAINER_CACHE_NAME); applicationCache = core.getInstance().getMap(EJB_TIMER_APPLICAION_CACHE_NAME); serverName = core.getInstance().getCluster().getLocalMember().getStringAttribute(HazelcastCore.INSTANCE_ATTRIBUTE); this.ownerIdOfThisServer_ = serverName; this.domainName_ = core.getInstance().getConfig().getGroupConfig().getName(); super.enableRescheduleTimers(); Globals.getDefaultBaseServiceLocator().getService(PayaraCluster.class).addClusterListener(this); }

Target:
public HazelcastTimerStore(HazelcastCore core) throws Exception { if (!core.isEnabled()) { throw new Exception("Hazelcast MUST be enabled when using the HazelcastTimerStore"); } hazelcast = core.getInstance(); pkCache = hazelcast.getMap(EJB_TIMER_CACHE_NAME); containerCache = hazelcast.getMap(EJB_TIMER_CONTAINER_CACHE_NAME); applicationCache = hazelcast.getMap(EJB_TIMER_APPLICAION_CACHE_NAME); serverName = hazelcast.getCluster().getLocalMember().getStringAttribute(HazelcastCore.INSTANCE_ATTRIBUTE); this.ownerIdOfThisServer_ = serverName; this.domainName_ = core.getInstance().getConfig().getGroupConfig().getName(); super.enableRescheduleTimers(); }
Source:
private void collectMinings(ITypeRoot unit, ITextEditor textEditor, IJavaElement[] elements, List<ICodeMining> minings, ITextViewer viewer, IProgressMonitor monitor) throws JavaModelException { for (IJavaElement element : elements) { if (monitor.isCanceled()) { return; } if (element.getElementType() == IJavaElement.TYPE) { collectMinings(unit, textEditor, ((IType) element).getChildren(), minings, viewer, monitor); } else if (!(element.getElementType() == IJavaElement.METHOD || element.getElementType() == IJavaElement.FIELD)) { continue; } if (showReferences) { try { if ((showReferencesOnTypes && (element.getElementType() == IJavaElement.TYPE)) || (showReferencesOnMethods && (element.getElementType() == IJavaElement.METHOD)) || (showReferencesOnFields && (element.getElementType() == IJavaElement.FIELD)) ) { minings.add(new JavaReferenceCodeMining(element, (JavaEditor) textEditor, viewer.getDocument(), this, showAtLeastOne)); } } catch (BadLocationException e) { } } if (showImplementations) { if (element instanceof IType) { IType type= (IType) element; if (type.isInterface() || type.isClass() || Flags.isAbstract(type.getFlags())) { try { minings.add(new JavaImplementationCodeMining(type, (JavaEditor) textEditor, viewer.getDocument(), this, showAtLeastOne)); } catch (BadLocationException e) { } } } } } }

Target:
private void collectMinings(ITypeRoot unit, ITextEditor textEditor, IJavaElement[] elements, List<ICodeMining> minings, ITextViewer viewer, IProgressMonitor monitor) throws JavaModelException { for (IJavaElement element : elements) { if (monitor.isCanceled()) { return; } if (element.getElementType() == IJavaElement.TYPE) { collectMinings(unit, textEditor, ((IType) element).getChildren(), minings, viewer, monitor); } else if (!(element.getElementType() == IJavaElement.METHOD || element.getElementType() == IJavaElement.FIELD)) { continue; } if (showReferences) { try { if ((showReferencesOnTypes && (element.getElementType() == IJavaElement.TYPE)) || (showReferencesOnMethods && (element.getElementType() == IJavaElement.METHOD)) || (showReferencesOnFields && (element.getElementType() == IJavaElement.FIELD)) ) { minings.add(new JavaReferenceCodeMining(element, (JavaEditor) textEditor, viewer.getDocument(), this, showAtLeastOne)); } } catch (BadLocationException e) { } } if (showImplementations) { boolean addMining= false; if (element instanceof IType) { IType type= (IType) element; if (type.isInterface() || type.isClass()) { addMining= true; } } else if (element instanceof IMethod) { addMining= true; } if (addMining) { try { minings.add(new JavaImplementationCodeMining(element, (JavaEditor) textEditor, viewer.getDocument(), this, showAtLeastOne)); } catch (BadLocationException e) { } } } } }
Source:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if(!isAdded()) { return; } super.onCreateOptionsMenu(menu, inflater); if (queue != null) { inflater.inflate(R.menu.queue, menu); MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem); MenuItemUtils.adjustTextColor(getActivity(), sv); sv.setQueryHint(getString(R.string.search_hint)); sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { sv.clearFocus(); ((MainActivity) getActivity()).loadChildFragment(SearchFragment.newInstance(s)); return true; } @Override public boolean onQueryTextChange(String s) { return false; } }); MenuItemUtils.refreshLockItem(getActivity(), menu); boolean sortedAutomatically = UserPreferences.isQueueSortedAutomatically(); MenuItem lockItem = menu.findItem(R.id.queue_lock); lockItem.setVisible(!sortedAutomatically); MenuItem sortedAutomaticallyItem = menu.findItem(R.id.queue_sort_automatically); sortedAutomaticallyItem.setChecked(sortedAutomatically); MenuItem sortRandomItem = menu.findItem(R.id.queue_sort_random); sortRandomItem.setVisible(!sortedAutomatically); MenuItem sortSmartShuffleItem = menu.findItem(R.id.queue_sort_smart_shuffle); sortSmartShuffleItem.setVisible(!sortedAutomatically); isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(menu, R.id.refresh_item, updateRefreshMenuItemChecker); } }

Target:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if(!isAdded()) { return; } super.onCreateOptionsMenu(menu, inflater); if (queue != null) { inflater.inflate(R.menu.queue, menu); MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem); MenuItemUtils.adjustTextColor(getActivity(), sv); sv.setQueryHint(getString(R.string.search_hint)); sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { sv.clearFocus(); ((MainActivity) getActivity()).loadChildFragment(SearchFragment.newInstance(s)); return true; } @Override public boolean onQueryTextChange(String s) { return false; } }); MenuItemUtils.refreshLockItem(getActivity(), menu); boolean keepSorted = UserPreferences.isQueueKeepSorted(); MenuItem lockItem = menu.findItem(R.id.queue_lock); lockItem.setVisible(!keepSorted); MenuItem sortRandomItem = menu.findItem(R.id.queue_sort_random); sortRandomItem.setVisible(!keepSorted); MenuItem keepSortedItem = menu.findItem(R.id.queue_keep_sorted); keepSortedItem.setChecked(keepSorted); isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(menu, R.id.refresh_item, updateRefreshMenuItemChecker); } }
Source:
public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId) { try { Stat stat = new Stat(); final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoinNodeBlocker, false, stat)).getInt(); if (hostId == rejoiningHost) { zk.delete(rejoinNodeBlocker, stat.getVersion()); return true; } } catch (KeeperException e) { if (e.code() != KeeperException.Code.NONODE && e.code() != KeeperException.Code.BADVERSION) { return false; } } catch (InterruptedException e) { return false; } return false; }

Target:
public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId) { try { Stat stat = new Stat(); final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoinNodeBlocker, false, stat)).getInt(); if (hostId == rejoiningHost) { zk.delete(rejoinNodeBlocker, stat.getVersion()); return true; } } catch (KeeperException e) { if (e.code() == KeeperException.Code.NONODE || e.code() == KeeperException.Code.BADVERSION) { return true; } } catch (InterruptedException e) { return false; } return false; }
Source:
protected List<PullRequestReference> fetchPullRequestsRaw() { final List<PullRequestReference> pullRequests = new ArrayList<>(); for(StreamDefinition streamDefinition: super.processorConfig.getStreamDefinition()){ if(streamDefinition.isFound()){ for(StreamComponentDefinition streamComponentDefinition:streamDefinition.getStreamComponents()){ if(streamDefinition.isFound()){ try { final Repository repository = super.processorConfig.getAphrodite().getRepository(streamComponentDefinition.getStreamComponent().getRepositoryURL().toURL()); if(repository != null){ final List<PullRequest> componentPullRequests = super.processorConfig.getAphrodite().getPullRequestsByState(repository, PullRequestState.OPEN); pullRequests.addAll(componentPullRequests.stream().map(p->{ PullRequestReference pullRequestReference = new PullRequestReference(); pullRequestReference.setComponentDefinition(streamComponentDefinition); pullRequestReference.setPullRequest(p); return pullRequestReference; }).collect(Collectors.toList())); } else { super.logger.warning("Did not find repository: "+streamComponentDefinition.getStreamComponent().getRepositoryURL()); } } catch (MalformedURLException e) { super.log(Level.WARNING, "Did not find repo",e); } catch (NotFoundException e) { super.log(Level.WARNING, "Did not find repo",e); } } else { super.log(Level.WARNING, "Component not found, ignoring: "+streamComponentDefinition); } } } } return pullRequests; }

Target:
protected List<PullRequestReference> fetchPullRequestsRaw() { final List<PullRequestReference> pullRequests = new ArrayList<>(); for(StreamDefinition streamDefinition: super.processorConfig.getStreamDefinition()){ if(streamDefinition.isFound()){ for(StreamComponentDefinition streamComponentDefinition:streamDefinition.getStreamComponents()){ if(streamDefinition.isFound()){ try { final Repository repository = super.processorConfig.getAphrodite().getRepository(streamComponentDefinition.getStreamComponent().getRepositoryURL().toURL()); if(repository != null){ final List<PullRequest> componentPullRequests = super.processorConfig.getAphrodite().getPullRequestsByState(repository, PullRequestState.OPEN); pullRequests.addAll(componentPullRequests.stream().map(p->{ return new PullRequestReference(p, streamComponentDefinition); }).collect(Collectors.toList())); } else { super.LOGGER.warning("Did not find repository: "+streamComponentDefinition.getStreamComponent().getRepositoryURL()); } } catch (MalformedURLException e) { super.log(Level.WARNING, "Did not find repo",e); } catch (NotFoundException e) { super.log(Level.WARNING, "Did not find repo",e); } } else { super.log(Level.WARNING, "Component not found, ignoring: "+streamComponentDefinition); } } } } return pullRequests; }
Source:
public List<MatchmakerQueueMapPool> getMatchmakerPools(int matchmakerQueueId) { return Collections.emptyList(); }

Target:
public List<MatchmakerQueueMapPool> getMatchmakerPools(int matchmakerQueueId) { return List.of(); }
Source:
public void parse() { sink.start() ; HandlerSink rslt = new HandlerSink(sink, errorHandler) ; arp.getHandlers().setStatementHandler(rslt) ; arp.getHandlers().setErrorHandler(rslt) ; arp.getHandlers().setNamespaceHandler(rslt) ; ARPOptions arpOptions = arp.getOptions() ; if ( RiotUniformCompatibility ) { for ( int code : additionalErrors ) arpOptions.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ; } if ( JenaRuntime.isRDF11 ) arp.getOptions().setIRIFactory(IRIResolver.iriFactory()); if ( context != null ) { try { @SuppressWarnings("unchecked") Map<String, Object> p = (Map<String, Object>)(context.get(SysRIOT.sysRdfReaderProperties)) ; if ( p != null ) p.forEach((k,v) -> oneProperty(arpOptions, k, v)) ; } catch (Throwable ex) { Log.warn(AdapterRDFWriter.class, "Problem setting properties", ex); } } arp.setOptionsWith(arpOptions) ; try { if ( reader != null ) arp.load(reader, xmlBase) ; else arp.load(input, xmlBase) ; } catch (IOException e) { errorHandler.error(filename + ": " + ParseException.formatMessage(e), -1, -1) ; } catch (SAXParseException e) { } catch (SAXException sax) { errorHandler.error(filename + ": " + ParseException.formatMessage(sax), -1, -1) ; } sink.finish() ; }

Target:
public void parse() { sink.start() ; HandlerSink rslt = new HandlerSink(sink, errorHandler) ; arp.getHandlers().setStatementHandler(rslt) ; arp.getHandlers().setErrorHandler(rslt) ; arp.getHandlers().setNamespaceHandler(rslt) ; ARPOptions arpOptions = arp.getOptions() ; if ( RiotUniformCompatibility ) { for ( int code : additionalErrors ) arpOptions.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ; } if ( JenaRuntime.isRDF11 ) arp.getOptions().setIRIFactory(IRIResolver.iriFactory()); if ( context != null ) { Map<String, Object> properties = null; try { @SuppressWarnings("unchecked") Map<String, Object> p = (Map<String, Object>)(context.get(SysRIOT.sysRdfReaderProperties)) ; properties = p; } catch(Throwable ex) { Log.warn(this, "Problem accessing the RDF/XML reader properties: properties ignored", ex); } if ( properties != null ) properties.forEach((k,v) -> oneProperty(arpOptions, k, v)) ; } arp.setOptionsWith(arpOptions) ; try { if ( reader != null ) arp.load(reader, xmlBase) ; else arp.load(input, xmlBase) ; } catch (IOException e) { errorHandler.error(filename + ": " + ParseException.formatMessage(e), -1, -1) ; } catch (SAXParseException e) { } catch (SAXException sax) { errorHandler.error(filename + ": " + ParseException.formatMessage(sax), -1, -1) ; } sink.finish() ; }
Source:
private Token scanIdentifierOrKeyword(int beginToken, char ch) { StringBuilder valueBuilder = new StringBuilder(); valueBuilder.append(ch); boolean containsUnicodeEscape = ch == '\\'; boolean bracedUnicodeEscape = false; int unicodeEscapeLen = (ch == '\\' ? 1 : 0); ch = peekChar(); while (isIdentifierPart(ch) || ch == '\\' || (ch == '{' && unicodeEscapeLen == 2) || (ch == '}' && bracedUnicodeEscape)) { if (ch == '\\') { containsUnicodeEscape = true; } if (ch == '\\' || unicodeEscapeLen > 0) { unicodeEscapeLen ++; } if (ch == '{') { bracedUnicodeEscape = true; } if (ch == '}' || (unicodeEscapeLen >= 6 && !bracedUnicodeEscape)) { bracedUnicodeEscape = false; unicodeEscapeLen = 0; } valueBuilder.append(nextChar()); ch = peekChar(); } String value = valueBuilder.toString(); if (containsUnicodeEscape) { value = processUnicodeEscapes(value); if (value == null) { reportError( getPosition(index), "Invalid escape sequence"); return createToken(TokenType.ERROR, beginToken); } } char start = value.charAt(0); if (!isIdentifierStart(start)) { reportError( getPosition(beginToken), "Character '%c' (U+%04X) is not a valid identifier start char", start, (int) start); return createToken(TokenType.ERROR, beginToken); } if (Keywords.isKeyword(value)) { return new Token(Keywords.getTokenType(value), getTokenRange(beginToken)); } return new IdentifierToken(getTokenRange(beginToken), value.intern()); }

Target:
private Token scanIdentifierOrKeyword(int beginToken, char ch) { StringBuilder valueBuilder = new StringBuilder(); valueBuilder.append(ch); boolean containsUnicodeEscape = ch == '\\'; boolean bracedUnicodeEscape = false; int unicodeEscapeLen = containsUnicodeEscape ? 1 : 0; ch = peekChar(); while (isIdentifierPart(ch) || ch == '\\' || (ch == '{' && unicodeEscapeLen == 2) || (ch == '}' && bracedUnicodeEscape)) { if (ch == '\\') { containsUnicodeEscape = true; } if (ch == '\\' || unicodeEscapeLen > 0) { unicodeEscapeLen ++; } if (ch == '{') { bracedUnicodeEscape = true; } if (ch == '}' || (unicodeEscapeLen >= 6 && !bracedUnicodeEscape)) { bracedUnicodeEscape = false; unicodeEscapeLen = 0; } valueBuilder.append(nextChar()); ch = peekChar(); } String value = valueBuilder.toString(); if (containsUnicodeEscape) { value = processUnicodeEscapes(value); if (value == null) { reportError( getPosition(index), "Invalid escape sequence"); return createToken(TokenType.ERROR, beginToken); } } char start = value.charAt(0); if (!isIdentifierStart(start)) { reportError( getPosition(beginToken), "Character '%c' (U+%04X) is not a valid identifier start char", start, (int) start); return createToken(TokenType.ERROR, beginToken); } if (Keywords.isKeyword(value)) { return new Token(Keywords.getTokenType(value), getTokenRange(beginToken)); } return new IdentifierToken(getTokenRange(beginToken), value.intern()); }
Source:
public void stepExecutionWithCredentialsAndQueueItemAuthenticator() throws Exception { assumeNotWindows(); r.getInstance().setSecurityRealm(r.createDummySecurityRealm()); MockAuthorizationStrategy auth = new MockAuthorizationStrategy() .grant(Jenkins.READ).everywhere().to("alice") .grant(Computer.BUILD).everywhere().to("alice") .grant(Item.CONFIGURE).everywhere().to("alice"); r.getInstance().setAuthorizationStrategy(auth); IdCredentials registryCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "registryCreds", null, "me", "pass"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), registryCredentials); WorkflowJob p = r.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " mockDockerLoginWithEcho {\n" + " withDockerRegistry(url: 'https://my-reg:1234', credentialsId: 'registryCreds') {\n" + " echo 'config would be set up to connect to https://my-reg:1234'\n" + " }\n" + " }\n" + "}", true)); QueueItemAuthenticatorConfiguration.get().getAuthenticators().replace(new MockQueueItemAuthenticator( Collections.singletonMap(p.getName(), User.getById("alice", true).impersonate()))); WorkflowRun b; try (ACLContext as = ACL.as(User.getById("alice", false))) { b = r.buildAndAssertSuccess(p); } r.assertLogContains("docker login -u me -p pass https://my-reg:1234", b); r.assertLogContains("config would be set up to connect to https://my-reg:1234", b); }

Target:
public void stepExecutionWithCredentialsAndQueueItemAuthenticator() throws Exception { assumeNotWindows(); r.getInstance().setSecurityRealm(r.createDummySecurityRealm()); MockAuthorizationStrategy auth = new MockAuthorizationStrategy() .grant(Jenkins.READ).everywhere().to("alice") .grant(Computer.BUILD).everywhere().to("alice") .grant(Item.CONFIGURE).everywhere().to("alice"); r.getInstance().setAuthorizationStrategy(auth); IdCredentials registryCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "registryCreds", null, "me", "pass"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), registryCredentials); WorkflowJob p = r.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " mockDockerLoginWithEcho {\n" + " withDockerRegistry(url: 'https://my-reg:1234', credentialsId: 'registryCreds') {\n" + " }\n" + " }\n" + "}", true)); QueueItemAuthenticatorConfiguration.get().getAuthenticators().replace(new MockQueueItemAuthenticator( Collections.singletonMap(p.getName(), User.getById("alice", true).impersonate()))); WorkflowRun b; try (ACLContext as = ACL.as(User.getById("alice", false))) { b = r.buildAndAssertSuccess(p); } r.assertLogContains("docker login -u me -p pass https://my-reg:1234", b); }
Source:
public DeviceFingerprintComponent deviceFingerprintUserAgentComponent() { final UserAgent properties = casProperties.getAuthn().getMfa().getTrusted().getDeviceFingerprint().getUserAgent(); if (properties.isEnabled()) { final UserAgentDeviceFingerprintComponent component = new UserAgentDeviceFingerprintComponent(); component.setOrder(properties.getOrder()); return component; } else { return DeviceFingerprintComponent.noOp(); } }

Target:
public DeviceFingerprintComponentExtractor deviceFingerprintUserAgentComponent() { final UserAgent properties = casProperties.getAuthn().getMfa().getTrusted().getDeviceFingerprint().getUserAgent(); if (properties.isEnabled()) { final UserAgentDeviceFingerprintComponentExtractor component = new UserAgentDeviceFingerprintComponentExtractor(); component.setOrder(properties.getOrder()); return component; } LOGGER.info("User-Agent is not being included when creating MFA Trusted Device Fingerprints"); return DeviceFingerprintComponentExtractor.noOp(); }
Source:
public void createChannel() throws Exception { final Account current = gd.getAccountService().getCurrent(); channel = gd.getNotificationService().createChannel(current, new ChannelConfiguration( new EmailConfiguration(current.getEmail()), new Meta("test channel"))); assertThat(channel, is(notNullValue())); }

Target:
public void createChannel() throws Exception { final Account current = gd.getAccountService().getCurrent(); channel = gd.getNotificationService().createChannel(current, new Channel( new EmailConfiguration(current.getEmail()), "test channel")); assertThat(channel, is(notNullValue())); }
Source:
public void testGeneration() { GameRegistry.registerWorldGenerator(this, 0); try { CubeGeneratorsRegistry.computeSortedGeneratorList(); } catch (Throwable e) { fail("CubeGeneratorsRegistry failed on attempt to extract fields"); } CubeGeneratorsRegistry.generateWorld(null, null, null); if (!testPassed) { fail("CubeGeneratorsRegistry failed to generate list"); } }

Target:
public void testGeneration() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { ICubicWorldGenerator generator = mock(ICubicWorldGenerator.class); GameRegistry.registerWorldGenerator(generator, 0); CubeGeneratorsRegistry.computeSortedGeneratorList(); CubeGeneratorsRegistry.generateWorld(null, null, null); verify(generator).generate(null, null, null); }
Source:
private void performTransactionFailover(String key, int breakNodeIdx, int initiatingNodeIdx) throws IgniteCheckedException { IgniteTransactions ts = grid(initiatingNodeIdx).transactions(); IgniteCache<String, Integer> cache = jcache(initiatingNodeIdx); Transaction tx = ts.txStart(transactionConcurrency, transactionIsolation); cache.put(key, 1); tx.suspend(); G.stop(ignite(breakNodeIdx).name(), true); Assert.assertNull(ts.tx()); IgniteInternalFuture<Boolean> fut = GridTestUtils.runAsync(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Assert.assertNull(ts.tx()); Assert.assertEquals(TransactionState.SUSPENDED, tx.state()); tx.resume(); Assert.assertEquals(TransactionState.ACTIVE, tx.state()); tx.commit(); return true; } }); fut.get(); }

Target:
private void performTransactionFailover(String key, int breakNodeIdx, int initiatingNodeIdx) throws IgniteCheckedException { final IgniteTransactions transactions = grid(initiatingNodeIdx).transactions(); IgniteCache<String, Integer> cache = jcache(initiatingNodeIdx); final Transaction tx = transactions.txStart(TransactionConcurrency.OPTIMISTIC, transactionIsolation); cache.put(key, 1); tx.suspend(); G.stop(ignite(breakNodeIdx).name(), true); assertNull(transactions.tx()); IgniteInternalFuture<Boolean> fut = GridTestUtils.runAsync(new Callable<Boolean>() { @Override public Boolean call() throws Exception { assertNull(transactions.tx()); assertEquals(TransactionState.SUSPENDED, tx.state()); tx.resume(); assertEquals(TransactionState.ACTIVE, tx.state()); tx.commit(); return true; } }); fut.get(); }
Source:
public String configList(File workingDirectory, List<String> extraArgs) throws IOException, InterruptedException { List<String> args = new ArrayList<>(); for (String arg : extraArgs) { if (!"--verbose".equals(arg)) { args.add(arg); } } return runCommand(workingDirectory, new String[]{"c", "ls", "--json"}, args); }

Target:
public String configList(File workingDirectory, List<String> extraArgs) throws IOException, InterruptedException { List<String> args = new ArrayList<>(extraArgs); args.add("-s"); return runCommand(workingDirectory, new String[]{"c", "ls", "--json"}, args); }
Source:
public PojoInnerJoin(int num, Class<?> outClass, String... keys) { super(outClass,keys); }

Target:
public PojoInnerJoin(int num, Class<?> outClass, String... keys) { this.outClass = outClass; if (keys.length % 2 != 0) { throw new IllegalArgumentException("Wrong number of keys."); } this.leftKeys = new String[keys.length / 2]; this.rightKeys = new String[keys.length / 2]; for (int i = 0,j = 0; i < keys.length; i = i + 2, j++) { this.leftKeys[j] = keys[i]; this.rightKeys[j] = keys[i + 1]; } }
Source:
public String toString() { return "catalog: " + catName + "database:" + dbName + ", table:" + tblName + ", column:" + colName; }

Target:
public String toString() { return "catalog: " + catName + ", database:" + dbName + ", table:" + tblName + ", column:" + colName; }
Source:
List<Definitions> getOtherDMNDiagramsDefinitions(final Metadata metadata) { final List<Path> diagramPaths = pathsHelper.getDMNModelsPaths(getProject(metadata)); return diagramPaths .stream() .filter(path -> !Objects.equals(metadata.getPath(), path)) .map(path -> loadPath(path).map(this::toInputStreamReader).map(marshaller::unmarshal).orElse(null)) .filter(Objects::nonNull) .collect(Collectors.toList()); }

Target:
List<Definitions> getOtherDMNDiagramsDefinitions(final Metadata metadata) { final List<Path> diagramPaths = pathsHelper.getDMNModelsPaths(getProject(metadata)); return diagramPaths .stream() .filter(path -> !Objects.equals(metadata.getPath(), path)) .map(path -> loadPath(path).orElse(null)) .filter(Objects::nonNull) .map(this::toDefinitions) .filter(Objects::nonNull) .collect(Collectors.toList()); }
Source:
public boolean intersects(Vector3f position, float radius) { for (int i = 0; i < 6; i++) { if (planes[i].getA() * position.x + planes[i].getB() * position.y + planes[i].getC() * position.z + planes[i].getD() <= -radius) { return false; } } return true; }

Target:
public boolean intersects(Vector3f position, float radius) { return intersects(JomlUtil.from(position), radius); }
Source:
public void testClearMigratingToVds() throws Exception { Guid vmId = new Guid("77296e00-0cad-4e5a-9299-008a7b6f4356"); VmDynamic vmDynamic = dao.get(vmId); assertNotNull("migrating_to_vds field should not be null before we clear it", vmDynamic.getMigratingToVds()); dao.clearMigratingToVds(vmId); vmDynamic = dao.get(vmId); assertNull("migrating_to_vds field should not be null after we clear it", vmDynamic.getMigratingToVds()); }

Target:
public void testClearMigratingToVds() throws Exception { Guid vmId = new Guid("77296e00-0cad-4e5a-9299-008a7b6f4356"); VmDynamic vmDynamic = dao.get(vmId); assertNotNull("migrating_to_vds field should not be null before we clear it", vmDynamic.getMigratingToVds()); dao.clearMigratingToVds(vmId); vmDynamic = dao.get(vmId); assertNull("migrating_to_vds field should be null after we clear it", vmDynamic.getMigratingToVds()); }
Source:
public static void clearTemporaryAttachmentsCache(Context context){ File cacheDir = context.getCacheDir(); File tempAttachmentsDirectory = new File(cacheDir.getPath() + "/tempAttachments/"); if(tempAttachmentsDirectory.exists()){ try { FileUtils.cleanDirectory(tempAttachmentsDirectory); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public static void clearTemporaryAttachmentsCache(Context context) { File cacheDir = context.getCacheDir(); File tempAttachmentsDirectory = new File(cacheDir.getPath() + RESIZED_ATTACHMENTS_TEMPORARY_DIRECTORY); if (tempAttachmentsDirectory.exists()) { try { FileUtils.cleanDirectory(tempAttachmentsDirectory); } catch (IOException e) { Timber.e(e, "Error occurred while cleaning temporary directory for resized attachments"); } } }