auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void populateSelectedCategories() { List<View> viewsToRemove = new ArrayList<View>(); for (int i = 0; i < mSectionCategories.getChildCount(); i++) { View v = mSectionCategories.getChildAt(i); if (v == null) return; Object tag = v.getTag(); if (tag != null && tag.getClass() == String.class && (((String) tag).startsWith(CATEGORY_PREFIX_TAG) || tag.equals("select-category"))) { viewsToRemove.add(v); } } for (View viewToRemove : viewsToRemove) { mSectionCategories.removeView(viewToRemove); } viewsToRemove.clear(); LayoutInflater layoutInflater = getActivity().getLayoutInflater(); if (mCategories != null) { AppCompatButton buttonCategory = (AppCompatButton) layoutInflater.inflate(R.layout.category_button, null); for (String categoryName : mCategories) { if (categoryName != null && buttonCategory != null) { buttonCategory.setText(Html.fromHtml(categoryName)); buttonCategory.setTag(CATEGORY_PREFIX_TAG + categoryName); buttonCategory.setOnClickListener(this); mSectionCategories.addView(buttonCategory); } } } Button selectCategory = (Button) layoutInflater.inflate(R.layout.category_select_button, null); if (selectCategory != null) { selectCategory.setOnClickListener(this); mSectionCategories.addView(selectCategory); } }

Target:
private void populateSelectedCategories() { List<View> viewsToRemove = new ArrayList<View>(); for (int i = 0; i < mSectionCategories.getChildCount(); i++) { View v = mSectionCategories.getChildAt(i); if (v == null) return; Object tag = v.getTag(); if (tag != null && tag.getClass() == String.class && (((String) tag).startsWith(CATEGORY_PREFIX_TAG) || tag.equals("select-category"))) { viewsToRemove.add(v); } } for (View viewToRemove : viewsToRemove) { mSectionCategories.removeView(viewToRemove); } viewsToRemove.clear(); LayoutInflater layoutInflater = getActivity().getLayoutInflater(); if (mCategories != null) { for (String categoryName : mCategories) { AppCompatButton buttonCategory = (AppCompatButton) layoutInflater.inflate(R.layout.category_button, null); if (categoryName != null && buttonCategory != null) { buttonCategory.setText(Html.fromHtml(categoryName)); buttonCategory.setTag(CATEGORY_PREFIX_TAG + categoryName); buttonCategory.setOnClickListener(this); mSectionCategories.addView(buttonCategory); } } } Button selectCategory = (Button) layoutInflater.inflate(R.layout.category_select_button, null); if (selectCategory != null) { selectCategory.setOnClickListener(this); mSectionCategories.addView(selectCategory); } }
Source:
public void modelExec(Runnable runnable, boolean block) { service.modelExec(runnable, block); }

Target:
public void modelExec(Runnable runnable, boolean block) { if (service != null) { service.modelExec(runnable, block); } else { throw new RuntimeException("Internal Error: Connector must supply a service for execution."); } }
Source:
public void testPassword() { String upper = "ABC"; String numbers = "123"; String symbols = "!£$"; String id1 = Identifiers.makeRandomPassword(4, upper, numbers, symbols, Identifiers.PASSWORD_VALID_CHARS); Assert.assertTrue(upper.contains(id1.substring(0,1))); Assert.assertTrue(numbers.contains(id1.substring(1,2))); Assert.assertTrue(symbols.contains(id1.substring(2,3))); }

Target:
public void testPassword() { String upper = "ABC"; String numbers = "123"; String symbols = "!£$"; String password = Identifiers.makeRandomPassword(4, upper, numbers, symbols, Identifiers.PASSWORD_VALID_CHARS); Assert.assertTrue(password.matches(".*[" + upper + "].*")); Assert.assertTrue(password.matches(".*[" + numbers + "].*")); Assert.assertTrue(password.matches(".*[" + symbols + "].*")); }
Source:
private void compact( ByteBuffer writeBuffer ) throws IOException { if ( prePosition == stackPosition ) { return; } long writePosition = stackPosition; long readPosition = prePosition; int nBytes; do { writeBuffer.clear(); channel.position( readPosition ); nBytes = channel.read( writeBuffer ); if ( nBytes > 0 ) { readPosition += nBytes; writeBuffer.flip(); channel.position( writePosition ); channel.writeAll( writeBuffer ); writePosition += nBytes; } } while ( nBytes > 0 ); channel.truncate( writePosition ); }

Target:
private void compact( ByteBuffer writeBuffer ) throws IOException { assert stackPosition <= initialPosition; if ( initialPosition == stackPosition ) { return; } long writePosition = stackPosition; long readPosition = initialPosition; int nBytes; do { writeBuffer.clear(); channel.position( readPosition ); nBytes = channel.read( writeBuffer ); if ( nBytes > 0 ) { readPosition += nBytes; writeBuffer.flip(); channel.position( writePosition ); channel.writeAll( writeBuffer ); writePosition += nBytes; } } while ( nBytes > 0 ); channel.truncate( writePosition ); }
Source:
public List<ActionItemNoteDetailDto> getActionNotesToBeRequeued() { return getJdbcTemplate().execute((ConnectionCallback<List<ActionItemNoteDetailDto>>) con -> { PreparedStatement selectStatement = null; ResultSet queryResultSet = null; List<ActionItemNoteDetailDto> notes = new ArrayList<ActionItemNoteDetailDto>(); try { final Collection<String> docTypeIds = findNonRequeueableDocumentTypes(); final Collection<String> roleIds = findRequeueableRoleIds(); String selectStatementSql = buildActionNoteQuery(docTypeIds.size(), roleIds.size()); selectStatement = con.prepareStatement(selectStatementSql); addDocumentIdAndRoleIdsToSelectStatement(selectStatement, docTypeIds, roleIds); queryResultSet = selectStatement.executeQuery(); while (queryResultSet.next()) { String principleId = queryResultSet.getString(1); String docHeaderId = queryResultSet.getString(2); String actionNote = queryResultSet.getString(3); Timestamp noteTimeStamp = queryResultSet.getTimestamp(4, Calendar.getInstance()); String origianlActionItemId = queryResultSet.getString(5); notes.add(new ActionItemNoteDetailDto(principleId, docHeaderId, actionNote, origianlActionItemId, noteTimeStamp)); } queryResultSet.close(); } finally { processQueryFinally(selectStatement, queryResultSet); } return notes; }); }

Target:
public List<ActionItemNoteDetailDto> getActionNotesToBeRequeued() { return getJdbcTemplate().execute((ConnectionCallback<List<ActionItemNoteDetailDto>>) con -> { PreparedStatement selectStatement = null; ResultSet queryResultSet = null; List<ActionItemNoteDetailDto> notes = new ArrayList<ActionItemNoteDetailDto>(); try { final Collection<String> docTypeIds = findNonRequeueableDocumentTypes(); final Collection<String> roleIds = findRequeueableRoleIds(); String selectStatementSql = buildActionNoteQuery(docTypeIds.size(), roleIds.size()); selectStatement = con.prepareStatement(selectStatementSql); addDocumentIdAndRoleIdsToSelectStatement(selectStatement, docTypeIds, roleIds); queryResultSet = selectStatement.executeQuery(); while (queryResultSet.next()) { String principalId = queryResultSet.getString(1); String docHeaderId = queryResultSet.getString(2); String actionNote = queryResultSet.getString(3); Timestamp noteTimeStamp = queryResultSet.getTimestamp(4, Calendar.getInstance()); String originalActionItemId = queryResultSet.getString(5); notes.add(new ActionItemNoteDetailDto(principalId, docHeaderId, actionNote, originalActionItemId, noteTimeStamp)); } queryResultSet.close(); } finally { processQueryFinally(selectStatement, queryResultSet); } return notes; }); }
Source:
public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (jobUrl != null && this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); plan.setName(this.hudsonUrlUtil.getDisplayName(jobUrl)); } else { plan.setId(job.getName()); plan.setName(job.getName()); } plan.setDescription(job.getDescription()); plan.setUrl(job.getUrl()); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = createBuild(); build.setId(job.getLastBuild().getNumber() + ""); build.setLabel(job.getLastBuild().getNumber() + ""); build.setBuildNumber(job.getLastBuild().getNumber()); build.setUrl(job.getLastBuild().getUrl()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); return plan; }

Target:
public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); } else { plan.setId(job.getName()); } plan.setName(this.hudsonUrlUtil.getDisplayName(jobUrl)); plan.setDescription(job.getDescription()); plan.setUrl(job.getUrl()); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = createBuild(); build.setId(job.getLastBuild().getNumber() + ""); build.setLabel(job.getLastBuild().getNumber() + ""); build.setBuildNumber(job.getLastBuild().getNumber()); build.setUrl(job.getLastBuild().getUrl()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); return plan; }
Source:
private void updateQosChangeability() { getQosModel().setIsChangable(getQosOverridden().getEntity() && (!getIsToSync().getIsChangable() || getIsToSync().getEntity())); }

Target:
private void updateQosChangeability() { getQosModel().setIsChangable(getQosOverridden().getEntity() && getQosOverridden().getIsChangable()); }
Source:
public void check() { Preconditions.checkState(slowLockLogTriggerMillis() >= 0, "Slow lock log trigger threshold must be nonnegative, but found %s", slowLockLogTriggerMillis()); Preconditions.checkState( !internalAuthSecret().isPresent() || internalAuthSecret().get().length() >= MIN_SECRET_LENGTH, "Internal auth secret must have at least %s characters.", MIN_SECRET_LENGTH); }

Target:
public void check() { Preconditions.checkState(slowLockLogTriggerMillis() >= 0, "Slow lock log trigger threshold must be nonnegative, but found %s", slowLockLogTriggerMillis()); }
Source:
public void testFourLetterWordsAllDisabledByDefault() throws Exception { stopServer(); FourLetterCommands.resetWhiteList(); System.setProperty("zookeeper.4lw.commands.whitelist", "stat"); startServer(); verifyAllCommandsFail(); TestableZooKeeper zk = createClient(); String sid = getHexSessionId(zk.getSessionId()); verifyAllCommandsFail(); zk.getData("/", true, null); verifyAllCommandsFail(); zk.close(); verifyFuzzyMatch("stat", "Outstanding"); verifyAllCommandsFail(); }

Target:
public void testFourLetterWordsAllDisabledByDefault() throws Exception { stopServer(); FourLetterCommands.resetWhiteList(); System.setProperty("zookeeper.4lw.commands.whitelist", "stat"); startServer(); verifyAllCommandsFail(); TestableZooKeeper zk = createClient(); verifyAllCommandsFail(); zk.getData("/", true, null); verifyAllCommandsFail(); zk.close(); verifyFuzzyMatch("stat", "Outstanding"); verifyAllCommandsFail(); }
Source:
public MemoryManager(float ratio, long minAllocation) { checkRatio(ratio); memoryPoolRatio = ratio; minMemoryAllocation = minAllocation; totalMemoryPool = Math.round(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax () * ratio); LOG.info(String.format("Allocated total memory pool is: %,d", totalMemoryPool)); }

Target:
public MemoryManager(float ratio, long minAllocation) { checkRatio(ratio); memoryPoolRatio = ratio; minMemoryAllocation = minAllocation; totalMemoryPool = Math.round(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax () * ratio); LOG.debug(String.format("Allocated total memory pool is: %,d", totalMemoryPool)); }
Source:
private static Set<String> getNoAutoImportFunctionSignaturesFromTuple(@Nullable ErlangTupleExpression tupleExpression) { Set<String> result = ContainerUtil.newHashSet(); if (tupleExpression == null || tupleExpression.getExpressionList().size() != 2) return result; ErlangExpression first = tupleExpression.getExpressionList().get(0); ErlangExpression second = tupleExpression.getExpressionList().get(1); if (!(first instanceof ErlangMaxExpression) || !"no_auto_import".equals(StringUtil.unquoteString(first.getText())) || !(second instanceof ErlangListExpression)) return result; for (ErlangExpression fun : ((ErlangListExpression)second).getExpressionList()) { List<String> name = ContainerUtil.newArrayList(); for (PsiElement e : PsiTreeUtil.getChildrenOfTypeAsList(fun, PsiElement.class)) { if (!(e instanceof PsiWhiteSpace) && !(e instanceof PsiComment)) { name.add(StringUtil.unquoteString(e.getText())); } } result.add(StringUtil.join(name, "")); } return result; }

Target:
private static Set<String> getNoAutoImportFunctionSignaturesFromTuple(@Nullable ErlangTupleExpression tupleExpression) { final Set<String> result = ContainerUtil.newHashSet(); if (tupleExpression == null || tupleExpression.getExpressionList().size() != 2) return result; ErlangExpression first = ContainerUtil.getFirstItem(tupleExpression.getExpressionList()); ErlangExpression second = ContainerUtil.getLastItem(tupleExpression.getExpressionList()); if (!(first instanceof ErlangMaxExpression) || !(second instanceof ErlangListExpression) || !"no_auto_import".equals(ErlangPsiImplUtil.getAtomName((ErlangMaxExpression) first))) return result; second.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(PsiElement element) { if (element instanceof ErlangAtomWithArityExpression) { result.add(ErlangPsiImplUtil.createFunctionPresentation((ErlangAtomWithArityExpression) element)); } else { super.visitElement(element); } } }); return result; }
Source:
public void queueWithSecondaryIndexCheck() { CorfuQueue<String> corfuQueue = new CorfuQueue<>(getDefaultRuntime(), "test", Serializers.JAVA, CorfuTable.IndexRegistry.empty()); CorfuRecordId idC = corfuQueue.enqueue("c"); CorfuRecordId idB = corfuQueue.enqueue("b"); CorfuRecordId idA = corfuQueue.enqueue("a"); List<CorfuQueueRecord<String>> records = corfuQueue.entryList(); assertThat(records.size()).isEqualTo(3); }

Target:
public void queueWithSecondaryIndexCheck() { CorfuQueue<String> corfuQueue = new CorfuQueue<>(getDefaultRuntime(), "test", Serializers.JAVA, CorfuTable.IndexRegistry.empty()); CorfuRecordId idC = corfuQueue.enqueue("c"); CorfuRecordId idB = corfuQueue.enqueue("b"); CorfuRecordId idA = corfuQueue.enqueue("a"); final int expected = 3; List<CorfuQueueRecord<String>> records = corfuQueue.entryList(); assertThat(records.size()).isEqualTo(expected); }
Source:
public TitleMatchingContainerScorer(double exactTitleMatchScore) { this.scorer = new ContentTitleScorer<>( NAME, Functions.<String>identity(), Score.valueOf(exactTitleMatchScore), Score.ONE ); }

Target:
public TitleMatchingContainerScorer(double exactTitleMatchScore) { this(Score.valueOf(exactTitleMatchScore), Score.ONE); }
Source:
public static String fromIssueStatus(Issue.Status status) { switch (status) { case CLOSED: return "6"; case NEW: return "1"; default: return "1"; } }

Target:
public static String fromIssueStatus(Issue.Status status) { if (statusMap == null) { initMap(); } return statusMap.get(status); }
Source:
public void runInternal() throws HiveSQLException { setState(OperationState.PENDING); boolean runAsync = shouldRunAsync(); final boolean asyncPrepare = runAsync && HiveConf.getBoolVar(queryState.getConf(), HiveConf.ConfVars.HIVE_SERVER2_ASYNC_EXEC_ASYNC_COMPILE); if (!asyncPrepare) { prepare(queryState); getParentSession().updateQueryId(this, queryState.getQueryId()); } if (!runAsync) { runQuery(); } else { Runnable work = new BackgroundWork(getCurrentUGI(), parentSession.getSessionHive(), SessionState.get(), asyncPrepare); try { Future<?> backgroundHandle = getParentSession().submitBackgroundOperation(work); setBackgroundHandle(backgroundHandle); } catch (RejectedExecutionException rejected) { setState(OperationState.ERROR); throw new HiveSQLException("The background threadpool cannot accept" + " new task for execution, please retry the operation", rejected); } } }

Target:
public void runInternal() throws HiveSQLException { setState(OperationState.PENDING); boolean runAsync = shouldRunAsync(); final boolean asyncPrepare = runAsync && HiveConf.getBoolVar(queryState.getConf(), HiveConf.ConfVars.HIVE_SERVER2_ASYNC_EXEC_ASYNC_COMPILE); if (!asyncPrepare) { prepare(queryState); } if (!runAsync) { runQuery(); } else { Runnable work = new BackgroundWork(getCurrentUGI(), parentSession.getSessionHive(), SessionState.get(), asyncPrepare); try { Future<?> backgroundHandle = getParentSession().submitBackgroundOperation(work); setBackgroundHandle(backgroundHandle); } catch (RejectedExecutionException rejected) { setState(OperationState.ERROR); throw new HiveSQLException("The background threadpool cannot accept" + " new task for execution, please retry the operation", rejected); } } }
Source:
public void setListProperty(final String key, final List<String> values) { if (values == null) { setProperty(key, null); } else if (values.isEmpty()) { setProperty(key, ""); } else { final StringBuilder builder = new StringBuilder(); for (String value : values) { builder.append(value + ", "); } builder.setLength(builder.length() - 2); setProperty(key, builder.toString()); } }

Target:
public void setListProperty(final String key, final List<String> values) { if (values == null) { setProperty(key, null); } else if (values.isEmpty()) { setProperty(key, ""); } else { final StringBuilder builder = new StringBuilder(); for (final String value : values) { builder.append(value + ", "); } builder.setLength(builder.length() - 2); setProperty(key, builder.toString()); } }
Source:
private static boolean isMethodInvocation(@Nullable Tree tree, LambdaExpressionTree lambdaTree) { if (tree != null && tree.is(Tree.Kind.METHOD_INVOCATION, Tree.Kind.NEW_CLASS)) { Arguments arguments; if(tree.is(Tree.Kind.NEW_CLASS)) { if(((NewClassTree) tree).classBody() != null) { return false; } arguments = ((NewClassTree) tree).arguments(); } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if(mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mse = (MemberSelectExpressionTree) mit.methodSelect(); while (mse != null) { if(mse.expression().is(Tree.Kind.METHOD_INVOCATION)) { return false; } if(mse.expression().is(Tree.Kind.MEMBER_SELECT)) { mse = (MemberSelectExpressionTree) mse.expression(); } else { mse = null; } } } arguments = mit.arguments(); } List<VariableTree> parameters = lambdaTree.parameters(); return matchingParameters(parameters, arguments) || (arguments.isEmpty() && isNoArgMethodInvocationFromLambdaParam(tree, parameters)); } return false; }

Target:
private static boolean isMethodInvocation(@Nullable Tree tree, LambdaExpressionTree lambdaTree) { if (tree != null && tree.is(Tree.Kind.METHOD_INVOCATION, Tree.Kind.NEW_CLASS)) { Arguments arguments; if(tree.is(Tree.Kind.NEW_CLASS)) { if(((NewClassTree) tree).classBody() != null) { return false; } arguments = ((NewClassTree) tree).arguments(); } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if (hasMethodInvocationInMethodSelect(mit)) { return false; } arguments = mit.arguments(); } List<VariableTree> parameters = lambdaTree.parameters(); return matchingParameters(parameters, arguments) || (arguments.isEmpty() && isNoArgMethodInvocationFromLambdaParam(tree, parameters)); } return false; }
Source:
private ReentrantLock getLock() { if (sLock == null) { synchronized (this) { if (sLock == null) { return new ReentrantLock(); } } } return sLock; }

Target:
private static ReentrantLock getLock() { if (sLock == null) { synchronized (Discovery.class) { if (sLock == null) { sLock = new ReentrantLock(); } } } return sLock; }
Source:
private Trigger(int triggerId, long lastModifyTime, long submitTime, String submitUser, String source, Condition triggerCondition, Condition expireCondition, List<TriggerAction> actions, List<TriggerAction> expireActions, Map<String, Object> info, Map<String, Object> context) { this.lastModifyTime = lastModifyTime; this.submitTime = submitTime; this.submitUser = submitUser; this.source = source; this.triggerCondition = triggerCondition; this.expireCondition = expireCondition; this.actions = actions; this.triggerId = triggerId; this.expireActions = expireActions; this.info = info; this.context = context; }

Target:
private Trigger(int triggerId, long lastModifyTime, long submitTime, String submitUser, String source, Condition triggerCondition, Condition expireCondition, List<TriggerAction> actions, List<TriggerAction> expireActions, Map<String, Object> info, Map<String, Object> context) { requireNonNull(submitUser); requireNonNull(source); requireNonNull(triggerCondition); requireNonNull(expireActions); requireNonNull(info); requireNonNull(context); this.lastModifyTime = lastModifyTime; this.submitTime = submitTime; this.submitUser = submitUser; this.source = source; this.triggerCondition = triggerCondition; this.expireCondition = expireCondition; this.actions = actions; this.triggerId = triggerId; this.expireActions = expireActions; this.info = info; this.context = context; }
Source:
public Builder addAdditionalTestExecutionListeners(TestExecutionListener... listeners) { this.additionalTestExecutionListeners.addAll(Arrays.asList(listeners)); return this; }

Target:
public Builder addAdditionalTestExecutionListeners(TestExecutionListener... listeners) { Collections.addAll(this.additionalTestExecutionListeners, listeners); return this; }
Source:
public synchronized IConnection connect(String storm_id, String host, int port, AtomicBoolean[] remoteBpStatus) { return new Client(topoConf, remoteBpStatus, clientChannelFactory, clientScheduleService, host, port, this); }

Target:
public IConnection connect(String storm_id, String host, int port, AtomicBoolean[] remoteBpStatus) { return new Client(topoConf, remoteBpStatus, clientChannelFactory, clientScheduleService, host, port); }
Source:
Storage getStorage(Collection<String> scopes) throws IOException { GoogleCredential credential = null; try { if (mStorage == null) { if (mJsonKeyFile != null && mJsonKeyFile.exists()) { CLog.d("Using json key file %s.", mJsonKeyFile); credential = GoogleApiClientUtil.createCredentialFromJsonKeyFile( mJsonKeyFile, scopes); } else { CLog.d("Using local authentication."); try { credential = GoogleCredential.getApplicationDefault().createScoped(scopes); } catch (IOException e) { CLog.e(e.getMessage()); CLog.e("Try 'gcloud auth application-default login' to login."); throw e; } } mStorage = new Storage.Builder( GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), GoogleApiClientUtil.configureRetryStrategy( GoogleApiClientUtil.setHttpTimeout( credential, DEFAULT_TIMEOUT, DEFAULT_TIMEOUT))) .setApplicationName(GoogleApiClientUtil.APP_NAME) .build(); } return mStorage; } catch (GeneralSecurityException e) { throw new IOException(e); } }

Target:
Storage getStorage(Collection<String> scopes) throws IOException { GoogleCredential credential = null; try { if (mStorage == null) { if (mJsonKeyFile != null && mJsonKeyFile.exists()) { CLog.d("Using json key file %s.", mJsonKeyFile); credential = GoogleApiClientUtil.createCredentialFromJsonKeyFile( mJsonKeyFile, scopes); } else { CLog.d("Using local authentication."); try { credential = GoogleCredential.getApplicationDefault().createScoped(scopes); } catch (IOException e) { CLog.e(e.getMessage()); CLog.e( "Try 'gcloud auth application-default login' to login for " + "personal account; Or 'export " + "GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json' " + "for service account."); throw e; } } mStorage = new Storage.Builder( GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), GoogleApiClientUtil.configureRetryStrategy( GoogleApiClientUtil.setHttpTimeout( credential, DEFAULT_TIMEOUT, DEFAULT_TIMEOUT))) .setApplicationName(GoogleApiClientUtil.APP_NAME) .build(); } return mStorage; } catch (GeneralSecurityException e) { throw new IOException(e); } }
Source:
protected static ArchetypeTerm getTerm(Map<String, Map<String, ArchetypeTerm>> termDefinitions, String language, String nodeId) { Map<String, ArchetypeTerm> translations = termDefinitions.get(language); ArchetypeTerm term = translations.get(nodeId); if(term == null) { for(Map.Entry<String, ArchetypeTerm> entry: translations.entrySet()) { if(nodeId.startsWith(entry.getKey() + ".")) { NodeId.parse(nodeId); return entry.getValue(); } } } return term; }

Target:
protected static ArchetypeTerm getTerm(Map<String, Map<String, ArchetypeTerm>> termDefinitions, String language, String nodeId) { Map<String, ArchetypeTerm> translations = termDefinitions.get(language); ArchetypeTerm term = translations.get(nodeId); Map<String, ArchetypeTerm> foundTerms = new LinkedHashMap<>(); if(term == null) { for(Map.Entry<String, ArchetypeTerm> entry: translations.entrySet()) { if(nodeId.startsWith(entry.getKey() + ".")) { foundTerms.put(nodeId, entry.getValue()); } } List<String> foundNodeIds = new ArrayList(foundTerms.keySet()); Collections.sort(foundNodeIds, Comparator.comparingInt((id) -> id.length())); return foundTerms.get(foundNodeIds.get(foundNodeIds.size()-1)); } return term; }
Source:
public Iterator<V> iterator() { return matchingMode == MATCHING_MODE.KEEP_ALL ? allList.iterator() : firstOrLastHash.values().iterator(); }

Target:
public Iterator<V> iterator() { if (matchingMode == MATCHING_MODE.KEEP_ALL) { return allList.iterator(); } return firstOrLastHash.values().iterator(); }
Source:
public void deserialize(String value) { if (allKeyValueMap == null) { saveEntity = value; return; } if (value != null) { keyValueMap_used = new HashMap<String, String>(); if (!value.isEmpty()) { String[] lines = value.split(PROPERTIES_DELIMETER); keyValueMap_used = new HashMap<String, String>(); String[] splitLine; for (String line : lines) { if (line.isEmpty()) { continue; } splitLine = line.split(KEY_VALUE_DELIMETER, 2); String key = splitLine[0]; if (allKeyValueMap.containsKey(key)) { keyValueMap_used.put(key, splitLine[1]); } } } } init(allKeyValueMap.keySet(), keyValueMap_used.keySet()); }

Target:
public void deserialize(String value) { if (allKeyValueMap == null) { saveEntity = value; return; } if (value != null) { keyValueMap_used = new HashMap<String, String>(); if (!value.isEmpty()) { String[] lines = value.split(PROPERTIES_DELIMETER); String[] splitLine; for (String line : lines) { if (line.isEmpty()) { continue; } splitLine = line.split(KEY_VALUE_DELIMETER, 2); String key = splitLine[0]; if (allKeyValueMap.containsKey(key)) { keyValueMap_used.put(key, splitLine[1]); } } } } init(allKeyValueMap.keySet(), keyValueMap_used.keySet()); }
Source:
public void close() throws Exception { for (final EventProcessor eventProcessor : eventProcessors) { eventProcessor.interrupt(); } }

Target:
public void close() throws Exception { eventProcessors.forEach(eventProcessor -> eventProcessor.close()); }
Source:
protected synchronized com.ibm.icu.text.DecimalFormatSymbols getIcuDecimalFormatSymbols() { if (cachedIcuDFS != null) { return cachedIcuDFS; } cachedIcuDFS = new com.ibm.icu.text.DecimalFormatSymbols(this.locale); cachedIcuDFS.setZeroDigit(zeroDigit); cachedIcuDFS.setDigit(digit); cachedIcuDFS.setDecimalSeparator(decimalSeparator); cachedIcuDFS.setGroupingSeparator(groupingSeparator); cachedIcuDFS.setPatternSeparator(patternSeparator); cachedIcuDFS.setPercent(percent.charAt(0)); cachedIcuDFS.setMonetaryDecimalSeparator(monetarySeparator); cachedIcuDFS.setMinusSign(minusSign.charAt(0)); cachedIcuDFS.setInfinity(infinity); cachedIcuDFS.setNaN(NaN); cachedIcuDFS.setExponentSeparator(exponentSeparator); try { cachedIcuDFS.setCurrency( com.ibm.icu.util.Currency.getInstance(currency.getCurrencyCode())); } catch (NullPointerException e) { currency = Currency.getInstance("XXX"); } cachedIcuDFS.setCurrencySymbol(currencySymbol); cachedIcuDFS.setInternationalCurrencySymbol(intlCurrencySymbol); return cachedIcuDFS; }

Target:
protected com.ibm.icu.text.DecimalFormatSymbols getIcuDecimalFormatSymbols() { com.ibm.icu.text.DecimalFormatSymbols result = new com.ibm.icu.text.DecimalFormatSymbols(this.locale); result.setZeroDigit(zeroDigit); result.setDigit(digit); result.setDecimalSeparator(decimalSeparator); result.setGroupingSeparator(groupingSeparator); result.setPatternSeparator(patternSeparator); result.setPercent(percent.charAt(0)); result.setMonetaryDecimalSeparator(monetarySeparator); result.setMinusSign(minusSign.charAt(0)); result.setInfinity(infinity); result.setNaN(NaN); result.setExponentSeparator(exponentSeparator); try { result.setCurrency(com.ibm.icu.util.Currency.getInstance(currency.getCurrencyCode())); } catch (NullPointerException e) { currency = Currency.getInstance("XXX"); } result.setCurrencySymbol(currencySymbol); result.setInternationalCurrencySymbol(intlCurrencySymbol); return result; }
Source:
public MainTabBasicDetailsView(ApplicationResources resources) { operatingSystem = new ValueLabel<VmOsType>(new AbstractRenderer<VmOsType>() { private OSNamesTranslator osNamesTranslator = new OSNamesTranslator();; @Override public String render(VmOsType object) { return osNamesTranslator.translate(object); } }); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); }

Target:
public MainTabBasicDetailsView(ApplicationResources resources) { operatingSystem = new EnumLabel<VmOsType>(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); }
Source:
public void validate() { if (sheetName.indexOf(".") != -1) { throw new IllegalStateException("Sheet name cannot contain dots (.)"); } if (file.exists()) { Datastore datastore = new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath()); final Schema[] schemas = datastore.openConnection().getDataContext().getSchemas(); final String[] tableNames = schemas[1].getTableNames(); for (int i = 0; i < tableNames.length; i++) { if (tableNames[i].equals(sheetName)) { if (!overwriteSheetIfExists) { throw new IllegalStateException("The sheet '" + sheetName + "' already exists. Please select another sheet name."); } } } } }

Target:
public void validate() { if (sheetName.indexOf(".") != -1) { throw new IllegalStateException("Sheet name cannot contain dots (.)"); } if (file.exists()) { Datastore datastore = new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath()); try (final DatastoreConnection connection = datastore.openConnection()) { final String[] tableNames = connection.getDataContext().getDefaultSchema().getTableNames(); for (int i = 0; i < tableNames.length; i++) { if (tableNames[i].equals(sheetName)) { if (!overwriteSheetIfExists) { throw new IllegalStateException("The sheet '" + sheetName + "' already exists. Please select another sheet name."); } } } } } }
Source:
public boolean inMultiCombat() { return ctx.varpbits.varpbit(1021) == 0x20; }

Target:
public boolean inMultiCombat() { return ctx.varpbits.varpbit(1021, 5, 0x1) == 1; }
Source:
protected String toSqlType(Type type) { if (VARBINARY.equals(type)) { return "bytea"; } else if (JSON.equals(type)) { return "jsonb"; } return super.toSqlType(type); }

Target:
protected String toSqlType(Type type) { if (VARBINARY.equals(type)) { return "bytea"; } if (JSON.equals(type)) { return "jsonb"; } return super.toSqlType(type); }
Source:
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { if (isApiKey(accessToken)) { return remoteTokenServices.loadAuthentication(accessToken); } return jwtTokenService.loadAuthentication(accessToken); }

Target:
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { if (isApiKey(accessToken)) { return retryTemplate.execute(x -> remoteTokenServices.loadAuthentication(accessToken)); } return jwtTokenService.loadAuthentication(accessToken); }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("updated() is called!"); if (config != null) { port = 8021; host = (String) config.get("host"); password = (String) config.get("password"); String portString = (String) config.get("port"); if(StringUtils.isNotBlank(portString)) port = Integer.parseInt(portString); eventCache = new LinkedHashMap<String, Channel>(); mwiCache = new HashMap<String, FreeswitchBinding.MWIModel>(); itemMap = new LinkedHashMap<String, LinkedList<FreeswitchBindingConfig>>(); try { connect(); } catch (InboundConnectionFailure e) { logger.error(String.format("Could not connect to freeswitch server: %s", e.getMessage()),e); } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.trace("updated() is called!"); if (config != null) { startWatchdog(); port = DEFAULT_PORT; host = (String) config.get("host"); password = (String) config.get("password"); String portString = (String) config.get("port"); if(StringUtils.isNotBlank(portString)) port = Integer.parseInt(portString); eventCache = new LinkedHashMap<String, Channel>(); mwiCache = new HashMap<String, FreeswitchBinding.MWIModel>(); itemMap = new LinkedHashMap<String, LinkedList<FreeswitchBindingConfig>>(); try { connect(); } catch (InboundConnectionFailure e) { logger.error("Could not connect to freeswitch server",e); disconnect(); } } else { stopWatchdog(); disconnect(); } }
Source:
private void createBars() { BarGraphicObject bar; m_container = new VirtualBoundsGraphicObject(); m_container.setVirtualBounds(BAR_CONTAINER_BOUNDS); m_container.setDrawContainerBounds(false); int maxCount = Math.max(m_markerCount[0], m_markerCount[1]); maxCount = Math.max(maxCount, m_markerCount[2]); if (maxCount == 0) maxCount = 1; for (int severity = IMarker.SEVERITY_ERROR; severity >= IMarker.SEVERITY_INFO; severity--) { float barPercent = m_markerCount[severity] / (float) maxCount * 100.0f; bar = new BarGraphicObject(severity, Math.round(barPercent)); bar.setVirtualBounds(BARS_VIRTUAL_BOUNDS[severity]); bar.setLabel(m_markerSeverityLabels[severity] + " " + m_markerCount[severity]); bar.setDrawContainerBounds(true); m_container.addChildObject("bar" + severity, bar); } m_container.setBounds(m_canvas.getBounds()); m_canvas.add(m_container); }

Target:
private void createBars() { BarGraphicObject bar; m_container = new VirtualBoundsGraphicObject(); m_container.setVirtualBounds(BAR_CONTAINER_BOUNDS); m_container.setDrawContainerBounds(false); int maxCount = Math.max(m_markerCount[0], m_markerCount[1]); maxCount = Math.max(maxCount, m_markerCount[2]); if (maxCount == 0) maxCount = 1; for (int severity = IMarker.SEVERITY_ERROR; severity >= IMarker.SEVERITY_INFO; severity--) { float barPercent = m_markerCount[severity] / (float) maxCount * 100.0f; bar = new BarGraphicObject(severity, Math.round(barPercent)); bar.setVirtualBounds(BARS_VIRTUAL_BOUNDS[severity]); bar.setLabel(m_markerSeverityLabels[severity] + " " + m_markerCount[severity]); m_container.addChildObject("bar" + severity, bar); } m_container.setBounds(m_canvas.getBounds()); m_canvas.add(m_container); }
Source:
public void cleanup() { if (!tagKeyId.isEmpty()) { api().deleteTagKey(tagKeyId); } }

Target:
public void cleanup() { if (tagKeyId != null && !tagKeyId.isEmpty()) { api().deleteTagKey(tagKeyId); } }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("ref", _ref) .add("cached", _cached) .toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("ref", _ref) .add("cached", _cached) .add("lastRun", _lastRun) .toString(); }
Source:
public void visit(String name, Object value) { if (this.state == State.AUTHORS) { if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'author'"); } this.metadata.addAuthor((String) value); return; } if (name == null) { throw new InvalidPluginException("Plugin annotation has null element"); } if (this.state == State.DEPENDENCIES) { throw new InvalidPluginException("Plugin annotation has invalid element 'dependencies'"); } switch (name) { case "id": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'id'"); } this.hasId = true; this.metadata.setId((String) value); return; case "name": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'name'"); } this.metadata.setName((String) value); return; case "version": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'version'"); } this.metadata.setVersion((String) value); return; case "description": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'description'"); } this.metadata.setDescription((String) value); return; case "url": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'url'"); } this.metadata.setUrl((String) value); return; default: super.visit(name, value); } }

Target:
public void visit(String name, Object value) { if (this.state == State.AUTHORS) { if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'author'"); } this.metadata.addAuthor((String) value); return; } if (name == null) { throw new InvalidPluginException("Plugin annotation attribute name is null"); } if (this.state == State.DEPENDENCIES) { throw new InvalidPluginException("Plugin annotation has invalid element 'dependencies'"); } switch (name) { case "id": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'id'"); } this.hasId = true; this.metadata.setId((String) value); return; case "name": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'name'"); } this.metadata.setName((String) value); return; case "version": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'version'"); } this.metadata.setVersion((String) value); return; case "description": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'description'"); } this.metadata.setDescription((String) value); return; case "url": if (!(value instanceof String)) { throw new InvalidPluginException("Plugin annotation has invalid element 'url'"); } this.metadata.setUrl((String) value); return; default: super.visit(name, value); } }
Source:
public GrammarAST(int type, Token t) { this(new CommonToken(type, t.getText())); if ( t instanceof CommonToken ) { ((CommonToken) token).setStartIndex(((CommonToken) t).getStartIndex()); ((CommonToken) token).setStopIndex(((CommonToken) t).getStopIndex()); } token.setInputStream(t.getInputStream()); token.setLine(t.getLine()); token.setCharPositionInLine(t.getCharPositionInLine()); token.setTokenIndex(t.getTokenIndex()); }

Target:
public GrammarAST(int type, Token t) { this(new CommonToken(t)); token.setType(type); }
Source:
private void loadUrlNow(String url) { if (LOG.isLoggable(LOG.DEBUG) && !url.startsWith("javascript:")) { LOG.d(TAG, ">>> loadUrlNow()"); } Boolean shouldAllowNavigation = pluginManager.shouldAllowNavigation(url); if (url.startsWith("file://") || url.startsWith("javascript:") || (shouldAllowNavigation != null && shouldAllowNavigation == true)) { super.loadUrl(url); } }

Target:
private void loadUrlNow(String url) { if (LOG.isLoggable(LOG.DEBUG) && !url.startsWith("javascript:")) { LOG.d(TAG, ">>> loadUrlNow()"); } if (url.startsWith("javascript:") || helper.shouldAllowNavigation(url)) { super.loadUrl(url); } }
Source:
public void addTextFilter(String label, String placeholder, boolean disableFiltersInputHelp, Consumer<ActiveFilterItem<String>> callback) { filtersInputHelp.setDisabled(disableFiltersInputHelp); addTextFilter(label, placeholder, callback); }

Target:
public void addTextFilter(String label, String placeholder, boolean disableFiltersInputHelp, Consumer<ActiveFilterItem<String>> callback) { filtersInputHelp.setDisabled(disableFiltersInputHelp); if (disableFiltersInputHelp) { addCSSClass(filtersInputHelp, "hidden"); } createFilterOption(label); createTextInput(label, placeholder, refineSelect.getOptions().getLength() > 1, input -> input.setType("text"), v -> v, callback); }
Source:
private CompletableFuture<ICluster> join0() { CompletableFuture<Transport> transportFuture = Transport.bind(config.getTransportConfig()); CompletableFuture<Void> clusterFuture = transportFuture.thenCompose(boundTransport -> { transport = boundTransport; messageObservable = transport.listen() .filter(msg -> !SYSTEM_MESSAGES.contains(msg.qualifier())); membership = new MembershipProtocol(transport, config.getMembershipConfig()); gossip = new GossipProtocol(transport, membership, config.getGossipConfig()); failureDetector = new FailureDetector(transport, membership, config.getFailureDetectorConfig()); membership.setFailureDetector(failureDetector); membership.setGossipProtocol(gossip); Member localMember = membership.member(); onMemberAdded(localMember); membership.listen() .filter(MembershipEvent::isAdded).map(MembershipEvent::member).subscribe(this::onMemberAdded); membership.listen() .filter(MembershipEvent::isRemoved).map(MembershipEvent::member).subscribe(this::onMemberRemoved); failureDetector.start(); gossip.start(); gossipObservable = gossip.listen() .filter(msg -> !SYSTEM_GOSSIPS.contains(msg.qualifier())); return membership.start(); }); return clusterFuture.thenApply(aVoid -> Cluster.this); }

Target:
private CompletableFuture<ICluster> join0() { CompletableFuture<Transport> transportFuture = Transport.bind(config.getTransportConfig()); CompletableFuture<Void> clusterFuture = transportFuture.thenCompose(boundTransport -> { transport = boundTransport; messageObservable = transport.listen() .filter(msg -> !SYSTEM_MESSAGES.contains(msg.qualifier())); membership = new MembershipProtocol(transport, config.getMembershipConfig()); gossip = new GossipProtocol(transport, membership, config.getGossipConfig()); failureDetector = new FailureDetector(transport, membership, config.getFailureDetectorConfig()); membership.setFailureDetector(failureDetector); membership.setGossipProtocol(gossip); Member localMember = membership.member(); onMemberAdded(localMember); membership.listen() .filter(MembershipEvent::isAdded) .map(MembershipEvent::member) .subscribe(this::onMemberAdded, this::onError); membership.listen() .filter(MembershipEvent::isRemoved) .map(MembershipEvent::member) .subscribe(this::onMemberRemoved, this::onError); failureDetector.start(); gossip.start(); gossipObservable = gossip.listen() .filter(msg -> !SYSTEM_GOSSIPS.contains(msg.qualifier())); return membership.start(); }); return clusterFuture.thenApply(aVoid -> Cluster.this); }
Source:
private void handleGetUserCountFailure(String errorCode, String errorMessage, String claim, String claimValue ) throws UserStoreException { for (UserManagementErrorEventListener listener : UMListenerServiceComponent .getUserManagementErrorEventListeners()) { if (listener.isEnable() && !listener .onGetUserListFailure(errorCode, errorMessage, claim, claimValue, this)) { return; } } }

Target:
protected void handleGetUserCountFailure(String errorCode, String errorMessage, String claim, String claimValue ) throws UserStoreException { for (UserManagementErrorEventListener listener : UMListenerServiceComponent .getUserManagementErrorEventListeners()) { if (listener.isEnable() && !listener .onGetUserCountFailure(errorCode, errorMessage, claim, claimValue, this)) { return; } } }
Source:
public void test() throws Exception { server.expect( server.formatUrl( REMOTE, PATH ), 200, new ByteArrayInputStream( CONTENT_1.getBytes( "UTF-8" ) ) ); final RemoteRepository remote = new RemoteRepository( NPM_PKG_KEY, REMOTE, server.formatUrl( REMOTE, SUBPATH ) ); client.stores().create( remote, "adding npm remote repo", RemoteRepository.class ); final HostedRepository hosted = new HostedRepository( NPM_PKG_KEY, HOSTED ); client.stores().create( hosted, "adding npm hosted repo", HostedRepository.class ); client.content().store( hosted.getKey(), PATH, new ByteArrayInputStream( CONTENT_1.getBytes() ) ); final Group group = new Group( NPM_PKG_KEY, GROUP, remote.getKey(), hosted.getKey() ); client.stores().create( group, "adding npm group repo", Group.class ); assertThat( client.content().exists( remote.getKey(), MAPPING_PATH ), equalTo( false ) ); assertThat( client.content().exists( remote.getKey(), PATH ), equalTo( true ) ); assertThat( client.content().exists( hosted.getKey(), MAPPING_PATH ), equalTo( true ) ); assertThat( client.content().exists( hosted.getKey(), PATH ), equalTo( true ) ); assertThat( client.content().exists( group.getKey(), MAPPING_PATH ), equalTo( true ) ); assertThat( client.content().exists( group.getKey(), PATH ), equalTo( true ) ); }

Target:
public void test() throws Exception { server.expect( server.formatUrl( REMOTE, PATH ), 200, new ByteArrayInputStream( CONTENT_1.getBytes( "UTF-8" ) ) ); final RemoteRepository remote = new RemoteRepository( NPM_PKG_KEY, REMOTE, server.formatUrl( REMOTE ) ); client.stores().create( remote, "adding npm remote repo", RemoteRepository.class ); final HostedRepository hosted = new HostedRepository( NPM_PKG_KEY, HOSTED ); client.stores().create( hosted, "adding npm hosted repo", HostedRepository.class ); client.content().store( hosted.getKey(), PATH, new ByteArrayInputStream( CONTENT_1.getBytes() ) ); final Group group = new Group( NPM_PKG_KEY, GROUP, remote.getKey(), hosted.getKey() ); client.stores().create( group, "adding npm group repo", Group.class ); assertThat( client.content().exists( remote.getKey(), MAPPING_PATH ), equalTo( false ) ); assertThat( client.content().exists( remote.getKey(), PATH ), equalTo( true ) ); assertThat( client.content().exists( hosted.getKey(), MAPPING_PATH ), equalTo( true ) ); assertThat( client.content().exists( hosted.getKey(), PATH ), equalTo( true ) ); assertThat( client.content().exists( group.getKey(), MAPPING_PATH ), equalTo( true ) ); assertThat( client.content().exists( group.getKey(), PATH ), equalTo( true ) ); }
Source:
public void clear() { List<Subscription> unsubscribe = null; synchronized (this) { if (unsubscribed || subscriptions == null) { return; } else { unsubscribe = new ArrayList<Subscription>(subscriptions); } } unsubscribeFromAll(unsubscribe); }

Target:
public void clear() { Collection<Subscription> unsubscribe = null; synchronized (this) { if (unsubscribed || subscriptions == null) { return; } else { unsubscribe = subscriptions; subscriptions = null; } } unsubscribeFromAll(unsubscribe); }
Source:
private void populateData(boolean train) { try { File categories = new File(this.dataDirectory + "\\categories.txt"); BufferedReader brCategories = new BufferedReader(new FileReader(categories)); String temp = ""; while ((temp = brCategories.readLine()) != null) { String curFileName = train == true ? this.dataDirectory + "\\train\\" + temp.split(",")[0] + ".txt" : this.dataDirectory + "\\test\\" + temp.split(",")[0] + ".txt"; File currFile = new File(curFileName); BufferedReader currBR = new BufferedReader((new FileReader(currFile))); String tempCurrLine = ""; List<String> tempList = new ArrayList<String>(); while ((tempCurrLine = currBR.readLine()) != null) { tempList.add(tempCurrLine); this.totalNews++; } currBR.close(); Pair<String, List<String>> tempPair = Pair.of(temp, tempList); this.categoryData.add(tempPair); } brCategories.close(); } catch (Exception e) { System.out.println("Exception in populateData : " + e.getMessage()); } }

Target:
private void populateData(boolean train) { File categories = new File(this.dataDirectory + File.separator + "categories.txt"); try (BufferedReader brCategories = new BufferedReader(new FileReader(categories))) { String temp = ""; while ((temp = brCategories.readLine()) != null) { String curFileName = train == true ? this.dataDirectory + File.separator + "train" + File.separator + temp.split(",")[0] + ".txt" : this.dataDirectory + File.separator + "test" + File.separator + temp.split(",")[0] + ".txt"; File currFile = new File(curFileName); BufferedReader currBR = new BufferedReader((new FileReader(currFile))); String tempCurrLine = ""; List<String> tempList = new ArrayList<>(); while ((tempCurrLine = currBR.readLine()) != null) { tempList.add(tempCurrLine); this.totalNews++; } currBR.close(); Pair<String, List<String>> tempPair = Pair.of(temp, tempList); this.categoryData.add(tempPair); } brCategories.close(); } catch (Exception e) { System.out.println("Exception in reading file :" + e.getMessage()); } }
Source:
default String getConcatenatedName() { final List<String> names = getNames(); return names.size() > 1 ? names.toString() : names.get(0); }

Target:
default String getConcatenatedName() { final List<String> names = getNames(); Preconditions.checkState(!names.isEmpty()); return names.size() > 1 ? names.toString() : names.get(0); }