auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setEnrolment(WrittenEvaluation writtenEvaluation) { DateTime beginDateTime = writtenEvaluation.getEnrolmentPeriodStart(); DateTime endDateTime = writtenEvaluation.getEnrolmentPeriodEnd(); this.enrolmentPast = endDateTime == null ? false : endDateTime.isBeforeNow(); this.enrolmentElapsing = new Interval(beginDateTime, endDateTime).containsNow(); if (writtenEvaluation.getEnrollmentBeginDayDateYearMonthDay() != null && writtenEvaluation.getEnrollmentEndDayDateYearMonthDay() != null) { this.enrolment = writtenEvaluation.getEnrollmentBeginDayDateYearMonthDay().toString() + " " + BundleUtil.getString(Bundle.STUDENT, "message.out.until") + " " + writtenEvaluation.getEnrollmentEndDayDateYearMonthDay().toString(); } else { this.enrolment = "-"; this.register = "-"; } }

Target:
public void setEnrolment(WrittenEvaluation writtenEvaluation) { DateTime beginDateTime = writtenEvaluation.getEnrolmentPeriodStart(); DateTime endDateTime = writtenEvaluation.getEnrolmentPeriodEnd(); this.enrolmentPast = endDateTime == null ? false : endDateTime.isBeforeNow(); this.enrolmentElapsing = false; if (writtenEvaluation.getEnrollmentBeginDayDateYearMonthDay() != null && writtenEvaluation.getEnrollmentEndDayDateYearMonthDay() != null) { this.enrolmentElapsing = new Interval(beginDateTime, endDateTime).containsNow(); this.enrolment = writtenEvaluation.getEnrollmentBeginDayDateYearMonthDay().toString() + " " + BundleUtil.getString(Bundle.STUDENT, "message.out.until") + " " + writtenEvaluation.getEnrollmentEndDayDateYearMonthDay().toString(); } else { this.enrolment = "-"; this.register = "-"; } }
Source:
private AnalyzerResultReducer<AnalyzerResult> initializeReducer( final Class<? extends AnalyzerResultReducer<?>> resultReducerClass) { final DataCleanerConfiguration configuration = _sparkJobContext.getConfiguration(); final InjectionManager injectionManager = configuration.getEnvironment().getInjectionManagerFactory() .getInjectionManager(configuration, _sparkJobContext.getAnalysisJob()); final LifeCycleHelper lifeCycleHelper = new LifeCycleHelper(injectionManager, true); final ComponentDescriptor<? extends AnalyzerResultReducer<?>> reducerDescriptor = Descriptors .ofComponent(resultReducerClass); @SuppressWarnings("unchecked") AnalyzerResultReducer<AnalyzerResult> reducer = (AnalyzerResultReducer<AnalyzerResult>) reducerDescriptor.newInstance(); lifeCycleHelper.assignProvidedProperties(reducerDescriptor, reducer); lifeCycleHelper.initialize(reducerDescriptor, reducer); return reducer; }

Target:
private AnalyzerResultReducer<AnalyzerResult> initializeReducer( final Class<? extends AnalyzerResultReducer<?>> resultReducerClass) { final DataCleanerConfiguration configuration = _sparkJobContext.getConfiguration(); final InjectionManager injectionManager = configuration.getEnvironment().getInjectionManagerFactory() .getInjectionManager(configuration, _sparkJobContext.getAnalysisJob()); final LifeCycleHelper lifeCycleHelper = new LifeCycleHelper(injectionManager, false); final ComponentDescriptor<? extends AnalyzerResultReducer<?>> reducerDescriptor = Descriptors .ofComponent(resultReducerClass); @SuppressWarnings("unchecked") AnalyzerResultReducer<AnalyzerResult> reducer = (AnalyzerResultReducer<AnalyzerResult>) reducerDescriptor.newInstance(); lifeCycleHelper.assignProvidedProperties(reducerDescriptor, reducer); lifeCycleHelper.initialize(reducerDescriptor, reducer); return reducer; }
Source:
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { this(schema, SchemaType.valueOf(schemaType)); }

Target:
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { this(schema, StringUtils.isEmpty(schemaType) ? (SchemaType) null : SchemaType.valueOf(schemaType)); }
Source:
CompletableFuture<Acknowledge> runApplicationAndShutdownClusterAsync( final DispatcherGateway dispatcher, final ScheduledExecutor scheduledExecutor) { applicationCompletionFuture = fixJobIdAndRunApplicationAsync(dispatcher, scheduledExecutor); return applicationCompletionFuture .handle((r, t) -> { final ApplicationStatus applicationStatus; if (t != null) { if (ExceptionUtils.findThrowable(t, JobCancellationException.class).isPresent()) { applicationStatus = ApplicationStatus.CANCELED; LOG.warn("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } if (ExceptionUtils.findThrowable(t, JobExecutionException.class).isPresent()) { applicationStatus = ApplicationStatus.FAILED; LOG.warn("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } return dispatcher.shutDownClusterExceptionally(t); } else { applicationStatus = ApplicationStatus.SUCCEEDED; LOG.info("Application completed SUCCESSFULLY"); return dispatcher.shutDownCluster(applicationStatus); } }) .thenCompose(Function.identity()); }

Target:
CompletableFuture<Acknowledge> runApplicationAndShutdownClusterAsync( final DispatcherGateway dispatcher, final ScheduledExecutor scheduledExecutor) { applicationCompletionFuture = fixJobIdAndRunApplicationAsync(dispatcher, scheduledExecutor); return applicationCompletionFuture .handle((r, t) -> { final ApplicationStatus applicationStatus; if (t != null) { if (ExceptionUtils.findThrowable(t, JobCancellationException.class).isPresent()) { applicationStatus = ApplicationStatus.CANCELED; LOG.info("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } if (ExceptionUtils.findThrowable(t, JobExecutionException.class).isPresent()) { applicationStatus = ApplicationStatus.FAILED; LOG.info("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } LOG.warn("Exiting with Application Status UNKNOWN: ", t); errorHandler.onFatalError(t); return CompletableFuture.completedFuture(Acknowledge.get()); } else { applicationStatus = ApplicationStatus.SUCCEEDED; LOG.info("Application completed SUCCESSFULLY"); return dispatcher.shutDownCluster(applicationStatus); } }) .thenCompose(Function.identity()); }
Source:
protected void ExecuteIrsBrokerCommand() { _result = getIrsProxy().getImagesList(getParameters().getStorageDomainId().toString()); ProceedProxyReturnValue(); ArrayList<Guid> tempRetValue = new ArrayList<Guid>(_result.mImageList.length); for (int i = 0; i < _result.mImageList.length; i++) { tempRetValue.add(new Guid(_result.mImageList[i])); } setReturnValue(tempRetValue); }

Target:
protected void ExecuteIrsBrokerCommand() { _result = getIrsProxy().getImagesList(getParameters().getStorageDomainId().toString()); ProceedProxyReturnValue(); ArrayList<Guid> tempRetValue = new ArrayList<Guid>(_result.getImageList().length); for (String id : _result.getImageList()) { tempRetValue.add(new Guid(id)); } setReturnValue(tempRetValue); }
Source:
private static String buildCanonicalUriFromId(String id) { checkArgument(!Strings.isNullOrEmpty(id), "Cannot build canonical uri from empty id"); return "<LINK_0>"+id; }

Target:
private static String buildCanonicalUriFromId(String id) { return RTE_CANONICAL_URI_PREFIX.concat(id); }
Source:
private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { if (dialogButton == confirmButtonType) { if (!queryField.isDisabled()) queryField.appendText(" "); return TurboLabel.getLabelsNameList(state.getAssignedLabels()); } return null; }); }

Target:
private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { if (dialogButton == confirmButtonType) { if (!queryField.isDisabled()) queryField.appendText(" "); return TurboLabel.getLabelNames(state.getAssignedLabels()); } return null; }); }
Source:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (allNulls) { return new RunLengthEncodedBlock(nullBlock, outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount == outputPositionCount) { Block block = makeBlock(positionCount, nullsAllowed, nulls, values); nulls = null; values = null; return block; } long[] valuesCopy = createValuesCopy(positionCount); boolean[] nullsCopy = null; if (includeNulls) { nullsCopy = new boolean[positionCount]; } copyValues(positions, positionCount, valuesCopy, nullsCopy); return makeBlock(positionCount, includeNulls, nullsCopy, valuesCopy); }

Target:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (allNulls) { return new RunLengthEncodedBlock(nullBlock, outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount == outputPositionCount) { Block block = makeBlock(positionCount, nullsAllowed, nulls, values); nulls = null; values = null; return block; } long[] valuesCopy = new long[valuesPerPosition * positionCount]; boolean[] nullsCopy = null; if (includeNulls) { nullsCopy = new boolean[positionCount]; } copyValues(positions, positionCount, valuesCopy, nullsCopy); return makeBlock(positionCount, includeNulls, nullsCopy, valuesCopy); }
Source:
public boolean isClearingPartition(CacheGroupContext grp, int part) { if (grp.persistenceEnabled()) return false; synchronized (mux) { if (clearingPartitions == null) return false; Set<Integer> parts = clearingPartitions.get(grp.groupId()); return parts != null && parts.contains(part); } }

Target:
public boolean isClearingPartition(CacheGroupContext grp, int part) { if (!grp.persistenceEnabled()) return false; synchronized (mux) { if (clearingPartitions == null) return false; Set<Integer> parts = clearingPartitions.get(grp.groupId()); return parts != null && parts.contains(part); } }
Source:
public List<N> sort(Collection<N> nodes) { LinkedHashMap<ID, NodeInfo<ID, N>> nodeInfos = new LinkedHashMap<>(nodes.size()); List<NodeInfo<ID, N>> results = new ArrayList<>(nodes.size()); int pos = 0; boolean needsSorting = false; for (N node : nodes) { ID nodeID = identityExtractor.apply(node); Set<ID> preds = new HashSet<>(directPredecessorsExtractor.apply(node)); needsSorting |= !preds.isEmpty(); NodeInfo<ID, N> nodeInfo = nodeInfos.computeIfAbsent(nodeID, __ -> new NodeInfo<>()); nodeInfo.id = nodeID; nodeInfo.predecessors = preds; nodeInfo.sourcePosition = pos++; nodeInfo.node = node; for (ID pred : preds) { NodeInfo<ID, N> predNode = nodeInfos.computeIfAbsent(pred, __ -> new NodeInfo<>()); if (predNode.successors == null) { predNode.successors = new HashSet<>(); } predNode.successors.add(nodeID); } } if (needsSorting) { TreeSet<NodeInfo<ID, N>> tmp = new TreeSet<>(Comparator.comparingInt(a -> a.sourcePosition)); tmp.addAll(nodeInfos.values()); nodeInfos.clear(); tmp.forEach(ni -> nodeInfos.put(ni.id, ni)); sort(nodeInfos, results); } else { results = new ArrayList<>(nodeInfos.values()); } return results.stream().map(ni -> ni.node).collect(Collectors.toList()); }

Target:
public List<N> sort(Collection<N> nodes) { LinkedHashMap<ID, NodeInfo<ID, N>> nodeInfos = newLinkedHashMapWithExpectedSize(nodes.size()); List<NodeInfo<ID, N>> results = new ArrayList<>(nodes.size()); int pos = 0; boolean needsSorting = false; for (N node : nodes) { ID nodeID = identityExtractor.apply(node); Set<ID> preds = new HashSet<>(directPredecessorsExtractor.apply(node)); needsSorting = needsSorting || !preds.isEmpty(); NodeInfo<ID, N> nodeInfo = nodeInfos.computeIfAbsent(nodeID, __ -> new NodeInfo<>()); nodeInfo.id = nodeID; nodeInfo.predecessors = preds; nodeInfo.sourcePosition = pos++; nodeInfo.node = node; for (ID pred : preds) { NodeInfo<ID, N> predNode = nodeInfos.computeIfAbsent(pred, __ -> new NodeInfo<>()); if (predNode.successors == null) { predNode.successors = new HashSet<>(); } predNode.successors.add(nodeID); } } if (needsSorting) { TreeSet<NodeInfo<ID, N>> tmp = new TreeSet<>(Comparator.comparingInt(a -> a.sourcePosition)); tmp.addAll(nodeInfos.values()); nodeInfos.clear(); tmp.forEach(ni -> nodeInfos.put(ni.id, ni)); sort(nodeInfos, results); } else { results = new ArrayList<>(nodeInfos.values()); } return results.stream().map(ni -> ni.node).collect(Collectors.toList()); }
Source:
protected boolean showDebug() { return (devMode || "false".equalsIgnoreCase(disabled)); }

Target:
protected boolean showDebug() { return (devMode || Boolean.TRUE == PrepareOperations.getDevModeOverride()); }
Source:
public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors) { SchedulerAssignment assignment = this.getAssignmentById(topologyId); if (assignment == null) { assignment = new SchedulerAssignment(topologyId, new HashMap<ExecutorDetails, WorkerSlot>()); this.assignments.put(topologyId, assignment); } assignment.assign(slot, executors); }

Target:
public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors) { if (this.isSlotOccupied(slot)) { throw new RuntimeException("slot: [" + slot.getNodeId() + ", " + slot.getPort() + "] is already occupied."); } SchedulerAssignmentImpl assignment = (SchedulerAssignmentImpl)this.getAssignmentById(topologyId); if (assignment == null) { assignment = new SchedulerAssignmentImpl(topologyId, new HashMap<ExecutorDetails, WorkerSlot>()); this.assignments.put(topologyId, assignment); } else { for (ExecutorDetails executor : executors) { if (assignment.isExecutorAssigned(executor)) { throw new RuntimeException("the executor is already assigned, you should unassign it before assign it to another slot."); } } } assignment.assign(slot, executors); }
Source:
private Field dbSaveUpdate(final Field throwAwayField) throws DotDataException { FieldBuilder builder = FieldBuilder.builder(throwAwayField); Date modDate = DateUtils.round(new Date(), Calendar.SECOND); builder.modDate(modDate); Field oldField = null; try { oldField = selectInDb(throwAwayField.id()); builder.fixed(oldField.fixed()); builder.readOnly(oldField.readOnly()); builder.dataType(oldField.dataType()); builder.dbColumn(oldField.dbColumn()); } catch (NotFoundInDbException e) { List<Field> fieldsAlreadyAdded = byContentTypeId(throwAwayField.contentTypeId()); if (throwAwayField.id() == null) { builder.id(UUID.randomUUID().toString()); } if (throwAwayField.sortOrder() < 0) { builder.sortOrder( fieldsAlreadyAdded.stream().map(f -> f.sortOrder()).max(Integer::compare).orElse(-1) + 1 ); } final List<String> takenFieldVars = fieldsAlreadyAdded.stream().map(Field::variable).collect( Collectors.toList()); takenFieldVars.addAll(InterfaceType.RESERVED_GRAPHQL_FIELD_NAMES); String tryVar = (throwAwayField.variable() == null) ? suggestVelocityVar(throwAwayField.name(), takenFieldVars) : throwAwayField.variable(); builder.variable(tryVar); } builder = FieldBuilder.builder(normalizeData(builder.build())); Field retField = builder.build(); validateDbColumn(retField); if (oldField == null) { insertInodeInDb(retField); insertFieldInDb(retField); } else { updateInodeInDb(retField); updateFieldInDb(retField); } return retField; }

Target:
private Field dbSaveUpdate(final Field throwAwayField) throws DotDataException { FieldBuilder builder = FieldBuilder.builder(throwAwayField); Date modDate = DateUtils.round(new Date(), Calendar.SECOND); builder.modDate(modDate); Field oldField = null; try { oldField = selectInDb(throwAwayField.id()); builder.fixed(oldField.fixed()); builder.readOnly(oldField.readOnly()); builder.dataType(oldField.dataType()); builder.dbColumn(oldField.dbColumn()); } catch (NotFoundInDbException e) { List<Field> fieldsAlreadyAdded = byContentTypeId(throwAwayField.contentTypeId()); if (throwAwayField.id() == null) { builder.id(UUID.randomUUID().toString()); } if (throwAwayField.sortOrder() < 0) { builder.sortOrder( fieldsAlreadyAdded.stream().map(f -> f.sortOrder()).max(Integer::compare).orElse(-1) + 1 ); } final List<String> takenFieldVars = fieldsAlreadyAdded.stream().map(Field::variable).collect( Collectors.toList()); String tryVar = (throwAwayField.variable() == null) ? suggestVelocityVar(throwAwayField.name(), takenFieldVars) : throwAwayField.variable(); builder.variable(tryVar); } builder = FieldBuilder.builder(normalizeData(builder.build())); Field retField = builder.build(); validateDbColumn(retField); if (oldField == null) { insertInodeInDb(retField); insertFieldInDb(retField); } else { updateInodeInDb(retField); updateFieldInDb(retField); } return retField; }
Source:
private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Publisher) buildStep = ((Publisher) bs).getDescriptor().getDisplayName(); else buildStep = bs.getClass().getName(); if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error(buildStep + "' failed: " + e.getMessage()); } else { String msg = buildStep + "' aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }

Target:
private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Publisher) { buildStep = ((Publisher) bs).getDescriptor().getDisplayName(); } else { buildStep = bs.getClass().getName(); } if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error(buildStep + "' failed: " + e.getMessage()); } else { String msg = buildStep + "' aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }
Source:
public SlackResponse(String slackResponseString) { JSONObject result = new JSONObject(slackResponseString); channelId = result.getString("channel"); ts = result.getString("ts"); }

Target:
public SlackResponse(String slackResponseString) { if (!StringUtils.isEmpty(slackResponseString)) { JSONObject result = new JSONObject(slackResponseString); channelId = result.getString("channel"); ts = result.getString("ts"); } }
Source:
protected CompressionCodec getCodec(CompressionCodecName codecName,Configuration conf) { String[] configCodecNames = conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_NAME); String codecClassName = null; int codecIdx = Arrays.asList(configCodecNames).indexOf(codecName.toString()); if(codecIdx > 0){ String[] configCodecClassNames=conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_CLASS_NAME); codecClassName = configCodecClassNames[codecIdx]; } if(codecClassName == null ||codecClassName.isEmpty()){ codecClassName = codecName.getHadoopCompressionCodecClassName(); } if (codecClassName == null) { return null; } CompressionCodec codec = CODEC_BY_NAME.get(codecClassName); if (codec != null) { return codec; } try { Class<?> codecClass; try { codecClass = Class.forName(codecClassName); } catch (ClassNotFoundException e) { codecClass = configuration.getClassLoader().loadClass(codecClassName); } codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, configuration); CODEC_BY_NAME.put(codecClassName, codec); return codec; } catch (ClassNotFoundException e) { throw new BadConfigurationException("Class " + codecClassName + " was not found", e); } }

Target:
protected CompressionCodec getCodec(CompressionCodecName codecName,Configuration conf) { String[] configCodecNames = conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_NAME); String codecClassName = null; if(configCodecNames != null && configCodecNames.length > 0 && codecName != null) { int codecIdx = Arrays.asList(configCodecNames).indexOf(codecName.toString()); if(codecIdx >= 0) { String[] configCodecClassNames=conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_CLASS_NAME); codecClassName = configCodecClassNames[codecIdx]; } } if(codecClassName == null ||codecClassName.isEmpty()) { codecClassName = codecName.getHadoopCompressionCodecClassName(); } if (codecClassName == null) { return null; } CompressionCodec codec = CODEC_BY_NAME.get(codecClassName); if (codec != null) { return codec; } try { Class<?> codecClass; try { codecClass = Class.forName(codecClassName); } catch (ClassNotFoundException e) { codecClass = configuration.getClassLoader().loadClass(codecClassName); } codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, configuration); CODEC_BY_NAME.put(codecClassName, codec); return codec; } catch (ClassNotFoundException e) { throw new BadConfigurationException("Class " + codecClassName + " was not found", e); } }
Source:
private SSLEngineResult.HandshakeStatus wrap() throws IOException { SSLEngineResult res; SSLEngineResult.HandshakeStatus hs; SSLEngineResult.Status status; try { res = m_sslEngine.wrap(m_localClearData, m_localEncData); hs = res.getHandshakeStatus(); } catch (SSLException e) { System.err.println("wrap: see SSLException"); m_sslEngine.closeOutbound(); return m_sslEngine.getHandshakeStatus(); } switch (res.getStatus()) { case OK: m_localEncData.flip(); while (m_localEncData.hasRemaining()) { m_sc.write(m_localEncData); } m_localEncData.compact(); break; case BUFFER_OVERFLOW: m_localEncData = ByteBuffer.allocate(m_localEncData.capacity() * 2); break; case BUFFER_UNDERFLOW: throw new IOException("SSLEngine: nothing in m_localClearData when wrapping"); case CLOSED: m_localEncData.flip(); try { while (m_localEncData.hasRemaining()) { m_sc.write(m_localEncData); } } catch (IOException e) { } hs = m_sslEngine.getHandshakeStatus(); break; } return hs; }

Target:
private SSLEngineResult.HandshakeStatus wrap() throws IOException { SSLEngineResult res; SSLEngineResult.HandshakeStatus hs; try { res = m_sslEngine.wrap(m_clear, m_encrypted); hs = res.getHandshakeStatus(); } catch (SSLException e) { m_sslEngine.closeOutbound(); throw e; } switch (res.getStatus()) { case OK: m_encrypted.flip(); while (m_encrypted.hasRemaining()) { m_sc.write(m_encrypted); } m_encrypted.compact(); break; case BUFFER_OVERFLOW: m_encrypted = ByteBuffer.allocate(m_encrypted.capacity() << 1); break; case BUFFER_UNDERFLOW: throw new IOException("SSLEngine: nothing in m_localClearData when wrapping"); case CLOSED: m_encrypted.flip(); try { while (m_encrypted.hasRemaining()) { m_sc.write(m_encrypted); } } catch (IOException e) { } hs = m_sslEngine.getHandshakeStatus(); break; } return hs; }
Source:
public void addPlanTags() { Set<String> planTags = BlogUtils.planTags(); if (planTags != null) { addTags(planTags.toArray(new String[planTags.size()])); } }

Target:
public void addPlanTags() { Set<String> planTags = BlogUtils.planTags(); addTags(planTags.toArray(new String[planTags.size()])); }
Source:
public static Map<@NonNull String, @NonNull Collection<String>> getEventFieldNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) { Map<@NonNull String, @NonNull Collection<String>> retMap = new HashMap<>(); for (ITmfEventType eventType : eventTypes) { Collection<String> collection = eventType.getFieldNames(); if (collection != null) { Collections.unmodifiableCollection(collection); retMap.put(eventType.getName(), Collections.unmodifiableCollection(collection)); } } return retMap; }

Target:
public static Multimap<@NonNull String, @NonNull String> getEventFieldNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) { Multimap<@NonNull String, @NonNull String> retMap = HashMultimap.create(); eventTypes.forEach(eventType -> { Collection<String> collection = eventType.getFieldNames(); if (collection != null) { collection.forEach(field -> { if (field != null) { retMap.put(eventType.getName(), field); } }); } }); return retMap; }
Source:
private void showRestartDialog() { Display.getDefault().asyncExec(() -> { IWorkbench workbench = PlatformUI.getWorkbench(); if (0 == MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL, workbench.getActiveWorkbenchWindow().getShell(), PreferencesMessages.WizardPreferencesImportRestartDialog_title, PreferencesMessages.WizardPreferencesImportRestartDialog_message, SWT.NONE, PreferencesMessages.WizardPreferencesImportRestartDialog_ok, PreferencesMessages.WizardPreferencesImportRestartDialog_cancel)) workbench.restart(); }); }

Target:
private void showRestartDialog() { if (0 == MessageDialog.open(MessageDialog.CONFIRM, mainPage.getShell(), PreferencesMessages.WizardPreferencesImportRestartDialog_title, PreferencesMessages.WizardPreferencesImportRestartDialog_message, SWT.NONE, PreferencesMessages.WizardPreferencesImportRestartDialog_ok, PreferencesMessages.WizardPreferencesImportRestartDialog_cancel)) { Display.getDefault().asyncExec(() -> { PlatformUI.getWorkbench().restart(); }); } }
Source:
public void useHTML(boolean enabled) { LOGGER.fine("Deprecated: HTMLWriterOutput.useHtml() has been deprecated and its functionality removed."); }

Target:
public void useHTML(boolean enabled) { LOGGER.log(Level. WARNING, null, new UnsupportedOperationException("Deprecated: HTMLWriterOutput.useHtml() has been deprecated and its functionality removed.")); }
Source:
protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) throw new IllegalArgumentException("Null index for fasta " + path); this.index = index; IOUtil.assertFileIsReadable(path); reset(); if(getSequenceDictionary() != null) sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); }

Target:
protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) { throw new IllegalArgumentException("Null index for fasta " + path); } this.index = index; IOUtil.assertFileIsReadable(path); reset(); if(getSequenceDictionary() != null) { sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); } }
Source:
private CountDownLatch submitPut() throws Exception { final CountDownLatch doneLatch = new CountDownLatch(requestAndResultsList.size()); if (router == null || !router.isOpen()) { VerifiableProperties vProps = getNonBlockingRouterProperties(); router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); } for (final RequestAndResult requestAndResult : requestAndResultsList) { Utils.newThread(new Runnable() { @Override public void run() { ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(requestAndResult.putContent)); requestAndResult.result = (FutureResult<String>) router .putBlob(requestAndResult.putBlobProperties, requestAndResult.putUserMetadata, putChannel, new Callback<String>() { @Override public void onCompletion(String result, Exception exception) { doneLatch.countDown(); } }); } }, false).start(); } return doneLatch; }

Target:
private CountDownLatch submitPut() throws Exception { final CountDownLatch doneLatch = new CountDownLatch(requestAndResultsList.size()); if (router == null || !router.isOpen()) { router = getNonBlockingRouter(); } for (final RequestAndResult requestAndResult : requestAndResultsList) { Utils.newThread(new Runnable() { @Override public void run() { ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(requestAndResult.putContent)); requestAndResult.result = (FutureResult<String>) router .putBlob(requestAndResult.putBlobProperties, requestAndResult.putUserMetadata, putChannel, new Callback<String>() { @Override public void onCompletion(String result, Exception exception) { doneLatch.countDown(); } }); } }, true).start(); } return doneLatch; }
Source:
public boolean remove(EE value) throws Exception { Iterator<EE> iterator = getListState().get().iterator(); List<EE> list = new ArrayList<>(); while (iterator.hasNext()) { EE it = iterator.next(); list.add(it); } boolean success = list.remove(value); if (success) { getListState().update(list); } return success; }

Target:
public boolean remove(EE value) throws Exception { Iterable<EE> iterable = getListState().get(); if (iterable == null) { return false; } Iterator<EE> iterator = iterable.iterator(); List<EE> list = new ArrayList<>(); while (iterator.hasNext()) { EE it = iterator.next(); list.add(it); } boolean success = list.remove(value); if (success) { getListState().update(list); } return success; }
Source:
public void testPairPutIfAbsent() { Module module = createModule(createModuleRootManager(createVirtualRoot(moduleRootPath, "/asd", null))); intelliJReferencePointManager.putIfAbsent(referencePoint, module); Module module2 = intelliJReferencePointManager.getModule(referencePoint); Assert.assertNotNull(module2); }

Target:
public void testPairPutIfAbsent() { Module module = createModule("Module1"); intelliJReferencePointManager.putIfAbsent(referencePoint, module); Module module2 = intelliJReferencePointManager.getModule(referencePoint); Assert.assertNotNull(module2); Assert.assertEquals(module, module2); }
Source:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } for (GoImportSpec duplicatedImportSpec : GoImportOptimizer.findDuplicatedEntries(importMap)) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } MultiMap<String, GoImportSpec> nameMap = getImportNameMap(file); for (Map.Entry<String, Collection<GoImportSpec>> specs : nameMap.entrySet()) { Iterator<GoImportSpec> imports = specs.getValue().iterator(); imports.next(); while (imports.hasNext()) { problemsHolder.registerProblem(imports.next(), "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } Collection<GoImportSpec> duplicatedEntries = GoImportOptimizer.findDuplicatedEntries(importMap); for (GoImportSpec duplicatedImportSpec : duplicatedEntries) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } for (Map.Entry<String, Collection<GoImportSpec>> specs : importMap.entrySet()) { Iterator<GoImportSpec> imports = specs.getValue().iterator(); imports.next(); while (imports.hasNext()) { GoImportSpec redeclaredImport = imports.next(); if (!duplicatedEntries.contains(redeclaredImport)) { problemsHolder.registerProblem(redeclaredImport, "Redeclared import", ProblemHighlightType.GENERIC_ERROR); } } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }
Source:
public static AdapterFBType getPlugType(AdapterType adapterType) { AdapterFBType temp = EcoreUtil.copy(adapterType.getAdapterFBType()); ArrayList<Event> inputEvents = new ArrayList<>(temp.getInterfaceList().getEventOutputs()); for (Event event : inputEvents) { event.setIsInput(true); } ArrayList<Event> outputEvents = new ArrayList<>(temp.getInterfaceList().getEventInputs()); for (Event event : outputEvents) { event.setIsInput(false); } ArrayList<VarDeclaration> inputVars = new ArrayList<>(temp.getInterfaceList().getOutputVars()); for (VarDeclaration varDecl : inputVars) { varDecl.setIsInput(true); } ArrayList<VarDeclaration> outputVars = new ArrayList<>(temp.getInterfaceList().getInputVars()); for (VarDeclaration varDecl : outputVars) { varDecl.setIsInput(false); } temp.getInterfaceList().getEventInputs().clear(); temp.getInterfaceList().getEventOutputs().clear(); temp.getInterfaceList().getInputVars().clear(); temp.getInterfaceList().getOutputVars().clear(); temp.getInterfaceList().getEventInputs().addAll(inputEvents); temp.getInterfaceList().getEventOutputs().addAll(outputEvents); temp.getInterfaceList().getInputVars().addAll(inputVars); temp.getInterfaceList().getOutputVars().addAll(outputVars); return temp; }

Target:
public static AdapterFBType getPlugType(AdapterType adapterType) { AdapterFBType temp = EcoreUtil.copy(adapterType.getAdapterFBType()); List<Event> inputEvents = new ArrayList<>(temp.getInterfaceList().getEventOutputs()); for (Event event : inputEvents) { event.setIsInput(true); } List<Event> outputEvents = new ArrayList<>(temp.getInterfaceList().getEventInputs()); for (Event event : outputEvents) { event.setIsInput(false); } List<VarDeclaration> inputVars = new ArrayList<>(temp.getInterfaceList().getOutputVars()); for (VarDeclaration varDecl : inputVars) { varDecl.setIsInput(true); } List<VarDeclaration> outputVars = new ArrayList<>(temp.getInterfaceList().getInputVars()); for (VarDeclaration varDecl : outputVars) { varDecl.setIsInput(false); } temp.getInterfaceList().getEventInputs().clear(); temp.getInterfaceList().getEventOutputs().clear(); temp.getInterfaceList().getInputVars().clear(); temp.getInterfaceList().getOutputVars().clear(); temp.getInterfaceList().getEventInputs().addAll(inputEvents); temp.getInterfaceList().getEventOutputs().addAll(outputEvents); temp.getInterfaceList().getInputVars().addAll(inputVars); temp.getInterfaceList().getOutputVars().addAll(outputVars); return temp; }
Source:
public static void setAutoCrashReportingEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CRASH_REPORTS, isEnabled); editor.commit(); CrashReporter.IS_CRASH_REPORTER_INITIALIZED = CrashReporter.initialize(context); }

Target:
public static void setAutoCrashReportingEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CRASH_REPORTS, isEnabled); editor.commit(); if (isEnabled) { CrashReporter.initialize(context); } }
Source:
public MySqlAccountServiceConfig(VerifiableProperties verifiableProperties) { dbUrl = verifiableProperties.getString(DB_URL, ""); dbUser = verifiableProperties.getString(DB_USER, ""); dbPassword = verifiableProperties.getString(DB_PASSWORD, ""); updaterPollingIntervalMs = verifiableProperties.getIntInRange(UPDATER_POLLING_INTERVAL_MS_KEY, 2 * 1000, 0, Integer.MAX_VALUE); updaterShutDownTimeoutMs = verifiableProperties.getIntInRange(UPDATER_SHUT_DOWN_TIMEOUT_MS_KEY, 5 * 1000, 1, Integer.MAX_VALUE); backupDir = verifiableProperties.getString(BACKUP_DIRECTORY_KEY, ""); updateDisabled = verifiableProperties.getBoolean(UPDATE_DISABLED, false); }

Target:
public MySqlAccountServiceConfig(VerifiableProperties verifiableProperties) { dbUrl = verifiableProperties.getString(DB_URL); dbUser = verifiableProperties.getString(DB_USER); dbPassword = verifiableProperties.getString(DB_PASSWORD); updaterPollingIntervalSeconds = verifiableProperties.getIntInRange(UPDATER_POLLING_INTERVAL_SECONDS, 60, 0, Integer.MAX_VALUE); updaterShutDownTimeoutMinutes = verifiableProperties.getIntInRange(UPDATER_SHUT_DOWN_TIMEOUT_MINUTES, 2, 1, Integer.MAX_VALUE); backupDir = verifiableProperties.getString(BACKUP_DIRECTORY_KEY, ""); updateDisabled = verifiableProperties.getBoolean(UPDATE_DISABLED, false); }
Source:
public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { if (!session.getSystemProperty("tdigest_enabled", Boolean.class) && isTDigestFunction(name.toString(), parameterTypes)) { throw new PrestoException(INVALID_SESSION_PROPERTY, "Session property for tdigest functions is disabled"); } return staticFunctionNamespace.resolveFunction(name, parameterTypes); }

Target:
public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { StaticFunctionHandle resolvedFunction = (StaticFunctionHandle) staticFunctionNamespace.resolveFunction(name, parameterTypes); if (!isTDigestEnabled(session) && isTDigestFunction(resolvedFunction.getSignature().getName(), resolvedFunction.getSignature().getArgumentTypes())) { throw new PrestoException(FUNCTION_NOT_FOUND, "Session property for tdigest functions is disabled"); } return resolvedFunction; }
Source:
private boolean removeFromFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { final Collection<EObject> setHolder = valueToFeatureToHolderMap.get(value, featureKey); if (setHolder != null) { boolean removed = setHolder.remove(holder); if (setHolder.isEmpty()) { valueToFeatureToHolderMap.remove(value, featureKey); } if (!removed) { String msg = String.format("Notification received to remove value %s from feature %s of object %s, but feature is not indexed. This indicates some errors in underlying model representation.", value, featureKey, holder); logNotificationHandlingError(msg); } return removed && (unique || (!setHolder.contains(holder))); } return false; }

Target:
private boolean removeFromFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { final Collection<EObject> setHolder = valueToFeatureToHolderMap.get(value, featureKey); if (setHolder != null) { boolean removed = setHolder.remove(holder); if (setHolder.isEmpty()) { valueToFeatureToHolderMap.remove(value, featureKey); } if (!removed) { String msg = String.format("Notification received to remove value %s from feature %s of object %s, but feature value is missing from the index. This indicates some errors in underlying model representation.", value, featureKey, holder); logNotificationHandlingError(msg); } return removed && (unique || (!setHolder.contains(holder))); } return false; }
Source:
public final Response containerContent(@Context final HttpServletRequest req, @Context final HttpServletResponse res, @PathParam("containerId") final String containerId, @PathParam("contentletId") final String contentletId) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(true, req, true); final User user = initData.getUser(); final PageMode mode = PageMode.EDIT_MODE; final Language landId = WebAPILocator.getLanguageWebAPI().getLanguage(req); PageMode.setPageMode(req, PageMode.EDIT_MODE); final ShortyId contentShorty = this.shortyAPI .getShorty(contentletId) .orElseGet(() -> { throw new ResourceNotFoundException("Can't find contentlet:" + contentletId); }); try { req.getSession().setAttribute(com.liferay.portal.util.WebKeys.USER_ID, user.getUserId()); PrincipalThreadLocal.setName(user.getUserId()); final Contentlet contentlet = (contentShorty.type == ShortType.IDENTIFIER) ? this.contentletAPI.findContentletByIdentifierAnyLanguage(contentShorty.longId): this.contentletAPI.find(contentShorty.longId, user, mode.respectAnonPerms); final String html = this.getHTML(req, res, containerId, user, contentlet); final Map<String, String> response = ImmutableMap.<String, String> builder().put("render", html).build(); return Response.ok(new ResponseEntityView(response)).build(); } catch (DotSecurityException e) { throw new ForbiddenException(e); } }

Target:
public final Response containerContent(@Context final HttpServletRequest req, @Context final HttpServletResponse res, @PathParam("containerId") final String containerId, @PathParam("contentletId") final String contentletId) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(true, req, true); final User user = initData.getUser(); final PageMode mode = PageMode.EDIT_MODE; final Language landId = WebAPILocator.getLanguageWebAPI().getLanguage(req); PageMode.setPageMode(req, PageMode.EDIT_MODE); final ShortyId contentShorty = this.shortyAPI .getShorty(contentletId) .orElseGet(() -> { throw new ResourceNotFoundException("Can't find contentlet:" + contentletId); }); try { final Contentlet contentlet = (contentShorty.type == ShortType.IDENTIFIER) ? this.contentletAPI.findContentletByIdentifierAnyLanguage(contentShorty.longId): this.contentletAPI.find(contentShorty.longId, user, mode.respectAnonPerms); final String html = this.getHTML(req, res, containerId, user, contentlet); final Map<String, String> response = ImmutableMap.<String, String> builder().put("render", html).build(); return Response.ok(new ResponseEntityView(response)).build(); } catch (DotSecurityException e) { throw new ForbiddenException(e); } }
Source:
private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<EventTypePartition, NakadiCursor> beforeFirst = getBeforeFirstCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (InvalidCursorException ex) { getLog().error("Failed to reassign updated cursors for subscription", ex); switchState(new CleanupState(ex)); } } }

Target:
private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<EventTypePartition, NakadiCursor> beforeFirst = getBeforeFirstCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } }
Source:
public void rootTestForDeletions() throws URISyntaxException { String url = "/v2/variants/13:32889711::A?species=mmusculus&assembly=grcm38"; VariantWithSamplesAndAnnotation variantWithSamplesAndAnnotations = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<VariantWithSamplesAndAnnotation>() { }).getBody(); assertEquals("13", variantWithSamplesAndAnnotations.getChromosome()); assertNull(variantWithSamplesAndAnnotations.getReference()); assertEquals("A", variantWithSamplesAndAnnotations.getAlternate()); assertEquals(32889711, variantWithSamplesAndAnnotations.getStart()); }

Target:
public void rootTestForDeletions() throws URISyntaxException { String url = "/v2/variants/13:32889711:T:?species=mmusculus&assembly=grcm38"; VariantWithSamplesAndAnnotation variantWithSamplesAndAnnotations = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<VariantWithSamplesAndAnnotation>() { }).getBody(); assertEquals("13", variantWithSamplesAndAnnotations.getChromosome()); assertEquals("T", variantWithSamplesAndAnnotations.getReference()); assertTrue(variantWithSamplesAndAnnotations.getAlternate().isEmpty()); assertEquals(32889711, variantWithSamplesAndAnnotations.getStart()); }
Source:
public String getCustomField(String fieldName) { if(customFields == null) return null; for (CustomField f : customFields) { if (f.getName().equals(fieldName)) { return f.getValue(); } } return null; }

Target:
public String getCustomField(String fieldName) { for (CustomField f : customFields) { if (f.getName().equals(fieldName)) { return f.getValue(); } } return null; }
Source:
public void addSessionWithDefaultPrivileges(String sectionName, String sessionName) { verifyExistenceOfsectionName(sectionName); this.sessionLevel.get(sectionName).put(sessionName, this.sectionLevel.getOrDefault(sessionName, getOverallPrivilegesForSessionsInSection(sectionName))); }

Target:
public void addSessionWithDefaultPrivileges(String sectionName, String sessionName) { verifyExistenceOfsectionName(sectionName); if (this.sessionLevel.get(sectionName).containsKey(sessionName)) { return; } this.sessionLevel.get(sectionName).put(sessionName, getOverallPrivilegesForSessionsInSection(sectionName)); }