auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testTwoGroups() throws Exception { <START> String header1 = "A, B"; <END> String data1 = "a1, b1"; AtomicBoolean wasCalled1 = new AtomicBoolean(false); RecordGroup recordGroup1 = createTwoGroupsFirstRecordGroup(wasCalled1); String header2 = "C, D, E"; String data2 = "c1, d1, e1"; AtomicBoolean wasCalled2 = new AtomicBoolean(false); RecordGroup recordGroup2 = createTwoGroupsSecondRecordGroup(wasCalled2); GanttCSVOpen importer = new GanttCSVOpen(createSupplier(Joiner.on('\n').join(header1, data1, "", header2, data2)), CSV, recordGroup1, recordGroup2); importer.load(); assertTrue(wasCalled1.get() && wasCalled2.get()); wasCalled1 = new AtomicBoolean(false); recordGroup1 = createTwoGroupsFirstRecordGroup(wasCalled1); wasCalled2 = new AtomicBoolean(false); recordGroup2 = createTwoGroupsSecondRecordGroup(wasCalled2); importer = new GanttCSVOpen(createSupplier(createXls(header1, data1, "", header2, data2)), XLS, recordGroup1, recordGroup2); importer.load(); assertTrue(wasCalled1.get() && wasCalled2.get()); }</code><technical_language>suggestion moving common test stup assertion do* methods</technical_language>

Target:
public void testTwoGroups() throws Exception { String header1 = "A, B"; String data1 = "a1, b1"; String header2 = "C, D, E"; String data2 = "c1, d1, e1"; for (Pair<SpreadsheetFormat, Supplier<InputStream>> pair : createPairs(header1, data1, "", header2, data2)) { final AtomicBoolean wasCalled1 = new AtomicBoolean(false); RecordGroup recordGroup1 = new RecordGroup("AB", ImmutableSet.of("A", "B")) { @Override protected boolean doProcess(SpreadsheetRecord record) { if (!super.doProcess(record)) { return false; } assertEquals("a1", record.get("A")); assertEquals("b1", record.get("B")); wasCalled1.set(true); return true; } }; final AtomicBoolean wasCalled2 = new AtomicBoolean(false); RecordGroup recordGroup2 = new RecordGroup("CDE", ImmutableSet.of("C", "D", "E")) { @Override protected boolean doProcess(SpreadsheetRecord record) { if (!super.doProcess(record)) { return false; } assertEquals("c1", record.get("C")); assertEquals("d1", record.get("D")); assertEquals("e1", record.get("E")); wasCalled2.set(true); return true; } }; GanttCSVOpen importer = new GanttCSVOpen(pair.second(), pair.first(), recordGroup1, recordGroup2); importer.load(); assertTrue(wasCalled1.get() && wasCalled2.get()); } }
Source:
<code><START> public static <K extends Comparable<? super K>, V> TreeMap<K, V> of(Comparator<? super K> keyComparator, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) { <END> return TreeMap.<K, V> empty(keyComparator).put(k1, v1).put(k2, v2).put(k3, v3).put(k4, v4).put(k5, v5).put(k6, v6).put(k7, v7).put(k8, v8).put(k9, v9).put(k10, v10); }</code><technical_language>reuse previous here, i.e. intead of java return TreeMap.<K, V> empty(keyComparator).put(k1, v1).put(k2, v2).put(k3, v3).put(k4, v4).put(k5, v5).put(k6, v6).put(k7, v7).put(k8, v8).put(k9, v9).put(k10, v10); java return of(keyComparator, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9).put(k10, v10);</technical_language>

Target:
public static <K, V> TreeMap<K, V> of(Comparator<? super K> keyComparator, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) { return TreeMap.<K, V> empty(keyComparator).put(k1, v1).put(k2, v2).put(k3, v3).put(k4, v4).put(k5, v5).put(k6, v6).put(k7, v7).put(k8, v8).put(k9, v9).put(k10, v10); }
Source:
<code>public Object associate(@Nullable UserIdentity user) { <START> if (user == null || user.getUserPrincipal() == null) return null; <END> Subject subject = (Subject) user.getUserPrincipal(); ThreadContext.bind(subject); return null; }</code><technical_language>surprised this passes checkstyle</technical_language>

Target:
public Object associate(@Nullable UserIdentity user) { if (user != null && user.getUserPrincipal() != null) { Subject subject = (Subject) user.getUserPrincipal(); ThreadContext.bind(subject); } return null; }
Source:
<code>public static List<String> getAppendersNames() { <START> Enumeration enumeration = org.apache.log4j.Logger.getRootLogger().getAllAppenders(); <END> List<String> names = new LinkedList<>(); while (enumeration.hasMoreElements()) { names.add(((Appender)enumeration.nextElement()).getName()); } return names; }</code><technical_language>Replace Logger LogManager</technical_language>

Target:
public static List<String> getAppendersNames() { Enumeration enumeration = LogManager.getRootLogger().getAllAppenders(); List<String> names = new LinkedList<>(); while (enumeration.hasMoreElements()) { names.add(((Appender)enumeration.nextElement()).getName()); } return names; }
Source:
<code>@Override public void start() throws IgniteCheckedException { <START> if (ctx.isDaemon()) <END> return; GridInternalSubscriptionProcessor isp = ctx.internalSubscriptionProcessor(); isp.registerDistributedMetastorageListener(new DistributedMetastorageLifecycleListener() { @Override public void onReadyForRead(ReadableDistributedMetaStorage metastorage) { distributedMetastorage = ctx.distributedMetastorage(); distributedMetastorage.listen( (key) -> key.startsWith(DIST_CONF_PREFIX), (String key, Serializable oldVal, Serializable newVal) -> { DistributedChangeableProperty prop = props.get(toPropertyKey(key)); if (prop != null) prop.localUpdate(newVal); } ); switchCurrentActionTo(ACTUALIZE); isp.getDistributedConfigurationListeners() .forEach(listener -> listener.onReadyToRegister(DistributedConfigurationProcessor.this)); } @Override public void onReadyForWrite(DistributedMetaStorage metastorage) { switchCurrentActionTo(CLUSTER_WIDE_UPDATE); isp.getDistributedConfigurationListeners() .forEach(DistributedConfigurationLifecycleListener::onReadyToWrite); } }); }</code><technical_language>Why</technical_language>

Target:
@Override public void start() throws IgniteCheckedException { GridInternalSubscriptionProcessor isp = ctx.internalSubscriptionProcessor(); isp.registerDistributedMetastorageListener(new DistributedMetastorageLifecycleListener() { @Override public void onReadyForRead(ReadableDistributedMetaStorage metastorage) { distributedMetastorage = ctx.distributedMetastorage(); distributedMetastorage.listen( (key) -> key.startsWith(DIST_CONF_PREFIX), (String key, Serializable oldVal, Serializable newVal) -> { DistributedChangeableProperty prop = props.get(toPropertyKey(key)); if (prop != null) prop.localUpdate(newVal); } ); switchCurrentActionTo(ACTUALIZE); isp.getDistributedConfigurationListeners() .forEach(listener -> listener.onReadyToRegister(DistributedConfigurationProcessor.this)); } @Override public void onReadyForWrite(DistributedMetaStorage metastorage) { switchCurrentActionTo(CLUSTER_WIDE_UPDATE); isp.getDistributedConfigurationListeners() .forEach(DistributedConfigurationLifecycleListener::onReadyToWrite); } }); }
Source:
<code>private void findNegotiatingProfiles(ServletRequest req) { if (profiles == null) { synchronized (this) { if (profiles == null) { profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; <START> for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).split("|")) { <END> if (nego.trim().equals("AUTHENTICATE_NEGOTIATE_INTERACTIVE")) { caps |= Authn.Capabilities.AUTHENTICATE_NEGOTIATE_INTERACTIVE; } else if (nego.trim().equals("AUTHENTICATE_NEGOTIATE_NON_INTERACTIVE")) { caps |= Authn.Capabilities.AUTHENTICATE_NEGOTIATE_NON_INTERACTIVE; } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { if ((profile.getAuthn().getContext().<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != 0) { profiles.add(0, profile); } } } } } } }</code><technical_language>Change .trim().split(" *| *") remove bellow trims</technical_language>

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("*|*")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
<code>private int countIndexedNodes( GraphDatabaseAPI db, Label label, String... keys ) throws Exception { try ( Transaction tx = db.beginTx() ) { KernelTransaction ktx = db.getDependencyResolver() .resolveDependency( ThreadToStatementContextBridge.class ) .getKernelTransactionBoundToThisThread( true ); try ( Statement statement = ktx.acquireStatement() ) { TokenRead tokenRead = ktx.tokenRead(); int labelId = tokenRead.nodeLabel( label.name() ); int[] propertyKeyIds = new int[keys.length]; for ( int i = 0; i < keys.length; i++ ) { propertyKeyIds[i] = tokenRead.propertyKey( keys[i] ); } CapableIndexReference index = ktx.schemaRead().index( labelId, propertyKeyIds ); final long timeout = 5000; <START> final long start = System.currentTimeMillis(); <END> long runningFor; InternalIndexState state; do { state = ktx.schemaRead().indexGetState( index ); runningFor = System.currentTimeMillis() - start; } while ( state != InternalIndexState.ONLINE && runningFor < timeout ); int count; StorageStatement storeStatement = ((KernelStatement) statement).getStoreStatement(); IndexReader reader = storeStatement.getIndexReader( DefaultIndexReference.toDescriptor( index ) ); IndexQuery[] predicates = new IndexQuery[propertyKeyIds.length]; for ( int i = 0; i < propertyKeyIds.length; i++ ) { predicates[i] = IndexQuery.exists( propertyKeyIds[i] ); } count = count( reader.query( predicates ) ); tx.success(); return count; } } }</code><technical_language>is db.schema().awaitIndexesOnline( )</technical_language>

Target:
private int countIndexedNodes( GraphDatabaseAPI db, Label label, String... keys ) throws Exception { try ( Transaction tx = db.beginTx() ) { KernelTransaction ktx = db.getDependencyResolver() .resolveDependency( ThreadToStatementContextBridge.class ) .getKernelTransactionBoundToThisThread( true ); try ( Statement statement = ktx.acquireStatement() ) { TokenRead tokenRead = ktx.tokenRead(); int labelId = tokenRead.nodeLabel( label.name() ); int[] propertyKeyIds = new int[keys.length]; for ( int i = 0; i < keys.length; i++ ) { propertyKeyIds[i] = tokenRead.propertyKey( keys[i] ); } CapableIndexReference index = ktx.schemaRead().index( labelId, propertyKeyIds ); db.schema().awaitIndexesOnline(5, TimeUnit.SECONDS ); int count; StorageStatement storeStatement = ((KernelStatement) statement).getStoreStatement(); IndexReader reader = storeStatement.getIndexReader( DefaultIndexReference.toDescriptor( index ) ); IndexQuery[] predicates = new IndexQuery[propertyKeyIds.length]; for ( int i = 0; i < propertyKeyIds.length; i++ ) { predicates[i] = IndexQuery.exists( propertyKeyIds[i] ); } count = count( reader.query( predicates ) ); tx.success(); return count; } } }
Source:
<code>public static Long getPID() { if (cachedPid == null) { initPid(); } <START> if (log.isDebugEnabled()) { <END> log.debug("My PID is " + cachedPid); } return cachedPid; }</code><technical_language>log.debug("My PID is {}", cachedPid);. is evaluated lazily **slf4j** is reason method isDebugEnabled. This project this construction I know</technical_language>

Target:
public static Long getPID() { if (cachedPid == null) { initPid(); } log.debug("My PID is {}", cachedPid); return cachedPid; }
Source:
<code>public void run() { try { while (running) { if (!hardDelete()) { try { <START> Thread.sleep(hardDeleterSleepTimeWhenCaughtUpMs); <END> } catch (InterruptedException e) { logger.info("Caught interrupted exception"); } } } } finally { shutdownLatch.countDown(); } }</code><technical_language>need a gauge metric ensure thread is running</technical_language>

Target:
public void run() { try { while (running) { if (!hardDelete()) { try { Thread.sleep(hardDeleterSleepTimeWhenCaughtUpMs); } catch (InterruptedException e) { logger.info("Caught interrupted exception"); } } } } finally { close(); } }
Source:
<code>public void testFirstLast_CreateSparseContainersAfterRun() { RoaringBitmap rb = new RoaringBitmap(); rb.add(1L, 1 << 14); for(int i = 18; i < 31; ++i) { int x = 1 << i; rb.add(x); Assert.assertEquals(1, rb.first()); <START> rb.last(); <END> Assert.assertEquals(x, rb.last()); } }</code><technical_language>Is this call mandatory ? storing computing next line</technical_language>

Target:
public void testFirstLast_CreateSparseContainersAfterRun() { RoaringBitmap rb = new RoaringBitmap(); rb.add(1L, 1 << 14); for(int i = 18; i < 31; ++i) { int x = 1 << i; rb.add(x); Assert.assertEquals(1, rb.first()); Assert.assertEquals(x, rb.last()); } }
Source:
<code>public void testObtainCertificateChainMissingLocationURL() throws Exception { server = setupTestObtainCertificate(true); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; try { obtainCertificateChain(null, -1, account, domainName); fail("Expected AcmeException not thrown"); } catch(AcmeException e) { <START> assertTrue(e.getMessage().contains("order location URL")); <END> } }</code><technical_language>here, a constant instead</technical_language>

Target:
public void testObtainCertificateChainMissingLocationURL() throws Exception { server = setupTestObtainCertificate(true); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; try { obtainCertificateChain(null, -1, account, domainName); fail("Expected AcmeException not thrown"); } catch(AcmeException e) { assertTrue(e.getMessage().contains(ORDER)); } }
Source:
<code>public EnhancementAsProxyLazinessInterceptor( String entityName, Set<String> identifierAttributeNames, CompositeType nonAggregatedCidMapper, EntityKey entityKey, SharedSessionContractImplementor session) { super( entityName, session ); this.identifierAttributeNames = identifierAttributeNames; assert identifierAttributeNames != null; this.nonAggregatedCidMapper = nonAggregatedCidMapper; assert nonAggregatedCidMapper != null || identifierAttributeNames.size() == 1; this.entityKey = entityKey; final EntityPersister entityPersister = session.getFactory().getMetamodel().entityPersister( entityName ); this.inLineDirtyChecking = entityPersister.getEntityMode() == EntityMode.POJO && SelfDirtinessTracker.class.isAssignableFrom( entityPersister.getMappedClass() ); <START> initializeOnRead = !inLineDirtyChecking || !entityPersister.getEntityMetamodel().isDynamicUpdate(); <END> }</code><technical_language>IIUC, initializeOnRead entity initialized writing attribute entity. If is case, field named initializeBeforeWrite</technical_language>

Target:
public EnhancementAsProxyLazinessInterceptor( String entityName, Set<String> identifierAttributeNames, CompositeType nonAggregatedCidMapper, EntityKey entityKey, SharedSessionContractImplementor session) { super( entityName, session ); this.identifierAttributeNames = identifierAttributeNames; assert identifierAttributeNames != null; this.nonAggregatedCidMapper = nonAggregatedCidMapper; assert nonAggregatedCidMapper != null || identifierAttributeNames.size() == 1; this.entityKey = entityKey; final EntityPersister entityPersister = session.getFactory().getMetamodel().entityPersister( entityName ); this.inLineDirtyChecking = entityPersister.getEntityMode() == EntityMode.POJO && SelfDirtinessTracker.class.isAssignableFrom( entityPersister.getMappedClass() ); initializeBeforeWrite = !inLineDirtyChecking || !entityPersister.getEntityMetamodel().isDynamicUpdate(); }
Source:
<code>public void testTwoBrokerCluster() throws InterruptedException { final KafkaCluster cluster = app.createAndManageChild(EntitySpec.create(KafkaCluster.class) .configure(KafkaCluster.INITIAL_SIZE, 2)); cluster.start(ImmutableList.of(testLocation)); Asserts.succeedsEventually(MutableMap.of("timeout", Duration.TWO_MINUTES), new Callable<Void>() { @Override public Void call() { assertTrue(cluster.getAttribute(Startable.SERVICE_UP)); assertTrue(cluster.getZooKeeper().getAttribute(Startable.SERVICE_UP)); assertEquals(cluster.getCurrentSize().intValue(), 2); return null; } }); Entities.dumpInfo(cluster); final KafkaSupport support = new KafkaSupport(cluster); support.sendMessage("brooklyn", "TEST_MESSAGE"); <START> Asserts.succeedsEventually(MutableMap.of("timeout", Duration.FIVE_SECONDS), new Callable<Void>() { <END> @Override public Void call() throws Exception { String message = support.getMessage("brooklyn"); assertEquals(message, "TEST_MESSAGE"); return null; } }); }</code><technical_language>Runnable in this case, need return null down</technical_language>

Target:
public void testTwoBrokerCluster() throws InterruptedException { final KafkaCluster cluster = app.createAndManageChild(EntitySpec.create(KafkaCluster.class) .configure(KafkaCluster.INITIAL_SIZE, 2)); cluster.start(ImmutableList.of(testLocation)); Asserts.succeedsEventually(MutableMap.of("timeout", Duration.TWO_MINUTES), new Callable<Void>() { @Override public Void call() { assertTrue(cluster.getAttribute(Startable.SERVICE_UP)); assertTrue(cluster.getZooKeeper().getAttribute(Startable.SERVICE_UP)); assertEquals(cluster.getCurrentSize().intValue(), 2); return null; } }); Entities.dumpInfo(cluster); final KafkaSupport support = new KafkaSupport(cluster); support.sendMessage("brooklyn", "TEST_MESSAGE"); Asserts.succeedsEventually(MutableMap.of("timeout", Duration.FIVE_SECONDS), new Runnable() { @Override public void run() { String message = support.getMessage("brooklyn"); assertEquals(message, "TEST_MESSAGE"); } }); }
Source:
<code>static void bindField(PreparedStatement statement, int index, Schema schema, Object value) throws SQLException { if (value == null) { statement.setObject(index, null); } else { if (schema.name() != null) { LogicalTypeConverter logicalConverter = LOGICAL_CONVERTERS.get(schema.name()); <START> if (logicalConverter != null) <END> value = logicalConverter.convert(schema, value); } Schema.Type type = schema.type(); switch (type) { case INT8: statement.setByte(index, (Byte) value); break; case INT16: statement.setShort(index, (Short) value); break; case INT32: statement.setInt(index, (Integer) value); break; case INT64: statement.setLong(index, (Long) value); break; case FLOAT32: statement.setFloat(index, (Float) value); break; case FLOAT64: statement.setDouble(index, (Double) value); break; case BOOLEAN: statement.setBoolean(index, (Boolean) value); break; case STRING: statement.setString(index, (String) value); break; case BYTES: final byte[] bytes; if (value instanceof ByteBuffer) { final ByteBuffer buffer = ((ByteBuffer) value).slice(); bytes = new byte[buffer.remaining()]; buffer.get(bytes); } else { bytes = (byte[]) value; } statement.setBytes(index, bytes); break; default: throw new ConnectException("Unsupported source data type: " + type); } } }</code><technical_language>minor nit, rest of sink code is braces single statement blocks</technical_language>

Target:
static void bindField(PreparedStatement statement, int index, Schema schema, Object value) throws SQLException { if (value == null) { statement.setObject(index, null); } else { if (schema.name() != null) { LogicalTypeConverter logicalConverter = LOGICAL_CONVERTERS.get(schema.name()); if (logicalConverter != null) { value = logicalConverter.convert(schema, value); } } switch (schema.type()) { case INT8: statement.setByte(index, (Byte) value); break; case INT16: statement.setShort(index, (Short) value); break; case INT32: statement.setInt(index, (Integer) value); break; case INT64: statement.setLong(index, (Long) value); break; case FLOAT32: statement.setFloat(index, (Float) value); break; case FLOAT64: statement.setDouble(index, (Double) value); break; case BOOLEAN: statement.setBoolean(index, (Boolean) value); break; case STRING: statement.setString(index, (String) value); break; case BYTES: final byte[] bytes; if (value instanceof ByteBuffer) { final ByteBuffer buffer = ((ByteBuffer) value).slice(); bytes = new byte[buffer.remaining()]; buffer.get(bytes); } else { bytes = (byte[]) value; } statement.setBytes(index, bytes); break; default: throw new ConnectException("Unsupported source data type: " + schema.type()); } } }
Source:
<code>public boolean unloadChunk(int x, int z, boolean save, boolean safe) { boolean success = !isChunkLoaded(x, z) || getChunkAt(x, z).unload(save, safe); <START> if(success) rsManager.dropRedChunk(x, z); <END> return success; }</code><technical_language>Conventions { }</technical_language>

Target:
public boolean unloadChunk(int x, int z, boolean save, boolean safe) { boolean success = (!isChunkLoaded(x, z) || getChunkAt(x, z).unload(save, safe)); if(success) { getRSManager().dropChunk(x, z); } return success; }
Source:
<code>public void comparesToAnotherDocument() throws Exception { final String xml = "<hi><dude> </dude></hi>"; MatcherAssert.assertThat( <START> new XMLDocument(xml), <END> Matchers.equalTo(new XMLDocument(xml)) ); MatcherAssert.assertThat( new XMLDocument("<hi><man></man></hi>"), Matchers.not( Matchers.equalTo(new XMLDocument("<hi><man> </man></hi>")) ) ); }</code><technical_language>is confusing unrelated asserts in test method, please split separate tests</technical_language>

Target:
public void comparesToAnotherDocument() throws Exception { MatcherAssert.assertThat( new XMLDocument("<hi>\n<dude> </dude></hi>"), Matchers.equalTo(new XMLDocument("<hi><dude> </dude></hi>")) ); MatcherAssert.assertThat( new XMLDocument("<hi><man></man></hi>"), Matchers.not( Matchers.equalTo(new XMLDocument("<hi><man> </man></hi>")) ) ); }
Source:
<code>public PluginConfig(String className) { <START> requireNonNull(className); this.className = className; <END> }</code><technical_language>suggestion this.className = requireNonNull(className);</technical_language>

Target:
public PluginConfig(String className) { this.className = requireNonNull(className); this.options = Map.of(); }
Source:
<code>private Issue applyInput(Issue issue, IssueInputView input) { String issueUri = input.getIssueUri(); if (issueUri != null) { IssueIdentifier issueId = IssueIdentifier.create(issueUri); issue.setIssueUri(issueId.getIssueUri()); } String displayName = input.getDisplayName(); if (displayName != null) { issue.setDisplayName(displayName); } else if (issue.getDisplayName() == null) { issue.setDisplayName(""); } String imageUri = input.getImageUri(); if (imageUri != null) { ArticleIdentifier imageArticleId = ArticleIdentifier.create(imageUri); if (!imageArticleId.getDoiName().equals(issue.getImageUri())) { updateImageArticle(issue, imageArticleId); } } else if (issue.getImageUri() == null) { issue.setImageUri(""); } Boolean respectOrder = input.getRespectOrder(); if (respectOrder != null) { issue.setRespectOrder(respectOrder); } List<String> inputArticleDois = input.getArticleOrder(); if (inputArticleDois != null) { List<IssueArticle> existingIssueArticles = getIssueArticles(issue); for (IssueArticle issueArticle : existingIssueArticles) { hibernateTemplate.delete(issueArticle); } List<ArticleTable> inputArticles = inputArticleDois.stream() .map(doi -> articleCrudService.getArticle(ArticleIdentifier.create(doi))) .collect(Collectors.toList()); int sortOrder = 0; for (ArticleTable article : inputArticles) { IssueArticle issueArticle = new IssueArticle(issue, article, sortOrder); hibernateTemplate.save(issueArticle); <START> sortOrder++; <END> } } return issue; }</code><technical_language>This feels pretty wrong. if committed one-to-many collections in Hibernate entities, another utility for this</technical_language>

Target:
private Issue applyInput(Issue issue, IssueInputView input) { String issueDoi = input.getDoi(); if (issueDoi != null) { IssueIdentifier issueId = IssueIdentifier.create(issueDoi); issue.setDoi(issueId.getDoi().getName()); } String displayName = input.getDisplayName(); if (displayName != null) { issue.setDisplayName(displayName); } else if (issue.getDisplayName() == null) { issue.setDisplayName(""); } String imageDoi = input.getImageArticleDoi(); if (imageDoi != null) { ArticleIdentifier imageArticleId = ArticleIdentifier.create(imageDoi); ArticleTable imageArticle = articleCrudService.getArticle(imageArticleId); issue.setImageArticle(imageArticle); } else { issue.setImageArticle(null); } List<String> inputArticleDois = input.getArticleOrder(); if (inputArticleDois != null) { List<ArticleTable> inputArticles = inputArticleDois.stream() .map(doi -> articleCrudService.getArticle(ArticleIdentifier.create(doi))) .collect(Collectors.toList()); issue.setArticles(inputArticles); } return issue; }
Source:
<code>public void testObserverConfig() { FluoConfiguration config = new FluoConfiguration(); config.setProperty("key1", "com.foo.Observer2,configKey1=configVal1,configKey2=configVal2"); ObserverConfiguration oc = config.getObserverConfig("key1"); Assert.assertEquals("com.foo.Observer2", oc.getClassName()); Assert.assertEquals("configVal1", oc.getParameters().get("configKey1")); <START> Assert.assertEquals(2, oc.getParameters().size()); <END> assertIAE("index,check,,phrasecount.PhraseCounter"); assertIAE(""); assertIAE(" "); assertIAE(",key=value"); assertIAE(","); assertIAE("com.foo.Observer2,configKey1=,configKey2=configVal2"); assertIAE("com.foo.Observer2,configKey1=val,=configVal2"); config.setProperty("key3", "Class,"); oc = config.getObserverConfig("key3"); Assert.assertEquals("Class", oc.getClassName()); Assert.assertEquals(0, oc.getParameters().size()); config = new FluoConfiguration(); try { config.setProperty(FluoConfiguration.OBSERVER_PREFIX+"1", "class,bad,input"); config.validate(); Assert.fail(); } catch (IllegalArgumentException e) { } }</code><technical_language>whay validate configKey2</technical_language>

Target:
public void testObserverConfig() { FluoConfiguration config = new FluoConfiguration(); config.setProperty(FluoConfiguration.OBSERVER_PREFIX+"1", "com.foo.Observer2,configKey1=configVal1,configKey2=configVal2"); List<ObserverConfiguration> ocList = config.getObserverConfig(); Assert.assertEquals(1, ocList.size()); Assert.assertEquals("com.foo.Observer2", ocList.get(0).getClassName()); Assert.assertEquals("configVal1", ocList.get(0).getParameters().get("configKey1")); Assert.assertEquals("configVal2", ocList.get(0).getParameters().get("configKey2")); Assert.assertEquals(2, ocList.get(0).getParameters().size()); assertIAE("index,check,,phrasecount.PhraseCounter"); assertIAE(""); assertIAE(" "); assertIAE(",key=value"); assertIAE(","); assertIAE("com.foo.Observer2,configKey1=,configKey2=configVal2"); assertIAE("com.foo.Observer2,configKey1=val,=configVal2"); config = new FluoConfiguration(); config.setProperty(FluoConfiguration.OBSERVER_PREFIX+"1", "Class,"); ocList = config.getObserverConfig(); Assert.assertEquals(1, ocList.size()); Assert.assertEquals("Class", ocList.get(0).getClassName()); Assert.assertEquals(0, ocList.get(0).getParameters().size()); config = new FluoConfiguration(); try { config.setProperty(FluoConfiguration.OBSERVER_PREFIX+"1", "class,bad,input"); config.validate(); Assert.fail(); } catch (IllegalArgumentException e) { } }
Source:
<code><START> private void removeOvfForTemplatesAndVmsOfStoragePool(Guid poolId) { <END> List<Guid> idsForRemoval = new LinkedList<Guid>(getVmAndTemplatesGenerationsDao().getIdsForOvfDeletion(poolId)); for (Guid id : idsForRemoval){ executeRemoveVmInSpm(poolId, id, Guid.Empty); } getVmAndTemplatesGenerationsDao().deleteOvfGenerations(idsForRemoval); }</code><technical_language>create LinkedList</technical_language>

Target:
private void removeOvfForTemplatesAndVmsOfStoragePool(Guid poolId) { List<Guid> idsForRemoval = getVmAndTemplatesGenerationsDao().getIdsForOvfDeletion(poolId); for (Guid id : idsForRemoval){ executeRemoveVmInSpm(poolId, id, Guid.Empty); } getVmAndTemplatesGenerationsDao().deleteOvfGenerations(idsForRemoval); }
Source:
<code>protected Warning createWarning(final Matcher matcher) { String fileName = matcher.group(1); int lineNumber = getLineNumber(matcher.group(2)); String message = matcher.group(5); Priority priority; StringBuilder category = new StringBuilder(); <START> if (matcher.group(3).equalsIgnoreCase("error")) { <END> priority = Priority.HIGH; category.append("ERROR"); } else if (matcher.group(3).equalsIgnoreCase("information")) { priority = Priority.LOW; category.append("Info"); } else { priority = Priority.NORMAL; category.append("Warning"); } Warning warning = createWarning(fileName, lineNumber, category.toString(), message, priority); return warning; }</code><technical_language>"error".equalsIgnoreCase(...)</technical_language>

Target:
protected Warning createWarning(final Matcher matcher) { String fileName = matcher.group(1); int lineNumber = getLineNumber(matcher.group(2)); String message = matcher.group(5); Priority priority; String category; if ("error".equalsIgnoreCase(matcher.group(3))) { priority = Priority.HIGH; category = "ERROR"; } else if ("information".equalsIgnoreCase(matcher.group(3))) { priority = Priority.LOW; category = "Info"; } else { priority = Priority.NORMAL; category = "Warning"; } return createWarning(fileName, lineNumber, category, message, priority); }
Source:
<code>public Response getCertPw(@QueryParam("keyStore") String keyStore, @QueryParam("projectUser") String projectUser, @Context SecurityContext sc, @Context HttpServletRequest req) { try { CertPwDTO respDTO; Users user; if (projectGenericPattern.matcher(projectUser).matches()) { <START> user = projectFacade.findByName(projectUser).getOwner(); <END> respDTO = projectController.getProjectWideCertPw(user, projectUser, keyStore); } else { String username = hdfsUserBean.getUserName(projectUser); String projectName = hdfsUserBean.getProjectName(projectUser); user = userFacade.findByUsername(username); respDTO = projectController.getProjectSpecificCertPw(user, projectName, keyStore); } return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(respDTO).build(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Could not retrieve certificate passwords for " + "user:" + projectUser, ex); return noCacheResponse.getNoCacheResponseBuilder(Response.Status.EXPECTATION_FAILED).build(); } }</code><technical_language>projectUser is Project__PROJECTGENERICUSER. extract token do findByName(projectName)</technical_language>

Target:
public Response getCertPw(@QueryParam("keyStore") String keyStore, @QueryParam("projectUser") String projectUser, @Context SecurityContext sc, @Context HttpServletRequest req) { try { CertPwDTO respDTO = null; Users user; if (projectGenericPattern.matcher(projectUser).matches()) { String[] splits = projectUser.split(HdfsUsersController.USER_NAME_DELIMITER,2); user = projectFacade.findByName(splits[0]).getOwner(); respDTO = projectController.getProjectWideCertPw(user, projectUser, keyStore); } else if (projectSpecificPattern.matcher(projectUser).matches()){ String username = hdfsUserBean.getUserName(projectUser); String projectName = hdfsUserBean.getProjectName(projectUser); user = userFacade.findByUsername(username); respDTO = projectController.getProjectSpecificCertPw(user, projectName, keyStore); } else { throw new Exception("Unrecognized format for project user"); } return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(respDTO).build(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Could not retrieve certificate passwords for " + "user:" + projectUser, ex); return noCacheResponse.getNoCacheResponseBuilder(Response.Status.EXPECTATION_FAILED).build(); } }
Source:
<code>protected ConnectionFactory createRabbitConnectionFactory() { RabbitConnectionFactoryBean factoryBean = new RabbitConnectionFactoryBean(); configureRabbitConnectionFactory(factoryBean); try { factoryBean.afterPropertiesSet(); return factoryBean.getObject(); } catch (Exception e) { <START> LogFactory.getLog("log4j2AppenderErrors").error("Failed to create customized Rabbit ConnectionFactory.", <END> e); return null; } }</code><technical_language>mind explaining this code a bit? I guess is global for appenders/loggers problems. some public API constant do remember this String literal</technical_language>

Target:
protected ConnectionFactory createRabbitConnectionFactory() { RabbitConnectionFactoryBean factoryBean = new RabbitConnectionFactoryBean(); configureRabbitConnectionFactory(factoryBean); try { factoryBean.afterPropertiesSet(); return factoryBean.getObject(); } catch (Exception e) { LOGGER.error("Failed to create customized Rabbit ConnectionFactory.", e); return null; } }
Source:
<code>private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); <START> case KA: <END> return new GeFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }</code><technical_language>Is language code GE KA</technical_language>

Target:
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); case KA: return new KaFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }
Source:
<code>public Credential getCredentialsFromSAParameters( String privateKeyId, String privateKeyPem, String clientEmail, List<String> scopes, HttpTransport transport) throws IOException { <START> logger.atFine().log("getServiceAccountCredentialFromHadoopConfiguration({})", clientEmail); <END> if (clientEmail == null || privateKeyPem == null || privateKeyId == null) { throw new IOException("Error reading service account credential from stream, " + "expecting, 'client_email', 'private_key' and 'private_key_id'."); } PrivateKey privateKey = privateKeyFromPkcs8(privateKeyPem); GoogleCredential.Builder builder = new GoogleCredential.Builder() .setTransport(transport) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(clientEmail) .setServiceAccountScopes(scopes) .setServiceAccountPrivateKey(privateKey) .setServiceAccountPrivateKeyId(privateKeyId); return new GoogleCredentialWithRetry(builder); }</code><technical_language>Flogger string format style placeholders: %s</technical_language>

Target:
public Credential getCredentialsFromSAParameters( String privateKeyId, String privateKeyPem, String clientEmail, List<String> scopes, HttpTransport transport) throws IOException { logger.atFine().log("getServiceAccountCredentialFromHadoopConfiguration(%s)", clientEmail); if (clientEmail == null || privateKeyPem == null || privateKeyId == null) { throw new IOException( "Error reading service account credential from stream, " + "expecting, 'client_email', 'private_key' and 'private_key_id'."); } PrivateKey privateKey = privateKeyFromPkcs8(privateKeyPem); GoogleCredential.Builder builder = new GoogleCredential.Builder() .setTransport(transport) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(clientEmail) .setServiceAccountScopes(scopes) .setServiceAccountPrivateKey(privateKey) .setServiceAccountPrivateKeyId(privateKeyId); return new GoogleCredentialWithRetry(builder); }
Source:
<code>public <T extends ArtifactId> ArtifactToken getArtifactOrSentinel(T artifact) { if (artifact == null) { return ArtifactToken.getSentinal(); } ArtifactToken result = ArtifactToken.getSentinal(); if (artifact instanceof Artifact) { result = AtsClientService.get().getQueryServiceClient().getArtifact(artifact); } else if (artifact instanceof IAtsObject) { IAtsObject atsObject = (IAtsObject) artifact; if (atsObject.getStoreObject() instanceof Artifact) { result = AtsClientService.get().getQueryServiceClient().getArtifact(atsObject); } else { <START> result = getArtifact(atsObject.getId()); <END> } } else { result = getArtifactOrSentinel(artifact.getId()); } return result; }</code><technical_language>this call return null</technical_language>

Target:
public <T extends ArtifactId> ArtifactToken getArtifactOrSentinel(T artifact) { if (artifact == null) { return ArtifactToken.getSentinal(); } ArtifactToken result = ArtifactToken.getSentinal(); if (artifact instanceof Artifact) { result = AtsClientService.get().getQueryServiceClient().getArtifact(artifact); } else if (artifact instanceof IAtsObject) { IAtsObject atsObject = (IAtsObject) artifact; if (atsObject.getStoreObject() instanceof Artifact) { result = AtsClientService.get().getQueryServiceClient().getArtifact(atsObject); } else { result = getArtifactOrSentinel(atsObject.getId()); } } else { result = getArtifactOrSentinel(artifact.getId()); } return result; }
Source:
<code>public int compare(InboxMessage m1, InboxMessage m2) { int timeComparison = Timestamps.compare(m1.getWhenReceived(), m2.getWhenReceived()); if (timeComparison != 0) { return timeComparison; } int versionComparison = Integer.compare(m1.getVersion(), m2.getVersion()); <START> if(versionComparison != 0) { <END> return versionComparison; } return m1.getId().getUuid().compareTo(m2.getId().getUuid()); }</code><technical_language>Please add a space. consider a Comparator.comparing(..) chain instead of implementing interface directly</technical_language>

Target:
public int compare(InboxMessage m1, InboxMessage m2) { int result = Comparator .comparing(InboxMessage::getWhenReceived, Timestamps.comparator()) .thenComparing(InboxMessage::getVersion) .thenComparing((m) -> m.getId() .getUuid()) .compare(m1, m2); return result; }
Source:
<code>public boolean status() { <START> return status != null && status.equals("Enabled"); <END> }</code><technical_language>return "Enabled".equals(status) work</technical_language>

Target:
public boolean status() { return ("Enabled").equals(status); }
Source:
<code>public TableDescriptor get(TableName tableName) throws IOException { invocations++; if (usecache) { TableDescriptor cachedtdm = this.cache.get(tableName); if (cachedtdm != null) { cachehits++; return cachedtdm; } if (fsvisited) { return null; } } TableDescriptor tdmt = null; try { tdmt = getTableDescriptorFromFs(fs, rootdir, tableName); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tableName, e); } catch (TableInfoMissingException e) { <START> } catch (IOException ioe) { <END> LOG.debug("Exception during readTableDecriptor. Current table name = " + tableName, ioe); } if (usecache && tdmt != null) { this.cache.put(tableName, tdmt); } return tdmt; }</code><technical_language>nit: catch (NullPointerException | IOException e)</technical_language>

Target:
public TableDescriptor get(TableName tableName) { invocations++; if (usecache) { TableDescriptor cachedtdm = this.cache.get(tableName); if (cachedtdm != null) { cachehits++; return cachedtdm; } if (fsvisited) { return null; } } TableDescriptor tdmt = null; try { tdmt = getTableDescriptorFromFs(fs, rootdir, tableName); } catch (TableInfoMissingException e) { } catch (NullPointerException | IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tableName, ioe); } if (usecache && tdmt != null) { this.cache.put(tableName, tdmt); } return tdmt; }
Source:
<code>public void sendDirectMessage(Message message, User toUser) { MessageDestination destinationEntity = toUser.getNamedMessageDestination(); destinationEntity.send(message); if (!toUser.isCreatedOnBuddyRequest()) { <START> smsService.send(toUser.getMobileNumber(), SmsTemplate.DIRECT_MESSAGE_NOTIFICATION, new HashMap<>()); <END> } }</code><technical_language>more canonical pass empty map is Collections.emptyMap()</technical_language>

Target:
public void sendDirectMessage(Message message, User toUser) { MessageDestination destinationEntity = toUser.getNamedMessageDestination(); destinationEntity.send(message); if (!toUser.isCreatedOnBuddyRequest()) { smsService.send(toUser.getMobileNumber(), SmsTemplate.DIRECT_MESSAGE_NOTIFICATION, Collections.emptyMap()); } }
Source:
<code><START> public Map<ColumnName, @Nullable Object> valuesIn(E entity) { <END> checkNotNull(entity); Map<ColumnName, @Nullable Object> result = new HashMap<>(); systemColumns.forEach( column -> result.put(column.name(), column.valueIn(entity)) ); simpleColumns.forEach( column -> result.put(column.name(), column.valueIn(entity.state())) ); return result; }</code><technical_language>do need this Map mutable</technical_language>

Target:
public Map<ColumnName, @Nullable Object> valuesIn(E entity) { checkNotNull(entity); Map<ColumnName, @Nullable Object> result = new HashMap<>(); systemColumns.forEach( column -> result.put(column.name(), column.valueIn(entity)) ); stateColumns.forEach( column -> result.put(column.name(), column.valueIn(entity.state())) ); return unmodifiableMap(result); }
Source:
<code>private void checkTernary( ExecutableSequence s, ObjectContract c, Set<Integer> values, ErrorRevealingChecks checks) { for (Integer i : values) { for (Integer j : values) { for (Integer k : values) { ExecutionOutcome result1 = s.getResult(i); ExecutionOutcome result2 = s.getResult(j); ExecutionOutcome result3 = s.getResult(k); if (Log.isLoggingOn()) { Log.logLine("Checking contract " + c.getClass() + " on " + i + ", " + j + ", " + k); } ExecutionOutcome exprOutcome = ObjectContractUtils.execute( c, ((NormalExecution) result1).getRuntimeValue(), ((NormalExecution) result2).getRuntimeValue(), ((NormalExecution) result3).getRuntimeValue()); if (exprOutcome instanceof NormalExecution) { NormalExecution e = (NormalExecution) exprOutcome; if (e.getRuntimeValue().equals(true)) { if (Log.isLoggingOn()) Log.logLine("Contract returned true."); } else { if (Log.isLoggingOn()) Log.logLine("Contract returned false. Will add ExpressionEqFalse check"); checks.add(new ObjectCheck(c, i, s.sequence.getVariable(i), s.sequence.getVariable(j), s.sequence.getVariable(k))); } } else if (exprOutcome instanceof ExceptionalExecution) { Throwable e = ((ExceptionalExecution) exprOutcome).getException(); if (Log.isLoggingOn()) Log.logLine("Contract threw exception: " + e.getMessage()); if (e instanceof BugInRandoopException) { <START> throw new BugInRandoopException(e); <END> } } else { throw new Error("Contract failed to execute during evaluation"); } } } } }</code><technical_language>wrapping a BugInRandoopException another BugInRandoopException? throw e</technical_language>

Target:
private void checkTernary( ExecutableSequence s, ObjectContract c, Set<Integer> values, ErrorRevealingChecks checks) { for (Integer i : values) { ExecutionOutcome result1 = s.getResult(i); for (Integer j : values) { ExecutionOutcome result2 = s.getResult(j); for (Integer k : values) { ExecutionOutcome result3 = s.getResult(k); if (Log.isLoggingOn()) { Log.logLine("Checking contract " + c.getClass() + " on indices " + i + ", " + j + ", " + k); } ExecutionOutcome exprOutcome = ObjectContractUtils.execute( c, ((NormalExecution) result1).getRuntimeValue(), ((NormalExecution) result2).getRuntimeValue(), ((NormalExecution) result3).getRuntimeValue()); if (exprOutcome instanceof NormalExecution) { NormalExecution e = (NormalExecution) exprOutcome; if (e.getRuntimeValue().equals(true)) { if (Log.isLoggingOn()) Log.logLine("Contract returned true."); } else { if (Log.isLoggingOn()) Log.logLine("Contract returned false. Will add ExpressionEqFalse check"); checks.add(new ObjectCheck(c, i, s.sequence.getVariable(i), s.sequence.getVariable(j), s.sequence.getVariable(k))); } } else if (exprOutcome instanceof ExceptionalExecution) { Throwable e = ((ExceptionalExecution) exprOutcome).getException(); if (Log.isLoggingOn()) Log.logLine("Contract threw exception: " + e.getMessage()); if (e instanceof BugInRandoopException) { throw (BugInRandoopException) e; } } else { throw new Error("Contract failed to execute during evaluation"); } } } } }
Source:
<code>public static Integer convertToInteger(String value) { Integer result = null; if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("N/A") && !value.equalsIgnoreCase("NA") <START> && !value.equals("-") && !value.equals("--")) { <END> try { result = Integer.valueOf(value); } catch (NumberFormatException e) { logger.debug("Cannot convert to Integer", value); result = null; } } return result; }</code><technical_language>Please change this if (!(value == null || value.isEmpty() || value.equalsIgnoreCase(....)), this read</technical_language>

Target:
public static Integer convertToInteger(String value) { Integer result = null; if (isValid(value)) { try { result = Integer.valueOf(value.trim()); } catch (NumberFormatException e) { LoggerFactory.getLogger(WeatherUndergroundJsonUtils.class).debug("Cannot convert to Integer", value); result = null; } } return result; }
Source:
<code>public static String readFileAsString(MultipartFile file) throws ValidationException { StringBuffer data = new StringBuffer(); try { <START> try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) { <END> String line = null; while ((line = reader.readLine()) != null) { if (data.length() > 0) { data.append(System.getProperty("line.separator")); } data.append(line); } } } catch (final IOException ex) { String msg = "Could not read file: " + ex.getMessage(); LOGGER.error(msg); throw new ValidationException(msg); } return data.toString(); }</code><technical_language>Double try</technical_language>

Target:
public static String readFileAsString(MultipartFile file) throws ValidationException { StringBuffer data = new StringBuffer(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) { String line = null; while ((line = reader.readLine()) != null) { if (data.length() > 0) { data.append(System.getProperty("line.separator")); } data.append(line); } } catch (final IOException ex) { String msg = "Could not read file: " + ex.getMessage(); LOGGER.error(msg); throw new ValidationException(msg); } return data.toString(); }
Source:
<code>public BOAndDPCompileHook() { <START> System.out.println("Loaded BO and DP compile hook"); <END> }</code><technical_language>I full name: Blue Ocean Declarative Pipeline compile hook</technical_language>

Target:
public BOAndDPCompileHook() { System.out.println("Loaded Blue Ocean and Declarative Pipeline compile hook"); }
Source:
<code>public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { <START> try { <END> return withContext(context -> addSetting(setting, context)) .flatMap(response -> Mono.justOrEmpty(response.getValue())); } catch (RuntimeException ex) { return Mono.error(logger.logExceptionAsError(Exceptions.propagate(ex))); } }</code><technical_language>is RuntimeException thrown from? surprised withContext( ) underlying RestProxy bubbling this downstream</technical_language>

Target:
public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { try { return withContext(context -> addSetting(setting, context)) .flatMap(response -> Mono.justOrEmpty(response.getValue())); } catch (RuntimeException ex) { return monoError(logger, ex); } }