auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { List<ReplicationMetric> metrics = collector.getMetrics(); Retry<Void> retriable = new Retry<Void>(Exception.class) { @Override public Void execute() throws Exception { ReplicationMetricList metricList = new ReplicationMetricList(); <START> List<ReplicationMetrics> replicationMetricsList = new ArrayList<>(); <END> for (ReplicationMetric metric : metrics) { ReplicationMetrics persistentMetric = new ReplicationMetrics(); persistentMetric.setDumpExecutionId(metric.getDumpExecutionId()); persistentMetric.setScheduledExecutionId(metric.getScheduledExecutionId()); persistentMetric.setPolicy(metric.getPolicy()); ObjectMapper mapper = new ObjectMapper(); persistentMetric.setProgress(mapper.writeValueAsString(metric.getProgress())); persistentMetric.setMetadata(mapper.writeValueAsString(metric.getMetadata())); replicationMetricsList.add(persistentMetric); } metricList.setReplicationMetricList(replicationMetricsList); Hive.get(conf).getMSC().addReplicationMetrics(metricList); return null; } }; try { retriable.run(); } catch (Exception e) { throw new RuntimeException("Metrics are not getting persisted"); } }</code><technical_language>initialize new ArrayList<>() size list 'metrics'. This save resizing cost includes Array copy operation</technical_language>

Target:
public void run() { ReplicationMetricList metricList = new ReplicationMetricList(); try { LinkedList<ReplicationMetric> metrics = collector.getMetrics(); if (metrics.size() > 0) { int totalMetricsSize = metrics.size(); List<ReplicationMetrics> replicationMetricsList = new ArrayList<>(totalMetricsSize); for (int index = 0; index < totalMetricsSize; index++) { ReplicationMetric metric = metrics.removeFirst(); ReplicationMetrics persistentMetric = new ReplicationMetrics(); persistentMetric.setDumpExecutionId(metric.getDumpExecutionId()); persistentMetric.setScheduledExecutionId(metric.getScheduledExecutionId()); persistentMetric.setPolicy(metric.getPolicy()); ObjectMapper mapper = new ObjectMapper(); persistentMetric.setProgress(mapper.writeValueAsString(metric.getProgress())); persistentMetric.setMetadata(mapper.writeValueAsString(metric.getMetadata())); replicationMetricsList.add(persistentMetric); } metricList.setReplicationMetricList(replicationMetricsList); } } catch (Exception e) { throw new RuntimeException("Metrics are not getting persisted", e); } Retry<Void> retriable = new Retry<Void>(Exception.class) { @Override public Void execute() throws Exception { if (metricList.getReplicationMetricListSize() > 0) { Hive.get(conf).getMSC().addReplicationMetrics(metricList); } return null; } }; try { retriable.run(); } catch (Exception e) { throw new RuntimeException("Metrics are not getting persisted to HMS", e); } }
Source:
<code>public Object getEditHelperContext() { Object result; IClientContext context = getClientContext(); Element excludee = getElementToExclude(); if (context == null) { result = excludee; } else { <START> Element owner = (excludee == null) ? null : excludee; <END> result = new EditHelperContext(owner, context); } return result; }</code><technical_language>a test here? owner = excludee in cases</technical_language>

Target:
public Object getEditHelperContext() { Object result; IClientContext context = getClientContext(); Element owner = requireNonNull(getElementToExclude().getOwner(), "element.owner"); if (context == null) { result = owner; } else { result = new EditHelperContext(owner, context); } return result; }
Source:
<code>RequestContext( HttpServletRequest req ) { this.outputRequireJs = this.getBooleanValue( req.getParameter( "requirejs" ), true ); this.referer = req.getHeader( "referer" ); <START> this.serverAddress = ( 80 == req.getServerPort() || 443 == req.getServerPort() ) <END> ? req.getScheme() + "://" + req.getServerName() : req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort(); this.useFullyQualifiedUrl = this.getBooleanValue( req.getParameter( "useFullyQualifiedUrl" ), referer != null && !referer.startsWith( this.serverAddress ) ); }</code><technical_language>final variables for 80 443 ? variable a clear name default ports</technical_language>

Target:
RequestContext( HttpServletRequest req ) { this.outputRequireJs = this.getBooleanValue( req.getParameter( "requirejs" ), true ); this.referer = req.getHeader( "referer" ); this.serverAddress = ( HTTP_DEFAULT_PORT == req.getServerPort() || HTTPS_DEFAULT_PORT == req.getServerPort() ) ? req.getScheme() + "://" + req.getServerName() : req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort(); this.useFullyQualifiedUrl = this.getBooleanValue( req.getParameter( "useFullyQualifiedUrl" ), referer != null && !referer.startsWith( this.serverAddress ) ); }
Source:
<code>private void parsePdxDiskStore(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { ParsingUtils.setPropertyValue(element, builder, "pdx-disk-store", "pdxDiskStoreName"); final String pdxDiskStoreName = element.getAttribute("pdx-disk-store"); if (!StringUtils.isEmpty(pdxDiskStoreName)) { final BeanDefinitionRegistry registry = parserContext.getRegistry(); if (registry instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) registry).addBeanFactoryPostProcessor( new PdxDiskStoreAwareBeanFactoryPostProcessor(pdxDiskStoreName)); } <START> } <END> }</code><technical_language>if a ConfigurableApplicationContext? a class cast exception. happen, want this silently fail</technical_language>

Target:
private void parsePdxDiskStore(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { ParsingUtils.setPropertyValue(element, builder, "pdx-disk-store", "pdxDiskStoreName"); final String pdxDiskStoreName = element.getAttribute("pdx-disk-store"); if (!StringUtils.isEmpty(pdxDiskStoreName)) { registerPdxDiskStoreAwareBeanFactoryPostProcessor(parserContext, pdxDiskStoreName); } }
Source:
<code>public void execute(final String coords, final String goal, final Properties config) throws ValidationException { final Plugin plugin = new Plugin(); final String[] sectors = StringUtils.split(coords, ':'); plugin.setGroupId(sectors[0]); plugin.setArtifactId(sectors[1]); plugin.setVersion(sectors[2]); final MojoDescriptor descriptor = this.descriptor(plugin, goal); try { this.helper.setupPluginRealm( descriptor.getPluginDescriptor(), this.session, Thread.currentThread().getContextClassLoader(), new java.util.ArrayList<String>(), <START> new java.util.ArrayList<String>() <END> ); } catch (org.apache.maven.plugin.PluginResolutionException ex) { throw new IllegalStateException("Plugin resolution problem", ex); } catch (org.apache.maven.plugin.PluginContainerException ex) { throw new IllegalStateException("Can't setup realm", ex); } final Xpp3Dom xpp = Xpp3Dom.mergeXpp3Dom( this.toXppDom(config, "configuration"), this.toXppDom(descriptor.getMojoConfiguration()) ); final MojoExecution execution = new MojoExecution(descriptor, xpp); final Mojo mojo = this.mojo(execution); Logger.info(this, "Calling %s:%s...", coords, goal); try { mojo.execute(); } catch (org.apache.maven.plugin.MojoExecutionException ex) { throw new IllegalArgumentException(ex); } catch (org.apache.maven.plugin.MojoFailureException ex) { throw new ValidationException(ex); } this.manager.releaseMojo(mojo, execution); }</code><technical_language>Again, initial capacity specified. LinkedList</technical_language>

Target:
public void execute(final String coords, final String goal, final Properties config) throws ValidationException { final Plugin plugin = new Plugin(); final String[] sectors = StringUtils.split(coords, ':'); plugin.setGroupId(sectors[0]); plugin.setArtifactId(sectors[1]); plugin.setVersion(sectors[2]); final MojoDescriptor descriptor = this.descriptor(plugin, goal); try { this.helper.setupPluginRealm( descriptor.getPluginDescriptor(), this.session, Thread.currentThread().getContextClassLoader(), new LinkedList<String>(), new LinkedList<String>() ); } catch (org.apache.maven.plugin.PluginResolutionException ex) { throw new IllegalStateException("Plugin resolution problem", ex); } catch (org.apache.maven.plugin.PluginContainerException ex) { throw new IllegalStateException("Can't setup realm", ex); } final Xpp3Dom xpp = Xpp3Dom.mergeXpp3Dom( this.toXppDom(config, "configuration"), this.toXppDom(descriptor.getMojoConfiguration()) ); final MojoExecution execution = new MojoExecution(descriptor, xpp); final Mojo mojo = this.mojo(execution); Logger.info(this, "Calling %s:%s...", coords, goal); try { mojo.execute(); } catch (org.apache.maven.plugin.MojoExecutionException ex) { throw new IllegalArgumentException(ex); } catch (org.apache.maven.plugin.MojoFailureException ex) { throw new ValidationException(ex); } this.manager.releaseMojo(mojo, execution); }
Source:
<code>public void deleteUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) <START> .build(); <END> getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); getClient() .perform(delete("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); }</code><technical_language>turn auth system creating test data</technical_language>

Target:
public void deleteUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); getClient() .perform(delete("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); }
Source:
<code>public MessagePacker packString(String s) throws IOException { if(s.length() > 0) { CharBuffer in = CharBuffer.wrap(s); prepareEncoder(); ByteBuffer preservedEncodeBuffer = encodeBuffer; encodeBuffer.clear(); encoder.reset(); try { while(in.hasRemaining()) { try { CoderResult cr = encoder.encode(in, encodeBuffer, true); if(cr.isUnderflow()) { cr = encoder.flush(encodeBuffer); } if(cr.isOverflow()) { int estimatedRemainingSize = Math.max(1, (int) (in.remaining() * encoder.averageBytesPerChar())); encodeBuffer.flip(); ByteBuffer newBuffer = ByteBuffer.allocate(encodeBuffer.remaining() + estimatedRemainingSize); newBuffer.put(encodeBuffer); encodeBuffer = newBuffer; continue; } if(cr.isError()) { if(cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) { cr.throwException(); } else if(cr.isUnderflow() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT) { cr.throwException(); } } } catch(CharacterCodingException e) { <START> throw new MessageStringCodingException(e); <END> } } encodeBuffer.flip(); packRawStringHeader(encodeBuffer.remaining()); writePayload(encodeBuffer); } finally { encodeBuffer = preservedEncodeBuffer; } } else { packRawStringHeader(0); } return this; }</code><technical_language>+1: CoderResult good approach me</technical_language>

Target:
public MessagePacker packString(String s) throws IOException { if(s.length() > 0) { CharBuffer in = CharBuffer.wrap(s); prepareEncoder(); ByteBuffer preservedEncodeBuffer = encodeBuffer; encodeBuffer.clear(); encoder.reset(); try { while(in.hasRemaining()) { try { CoderResult cr = encoder.encode(in, encodeBuffer, true); if(cr.isUnderflow()) { cr = encoder.flush(encodeBuffer); } if(cr.isOverflow()) { int estimatedRemainingSize = Math.max(1, (int) (in.remaining() * encoder.averageBytesPerChar())); encodeBuffer.flip(); ByteBuffer newBuffer = ByteBuffer.allocate(Math.max((int) (encodeBuffer.capacity() * 1.5), encodeBuffer.remaining() + estimatedRemainingSize)); newBuffer.put(encodeBuffer); encodeBuffer = newBuffer; encoder.reset(); continue; } if(cr.isError()) { if((cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) || (cr.isUnmappable() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT)) { cr.throwException(); } } } catch(CharacterCodingException e) { throw new MessageStringCodingException(e); } } encodeBuffer.flip(); packRawStringHeader(encodeBuffer.remaining()); writePayload(encodeBuffer); } finally { encodeBuffer = preservedEncodeBuffer; } } else { packRawStringHeader(0); } return this; }
Source:
<code>private AbstractEndpoint createEndpoint(MessageHandler handler, Method method, List<Annotation> annotations) { String inputChannelName = null; String[] names = AnnotationUtils.getAnnotation(method, Bean.class).name(); if (!ObjectUtils.isEmpty(names)) { inputChannelName = names[0]; } if (!StringUtils.hasText(inputChannelName)) { inputChannelName = method.getName(); } MessageChannel inputChannel = this.beanFactory.getBean(inputChannelName, MessageChannel.class); if (inputChannel instanceof PollableChannel) { PollingConsumer pollingConsumer = new PollingConsumer((PollableChannel) inputChannel, handler); configurePollingEndpoint(pollingConsumer, annotations); return pollingConsumer; } else { Poller[] pollers = MessagingAnnotationUtils.resolveAttribute(annotations, "poller", Poller[].class); Assert.state(ObjectUtils.isEmpty(pollers), "A '@Poller' should not be specified for Annotation-based " + "endpoint, since '" + inputChannel + "' is a SubscribableChannel (not pollable)."); return new EventDrivenConsumer((SubscribableChannel) inputChannel, handler); <START> } <END> }</code><technical_language>duplicated code</technical_language>

Target:
protected AbstractEndpoint createEndpoint(MessageHandler handler, Method method, List<Annotation> annotations) { String inputChannelName = null; String[] names = AnnotationUtils.getAnnotation(method, Bean.class).name(); if (!ObjectUtils.isEmpty(names)) { inputChannelName = names[0]; } if (!StringUtils.hasText(inputChannelName)) { inputChannelName = method.getName(); } MessageChannel inputChannel = this.beanFactory.getBean(inputChannelName, MessageChannel.class); return doCreateEndpoint(handler, inputChannel, annotations); }
Source:
<code>public void checkRead(String file) { if (file != null) { <START> this.nGrinderHomeReadAllowed(file); <END> } }</code><technical_language>method name is weird. this.isReadAllowed better</technical_language>

Target:
public void checkRead(String file) { if (file != null && file.contains("database.conf")) { throw new SecurityException("File Read access on database.conf is not allowed."); } }
Source:
<code>public void remove() { if (lastLen == 0) { throw new IllegalStateException(); } System.arraycopy( baf.getBuffer(), nextOff, baf.getBuffer(), nextOff - lastLen, remainingLen); <START> baf.setLength(remainingLen - lastLen); <END> lastLen = 0; }</code><technical_language>I this baf.setLength(baf.getLength() - lastLen)</technical_language>

Target:
public void remove() { if (lastLen == 0) { throw new IllegalStateException(); } System.arraycopy( baf.getBuffer(), nextOff, baf.getBuffer(), nextOff - lastLen, remainingLen); nextOff -= lastLen; baf.setLength(baf.getLength() - lastLen); lastLen = 0; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); previouslyStarted = prefs.getBoolean(getString(R.string.pref_previously_started), false); ImageButton new_user = (ImageButton) findViewById(R.id.newUserButtonFirstPage); new_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(StartActivity.this, AvatarRoomActivity.class); startActivityForResult(myIntent, 0); } }); ImageButton start = (ImageButton) findViewById(R.id.startButtonMain); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> if (!previouslyStarted) { <END> startActivity(new Intent(StartActivity.this, AvatarRoomActivity.class)); } else { startActivity(new Intent(StartActivity.this, MapActivity.class)); } } }); }</code><technical_language>this if other round. Check for positive condition negative in else. more readable</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); haspreviouslyStarted = preferences.getBoolean(getString(R.string.preferences_has_previously_started), false); ImageButton new_user = (ImageButton) findViewById(R.id.newUserButtonFirstPage); new_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(StartActivity.this, AvatarRoomActivity.class); startActivityForResult(myIntent, 0); } }); ImageButton start = (ImageButton) findViewById(R.id.startButtonMain); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (haspreviouslyStarted) { startActivity(new Intent(StartActivity.this, MapActivity.class)); } else { startActivity(new Intent(StartActivity.this, AvatarRoomActivity.class)); } } }); }
Source:
<code>public Iterator<Chain> iterator() throws TimeoutException { Iterator<Chain> iterator = onStoreProxy(serverStoreProxy -> serverStoreProxy.iterator()); <START> return new Iterator<Chain>() { <END> @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Chain next() { return iterator.next(); } }; }</code><technical_language>Iterator instance extant a fail-over? expect a "nice, clean" termination next next hasNext call. I org.ehcache.clustered.IterationFailureBehaviorTest a test appears cover this. call path, this wind IlegalStateException wrapped in a StoreAccessException wrapped in a CacheIterationException</technical_language>

Target:
public Iterator<Chain> iterator() throws TimeoutException { return onStoreProxy(LockingServerStoreProxy::iterator); }
Source:
<code>public Object getValue() { Focus f = (Focus) super.getValue(); if (f == null) return null; Focus res = new Focus(); res.setStringValue(f.getStringValue()); <START> return res; <END> }</code><technical_language>I this is WavelengthEditor works. In fact pains admit originally responsible for this SuggestibleString business fact is mutable nullish. I do this days though. rate, a slight improvement add a copy method Focus: java public static final class Focus extends SuggestibleString { public Focus(String value) { super(FocusSuggestion.class); setStringValue(value); } public Focus() { this(FocusSuggestion.DEFAULT.displayValue()); } public Focus copy() { return new Focus(getStringValue()); } } java import edu.gemini.shared.util.immutable.*; public Object getValue() { return ImOption.apply((Focus) super.getValue()).map(f -> f.copy()).getOrNull(); }</technical_language>

Target:
public Object getValue() { return ImOption.apply((Focus) super.getValue()).map(f -> f.copy()).getOrNull(); }
Source:
<code>public PutResult performPut(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { final PutResults<Object> putResults = storIOSQLite .put() <START> .objects(asList(person, person.getCars())) <END> .prepare() .executeAsBlocking(); final Set<String> affectedTables = new HashSet<String>(2); affectedTables.add(PersonsTable.TABLE); affectedTables.add(CarsTable.TABLE); return PutResult.newUpdateResult(putResults.numberOfUpdates(), affectedTables); }</code><technical_language>put person storIOSQLite.put() recursive, need storIOSQLite.internal(), storIOSQLite.put() put cars</technical_language>

Target:
public PutResult performPut(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { storIOSQLite.internal().beginTransaction(); try { final ContentValues contentValues = new ContentValues(2); contentValues.put(PersonsTable.COLUMN_UUID, person.uuid()); contentValues.put(PersonsTable.COLUMN_NAME, person.name()); final Set<String> affectedTables = new HashSet<>(2); affectedTables.add(PersonsTable.TABLE_NAME); storIOSQLite .put() .object(person) .prepare() .executeAsBlocking(); List<Car> cars = person.cars(); int count = cars.size(); for (int i=0; i<count; i++) { storIOSQLite .put() .object(new Car.Builder(cars.get(i).model()).personUuid(person.uuid()).build()) .prepare() .executeAsBlocking(); } if (0<count) { affectedTables.add(CarsTable.TABLE_NAME); } storIOSQLite.internal().setTransactionSuccessful(); return person.id() != null ? PutResult.newUpdateResult(1, affectedTables) : PutResult.newInsertResult(personId, affectedTables); } finally { storIOSQLite.internal().endTransaction(); } }
Source:
<code>public void testIncr_whenWrongType_shouldReturnError() { String key = "key"; String nonIntegerValue = "I am not a number! I am a free man!"; assertThat(jedis.set(key, nonIntegerValue)).isEqualTo("OK"); try { jedis.incr(key); } catch (JedisDataException e) { <START> assertThat(e.getMessage()).contains("out of range"); <END> } assertThat(jedis.get(key)).isEqualTo(nonIntegerValue); }</code><technical_language>change this ERROR_NOT_INTEGER constant? Geode Redis return errors Redis</technical_language>

Target:
public void testIncr_whenWrongType_shouldReturnError() { String key = "key"; String nonIntegerValue = "I am not a number! I am a free man!"; assertThat(jedis.set(key, nonIntegerValue)).isEqualTo("OK"); assertThatThrownBy(() -> jedis.incr(key)).hasMessageContaining(ERROR_NOT_INTEGER); assertThat(jedis.get(key)).isEqualTo(nonIntegerValue); }
Source:
<code>public TestElasticsearchIntegrationSmokeTest(EmbeddedElasticsearchNode embeddedElasticsearchNode) <START> throws Exception <END> { super(() -> createElasticsearchQueryRunner(embeddedElasticsearchNode, TpchTable.getTables())); this.embeddedElasticsearchNode = embeddedElasticsearchNode; }</code><technical_language>unnecessary throws (same for constructor above)</technical_language>

Target:
public TestElasticsearchIntegrationSmokeTest(EmbeddedElasticsearchNode embeddedElasticsearchNode) { super(() -> createElasticsearchQueryRunner(embeddedElasticsearchNode, TpchTable.getTables())); this.embeddedElasticsearchNode = embeddedElasticsearchNode; }
Source:
<code>public void onResume() { super.onResume(); <START> if (pageViewCallback != null && pageViewCallback.multiLingualPageView != null) { pageViewCallback.multiLingualPageView.refresh(); } <END> }</code><technical_language>If top code, pageViewCallback.getOnbardingPageView()</technical_language>

Target:
public void onResume() { super.onResume(); if (pageViewCallback != null && pageViewCallback.getOnboardingPageView() != null) { pageViewCallback.getOnboardingPageView().refresh(); } }
Source:
<code>public Observable<Void> release(PooledConnection<I, O> connection) { if (null == connection) { return Observable.error(new IllegalArgumentException("Returned a null connection to the pool.")); } try { stateChangeListener.onReleaseAttempted(); <START> if (isShutdown.get()) { <END> discardConnection(connection); stateChangeListener.onReleaseSucceeded(); return Observable.empty(); } else if (connection.isUsable()) { idleConnections.add(connection); stateChangeListener.onReleaseSucceeded(); return Observable.empty(); } else { discardConnection(connection); stateChangeListener.onReleaseSucceeded(); return Observable.empty(); } } catch (Throwable throwable) { stateChangeListener.onReleaseFailed(); return Observable.error(throwable); } }</code><technical_language>some logic is repeated in if-elseif-else. simplified if (!isShutdown.get() && connection.isUsable()) { ... } else { ... }</technical_language>

Target:
public Observable<Void> release(PooledConnection<I, O> connection) { if (null == connection) { return Observable.error(new IllegalArgumentException("Returned a null connection to the pool.")); } try { stateChangeObservable.onNext(PoolStateChangeEvent.onReleaseAttempted); if (isShutdown.get() || !connection.isUsable()) { discardConnection(connection); stateChangeObservable.onNext(PoolStateChangeEvent.onReleaseSucceeded); return Observable.empty(); } else { idleConnections.add(connection); stateChangeObservable.onNext(PoolStateChangeEvent.onReleaseSucceeded); return Observable.empty(); } } catch (Throwable throwable) { stateChangeObservable.onNext(PoolStateChangeEvent.onReleaseFailed); return Observable.error(throwable); } }
Source:
<code>private void authzFetchPrincipalRecord() { logger.debug("start authz_fetch_principal_record"); <START> ExtensionProxy authzExtension = getExtensionByName((String) this.actionArgs.get("extension-name")); <END> ExtMap outMap = authzExtension.invoke( new ExtMap().mput( Authz.InvokeKeys.PRINCIPAL, this.actionArgs.get("principal-name") ).mput( Base.InvokeKeys.COMMAND, Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD ).mput( Authz.InvokeKeys.QUERY_FLAGS, getFlags() ) ); processAuthzResult(outMap, "AUTHENTICATE_CREDENTIALS"); logger.info("authz_fetch_principal_record action completed"); }</code><technical_language>do need this.</technical_language>

Target:
private void authzFetchPrincipalRecord() { logger.debug("start authz_fetch_principal_record"); ExtensionProxy authzExtension = getExtensionManager().getExtensionByName((String) this.actionArgs.get("extension-name")); ExtMap outMap = authzExtension.invoke( new ExtMap().mput( Authz.InvokeKeys.PRINCIPAL, this.actionArgs.get("principal-name") ).mput( Base.InvokeKeys.COMMAND, Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD ).mput( Authz.InvokeKeys.QUERY_FLAGS, getFlags() ) ); processAuthzResult(outMap, "AUTHENTICATE_CREDENTIALS"); logger.info("authz_fetch_principal_record action completed"); }
Source:
<code>public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) { if (commitMessage == null) { try { PatchSet.Id psId = change(db).currentPatchSetId(); String sha1 = db.get().patchSets().get(psId).getRevision().get(); Project.NameKey name = change.getProject(); Repository repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } catch (RepositoryNotFoundException e) { log.error("Problem opening change repository", e); } catch (IOException e) { log.error("Problem finding commit message", e); } catch (OrmException e) { <START> log.error("Problem requesting sha1 from database", e); <END> } } return commitMessage; }</code><technical_language>add "for patchSetId: " + psId.toString() this message, other pertinent detailed info other messages if appropriate</technical_language>

Target:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) { if (commitMessage == null) { PatchSet.Id psId = null; String sha1 = null; Project.NameKey name = null; Repository repo = null; try { psId = change(db).currentPatchSetId(); sha1 = db.get().patchSets().get(psId).getRevision().get(); name = change.getProject(); repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } catch (RepositoryNotFoundException e) { log.error("Repository not found: " + name.toString(), e); } catch (IOException e) { if(repo == null) { log.error("Problem opening repository: " + name.toString(), e); } else { log.error("Problem parsing commit: " + sha1, e); } } catch (OrmException e) { if (psId != null) { log.error("Problem requesting sha1 from database for patchSetId: " + psId.toString(), e); } else { log.error("Problem requesting change from database for change: " + legacyId.toString(), e); } } } return commitMessage; }
Source:
<code>static void putKeyValueSize( PageCursor cursor, int keySize, int valueSize ) { boolean hasAdditionalKeySize = keySize > MASK_ONE_BYTE_KEY_SIZE; boolean hasValueSize = valueSize > 0; { byte firstByte = (byte) (keySize & MASK_ONE_BYTE_KEY_SIZE); if ( hasAdditionalKeySize ) { firstByte |= FLAG_ADDITIONAL_KEY_SIZE; if ( keySize > MASK_TWO_BYTE_KEY_SIZE ) { throw new IllegalArgumentException( format( "Max supported key size is %d, but tried to store key of size %d", MASK_TWO_BYTE_KEY_SIZE, keySize ) ); } } if ( hasValueSize ) { firstByte |= FLAG_HAS_VALUE_SIZE; } cursor.putByte( firstByte ); if ( hasAdditionalKeySize ) { cursor.putByte( (byte) (keySize >> SHIFT_LSB_KEY_SIZE) ); } } { if ( hasValueSize ) { boolean needsAdditionalValueSize = valueSize > MASK_ONE_BYTE_VALUE_SIZE; byte firstByte = (byte) (valueSize & MASK_ONE_BYTE_VALUE_SIZE); if ( needsAdditionalValueSize ) { if ( valueSize > MASK_TWO_BYTE_VALUE_SIZE ) { throw new IllegalArgumentException( <START> format( "Max supported key size is %d, but tried to store key of size %d", MASK_TWO_BYTE_VALUE_SIZE, valueSize ) ); <END> } firstByte |= FLAG_ADDITIONAL_VALUE_SIZE; } cursor.putByte( firstByte ); if ( needsAdditionalValueSize ) { cursor.putByte( (byte) (valueSize >> SHIFT_LSB_VALUE_SIZE) ); } } } }</code><technical_language>size, instead of key size in a message</technical_language>

Target:
static void putKeyValueSize( PageCursor cursor, int keySize, int valueSize ) { boolean hasAdditionalKeySize = keySize > MASK_ONE_BYTE_KEY_SIZE; boolean hasValueSize = valueSize > 0; { byte firstByte = (byte) (keySize & MASK_ONE_BYTE_KEY_SIZE); if ( hasAdditionalKeySize ) { firstByte |= FLAG_ADDITIONAL_KEY_SIZE; if ( keySize > MAX_TWO_BYTE_KEY_SIZE ) { throw new IllegalArgumentException( format( "Max supported key size is %d, but tried to store key of size %d", MAX_TWO_BYTE_KEY_SIZE, keySize ) ); } } if ( hasValueSize ) { firstByte |= FLAG_HAS_VALUE_SIZE; } cursor.putByte( firstByte ); if ( hasAdditionalKeySize ) { cursor.putByte( (byte) (keySize >> SHIFT_LSB_KEY_SIZE) ); } } { if ( hasValueSize ) { boolean needsAdditionalValueSize = valueSize > MASK_ONE_BYTE_VALUE_SIZE; byte firstByte = (byte) (valueSize & MASK_ONE_BYTE_VALUE_SIZE); if ( needsAdditionalValueSize ) { if ( valueSize > MAX_TWO_BYTE_VALUE_SIZE ) { throw new IllegalArgumentException( format( "Max supported value size is %d, but tried to store value of size %d", MAX_TWO_BYTE_VALUE_SIZE, valueSize ) ); } firstByte |= FLAG_ADDITIONAL_VALUE_SIZE; } cursor.putByte( firstByte ); if ( needsAdditionalValueSize ) { cursor.putByte( (byte) (valueSize >> SHIFT_LSB_VALUE_SIZE) ); } } } }
Source:
<code>void reconnect(int index) { if (this.s == Operators.cancelledSubscription() && S.compareAndSet(this, Operators.cancelledSubscription(), null)) { keepAliveSupport.stop(); <START> logger.debug("Connection[" + index + "] is lost. Reconnecting..."); <END> connectionFactory.retryWhen(retry).timeout(resumeSessionDuration).subscribe(this); } }</code><technical_language>suggestion logger.debug("Connection[" + index + "] is lost. Reconnecting resume...");</technical_language>

Target:
void reconnect(int index) { if (this.s == Operators.cancelledSubscription() && S.compareAndSet(this, Operators.cancelledSubscription(), null)) { keepAliveSupport.stop(); logger.debug("Connection[" + index + "] is lost. Reconnecting to resume..."); connectionFactory.retryWhen(retry).timeout(resumeSessionDuration).subscribe(this); } }
Source:
<code>public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Imputing example started."); IgniteCache<Integer, Person> persons = createCache(ignite); IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); LearningEnvironmentBuilder envBuilder = LearningEnvironmentBuilder.defaultBuilder(); IgniteBiFunction<Integer, Person, Vector> preprocessor = new ImputerTrainer<Integer, Person>() <START> .fit(envBuilder, ignite, persons, featureExtractor); <END> try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, envBuilder, preprocessor)) { new DatasetHelper(dataset).describe(); } System.out.println(">>> Imputing example completed."); } }</code><technical_language>default builder default hide this argument</technical_language>

Target:
public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Imputing example started."); IgniteCache<Integer, Person> persons = createCache(ignite); IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); IgniteBiFunction<Integer, Person, Vector> preprocessor = new ImputerTrainer<Integer, Person>() .fit(ignite, persons, featureExtractor); try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) { new DatasetHelper(dataset).describe(); } System.out.println(">>> Imputing example completed."); } }
Source:
<code>public static void prepare_quality_profiles() { ImmutableMap<String, ImmutableMap<String, String>> rulesParameters = ImmutableMap.<String, ImmutableMap<String, String>>builder() .put( "IndentationCheck", ImmutableMap.of("indentationLevel", "4")) .put( "S1451", ImmutableMap.of( "headerFormat", "\n/*\n" + " * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.\n" + " * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.")) .build(); ImmutableSet<String> disabledRules = ImmutableSet.of( "UnusedPrivateMethod", "CallToDeprecatedMethod", "CycleBetweenPackages", "LeftCurlyBraceStartLineCheck" ); ProfileGenerator.generate(orchestrator, "java", "squid", rulesParameters, disabledRules); instantiateTemplateRule("S2253", "stringToCharArray", "className=\"java.lang.String\";methodName=\"toCharArray\""); instantiateTemplateRule("ArchitecturalConstraint", "doNotUseJavaIoFile", "fromClasses=\"**\";toClasses=\"java.io.File\""); instantiateTemplateRule("S124", "commentRegexTest", "regularExpression=\"(?i).*TODO\\(user\\).*\";message=\"bad user\""); instantiateTemplateRule("S3417", "doNotUseCommonsCollections", "dependencyName=\"commons-collections:*\";"); instantiateTemplateRule("S3417", "doNotUseJunitBefore4", "dependencyName=\"junit:junit\";version=\"*-3.9.9\""); <START> instantiateTemplateRule("S3546", "S3546_Example", "constructors=\"org.sonar.api.server.ws.WebService.NewController\";closingMethods=\"org.sonar.api.server.ws.WebService.NewController#done\""); <END> }</code><technical_language>Name of template more explicit</technical_language>

Target:
public static void prepare_quality_profiles() { ImmutableMap<String, ImmutableMap<String, String>> rulesParameters = ImmutableMap.<String, ImmutableMap<String, String>>builder() .put( "IndentationCheck", ImmutableMap.of("indentationLevel", "4")) .put( "S1451", ImmutableMap.of( "headerFormat", "\n/*\n" + " * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.\n" + " * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.")) .build(); ImmutableSet<String> disabledRules = ImmutableSet.of( "UnusedPrivateMethod", "CallToDeprecatedMethod", "CycleBetweenPackages", "LeftCurlyBraceStartLineCheck" ); ProfileGenerator.generate(orchestrator, "java", "squid", rulesParameters, disabledRules); instantiateTemplateRule("S2253", "stringToCharArray", "className=\"java.lang.String\";methodName=\"toCharArray\""); instantiateTemplateRule("ArchitecturalConstraint", "doNotUseJavaIoFile", "fromClasses=\"**\";toClasses=\"java.io.File\""); instantiateTemplateRule("S124", "commentRegexTest", "regularExpression=\"(?i).*TODO\\(user\\).*\";message=\"bad user\""); instantiateTemplateRule("S3417", "doNotUseCommonsCollections", "dependencyName=\"commons-collections:*\";"); instantiateTemplateRule("S3417", "doNotUseJunitBefore4", "dependencyName=\"junit:junit\";version=\"*-3.9.9\""); instantiateTemplateRule("S3546", "InstancesOfNewControllerClosedWithDone", "constructors=\"org.sonar.api.server.ws.WebService.NewController\";closingMethods=\"org.sonar.api.server.ws.WebService.NewController#done\""); }
Source:
<code>private Rate createRate(SchedulePeriod period, Schedule paymentSchedule) { int effectiveRateCutOffDaysOffset = (isLastAccrualInPaymentPeriod(period, paymentSchedule) ? rateCutOffDays : 0); LocalDate startDate = index.calculateFixingFromEffective(period.getStartDate()); LocalDate endDate = index.calculateFixingFromEffective(period.getEndDate()); <START> switch (accrualMethod) { <END> case AVERAGED: return OvernightAveragedRate.of(index, startDate, endDate, effectiveRateCutOffDaysOffset); case COMPOUNDED: default: return OvernightCompoundedRate.of(index, startDate, endDate, effectiveRateCutOffDaysOffset); } }</code><technical_language>worth switch</technical_language>

Target:
private Rate createRate(SchedulePeriod period, Schedule paymentSchedule) { int effectiveRateCutOffDaysOffset = (isLastAccrualInPaymentPeriod(period, paymentSchedule) ? rateCutOffDays : 0); LocalDate startDate = index.calculateFixingFromEffective(period.getStartDate()); LocalDate endDate = index.calculateFixingFromEffective(period.getEndDate()); if (accrualMethod == OvernightAccrualMethod.AVERAGED) { return OvernightAveragedRate.of(index, startDate, endDate, effectiveRateCutOffDaysOffset); } else { return OvernightCompoundedRate.of(index, startDate, endDate, effectiveRateCutOffDaysOffset); } }
Source:
<code>public void init() { super.init(); <START> subscribe(master, RedisStore.HOSTNAME, new MasterAttributePropagator()); <END> subscribe(master, RedisStore.ADDRESS, new MasterAttributePropagator()); subscribe(master, RedisStore.SUBNET_HOSTNAME, new MasterAttributePropagator()); subscribe(master, RedisStore.SUBNET_ADDRESS, new MasterAttributePropagator()); subscribe(master, RedisStore.REDIS_PORT, new MasterAttributePropagator()); }</code><technical_language>instead use: addEnricher(Enrichers.builder() .propagating(RedisStore.HOSTNAME, RedisStore.ADDRESS, RedisStore.SUBNET_HOSTNAME, RedisStore.SUBNET_ADDRESS, RedisStore.REDIS_PORT) .from(master) .build());</technical_language>

Target:
public void init() { super.init(); RedisStore master = addChild(EntitySpec.create(RedisStore.class)); setAttribute(MASTER, master); DynamicCluster slaves = addChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(RedisSlave.class).configure(RedisSlave.MASTER, master))); setAttribute(SLAVES, slaves); addEnricher(Enrichers.builder() .propagating(RedisStore.HOSTNAME, RedisStore.ADDRESS, RedisStore.SUBNET_HOSTNAME, RedisStore.SUBNET_ADDRESS, RedisStore.REDIS_PORT) .from(master) .build()); }
Source:
<code>public void activate() { <START> logger.debug("activate"); <END> }</code><technical_language>remove</technical_language>

Target:
public void activate() { }
Source:
<code>private int computeHashCode() { int hash = getContig().hashCode(); hash = 31 * hash + getSource().hashCode(); hash = 31 * hash + getType().hashCode(); hash = 31 * hash + getStart(); hash = 31 * hash + getEnd(); <START> hash = 31 * hash + getScore().hashCode(); <END> hash = 31 * hash + getPhase(); hash = 31 * hash + getStrand().hashCode(); hash = 31 * hash + getAttributes().hashCode(); if (getId() != null) { hash = 31 * hash + getId().hashCode(); } if (getName() != null) { hash = 31 * hash + getName().hashCode(); } if (getAlias() != null) { hash = 31 * hash + getAlias().hashCode(); } return hash; }</code><technical_language>null check</technical_language>

Target:
private int computeHashCode() { int hash = getContig().hashCode(); hash = 31 * hash + getSource().hashCode(); hash = 31 * hash + getType().hashCode(); hash = 31 * hash + getStart(); hash = 31 * hash + getEnd(); hash = 31 * hash + Double.hashCode(getScore()); hash = 31 * hash + getPhase(); hash = 31 * hash + getStrand().hashCode(); hash = 31 * hash + getAttributes().hashCode(); if (getId() != null) { hash = 31 * hash + getId().hashCode(); } if (getName() != null) { hash = 31 * hash + getName().hashCode(); } if (getAlias() != null) { hash = 31 * hash + getAlias().hashCode(); } return hash; }
Source:
<code><START> public Predicate<ChangeData> r05_byBranchOpenNext( <END> @Named("P") final ProjectPredicate p, @Named("B") final BranchPredicate b, @Named("S") final SortKeyPredicate.Before s, @Named("L") final IntPredicate<ChangeData> l) { return new PaginatedSource(500, s.getValue(), l.intValue()) { @Override ResultSet<Change> scan(ChangeAccess a, String key, int limit) throws OrmException { return a.byBranchOpenNext( new Branch.NameKey(p.getValueKey(), b.getValue()), key, limit); } @Override public boolean match(ChangeData cd) throws OrmException { return cd.change(dbProvider).getStatus().isOpen() && p.match(cd) && b.match(cd) && s.match(cd); } }; }</code><technical_language>methods name exception of prev/next suffix</technical_language>

Target:
public Predicate<ChangeData> r05_byBranchOpenNext( @Named("P") final ProjectPredicate p, @Named("B") final BranchPredicate b, @Named("S") final SortKeyPredicate.Before s, @Named("L") final IntPredicate<ChangeData> l) { return new PaginatedSource(500, s.getValue(), l.intValue()) { @Override ResultSet<Change> scan(ChangeAccess a, String key, int limit) throws OrmException { return a.byBranchOpenAll(new Branch.NameKey(p.getValueKey(), b .getValue())); } @Override public boolean match(ChangeData cd) throws OrmException { return cd.change(dbProvider).getStatus().isOpen() && p.match(cd) && b.match(cd) && s.match(cd); } }; }
Source:
<code>public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final ActorRef self = self(); final ActorRef sender = sender(); if (Observe.class.equals(klass)) { observe(message); } else if (StopObserving.class.equals(klass)) { stopObserving(message); } else if (GetLastSmsRequest.class.equals(klass)) { sender.tell(last, self); } else if (SmsSessionAttribute.class.equals(klass)) { final SmsSessionAttribute attribute = (SmsSessionAttribute) message; attributes.put(attribute.name(), attribute.value()); Object record = attributes.get("record"); <START> try { <END> SmsMessage msg = (SmsMessage)record; logger.debug ("SmsSessionAttribute "+msg.getSid()); } catch (Exception e) { e.printStackTrace(); } if (record != null) { system.eventStream().publish(record); } } else if (SmsSessionRequest.class.equals(klass)) { outbound(message); } else if (message instanceof SipServletRequest) { inbound(message); } else if (message instanceof SipServletResponse) { response(message); } else if (message instanceof SmppInboundMessageEntity) { inbound(message); } }</code><technical_language>is this try necesasary test casting, im i construct i prefer instanceof</technical_language>

Target:
public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final ActorRef self = self(); final ActorRef sender = sender(); if (Observe.class.equals(klass)) { observe(message); } else if (StopObserving.class.equals(klass)) { stopObserving(message); } else if (GetLastSmsRequest.class.equals(klass)) { sender.tell(last, self); } else if (SmsSessionAttribute.class.equals(klass)) { final SmsSessionAttribute attribute = (SmsSessionAttribute) message; attributes.put(attribute.name(), attribute.value()); Object record = attributes.get("record"); if (record != null) { system.eventStream().publish(record); } } else if (SmsSessionRequest.class.equals(klass)) { outbound(message); } else if (message instanceof SipServletRequest) { inbound(message); } else if (message instanceof SipServletResponse) { response(message); } else if (message instanceof SmppInboundMessageEntity) { inbound(message); } }
Source:
<code>private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final Property property, final boolean nested) throws XMLStreamException { final Element element = Element.forName(property.getName()); switch (element) { case INET_ADDRESS: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), nested); break; case LOOPBACK_ADDRESS: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), false); break; case LINK_LOCAL_ADDRESS: case LOOPBACK: case MULTICAST: case POINT_TO_POINT: case PUBLIC_ADDRESS: case SITE_LOCAL_ADDRESS: case UP: case VIRTUAL: { if (property.getValue().asBoolean(false)) { writer.writeEmptyElement(element.getLocalName()); } break; } case NIC: writeInterfaceCriteria(writer, element, Attribute.NAME, property.getValue(), nested); break; case NIC_MATCH: writeInterfaceCriteria(writer, element, Attribute.PATTERN, property.getValue(), nested); break; case SUBNET_MATCH: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), nested); break; case ANY: case NOT: if (nested) { break; } writer.writeStartElement(element.getLocalName()); writeInterfaceCriteria(writer, property.getValue(), true); writer.writeEndElement(); break; case NAME: break; case ANY_ADDRESS: <START> break; <END> default: { throw ControllerLogger.ROOT_LOGGER.unknownCriteriaInterfaceProperty(property.getName()); } } }</code><technical_language>is this happening</technical_language>

Target:
private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final Property property, final boolean nested) throws XMLStreamException { final Element element = Element.forName(property.getName()); switch (element) { case INET_ADDRESS: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), nested); break; case LOOPBACK_ADDRESS: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), false); break; case LINK_LOCAL_ADDRESS: case LOOPBACK: case MULTICAST: case POINT_TO_POINT: case PUBLIC_ADDRESS: case SITE_LOCAL_ADDRESS: case UP: case VIRTUAL: { if (property.getValue().asBoolean(false)) { writer.writeEmptyElement(element.getLocalName()); } break; } case NIC: writeInterfaceCriteria(writer, element, Attribute.NAME, property.getValue(), nested); break; case NIC_MATCH: writeInterfaceCriteria(writer, element, Attribute.PATTERN, property.getValue(), nested); break; case SUBNET_MATCH: writeInterfaceCriteria(writer, element, Attribute.VALUE, property.getValue(), nested); break; case ANY: case NOT: if (nested) { break; } writer.writeStartElement(element.getLocalName()); writeInterfaceCriteria(writer, property.getValue(), true); writer.writeEndElement(); break; case NAME: break; case ANY_ADDRESS: assert property.getValue().asBoolean(false) == false; break; default: { throw ControllerLogger.ROOT_LOGGER.unknownCriteriaInterfaceProperty(property.getName()); } } }
Source:
<code>public KeyMaterial materialize() throws IOException, InterruptedException { final KeyMaterial lhsMaterialized = lhs.materialize(); final KeyMaterial rhsMaterialized; try { rhsMaterialized = rhs.materialize(); } catch (Exception e) { <START> lhsMaterialized.close(); <END> if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new IOException("Error materializing credentials.", e); } } EnvVars env = lhsMaterialized.env(); env.putAll(rhsMaterialized.env()); return new KeyMaterial(env) { @Override public void close() throws IOException { try { lhsMaterialized.close(); } finally { rhsMaterialized.close(); } } }; }</code><technical_language>java // TODO Java 7+ chained exceptions</technical_language>

Target:
public KeyMaterial materialize() throws IOException, InterruptedException { KeyMaterial lhsMaterialized = lhs.materialize(); KeyMaterial rhsMaterialized = null; try { rhsMaterialized = rhs.materialize(); EnvVars env = lhsMaterialized.env(); env.putAll(rhsMaterialized.env()); return new CompositeKeyMaterial(env, lhsMaterialized, rhsMaterialized); } catch (Exception e) { try { lhsMaterialized.close(); if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new IOException("Error materializing credentials.", e); } } finally { if (rhsMaterialized != null) { rhsMaterialized.close(); } } } }
Source:
<code>public SiteRestRepository() { <START> System.out.println("Repository initialized by Spring"); <END> }</code><technical_language>this log, DEBUG level</technical_language>

Target:
public SiteRestRepository() { }