auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public GlobalProperty saveGlobalProperty(GlobalProperty gp) throws APIException { if (gp.getProperty() != null && gp.getProperty().length() > 0) { if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST)) { if (gp.getPropertyValue() != null && !gp.getPropertyValue().isEmpty() && !gp.getPropertyValue().contains(LocaleUtility.getDefaultLocale().getLanguage())) { gp.setPropertyValue(getAllowedLocales().toString().substring(1, getAllowedLocales().toString().length() - 1)); throw new APIException(Context.getMessageSourceService().getMessage( "general.locale.localeListNotIncludingDefaultLocale", new Object[] { LocaleUtility.getDefaultLocale() }, null)); } } else if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE)) { if (gp.getPropertyValue() != null && !gp.getPropertyValue().isEmpty()) { boolean containsLocale = false; for (Locale locale : getAllowedLocales()) { if (gp.getPropertyValue().startsWith(locale.getLanguage())) { containsLocale = true; } } if (!containsLocale) { String value = gp.getPropertyValue(); gp.setPropertyValue(LocaleUtility.getDefaultLocale().toString()); throw new APIException((Context.getMessageSourceService().getMessage( "general.locale.defaultNotInAllowedLocalesList", new Object[] { value }, null))); } } } CustomDatatypeUtil.saveIfDirty(gp); dao.saveGlobalProperty(gp); notifyGlobalPropertyChange(gp); return gp; } return gp; }

Target:
public GlobalProperty saveGlobalProperty(GlobalProperty gp) throws APIException { if (gp.getProperty() != null && gp.getProperty().length() > 0) { if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST)) { if (gp.getPropertyValue() != null) { List<Locale> localeList = new ArrayList<Locale>(); for (String localeString : gp.getPropertyValue().split(",")) { localeList.add(LocaleUtility.fromSpecification(localeString.trim())); } if (!localeList.contains(LocaleUtility.getDefaultLocale())) { gp.setPropertyValue(StringUtils.join(getAllowedLocales(), ", ")); throw new APIException(Context.getMessageSourceService().getMessage( "general.locale.localeListNotIncludingDefaultLocale", new Object[] { LocaleUtility.getDefaultLocale() }, null)); } } } else if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE)) { if (gp.getPropertyValue() != null) { List<Locale> localeList = getAllowedLocales(); if (!localeList.contains(LocaleUtility.fromSpecification(gp.getPropertyValue().trim()))) { String value = gp.getPropertyValue(); gp.setPropertyValue(LocaleUtility.getDefaultLocale().toString()); throw new APIException((Context.getMessageSourceService().getMessage( "general.locale.defaultNotInAllowedLocalesList", new Object[] { value }, null))); } } } CustomDatatypeUtil.saveIfDirty(gp); dao.saveGlobalProperty(gp); notifyGlobalPropertyChange(gp); return gp; } return gp; }
Source:
private void updateLayoutType(String value) { layout = value; YoungAndroidListViewAddDataPropertyEditor editor = (YoungAndroidListViewAddDataPropertyEditor) properties.getProperty(PROPERTY_NAME_LISTVIEW_ADD_DATA).getEditor(); editor.setLayout(layout); if(!currentItems.isEmpty()) { createLabelItem(currentItems); } }

Target:
private void updateLayoutType(String value) { layout = Integer.parseInt(value); YoungAndroidListViewAddDataPropertyEditor editor = (YoungAndroidListViewAddDataPropertyEditor) properties.getProperty(PROPERTY_NAME_LISTVIEW_ADD_DATA).getEditor(); editor.setLayout(layout); if (!currentItems.isEmpty()) { createLabelItem(currentItems); } }
Source:
public static int getStandardMargin(Context context) { Resources resources = context.getResources(); int marginStandard = dpFromPx(context, resources.getDimensionPixelSize(R.dimen.margin_standard)); return marginStandard - FIELD_HORIZONTAL_MARGIN_MODIFIER; }

Target:
public static int getStandardMargin(Context context) { Resources resources = context.getResources(); int marginStandard = dpFromPx(context, resources.getDimensionPixelSize(R.dimen.margin_standard)); return marginStandard - WIDGET_ANSWER_STANDARD_MARGIN_MODIFIER; }
Source:
RFileScanner(Opts opts) { if (!opts.auths.equals(Authorizations.EMPTY) && !opts.useSystemIterators) { throw new IllegalArgumentException("Set authorizations and specified not to use system iterators"); } this.opts = opts; if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) { ConfigurationCopy cc = new ConfigurationCopy(); cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName()); try { factory = BlockCacheFactory.getInstance(cc); } catch (Exception e) { throw new RuntimeException("Error creating BlockCacheFactory", e); } BlockCacheConfigurationHelper helper = null; if (opts.indexCacheSize > 0) { helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory); helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString()); helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(CACHE_BLOCK_SIZE)); helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(opts.indexCacheSize)); } if (opts.dataCacheSize > 0) { if (null == helper) { helper = new BlockCacheConfigurationHelper(CacheType.DATA, factory); } else { helper.switchCacheType(CacheType.DATA); } helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString()); helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(CACHE_BLOCK_SIZE)); helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(opts.dataCacheSize)); } factory.start(helper.getConfiguration()); this.indexCache = factory.getBlockCache(CacheType.INDEX); if (null == indexCache) { this.indexCache = new NoopCache(); } this.dataCache = factory.getBlockCache(CacheType.DATA); if (null == this.dataCache) { this.dataCache = new NoopCache(); } } }

Target:
RFileScanner(Opts opts) { if (!opts.auths.equals(Authorizations.EMPTY) && !opts.useSystemIterators) { throw new IllegalArgumentException("Set authorizations and specified not to use system iterators"); } this.opts = opts; if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) { ConfigurationCopy cc = new ConfigurationCopy(DefaultConfiguration.getInstance()); if (null != opts.tableConfig) { opts.tableConfig.forEach(cc::set); } try { blockCacheManager = BlockCacheManager.getClientInstance(cc); if (opts.indexCacheSize > 0) { cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(opts.indexCacheSize)); } if (opts.dataCacheSize > 0) { cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(opts.dataCacheSize)); } blockCacheManager.start(cc); this.indexCache = blockCacheManager.getBlockCache(CacheType.INDEX); this.dataCache = blockCacheManager.getBlockCache(CacheType.DATA); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } if (null == indexCache) { this.indexCache = new NoopCache(); } if (null == this.dataCache) { this.dataCache = new NoopCache(); } }
Source:
void removeSegment( final DataSegment segment, final DataSegmentChangeCallback callback, final boolean scheduleDrop ) { try { announcer.unannounceSegment(segment); segmentsToDelete.add(segment); Runnable runnable = new Runnable() { @Override public void run() { Status result = null; try { synchronized (lock) { if (segmentsToDelete.remove(segment)) { segmentManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } } result = Status.SUCCESS; } catch (Exception e) { log.makeAlert(e, "Failed to remove segment! Possible resource leak!") .addData("segment", segment) .emit(); result = Status.failed(e.getMessage()); } finally { updateStatusAndResolveWaitingFutures(new SegmentChangeRequestDrop(segment), result); } } }; if (scheduleDrop) { log.info( "Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis() ); exec.schedule( runnable, config.getDropSegmentDelayMillis(), TimeUnit.MILLISECONDS ); } } catch (Exception e) { log.makeAlert(e, "Failed to remove segment") .addData("segment", segment) .emit(); updateStatusAndResolveWaitingFutures(new SegmentChangeRequestDrop(segment), Status.failed(e.getMessage())); } finally { callback.execute(); } }

Target:
private void removeSegment( final DataSegment segment, final DataSegmentChangeCallback callback, final boolean scheduleDrop ) { Status result = null; try { announcer.unannounceSegment(segment); segmentsToDelete.add(segment); Runnable runnable = new Runnable() { @Override public void run() { try { synchronized (lock) { if (segmentsToDelete.remove(segment)) { segmentManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } } } catch (Exception e) { log.makeAlert(e, "Failed to remove segment! Possible resource leak!") .addData("segment", segment) .emit(); } } }; if (scheduleDrop) { log.info( "Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis() ); exec.schedule( runnable, config.getDropSegmentDelayMillis(), TimeUnit.MILLISECONDS ); } else { runnable.run(); } result = Status.SUCCESS; } catch (Exception e) { log.makeAlert(e, "Failed to remove segment") .addData("segment", segment) .emit(); result = Status.failed(e.getMessage()); } finally { updateRequestStatus(new SegmentChangeRequestDrop(segment), result); callback.execute(); } }
Source:
public static Map<String, String> getTermCounts(IndexReader reader, String termStr) throws IOException, ParseException { EnglishAnalyzer ea = new EnglishAnalyzer(CharArraySet.EMPTY_SET); QueryParser qp = new QueryParser(LuceneDocumentGenerator.FIELD_BODY, ea); TermQuery q = (TermQuery)qp.parse(termStr); Term t = q.getTerm(); Map<String, String> termInfo = Map.ofEntries( Map.entry("rawTerm", termStr), Map.entry("stemmedTerm", q.toString(LuceneDocumentGenerator.FIELD_BODY)), Map.entry("collectionFreq", String.valueOf(reader.totalTermFreq(t))), Map.entry("docFreq", String.valueOf(reader.docFreq(t))) ); return termInfo; }

Target:
public static Map<String, Long> getTermCounts(IndexReader reader, String termStr) throws IOException, ParseException { EnglishAnalyzer ea = new EnglishAnalyzer(CharArraySet.EMPTY_SET); QueryParser qp = new QueryParser(LuceneDocumentGenerator.FIELD_BODY, ea); TermQuery q = (TermQuery) qp.parse(termStr); Term t = q.getTerm(); Map<String, Long> termInfo = Map.ofEntries( Map.entry("collectionFreq", reader.totalTermFreq(t)), Map.entry("docFreq", Long.valueOf(reader.docFreq(t))) ); return termInfo; }
Source:
public JAXBContextWrapper(final Class<?>[] classes, final Map<String, Object> properties, JAXBConfig config) throws JAXBException { processConfig(config); try { if (System.getSecurityManager() == null) { wrappedContext = JAXBContext.newInstance(classes, properties); } else { wrappedContext = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() { @Override public JAXBContext run() throws JAXBException { return JAXBContext.newInstance(classes, properties); } }); } } catch (PrivilegedActionException paex) { throw new JAXBException(paex.getMessage()); } }

Target:
public JAXBContextWrapper(final Class<?>[] classes, final Map<String, Object> properties, JAXBConfig config) throws JAXBException { processConfig(config); try { if (System.getSecurityManager() == null) { wrappedContext = JAXBContext.newInstance(classes, properties); } else { wrappedContext = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() { @Override public JAXBContext run() throws JAXBException { return JAXBContext.newInstance(classes, properties); } }); } } catch (PrivilegedActionException paex) { throw new JAXBException(paex.getMessage(),paex); } }
Source:
public synchronized void step() { world.step(); if ( null != solutionRecorder ) { solutionRecorder.appendStepEnd( ); } }

Target:
public synchronized void step() { world.step(); solutionRecorder.appendStepEnd( ); }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitMethodDeclaration(@NotNull GoMethodDeclaration o) { super.visitMethodDeclaration(o); visitDeclaration(o, false); } @Override public void visitFunctionDeclaration(@NotNull GoFunctionDeclaration o) { super.visitFunctionDeclaration(o); if (GoTestFinder.isTestFile(o.getContainingFile()) && GoTestFunctionType.fromName(o.getName()) != null) { return; } visitDeclaration(o, true); } private void visitDeclaration(@NotNull GoFunctionOrMethodDeclaration o, boolean checkParameters) { GoSignature signature = o.getSignature(); if (signature == null) return; if (checkParameters) { GoParameters parameters = signature.getParameters(); visitParameterList(parameters.getParameterDeclarationList(), "parameter"); } GoResult result = signature.getResult(); GoParameters returnParameters = result != null ? result.getParameters() : null; if (returnParameters != null) { visitParameterList(returnParameters.getParameterDeclarationList(), "named return parameter"); } } private void visitParameterList(List<GoParameterDeclaration> parameters, String what) { Query<PsiReference> search; for (GoParameterDeclaration parameterDeclaration : parameters) { if (parameterDeclaration.getParamDefinitionList().isEmpty()) { search = ReferencesSearch.search(parameterDeclaration, parameterDeclaration.getUseScope()); if (search.findFirst() == null) { holder.registerProblem( parameterDeclaration, "Unused " + what, ProblemHighlightType.LIKE_UNUSED_SYMBOL, new GoDeleteQuickFix("Remove " + what, parameterDeclaration.getElementType())); } continue; } for (GoParamDefinition parameter : parameterDeclaration.getParamDefinitionList()) { ProgressManager.checkCanceled(); if (parameter.isBlank()) continue; search = ReferencesSearch.search(parameter, parameter.getUseScope()); if (search.findFirst() != null) continue; String paramName = parameter.getIdentifier().getText(); holder.registerProblem( parameter, "Unused " + what + " '" + paramName + "'", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new GoRenameToBlankQuickFix(parameter), new GoDeleteQuickFix("Remove " + what, parameter.getElementType()) ); } } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitMethodDeclaration(@NotNull GoMethodDeclaration o) { super.visitMethodDeclaration(o); visitDeclaration(holder, o.getSignature(), false); } @Override public void visitFunctionDeclaration(@NotNull GoFunctionDeclaration o) { super.visitFunctionDeclaration(o); if (GoTestFinder.isTestFile(o.getContainingFile()) && GoTestFunctionType.fromName(o.getName()) != null) { return; } visitDeclaration(holder, o.getSignature(), true); } @Override public void visitFunctionLit(@NotNull GoFunctionLit o) { super.visitFunctionLit(o); visitDeclaration(holder, o.getSignature(), true); } }; }
Source:
private String getAssigneesStr(IAtsWorkItem workItem, ArtifactReadable action) { String results = ""; if (isShowHeaderFull()) { results = workItem.getStateMgr().getAssigneesStr(); } else { String currState = action.getSoleAttributeAsString(AtsAttributeTypes.CurrentState); String[] split = currState.split(";"); String assignees = split[1]; assignees = assignees.replaceAll("><", "; "); assignees = assignees.replaceAll(">", ""); assignees = assignees.replaceAll("<", ""); results = assignees; } return results; }

Target:
private String getAssigneesStr(IAtsWorkItem workItem, ArtifactReadable action) { String results = ""; if (isShowHeaderFull()) { results = workItem.getStateMgr().getAssigneesStr(); } else { String currState = action.getSoleAttributeAsString(AtsAttributeTypes.CurrentState); String[] split = currState.split(";"); if (split.length >= 2) { String assignees = split[1]; assignees = assignees.replaceAll("><", "; "); assignees = assignees.replaceAll(">", ""); assignees = assignees.replaceAll("<", ""); results = assignees; } } return results; }
Source:
public static InfinispanContext getInstance() { if (INSTANCE == null) { Map<String, String> properties = new HashMap<String, String>() {{ put(HOST, System.getProperty(HOST, "127.0.0.1")); put(PORT, System.getProperty(PORT, "11222")); put(USERNAME, System.getProperty(USERNAME, "user")); put(PASSWORD, System.getProperty(PASSWORD, "user")); }}; INSTANCE = new InfinispanContext(properties); } return INSTANCE; }

Target:
public static InfinispanContext getInstance() { return LazyHolder.INSTANCE; }
Source:
public void testComplete(TestPage test, TestSummary testSummary) { increaseCompletedTests(); if (firstFailure != null) { notifier.fireTestFailure(new Failure(descriptionFor(test), firstFailure)); fireTestFinishedFor(test); } else if (testSummary.getExceptions() > 0) { notifier.fireTestFailure(new Failure(descriptionFor(test), new Exception("Exception occurred on page " + test.getFullPath()))); fireTestFinishedFor(test); } else if (testSummary.getWrong() > 0) { notifier.fireTestFailure(new Failure(descriptionFor(test), new AssertionError("Test failures occurred on page " + test.getFullPath()))); fireTestFinishedFor(test); } else { fireTestFinishedFor(test); } }

Target:
public void testComplete(TestPage test, TestSummary testSummary) { increaseCompletedTests(); if (firstFailure != null) { notifier.fireTestFailure(new Failure(descriptionFor(test), firstFailure)); } else if (testSummary.getExceptions() > 0) { notifier.fireTestFailure(new Failure(descriptionFor(test), new Exception("Exception occurred on page " + test.getFullPath()))); } else if (testSummary.getWrong() > 0) { notifier.fireTestFailure(new Failure(descriptionFor(test), new AssertionError("Test failures occurred on page " + test.getFullPath()))); } fireTestFinishedFor(test); }
Source:
static void setPermissionsToOwnerOnly(File file) throws IOException { try { Method setReadable = File.class.getMethod("setReadable", boolean.class, boolean.class); Method setWritable = File.class.getMethod("setWritable", boolean.class, boolean.class); Method setExecutable = File.class.getMethod("setExecutable", boolean.class, boolean.class); if (!(Boolean) setReadable.invoke(file, false, false) || !(Boolean) setWritable.invoke(file, false, false) || !(Boolean) setExecutable.invoke(file, false, false)) { LOGGER.warning("unable to change permissions for everybody: " + file); } if (!(Boolean) setReadable.invoke(file, true, true) || !(Boolean) setWritable.invoke(file, true, true) || !(Boolean) setExecutable.invoke(file, true, true)) { LOGGER.warning("unable to change permissions for owner: " + file); } } catch (InvocationTargetException exception) { Throwable cause = exception.getCause(); Throwables.propagateIfPossible(cause, IOException.class); throw new RuntimeException(cause); } catch (NoSuchMethodException exception) { LOGGER.warning( "Unable to set permissions for " + file + ", likely because you are running a version of Java prior to 1.6"); } catch (SecurityException exception) { } catch (IllegalAccessException exception) { } catch (IllegalArgumentException exception) { } }

Target:
static void setPermissionsToOwnerOnly(File file) { try { if (!file.setReadable(false, false) || !file.setWritable(false, false) || !file.setExecutable(false, false)) { LOGGER.warning("unable to change permissions for everybody: " + file); } if (!file.setReadable(true, true) || !file.setWritable(true, true) || !file.setExecutable(true, true)) { LOGGER.warning("unable to change permissions for owner: " + file); } } catch (SecurityException exception) { } catch (IllegalArgumentException exception) { } }
Source:
private void addAttrsFromFile(XmlFile file) { Map<StyleableDefinitionImpl, String[]> parentMap = new HashMap<StyleableDefinitionImpl, String[]>(); final XmlDocument document = file.getDocument(); if (document == null) return; final XmlTag rootTag = document.getRootTag(); if (rootTag == null || !TAG_RESOURCES.equals(rootTag.getName())) return; String attrGroup = ""; for (XmlTag tag : rootTag.getSubTags()) { String tagName = tag.getName(); if (tagName.equals(TAG_ATTR)) { AttributeDefinition def = parseAttrTag(tag, null); if (def != null) { def.setAttrGroup(attrGroup); } } else if (tagName.equals(TAG_DECLARE_STYLEABLE)) { StyleableDefinitionImpl def = parseDeclareStyleableTag(tag, parentMap); if (def.getName().equals("Theme")) { parseAndAddAttrGroups(tag); } } else if (tagName.equals(TAG_EAT_COMMENT)) { String newAttrGroup = getCommentBeforeEatComment(tag); if (newAttrGroup.length() <= ATTR_GROUP_MAX_CHARACTERS) { attrGroup = newAttrGroup; } } } for (Map.Entry<StyleableDefinitionImpl, String[]> entry : parentMap.entrySet()) { StyleableDefinitionImpl definition = entry.getKey(); String[] parentNames = entry.getValue(); for (String parentName : parentNames) { StyleableDefinitionImpl parent = getStyleableByName(parentName); if (parent != null) { definition.addParent(parent); parent.addChild(definition); } else { LOG.info("Found tag with unknown parent: " + parentName); } } } }

Target:
private void addAttrsFromFile(XmlFile file) { Map<StyleableDefinitionImpl, String[]> parentMap = new HashMap<StyleableDefinitionImpl, String[]>(); final XmlDocument document = file.getDocument(); if (document == null) return; final XmlTag rootTag = document.getRootTag(); if (rootTag == null || !TAG_RESOURCES.equals(rootTag.getName())) return; String attrGroup = ""; for (XmlTag tag : rootTag.getSubTags()) { String tagName = tag.getName(); if (tagName.equals(TAG_ATTR)) { AttributeDefinition def = parseAttrTag(tag, null); if (def != null) { def.setAttrGroup(attrGroup); } } else if (tagName.equals(TAG_DECLARE_STYLEABLE)) { StyleableDefinitionImpl def = parseDeclareStyleableTag(tag, parentMap); if (def != null && def.getName().equals("Theme")) { parseAndAddAttrGroups(tag); } } else if (tagName.equals(TAG_EAT_COMMENT)) { String newAttrGroup = getCommentBeforeEatComment(tag); if (newAttrGroup.length() <= ATTR_GROUP_MAX_CHARACTERS) { attrGroup = newAttrGroup; } } } for (Map.Entry<StyleableDefinitionImpl, String[]> entry : parentMap.entrySet()) { StyleableDefinitionImpl definition = entry.getKey(); String[] parentNames = entry.getValue(); for (String parentName : parentNames) { StyleableDefinitionImpl parent = getStyleableByName(parentName); if (parent != null) { definition.addParent(parent); parent.addChild(definition); } else { LOG.info("Found tag with unknown parent: " + parentName); } } } }
Source:
private String getMcqAddInfo(FeedbackMcqQuestionDetails questionDetails) { String additionalInfo = "Multiple-choice (single answer) question options:\n"; return appendMultiChoiceInfo(additionalInfo, questionDetails.getGenerateOptionsFor(), questionDetails.getMcqChoices(), questionDetails.isOtherEnabled()); }

Target:
private String getMcqAddInfo(FeedbackMcqQuestionDetails questionDetails) { String additionalInfo = "Multiple-choice (single answer) question options:" + System.lineSeparator(); return appendMultiChoiceInfo(additionalInfo, questionDetails.getGenerateOptionsFor(), questionDetails.getMcqChoices(), questionDetails.isOtherEnabled()); }
Source:
private static String[] generateEmptyStrings(int num) { String[] strings = new String[num]; for (int i = 0; i < num; ++i) { strings[i] = ""; } return strings; }

Target:
private String[] generateEmptyStrings(int num) { String[] strings = new String[num]; Arrays.fill(strings, ""); return strings; }
Source:
public void testMovePlan() { final Plan plan = PlanImpl.newBuilder() .addTransferStep(Constants.NAMESPACE_WORKER, new TransferStepImpl(EVAL_ID_PREFIX + 0, EVAL_ID_PREFIX + 1, new DataInfoImpl())) .addTransferStep(Constants.NAMESPACE_WORKER, new TransferStepImpl(EVAL_ID_PREFIX + 2, EVAL_ID_PREFIX + 3, new DataInfoImpl())) .addTransferStep(Constants.NAMESPACE_SERVER, new TransferStepImpl(EVAL_ID_PREFIX + 4, EVAL_ID_PREFIX + 5, new DataInfoImpl())) .addTransferStep(Constants.NAMESPACE_SERVER, new TransferStepImpl(EVAL_ID_PREFIX + 6, EVAL_ID_PREFIX + 7, new DataInfoImpl())) .build(); final ETPlan etPlan = compiler.compile(plan, 0); final Set<Op> initialOps = etPlan.getInitialOps(); assertEquals(4, initialOps.size()); initialOps.forEach(op -> { assertEquals(Op.OpType.MOVE, op.getOpType()); assertTrue(etPlan.onComplete(op).isEmpty()); }); }

Target:
public void testMovePlan() { final Plan plan = PlanImpl.newBuilder() .addTransferStep(Constants.NAMESPACE_WORKER, new TransferStepImpl(EVAL_ID_PREFIX + 0, EVAL_ID_PREFIX + 1, DUMMY_DATA_INFO)) .addTransferStep(Constants.NAMESPACE_WORKER, new TransferStepImpl(EVAL_ID_PREFIX + 2, EVAL_ID_PREFIX + 3, DUMMY_DATA_INFO)) .addTransferStep(Constants.NAMESPACE_SERVER, new TransferStepImpl(EVAL_ID_PREFIX + 4, EVAL_ID_PREFIX + 5, DUMMY_DATA_INFO)) .addTransferStep(Constants.NAMESPACE_SERVER, new TransferStepImpl(EVAL_ID_PREFIX + 6, EVAL_ID_PREFIX + 7, DUMMY_DATA_INFO)) .build(); final int numAvailableEvals = 0; final ETPlan etPlan = compiler.compile(plan, numAvailableEvals); final Set<Op> initialOps = etPlan.getInitialOps(); assertEquals(4, initialOps.size()); initialOps.forEach(op -> { assertEquals(Op.OpType.MOVE, op.getOpType()); assertTrue(etPlan.onComplete(op).isEmpty()); }); }
Source:
public void createSubscription(final String subscriptionId, final List<String> topics, final List<Cursor> cursors) { try { createPersistentEmptyNode("/nakadi/subscriptions/%s", subscriptionId); createPersistentEmptyNode("/nakadi/subscriptions/%s/topology", subscriptionId); for (final String topic : topics) { createPersistentEmptyNode("/nakadi/subscriptions/%s/topics/%s", subscriptionId, topic); createPersistentEmptyNode("/nakadi/subscriptions/%s/topics/%s/partitions", subscriptionId, topic); } for (final Cursor cursor: cursors) { final String path = String.format("/nakadi/subscriptions/%s/topics/%s/partitions/%s", subscriptionId, cursor.getTopic(), cursor.getPartition()); zooKeeperHolder .get() .create() .forPath(path, cursor.getOffset().getBytes()); } } catch (Exception e) { throw new NakadiRuntimeException("Error when tried to create subscription in ZooKeeper", e); } }

Target:
public void createSubscription(final String subscriptionId, final List<String> topics, final List<Cursor> cursors) { try { createPersistentEmptyNode("/nakadi/subscriptions/%s/topology", subscriptionId); for (final Cursor cursor: cursors) { final String path = String.format("/nakadi/subscriptions/%s/topics/%s/partitions/%s", subscriptionId, cursor.getTopic(), cursor.getPartition()); zooKeeperHolder .get() .create() .creatingParentsIfNeeded() .forPath(path, cursor.getOffset().getBytes()); } } catch (Exception e) { throw new NakadiRuntimeException("Error when tried to create subscription in ZooKeeper", e); } }
Source:
public void computeAABB(final AABB aabb, final Transform xf, int childIndex) { final Vec2 lower = aabb.lowerBound; final Vec2 upper = aabb.upperBound; final Vec2 v1 = m_vertices[0]; final float xfqc = xf.q.c; final float xfqs = xf.q.s; final float xfpx = xf.p.x; final float xfpy = xf.p.y; lower.x = (xfqc * v1.x - xfqs * v1.y) + xfpx; lower.y = xfqs * v1.x + xfqc * v1.y + xfpy; upper.x = lower.x; upper.y = lower.y; for (int i = 1; i < vertexCount; ++i) { Vec2 v2 = m_vertices[i]; float vx = (xfqc * v2.x - xfqs * v2.y) + xfpx; float vy = xfqs * v2.x + xfqc * v2.y + xfpy; lower.x = lower.x < vx ? lower.x : vx; lower.y = lower.y < vy ? lower.y : vy; upper.x = upper.x > vx ? upper.x : vx; upper.y = upper.y > vy ? upper.y : vy; } lower.x -= getRadius(); lower.y -= getRadius(); upper.x += getRadius(); upper.y += getRadius(); }

Target:
public void computeAABB(final AABB aabb, final Transform xf, int childIndex) { final Vec2 lower = aabb.lowerBound; final Vec2 upper = aabb.upperBound; final Vec2 v1 = m_vertices[0]; final float xfqc = xf.q.c; final float xfqs = xf.q.s; final float xfpx = xf.p.x; final float xfpy = xf.p.y; lower.x = (xfqc * v1.x - xfqs * v1.y) + xfpx; lower.y = (xfqs * v1.x + xfqc * v1.y) + xfpy; upper.x = lower.x; upper.y = lower.y; for (int i = 1; i < vertexCount; ++i) { Vec2 v2 = m_vertices[i]; float vx = (xfqc * v2.x - xfqs * v2.y) + xfpx; float vy = xfqs * v2.x + xfqc * v2.y + xfpy; lower.x = lower.x < vx ? lower.x : vx; lower.y = lower.y < vy ? lower.y : vy; upper.x = upper.x > vx ? upper.x : vx; upper.y = upper.y > vy ? upper.y : vy; } lower.x -= getRadius(); lower.y -= getRadius(); upper.x += getRadius(); upper.y += getRadius(); }
Source:
public Set<X509Certificate> getCertificates() { synchronized (mLock) { if (mCertificates != null) { return mCertificates; } try { Set<X509Certificate> certificates = new ArraySet<>(mKeyStore.size()); for (Enumeration<String> en = mKeyStore.aliases(); en.hasMoreElements();) { final String alias = en.nextElement(); final X509Certificate cert = (X509Certificate) mKeyStore.getCertificate(alias); if (cert != null) { certificates.add(cert); } } mCertificates = certificates; return mCertificates; } catch (KeyStoreException e) { throw new RuntimeException("Failed to load certificates from KeyStore", e); } } }

Target:
public Set<X509Certificate> getCertificates() { synchronized (mLock) { if (mCertificates != null) { return mCertificates; } try { Set<X509Certificate> certificates = new ArraySet<>(mKeyStore.size()); for (Enumeration<String> en = mKeyStore.aliases(); en.hasMoreElements();) { String alias = en.nextElement(); if (!mKeyStore.isCertificateEntry(alias)) { continue; } X509Certificate cert = (X509Certificate) mKeyStore.getCertificate(alias); if (cert != null) { certificates.add(cert); } } mCertificates = certificates; return mCertificates; } catch (KeyStoreException e) { throw new RuntimeException("Failed to load certificates from KeyStore", e); } } }
Source:
public static String networkPrefixLengthToNetmask(int prefixLength) { if (prefixLength > 31 || prefixLength < 1) { throw new IllegalArgumentException("Network prefix length is not within bounds"); } int ipv4Netmask = 0xFFFFFFFF; ipv4Netmask <<= (32 - prefixLength); byte[] octets = new byte[] { (byte) (ipv4Netmask >>> 24), (byte) (ipv4Netmask >>> 16), (byte) (ipv4Netmask >>> 8), (byte) ipv4Netmask }; String result = ""; for (int i = 0; i < 4; i++) { result += octets[i] & 0xff; if (i < 3) { result += "."; } } return result; }

Target:
public static @NonNull String networkPrefixLengthToNetmask(int prefixLength) { if (prefixLength > 31 || prefixLength < 1) { throw new IllegalArgumentException("Network prefix length is not within bounds"); } int ipv4Netmask = 0xFFFFFFFF; ipv4Netmask <<= (32 - prefixLength); byte[] octets = new byte[] { (byte) (ipv4Netmask >>> 24), (byte) (ipv4Netmask >>> 16), (byte) (ipv4Netmask >>> 8), (byte) ipv4Netmask }; String result = ""; for (int i = 0; i < 4; i++) { result += octets[i] & 0xff; if (i < 3) { result += "."; } } return result; }
Source:
private void createMarkers() { Collection<FileInfo> files = fRevisionInContext.getFiles().values(); deleteAllMarkers(); for (FileInfo fileInfo : files) { IResource workspaceFile = new OpenCompareEditor(fGerritClient, fChangeInfo) .getCorrespondingWorkspaceFile(fileInfo); if (workspaceFile == null) { workspaceFile = ResourcesPlugin.getWorkspace().getRoot(); } EList<CommentInfo> sortedComments = ModelHelpers.sortComments(fileInfo.getAllComments()); boolean addingMarker = false; for (CommentInfo commentInfo : sortedComments) { addMarker(commentInfo, workspaceFile); addingMarker = true; } if (addingMarker) { openMarkerView(); } } }

Target:
private void createMarkers() { Collection<FileInfo> files = fRevisionInContext.getFiles().values(); deleteAllMarkers(); for (FileInfo fileInfo : files) { IResource workspaceFile = new OpenCompareEditor(fGerritClient, fChangeInfo) .getCorrespondingWorkspaceFile(fileInfo); if (workspaceFile == null) { workspaceFile = ResourcesPlugin.getWorkspace().getRoot(); } EList<CommentInfo> sortedComments = ModelHelpers.sortComments(fileInfo.getAllComments()); boolean addingMarker = false; for (CommentInfo commentInfo : sortedComments) { addMarker(commentInfo, workspaceFile); addingMarker = true; } if (addingMarker) { openMarkerView(IWorkbenchPage.VIEW_CREATE); } } }
Source:
public Calendar getSummary_date() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); try { Date date = format.parse(this.summary_date); calendar.setTime(date); } catch (ParseException e) { } return calendar; }

Target:
public Calendar getSummary_date() { final SimpleDateFormat format = new SimpleDateFormat(enphaseDateFormatString); Calendar calendar = Calendar.getInstance(); try { Date date = format.parse(this.summary_date); calendar.setTime(date); } catch (ParseException e) { logger.debug("summary_date has an unknown format", this.summary_date); } return calendar; }
Source:
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(response -> response.getValue()); }

Target:
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(Response::getValue); }
Source:
public boolean equalsToMemberName(String name) { return memberName != null && memberName.equals(name); }

Target:
private boolean equalsToMemberName(String name) { return memberName != null && memberName.equals(name); }
Source:
private boolean fromInstance(Symbol owner) { for (Symbol outerClass : outerClasses) { Type ownerType = owner.type(); if (owner.equals(outerClass) || (ownerType != null && outerClass.type().isSubtypeOf(ownerType))) { return true; } } return false; }

Target:
private boolean fromInstance(Symbol owner) { for (Symbol outerClass : outerClasses) { Type ownerType = owner.type(); if (ownerType != null) { if (owner.equals(outerClass) || outerClass.type().isSubtypeOf(ownerType)) { return true; } else { return fromInstance(ownerType.symbol().owner()); } } } return false; }
Source:
public Message postProcessMessage(Message message) throws AmqpException { ByteArrayOutputStream zipped = new ByteArrayOutputStream(); try { OutputStream zipper = getCompressorStream(zipped); FileCopyUtils.copy(new ByteArrayInputStream(message.getBody()), zipper); MessageProperties originalProperties = message.getMessageProperties(); MessageBuilderSupport<MessageProperties> messagePropertiesMessageBuilder = MessagePropertiesBuilder.fromClonedProperties(originalProperties) .setContentEncoding(getEncoding() + (originalProperties.getContentEncoding() == null ? "" : ":" + originalProperties.getContentEncoding())); if (this.autoDecompress) { messagePropertiesMessageBuilder.setHeader(MessageProperties.SPRING_AUTO_DECOMPRESS, true); } MessageProperties messageProperties = messagePropertiesMessageBuilder.build(); byte[] compressed = zipped.toByteArray(); if (this.logger.isTraceEnabled()) { this.logger.trace("Compressed " + message.getBody().length + " to " + compressed.length); } return new Message(compressed, messageProperties); } catch (IOException e) { throw new AmqpIOException(e); } }

Target:
public Message postProcessMessage(Message message) throws AmqpException { try { ByteArrayOutputStream zipped = new ByteArrayOutputStream(); OutputStream zipper = getCompressorStream(zipped); FileCopyUtils.copy(new ByteArrayInputStream(message.getBody()), zipper); byte[] compressed = zipped.toByteArray(); if (this.logger.isTraceEnabled()) { this.logger.trace("Compressed " + message.getBody().length + " to " + compressed.length); } MessageProperties originalProperties = message.getMessageProperties(); MessagePropertiesBuilder messagePropertiesBuilder = this.copyProperties ? MessagePropertiesBuilder.fromClonedProperties(originalProperties) : MessagePropertiesBuilder.fromProperties(originalProperties); if (this.autoDecompress) { messagePropertiesBuilder.setHeader(MessageProperties.SPRING_AUTO_DECOMPRESS, true); } MessageProperties messageProperties = messagePropertiesBuilder.setContentEncoding(getEncoding() + (originalProperties.getContentEncoding() == null ? "" : ":" + originalProperties.getContentEncoding())) .build(); return new Message(compressed, messageProperties); } catch (IOException e) { throw new AmqpIOException(e); } }
Source:
protected HashMap<String, String> evalDynamicProperties() throws ConfigurationException { HashMap<String, String> newParametersToSave = new HashMap<>(); evalEnvironmentVariables(); evalLoopbackURL(); evalServerStatusKey(newParametersToSave); return newParametersToSave; }

Target:
protected HashMap<String, String> evalDynamicProperties() throws ConfigurationException { HashMap<String, String> newParametersToSave = new HashMap<>(); evalEnvironmentVariables(newParametersToSave); evalLoopbackURL(); evalServerStatusKey(newParametersToSave); return newParametersToSave; }
Source:
public void addImport(String classQualifiedName) { if (couldNotBeLoaded.contains(classQualifiedName)) { loadJavaExtensions(Sets.newHashSet(classQualifiedName)); } if (classQualifiedName != null && classQualifiedName.contains(".") && !imports.contains(classQualifiedName)) { Set<String> addedImport = Sets.newLinkedHashSet(); addedImport.add(classQualifiedName); imports.add(classQualifiedName); loadJavaExtensions(addedImport); } }

Target:
public void addImport(String classQualifiedName) { if (couldNotBeLoaded.contains(classQualifiedName)) { loadJavaExtensions(Sets.newHashSet(classQualifiedName)); } if (classQualifiedName != null && classQualifiedName.contains(".") && !imports.contains(classQualifiedName)) { imports.add(classQualifiedName); loadJavaExtensions(Collections.singleton(classQualifiedName)); } }
Source:
public void before() throws Exception { serverLooper = new NIOLooper(); clientLooper = new NIOLooper(); threadPools = Executors.newFixedThreadPool(2); backendStorage = mock(IStatefulStorage.class); HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024); serverPort = SysUtils.getFreePort(); checkpointManagerServer = new CheckpointManagerServer( TOPOLOGY_NAME, TOPOLOGY_ID, CHECKPOINT_MANAGER_ID, backendStorage, serverLooper, SERVER_HOST, serverPort, serverSocketOptions); runServer(); Thread.sleep(2 * 1000); }

Target:
public void before() throws Exception { finishedSignal = new CountDownLatch(1); serverLooper = new NIOLooper(); clientLooper = new NIOLooper(); threadPools = Executors.newFixedThreadPool(2); backendStorage = mock(IStatefulStorage.class); HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024); serverPort = SysUtils.getFreePort(); checkpointManagerServer = new CheckpointManagerServer( TOPOLOGY_NAME, TOPOLOGY_ID, CHECKPOINT_MANAGER_ID, backendStorage, serverLooper, SERVER_HOST, serverPort, serverSocketOptions); runServer(); }
Source:
public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { this(baseUrl, teamDomain, botUser, roomId, replyBroadcast); if (populatedToken == null) { throw new IllegalArgumentException("populatedToken cannot be null"); } this.populatedToken = populatedToken; }

Target:
public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { this(baseUrl, teamDomain, botUser, roomId, replyBroadcast); if (populatedToken == null) { throw new IllegalArgumentException("No slack token found, setup a secret text credential and configure it to be used"); } this.populatedToken = populatedToken; }
Source:
public void testNormalWSDeflateFrameCompressionNegotiation() throws Exception { String path = "/some/path"; Buffer buff = Buffer.buffer("AAA"); server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT)).websocketHandler(ws -> { assertEquals("upgrade", ws.headers().get("Connection")); assertEquals("deflate-frame", ws.headers().get("sec-websocket-extensions")); ws.writeFrame(WebSocketFrame.binaryFrame(buff, true)); }); server.listen(ar -> { assertTrue(ar.succeeded()); HttpClientOptions options = new HttpClientOptions(); options.setTryWebsocketDefalteFrameCompression(true); client = vertx.createHttpClient(options); client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, ws -> { final Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); } }); }); }); await(); }

Target:
public void testNormalWSDeflateFrameCompressionNegotiation() throws Exception { String path = "/some/path"; Buffer buff = Buffer.buffer("AAA"); server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT)) .websocketHandler(ws -> { assertEquals("upgrade", ws.headers().get("Connection")); assertEquals("deflate-frame", ws.headers().get("sec-websocket-extensions")); ws.writeFrame(WebSocketFrame.binaryFrame(buff, true)); }); server.listen(ar -> { assertTrue(ar.succeeded()); HttpClientOptions options = new HttpClientOptions(); options.setTryUsePerFrameWebsocketCompression(true); client = vertx.createHttpClient(options); client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, ws -> { final Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); } }); }); }); await(); }
Source:
public static CompositeName toDecomposedCompositeName(final Name name) throws InvalidNameException { if (name instanceof CompositeName) { return (CompositeName) name; } else { final CompositeName compositeName = new CompositeName(); compositeName.addAll(new CompositeName(name.toString())); return compositeName; } }

Target:
public static CompositeName toDecomposedCompositeName(final Name name) throws InvalidNameException { if (name instanceof CompositeName) { return (CompositeName) name; } else { final CompositeName compositeName = new CompositeName(); final Enumeration<String> enumeration = name.getAll(); if (enumeration.hasMoreElements()) { int idx = 0; String item; do { item = enumeration.nextElement(); if (item == null) { throw Messages.log.invalidNullSegment(idx); } compositeName.add(item); idx ++; } while (enumeration.hasMoreElements()); } return compositeName; } }
Source:
private void transformFileGroupingEvent( PromoteCompleteEvent event, FileGroupingEvent fileGroupingEvent ) { PathsPromoteCompleteEvent pathsPromoteCompleteEvent = null; if ( event instanceof PathsPromoteCompleteEvent ) { pathsPromoteCompleteEvent = (PathsPromoteCompleteEvent) event; } PathsPromoteResult promoteResult = pathsPromoteCompleteEvent.getPromoteResult(); String error = promoteResult.getError(); if ( error != null ) { logger.trace( "Error in promoteResult, skip audit." ); return; } Set<String> paths = promoteResult.getCompletedPaths(); if ( paths.isEmpty() ) { logger.trace( "No completedPaths, skip audit." ); return; } PathsPromoteRequest req = promoteResult.getRequest(); StoreKey source = req.getSource(); StoreKey target = req.getTarget(); Map<String, String> extra = new HashMap<>(); extra.put( "source", source.toString() ); extra.put( "target", target.toString() ); fileGroupingEvent.setExtra( extra ); fileGroupingEvent.setTimestamp( new Date() ); TrackingKey trackingKey = getTrackingKey( source ); if ( trackingKey == null ) { logger.trace( "No tracking key found to: {}", source ); return; } fileGroupingEvent.setSessionId( trackingKey.getId() ); }

Target:
private void transformFileGroupingEvent( PromoteCompleteEvent event, FileGroupingEvent fileGroupingEvent ) { PathsPromoteCompleteEvent pathsPromoteCompleteEvent = (PathsPromoteCompleteEvent)event; PathsPromoteResult promoteResult = pathsPromoteCompleteEvent.getPromoteResult(); String error = promoteResult.getError(); if ( error != null ) { logger.trace( "Error in promoteResult, skip audit." ); return; } Set<String> paths = promoteResult.getCompletedPaths(); if ( paths.isEmpty() ) { logger.trace( "No completedPaths, skip audit." ); return; } PathsPromoteRequest req = promoteResult.getRequest(); StoreKey source = req.getSource(); StoreKey target = req.getTarget(); TrackingKey trackingKey = getTrackingKey( source ); if ( trackingKey == null ) { logger.trace( "No tracking key found to: {}", source ); return; } Map<String, String> extra = new HashMap<>(); extra.put( EventConstants.SOURCE, source.toString() ); extra.put( EventConstants.TARGET, target.toString() ); fileGroupingEvent.setExtra( extra ); fileGroupingEvent.setTimestamp( new Date() ); fileGroupingEvent.setSessionId( trackingKey.getId() ); }
Source:
public static void clean(ByteBuffer buffer) { if (buffer == null || !buffer.isDirect()) return; try { if (buffer.isDirect()) { Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); if (cleaner != null) { mhCleanerClean.bindTo(cleaner).invoke(); } else { Object attach = MemoryUtil.getAttachment(buffer); if (attach instanceof ByteBuffer && attach != buffer) clean((ByteBuffer) attach); } } } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }

Target:
public static void clean(ByteBuffer buffer) { if (buffer == null || !buffer.isDirect()) return; try { Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); if (cleaner != null) { mhCleanerClean.bindTo(cleaner).invoke(); } } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }
Source:
public static synchronized AppPrefs getInstance() { if(instance == null) { throw new RuntimeException( "AppPrefs instance is null. Make sure it is initialized in ResearchStack before calling."); } return instance; }

Target:
public static AppPrefs getInstance() { if(instance == null) { throw new RuntimeException( "AppPrefs instance is null. Make sure it is initialized in ResearchStack before calling."); } return instance; }
Source:
public void assertCanDelete(Project project) throws CannotDeleteProjectException { try { if (db.submoduleSubscriptions().bySubmoduleProject(project.getNameKey()) .iterator().hasNext()) { throw new CannotDeleteProjectException("Project is subscribed by other projects."); } } catch (OrmException e) { throw new CannotDeleteProjectException(e); } }

Target:
public void assertCanDelete(Project project) throws CannotDeleteProjectException, OrmException { if (db.submoduleSubscriptions().bySubmoduleProject(project.getNameKey()) .iterator().hasNext()) { throw new CannotDeleteProjectException( "Project is subscribed by other projects."); } }
Source:
public Builder transform(List<? extends Transformation> transformations) { if (transformations == null) { throw new IllegalArgumentException("Transformation list must not be null."); } for (Object transformation : transformations) { transform((Transformation) transformation); } return this; }

Target:
public Builder transform(List<? extends Transformation> transformations) { if (transformations == null) { throw new IllegalArgumentException("Transformation list must not be null."); } for (Transformation transformation : transformations) { transform(transformation); } return this; }
Source:
public boolean isRepoExist(String repo) { String fullItemUrl = artifactoryUrl + API_REPOSITORIES + "/" + repo; String encodedUrl = ArtifactoryHttpClient.encodeUrl(fullItemUrl); HttpRequestBase httpRequest = new HttpGet(encodedUrl); HttpResponse httpResponse = null; int connectionRetries = httpClient.getConnectionRetries(); try { httpResponse = httpClient.getHttpClient().execute(httpRequest); StatusLine statusLine = httpResponse.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { return false; } } catch (IOException e) { return false; } finally { httpClient.setConnectionRetries(connectionRetries); if (httpResponse != null) { EntityUtils.consumeQuietly(httpResponse.getEntity()); } } return true; }

Target:
public boolean isRepoExist(String repo) throws IOException { String fullItemUrl = artifactoryUrl + API_REPOSITORIES + "/" + repo; String encodedUrl = ArtifactoryHttpClient.encodeUrl(fullItemUrl); HttpRequestBase httpRequest = new HttpGet(encodedUrl); HttpResponse httpResponse = null; int connectionRetries = httpClient.getConnectionRetries(); try { httpResponse = httpClient.getHttpClient().execute(httpRequest); StatusLine statusLine = httpResponse.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { return false; } } finally { httpClient.setConnectionRetries(connectionRetries); if (httpResponse != null) { EntityUtils.consumeQuietly(httpResponse.getEntity()); } } return true; }