auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void postSaveAction(Guid networkGuid, boolean succeeded) { super.postSaveAction(networkGuid, succeeded); if (!succeeded) { return; } Guid networkId = getNetwork().getId() == null ? networkGuid : getNetwork().getId(); ArrayList<VdcActionParametersBase> actionParameters1 = new ArrayList<VdcActionParametersBase>(); for (NetworkClusterModel networkClusterModel : getClustersToAttach()) { Network tempVar = new Network(); tempVar.setId(networkId); tempVar.setName(getNetwork().getName()); NetworkCluster networkCluster = new NetworkCluster(); networkCluster.setRequired(networkClusterModel.isRequired()); tempVar.setCluster(networkCluster); actionParameters1.add(new AttachNetworkToVdsGroupParameter(networkClusterModel.getEntity(), tempVar)); } Frontend.getInstance().runMultipleAction(VdcActionType.AttachNetworkToVdsGroup, actionParameters1); if ((Boolean) getExport().getEntity() <START> && getSubnetModel().getName().getEntity() != null <END> && !getSubnetModel().getName().getEntity().isEmpty()) { getSubnetModel().setExternalNetwork(getNetwork().getProvidedBy()); getSubnetModel().flush(); Frontend.getInstance().runAction(VdcActionType.AddSubnetToProvider, new AddExternalSubnetParameters(getSubnetModel().getSubnet(), networkId)); } }</code><technical_language>name is mandatory. I understood you, subnet added if is CIDR IP version</technical_language>

Target:
protected void postSaveAction(Guid networkGuid, boolean succeeded) { super.postSaveAction(networkGuid, succeeded); if (!succeeded) { return; } Guid networkId = getNetwork().getId() == null ? networkGuid : getNetwork().getId(); ArrayList<VdcActionParametersBase> actionParameters1 = new ArrayList<VdcActionParametersBase>(); for (NetworkClusterModel networkClusterModel : getClustersToAttach()) { Network tempVar = new Network(); tempVar.setId(networkId); tempVar.setName(getNetwork().getName()); NetworkCluster networkCluster = new NetworkCluster(); networkCluster.setRequired(networkClusterModel.isRequired()); tempVar.setCluster(networkCluster); actionParameters1.add(new AttachNetworkToVdsGroupParameter(networkClusterModel.getEntity(), tempVar)); } Frontend.getInstance().runMultipleAction(VdcActionType.AttachNetworkToVdsGroup, actionParameters1); if ((Boolean) getExport().getEntity() && StringUtils.isNotEmpty(getSubnetModel().getCidr().getEntity())) { getSubnetModel().setExternalNetwork(getNetwork().getProvidedBy()); getSubnetModel().flush(); Frontend.getInstance().runAction(VdcActionType.AddSubnetToProvider, new AddExternalSubnetParameters(getSubnetModel().getSubnet(), networkId)); } }
Source:
<code>public void afterDelete(Attachable object) { for (FileAttachment a : object.getAttachments()) { File file = new File(makeFullPath(a.getPath())); deleteFileOrLog(file, object, a); } File dir = new File(makeFullPath(makeRelativeDir(object.getAttachmentsTarget(), object.getId()))); if (dir.exists() && dir.isDirectory()) { if (dir.listFiles() != null) { for (File file : dir.listFiles()) { deleteFileOrLog(file, object, null); } } if (!dir.delete()) { log.error("Failed to delete directory for deleted object: " + dir.getAbsolutePath()); <START> } <END> } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') "java.nio.Files#delete" for messages error conditions. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void afterDelete(Attachable object) { for (FileAttachment a : object.getAttachments()) { File file = new File(makeFullPath(a.getPath())); deleteFileOrLog(file, object, a); } File dir = new File(makeFullPath(makeRelativeDir(object.getAttachmentsTarget(), object.getId()))); if (dir.exists() && dir.isDirectory()) { if (dir.listFiles() != null) { for (File file : dir.listFiles()) { deleteFileOrLog(file, object, null); } } if (!dir.delete()) { log.error("Failed to delete directory for deleted object: {}", dir.getAbsolutePath()); } } }
Source:
<code>protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); if (ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { <START> e.printStackTrace(); <END> return null; } } return null; }).filter(r -> r != null).collect(Collectors.toList()); }</code><technical_language>This here. Log Activator.getDefault()</technical_language>

Target:
protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); if (repo == null) { return null; } if (ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { Activator.logError(e.getMessage(), e); return null; } } return null; }).filter(Objects::nonNull).collect(Collectors.toList()); }
Source:
<code>public <S> void set(final S instance, final T value) { try { if (propertyMetadata.isDeserializable()) { if (propertyMetadata.getSetter() != null) { propertyMetadata.getSetter().invoke(instance, value); } else { propertyMetadata.getField().set(instance, value); } <START> } else if (propertyMetadata.getGetter() != null <END> && value instanceof Collection) { T collection = (T) propertyMetadata.getGetter().invoke(instance); Collection<?> col = ((Collection<?>) collection); if (col != null && col.isEmpty()) { col.addAll((Collection) value); } } } catch (final Exception e) { throw setError(e); } }</code><technical_language>call isSerializable(), this logic transient fields..</technical_language>

Target:
public <S> void set(final S instance, final T value) { try { if (propertyMetadata.isDeserializable()) { if (propertyMetadata.getSetter() != null) { propertyMetadata.getSetter().invoke(instance, value); } else { propertyMetadata.getField().set(instance, value); } } else if (propertyMetadata.isSerializable() && value instanceof Collection) { T collection; if (propertyMetadata.getGetter() != null) { collection = (T) propertyMetadata.getGetter().invoke(instance); } else { collection = (T) propertyMetadata.getField().get(instance); } Collection<?> col = ((Collection<?>) collection); if (col != null && col.isEmpty()) { col.addAll((Collection) value); } } } catch (final Exception e) { throw setError(e); } }
Source:
<code>private static CharSequence generateMarkdown(Context c, String message) { <START> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { <END> return trimTrailingWhitespace( Markwon.markdown(c, convertCharacterEncodings(message))); } return trimTrailingWhitespace( new Bypass(c).markdownToSpannable(convertCharacterEncodings(message))); }</code><technical_language>Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN</technical_language>

Target:
private static CharSequence generateMarkdown(Context c, String message) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { return trimTrailingWhitespace( new Bypass(c).markdownToSpannable(convertCharacterEncodings(message))); } return trimTrailingWhitespace( Markwon.markdown(c, convertCharacterEncodings(message))); }
Source:
<code>public void multiQueuesRotation() throws IOException, InterruptedException { final Queue queueA = this.client.getQueues().get("testA"); final Queue queueB = this.client.getQueues().get("testB"); final Queue queueC = this.client.getQueues().get("testC"); queueA.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueA.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueB.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueC.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueC.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( <START> Arrays.asList(new String[] {"testA", "testB", "testC"}), <END> this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = new Thread() { @Override public void run() { try { Thread.sleep(5000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory, contains( "com.moz.qless.IntegrationTestJob.testA", "com.moz.qless.IntegrationTestJob.testB", "com.moz.qless.IntegrationTestJob.testC", "com.moz.qless.IntegrationTestJob.testA", "com.moz.qless.IntegrationTestJob.testC")); }</code><technical_language>If type mismatch, simply Arrays.asList("testA", "testB", "testC"). In Java, ... primitive arrays synonymous. if decompile byte code. function signature is for both, Arrays.asList is declared a varargs method, accept direct arguments a primitive array</technical_language>

Target:
public void multiQueuesRotation() throws IOException, InterruptedException { final Queue queueA = this.client.getQueue("testA"); final Queue queueB = this.client.getQueue("testB"); final Queue queueC = this.client.getQueue("testC"); queueA.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueA.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueB.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueC.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); queueC.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList("testA", "testB", "testC"), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = this.getWorkerThread(worker, 3); signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory, contains( "com.moz.qless.IntegrationTestJob.testA", "com.moz.qless.IntegrationTestJob.testB", "com.moz.qless.IntegrationTestJob.testC", "com.moz.qless.IntegrationTestJob.testA", "com.moz.qless.IntegrationTestJob.testC")); }
Source:
<code>private CertificateStatus getStatusFromOcspResponse( OCSPResp ocspResponse, X509Certificate certificate) { try { BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); if (basicResponse == null) { return new UnknownStatus(); } SingleResp[] singleResps = basicResponse.getResponses(); if (singleResps == null) { return new UnknownStatus(); } SingleResp response = Arrays.stream(singleResps) .filter(singleResp -> singleResp.getCertID() != null) <START> .collect(Collectors.toList()) <END> .stream() .filter( singleResp -> singleResp .getCertID() .getSerialNumber() .equals(certificate.getSerialNumber())) .findFirst() .orElse(null); if (response == null) { LOGGER.debug("Certificate status from OCSP response is unknown."); return new UnknownStatus(); } if (response.getCertStatus() == null) { LOGGER.debug("Certificate status from OCSP response is good."); return CertificateStatus.GOOD; } return response.getCertStatus(); } catch (OCSPException e) { return new UnknownStatus(); } }</code><technical_language>need collect in middle of stream, straight filter filter</technical_language>

Target:
private CertificateStatus getStatusFromOcspResponse( OCSPResp ocspResponse, X509Certificate certificate) { try { BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); if (basicResponse == null) { return new UnknownStatus(); } SingleResp[] singleResps = basicResponse.getResponses(); if (singleResps == null) { return new UnknownStatus(); } SingleResp response = Arrays.stream(singleResps) .filter(singleResp -> singleResp.getCertID() != null) .filter( singleResp -> singleResp .getCertID() .getSerialNumber() .equals(certificate.getSerialNumber())) .findFirst() .orElse(null); if (response == null) { LOGGER.debug("Certificate status from OCSP response is unknown."); return new UnknownStatus(); } if (response.getCertStatus() == null) { LOGGER.debug("Certificate status from OCSP response is good."); return CertificateStatus.GOOD; } return response.getCertStatus(); } catch (OCSPException e) { return new UnknownStatus(); } }
Source:
<code>public void action() throws Exception { log("Create an remove an empty local node source with cron policy"); createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with cron policy"); createNodeSource(NODE_SOURCE_NAME); log("Waiting for the cron policy to remove the nodes"); <START> for (int i = 0; i < NODES_NUMBER; i++) { <END> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED); } log("Waiting for the cron policy to add the nodes again"); for (int i = 0; i < NODES_NUMBER; i++) { this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED); } }</code><technical_language>Lambda.repeater repeater.accept(NODES_NUMBER, () -> { his.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED); }</technical_language>

Target:
public void action() throws Exception { log("Create an remove an empty local node source with cron policy"); createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with cron policy"); createNodeSource(NODE_SOURCE_NAME); log("Waiting for the cron policy to remove the nodes"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); log("Waiting for the cron policy to add the nodes again"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED)); }
Source:
<code>public void commit() throws IOException{ if(LOG.isTraceEnabled()) SpliceLogUtils.trace(LOG,"Before commit: txn=%s",this); if (getSubId() == 0) { switch (state) { case COMMITTED: return; case ROLLEDBACK: throw exceptionFactory.cannotCommit(txnId, state); } synchronized (this) { switch (state) { case COMMITTED: return; case ROLLEDBACK: <START> throw exceptionFactory.cannotCommit(txnId, state); <END> } commitTimestamp = tc.commit(txnId); state = State.COMMITTED; } } else { state = State.COMMITTED; } if(LOG.isTraceEnabled()) SpliceLogUtils.trace(LOG,"After commit: txn=%s,commitTimestamp=%s",this,commitTimestamp); }</code><technical_language>Nice add default switch stmt convert if-else if 2 states</technical_language>

Target:
public void commit() throws IOException{ if(LOG.isTraceEnabled()) SpliceLogUtils.trace(LOG,"Before commit: txn=%s",this); if (getSubId() == 0) { switch (state) { case COMMITTED: return; case ROLLEDBACK: throw exceptionFactory.cannotCommit(txnId, state); } synchronized (this) { switch (state) { case COMMITTED: return; case ROLLEDBACK: throw exceptionFactory.cannotCommit(txnId, state); case ACTIVE: commitTimestamp = tc.commit(txnId); state = State.COMMITTED; } } } else { state = State.COMMITTED; } if(LOG.isTraceEnabled()) SpliceLogUtils.trace(LOG,"After commit: txn=%s,commitTimestamp=%s",this,commitTimestamp); }
Source:
<code>private void setTimer(final MessageKey key, int seconds) { <START> if(seconds > 0) { <END> int limit = seconds*1000; new CountDownTimer(limit, 1000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { mMessagesList.remove(key); updateList(); } }.start(); } }</code><technical_language>I move if(seconds > 0) check message() function. way, setTimer sets a timer, now, sets a timer</technical_language>

Target:
private void setTimer(final MessageKey key, int seconds) { int limit = seconds*1000; new CountDownTimer(limit, limit) { @Override public void onTick(long millisUntilFinished) @Override public void onFinish() { mMessagesList.remove(key); adapter.notifyDataSetChanged(); } }.start(); }
Source:
<code>private Collection<T> attemptUpdateAsBatch(final Iterable<T> instances) throws OrmException { Collection<T> inserts = null; try { PreparedStatement ps = null; try { int cnt = 0; List<T> allInstances = new ArrayList<>(); for (final T o : instances) { if (ps == null) { ps = schema.getConnection().prepareStatement(getUpdateOneSql()); } bindOneUpdate(ps, o); ps.addBatch(); allInstances.add(o); cnt++; } <START> if (0 < cnt && ps != null) { <END> final int[] states = ps.executeBatch(); if (states == null) { inserts = allInstances; } else { int i = 0; for (T o : allInstances) { if (states.length <= i || states[i] != 1) { if (inserts == null) { inserts = new ArrayList<>(cnt - i); } inserts.add(o); } i++; } } } } finally { if (ps != null) { ps.close(); } } } catch (SQLException e) { throw convertError("update", e); } return inserts; }</code><technical_language>This is a confusing Eclipse is wrong here, ps null if cnt > 0. if way... Eclipse happy checkNotNull(ps) this blocK</technical_language>

Target:
private Collection<T> attemptUpdateAsBatch(final Iterable<T> instances) throws OrmException { Collection<T> inserts = null; try { PreparedStatement ps = null; try { int cnt = 0; List<T> allInstances = new ArrayList<>(); for (final T o : instances) { if (ps == null) { ps = schema.getConnection().prepareStatement(getUpdateOneSql()); } bindOneUpdate(ps, o); ps.addBatch(); allInstances.add(o); cnt++; } if (0 < cnt) { Preconditions.checkNotNull(ps); final int[] states = ps.executeBatch(); if (states == null) { inserts = allInstances; } else { int i = 0; for (T o : allInstances) { if (states.length <= i || states[i] != 1) { if (inserts == null) { inserts = new ArrayList<>(cnt - i); } inserts.add(o); } i++; } } } } finally { if (ps != null) { ps.close(); } } } catch (SQLException e) { throw convertError("update", e); } return inserts; }
Source:
<code>public String[] getFromExpressions(ConversionContext conversionContext) { if ( sourceType == targetType ) { <START> return new String[] { "", "" }; <END> } else { return new String[] { "", "." + sourceType.getName() + "Value()" }; } }</code><technical_language>If returned a proper object here, a constant placeholder EmptyExpression so</technical_language>

Target:
public ConversionExpression getFromExpressions(ConversionContext conversionContext) { if ( sourceType == targetType ) { return ConversionExpression.empty(); } else { return new ConversionExpression( "", "." + sourceType.getName() + "Value()" ); } }
Source:
<code>public void adsFandomDesktopArticleAds(String article) throws IOException { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsBaseObject wikiPage = new AdsBaseObject(driver, testedPage); getJquery(); <START> wikiPage.verifyFandomDesktopArticleTopLeaderboard(); <END> wikiPage.verifyFandomTopBoxad(); wikiPage.verifyFandomDesktopArticleBottomLeaderboard(); }</code><technical_language>do making more general methods like: verifyTopLeaderboard decide selector pick this method? Based wikiPage object/browser info</technical_language>

Target:
public void adsFandomDesktopArticleAds(String article) { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsFandomObject fandomPage = new AdsFandomObject(driver, testedPage); getJquery(); fandomPage.verifyFandomDesktopArticleTopLeaderboard(); fandomPage.verifyFandomDesktopTopBoxad(); fandomPage.verifyFandomDesktopArticleBottomLeaderboard(); }
Source:
<code>public static ModuleManager create(String masterServerAddress) throws Exception { ModuleManager moduleManager = new ModuleManagerImpl(masterServerAddress); <START> return LoadModuleEnvironment(moduleManager); <END> }</code><technical_language>suggestion return loadModuleEnvironment(moduleManager);</technical_language>

Target:
public static ModuleManager create(String masterServerAddress) throws Exception { ModuleManager moduleManager = new ModuleManagerImpl(masterServerAddress); return loadModuleEnvironment(moduleManager); }
Source:
<code>private DiscoveryClientEndpointLocator discoveryClientEndpointLocator() { if (this.client!=null) { <START> return new DiscoveryClientEndpointLocator(this.client, new EndpointCacheImpl(this.zipkinProperties)); <END> } return null; }</code><technical_language>EndpointCacheImpl a bean other implementations, otherwise, drop interface</technical_language>

Target:
private DiscoveryClientEndpointLocator discoveryClientEndpointLocator() { if (this.client!=null) { return new DiscoveryClientEndpointLocator(this.client, this.zipkinProperties); } return null; }
Source:
<code>public List<CacheConfigurationChangeListener> getConfigurationChangeListeners() { List<CacheConfigurationChangeListener> configurationChangeListenerList = new ArrayList<CacheConfigurationChangeListener>(); <START> configurationChangeListenerList.addAll(((Store)cachingTier()).getConfigurationChangeListeners()); <END> configurationChangeListenerList.addAll(((Store)authoritativeTier).getConfigurationChangeListeners()); return configurationChangeListenerList; }</code><technical_language>I presume this explicit realCachingTier reference</technical_language>

Target:
public List<CacheConfigurationChangeListener> getConfigurationChangeListeners() { List<CacheConfigurationChangeListener> configurationChangeListenerList = new ArrayList<CacheConfigurationChangeListener>(); configurationChangeListenerList.addAll(((Store)realCachingTier).getConfigurationChangeListeners()); configurationChangeListenerList.addAll(((Store)authoritativeTier).getConfigurationChangeListeners()); return configurationChangeListenerList; }
Source:
<code>public CalculatorExpressionTokenizer(Context context) { mReplacementMap = new HashMap<>(); NumberFormat nf = DecimalFormat.getInstance( <START> context.getResources().getConfiguration().locale); <END> mReplacementMap.put(".", context.getString(R.string.dec_point)); for (int i = 0; i < 9; ++i) { mReplacementMap.put(String.valueOf(i), nf.format(i)); } mReplacementMap.put("/", context.getString(R.string.op_div)); mReplacementMap.put("*", context.getString(R.string.op_mul)); mReplacementMap.put("-", context.getString(R.string.op_sub)); mReplacementMap.put("cos", context.getString(R.string.fun_cos)); mReplacementMap.put("ln", context.getString(R.string.fun_ln)); mReplacementMap.put("log", context.getString(R.string.fun_log)); mReplacementMap.put("sin", context.getString(R.string.fun_sin)); mReplacementMap.put("tan", context.getString(R.string.fun_tan)); mReplacementMap.put("Infinity", context.getString(R.string.inf)); }</code><technical_language>do need this explicit? i in theory this system Locale but..</technical_language>

Target:
public CalculatorExpressionTokenizer(Context context) { mReplacementMap = new HashMap<>(); NumberFormat nf = DecimalFormat.getInstance( context.getResources().getConfiguration().locale); mReplacementMap.put(".", context.getString(R.string.dec_point)); for (int i = 0; i <= 9; ++i) { mReplacementMap.put(String.valueOf(i), nf.format(i)); } mReplacementMap.put("/", context.getString(R.string.op_div)); mReplacementMap.put("*", context.getString(R.string.op_mul)); mReplacementMap.put("-", context.getString(R.string.op_sub)); mReplacementMap.put("cos", context.getString(R.string.fun_cos)); mReplacementMap.put("ln", context.getString(R.string.fun_ln)); mReplacementMap.put("log", context.getString(R.string.fun_log)); mReplacementMap.put("sin", context.getString(R.string.fun_sin)); mReplacementMap.put("tan", context.getString(R.string.fun_tan)); mReplacementMap.put("Infinity", context.getString(R.string.inf)); }
Source:
<code>@Test public void provideLazyFails() { @Module class ProvideProvidesModule { @Provides Lazy<Object> provideObject() { return null; } } try { ObjectGraph.create(new ProvideProvidesModule()); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage()) .startsWith("@Provides method must not return Lazy directly: ") <START> .endsWith("ProvideLazyModule.provideObject"); <END> } }</code><technical_language>(but test fails ): LazyProvidesModule? other ProvideProvideModule (without s)</technical_language>

Target:
@Test public void provideLazyFails() { @Module class ProvidesLazyModule { @Provides Lazy<Object> provideObject() { return null; } } try { ObjectGraph.create(new ProvidesLazyModule()); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage()) .startsWith("@Provides method must not return Lazy directly: ") .endsWith("ProvidesLazyModule.provideObject"); } }
Source:
<code>public JobId submit(Job userJob) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException { try { if (logger.isDebugEnabled()) { logger.debug("New job submission requested : " + userJob.getName()); } if (!schedulingService.isSubmitPossible()) { String msg = "Scheduler is stopped, cannot submit job"; logger.info(msg); throw new SubmissionClosedException(msg); } final UserIdentificationImpl ident = frontendState.checkPermission("submit", YOU_DO_NOT_HAVE_PERMISSION_TO_SUBMIT_A_JOB); final InternalJob job = frontendState.createJob(userJob, ident); pool.submit(() -> { try { schedulingService.submitJob(job); frontendState.jobSubmitted(job, ident); } catch (Exception e) { <START> logger.error(String.format("Error while submiting a job[id:%s] ", job.getId().value()), e); <END> } finally { unregisterSumbittedJob(job.getId()); } }); while (job.getId().longValue() == 0) { try { Thread.sleep(10); } catch (InterruptedException e) { } } registerJobAsUnderSumbission(job.getId()); return job.getId(); } catch (Exception e) { logger.warn("Error when submitting job.", e); throw e; } }</code><technical_language>Depending Exception is raised, jobID equal zero. In case, I a dedicated log message, like: Error while submitting job %JOBNAME%. JobID yet</technical_language>

Target:
public JobId submit(Job userJob) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException { try { if (logger.isDebugEnabled()) { logger.debug("New job submission requested : " + userJob.getName()); } if (!schedulingService.isSubmitPossible()) { String msg = "Scheduler is stopped, cannot submit job"; logger.info(msg); throw new SubmissionClosedException(msg); } final UserIdentificationImpl ident = frontendState.checkPermission("submit", YOU_DO_NOT_HAVE_PERMISSION_TO_SUBMIT_A_JOB); final InternalJob job = frontendState.createJob(userJob, ident); final Future<?> submitting = submitJob(userJob, ident, job); return blockUntilJobIdInitialized(userJob, job, submitting); } catch (Exception e) { logger.warn("Error when submitting job.", e); throw e; } }
Source:
<code>public void waitToolbar() { <START> seleniumWebDriverHelper.waitVisibility(By.xpath(" END> }</code><technical_language>clearer if "//*[@name='stackForm']" xpath a name</technical_language>

Target:
public void waitToolbar() { seleniumWebDriverHelper.waitVisibility(By.xpath(Locators.TOOLBAR_XPATH)); }
Source:
<code>public byte[] getRawHMAC(byte[] inputData) throws SigningException { try { <START> Mac mac = Mac.getInstance("HmacSHA1"); <END> mac.init(this.secretKey); byte[] hmacsig = mac.doFinal(inputData); return hmacsig; } catch (Exception e) { throw new SigningException("Failed to generate HMAC signature"); } }</code><technical_language>this assume SHA1 hmac, md5</technical_language>

Target:
public byte[] getRawHMAC(byte[] inputData) throws EncryptionException { try { Mac mac = Mac.getInstance(this.algorithm); mac.init(this.secretKey); byte[] hmacsig = mac.doFinal(inputData); return hmacsig; } catch (Exception e) { throw new EncryptionException("Failed to generate HMAC signature", e); } }
Source:
<code>public BasicElementVisitor(String nsUri, String localName) { if (nsUri == null) { nsUri = ""; } if (localName == null) { <START> localName = ""; <END> } this.nsUri = nsUri; this.localName = localName; }</code><technical_language>throw illegal argument exception? sense elements in namespace, element named empty string</technical_language>

Target:
public BasicElementVisitor(String nsUri, String localName) { if (nsUri == null) { nsUri = ""; } if (localName == null || localName.equals("")) { throw new IllegalArgumentException("LocalName cannot be null"); } this.nsUri = nsUri; this.localName = localName; }
Source:
<code>private static void internalDecrementCount(Map<ResourceProfile, ResourceCounter> primaryMap, ResourceProfile primaryKey, ResourceProfile secondaryKey, int decrement) { <START> primaryMap.computeIfPresent( primaryKey, (resourceProfile, resourceCounter) -> { resourceCounter.decrementCount(secondaryKey, decrement); return resourceCounter.isEmpty() ? null : resourceCounter; }); } <END></code><technical_language>computeIfPresent, ignoring attempts for decreasing non-exist primary keys silently. fail explicitly attempts</technical_language>

Target:
private static void internalDecrementCount(Map<ResourceProfile, ResourceCounter> primaryMap, ResourceProfile primaryKey, ResourceProfile secondaryKey, int decrement) { primaryMap.compute( primaryKey, (resourceProfile, resourceCounter) -> { Preconditions.checkState(resourceCounter != null, "Attempting to decrement count of %s->%s, but primary key was unknown.", resourceProfile, secondaryKey); resourceCounter.decrementCount(secondaryKey, decrement); return resourceCounter.isEmpty() ? null : resourceCounter; }); }
Source:
<code>public String getDeviceName() { String name = ""; String[] splitedJsonFile = jsonFile.split("_"); <START> if (splitedJsonFile.length > 1){ <END> name = splitedJsonFile[0].substring(0, splitedJsonFile[0].length()); } return name; }</code><technical_language>extract this magic numbers separate method add notes this magic numbers valid</technical_language>

Target:
public String getDeviceName() { String[] splitedJsonFile = jsonFile.split("_"); if (splitedJsonFile.length > 1){ return splitedJsonFile[0]; } else { return jsonFile.substring(0,jsonFile.lastIndexOf(".json")); } }
Source:
<code>private void storageDomain_SelectedItemChanged() { <START> if (getStorageDomain().getSelectedItem() != null) { <END> updateVolumeType(((StorageDomain)getStorageDomain().getSelectedItem()).getStorageType()); } updateQuota((StoragePool) getDataCenter().getSelectedItem()); }</code><technical_language>extract getStorageDomain().getSelectedItem() a variable</technical_language>

Target:
private void storageDomain_SelectedItemChanged() { StorageDomain selectedStorage = (StorageDomain) getStorageDomain().getSelectedItem(); if (selectedStorage != null) { updateVolumeType(selectedStorage.getStorageType()); } updateQuota((StoragePool) getDataCenter().getSelectedItem()); }
Source:
<code>public void validate(final UsernamePasswordCredentials credentials) { final String ticketGrantingTicketId = requestTicketGrantingTicket(credentials.getUsername(), credentials.getPassword()); <START> final HttpTGTProfile profile = new HttpTGTProfile(ticketGrantingTicketId); <END> credentials.setUserProfile(profile); }</code><technical_language>identifier for this profile? username if change actually</technical_language>

Target:
public void validate(final UsernamePasswordCredentials credentials) { if (credentials == null || credentials.getPassword() == null || credentials.getUsername() == null) { throw new TechnicalException("Credentials are required"); } final String ticketGrantingTicketId = requestTicketGrantingTicket(credentials.getUsername(), credentials.getPassword()); final HttpTGTProfile profile = new HttpTGTProfile(ticketGrantingTicketId, credentials.getUsername()); credentials.setUserProfile(profile); }
Source:
<code><START> public static <K, V> ExpiryPolicyBuilder<K, V> expiry() { <END> return new ExpiryPolicyBuilder<>(); }</code><technical_language>I this is error in generics changes... I this return ExpiryPolicyBuilder<Object, Object></technical_language>

Target:
public static ExpiryPolicyBuilder<Object, Object> expiry() { return new ExpiryPolicyBuilder<>(); }
Source:
<code>public void populate(final World world, final Random random, Chunk source) { if (random.nextInt(100) < 10) { final int x = 4 + random.nextInt(8) + source.getX() * 16; final int z = 4 + random.nextInt(8) + source.getZ() * 16; int maxY = world.getHighestBlockYAt(x, z); if (maxY < 16) { maxY = 32; } final int y = random.nextInt(maxY); new Thread() { @Override public void run() { Set<Location> snake = startSnake(world, random, x, y, z); if (random.nextInt(16) > 5) { if (y > 36) { snake = startSnake(world, random, x, y / 2, z); } else if (y < 24) { snake = startSnake(world, random, x, y * 2, z); } } } <START> } .start(); <END> } }</code><technical_language>whitespace</technical_language>

Target:
public void populate(final World world, final Random random, Chunk source) { if (random.nextInt(100) < 10) { final int x = 4 + random.nextInt(8) + source.getX() * 16; final int z = 4 + random.nextInt(8) + source.getZ() * 16; int maxY = world.getHighestBlockYAt(x, z); if (maxY < 16) { maxY = 32; } final int y = random.nextInt(maxY); Thread t = new Thread() { @Override public void run() { Set<Location> snake = startSnake(world, random, x, y, z); if (random.nextInt(16) > 5) { if (y > 36) { snake = startSnake(world, random, x, y / 2, z); } else if (y < 24) { snake = startSnake(world, random, x, y * 2, z); } } } }; t.start(); } }
Source:
<code>public ResponseEntity<ResourceSupport> deleteAdminGroup(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException, IOException { Context context = ContextUtil.obtainContext(request); Community community = communityService.find(context, uuid); if (community == null) { throw new ResourceNotFoundException("No such community: " + uuid); } <START> if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, community, <END> Constants.ADMIN, true)) { throw new AccessDeniedException("The current user was not allowed to retrieve the AdminGroup for" + " community: " + uuid); } if (community.getAdministrators() == null) { throw new UnprocessableEntityException("The community with UUID: " + uuid + " doesn't have an admin " + "group"); } communityRestRepository.deleteAdminGroup(context, community); context.complete(); return ControllerUtils.toEmptyResponse(HttpStatus.NO_CONTENT); }</code><technical_language>please org.dspace.app.util.AuthorizeUtil.authorizeManageAdminGroup(Context, Community)</technical_language>

Target:
public ResponseEntity<ResourceSupport> deleteAdminGroup(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException, IOException { Context context = ContextUtil.obtainContext(request); Community community = communityService.find(context, uuid); if (community == null) { throw new ResourceNotFoundException("No such community: " + uuid); } AuthorizeUtil.authorizeManageAdminGroup(context, community); if (community.getAdministrators() == null) { throw new UnprocessableEntityException("The community with UUID: " + uuid + " doesn't have an admin " + "group"); } communityRestRepository.deleteAdminGroup(context, community); context.complete(); return ControllerUtils.toEmptyResponse(HttpStatus.NO_CONTENT); }
Source:
<code>public boolean isTopicThroughput() { <START> return counterName.startsWith("throughput.") && metricParts == TOPIC_METRICS_PARTS; <END> }</code><technical_language>WDYT changing order of operations? (same a func code below) suggestion return metricParts == TOPIC_METRICS_PARTS && counterName.startsWith("throughput.");</technical_language>

Target:
public boolean isTopicThroughput() { return metricParts == TOPIC_METRICS_PARTS && counterName.startsWith("throughput."); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{ id: "); sb.append(this.getid()); sb.append(", connection: "); sb.append(this.getconnection()); sb.append(", iqn: "); sb.append(this.getiqn()); sb.append(", vfsType: "); sb.append(this.getVfsType()); sb.append(", mountOptions: "); sb.append(this.getMountOptions()); sb.append(", nfsVersion: "); sb.append(this.getNfsVersion()); sb.append(", nfsRetrans: "); sb.append(this.getNfsRetrans()); sb.append(", nfsTimeo: "); sb.append(this.getNfsTimeo()); if (this.getIface() != null) { sb.append(", iface: "); sb.append(this.getIface()); } if (getNetIfaceName() != null) { <START> sb.append(", netIfacename: "); <END> sb.append(this.getNetIfaceName()); } sb.append(" };"); return sb.toString(); }</code><technical_language>change this netIfaceName</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{ id: "); sb.append(this.getid()); sb.append(", connection: "); sb.append(this.getconnection()); sb.append(", iqn: "); sb.append(this.getiqn()); sb.append(", vfsType: "); sb.append(this.getVfsType()); sb.append(", mountOptions: "); sb.append(this.getMountOptions()); sb.append(", nfsVersion: "); sb.append(this.getNfsVersion()); sb.append(", nfsRetrans: "); sb.append(this.getNfsRetrans()); sb.append(", nfsTimeo: "); sb.append(this.getNfsTimeo()); if (this.getIface() != null) { sb.append(", iface: "); sb.append(this.getIface()); } if (getNetIfaceName() != null) { sb.append(", netIfaceName: "); sb.append(this.getNetIfaceName()); } sb.append(" };"); return sb.toString(); }
Source:
<code><START> public PortableInfoboxPageObject clickInternalLinkWithIndex(int index) { <END> wait.forElementVisible(internalLink.get(index)); scrollToElement(internalLink.get(index)); internalLink.get(index).click(); return this; }</code><technical_language>approach proposed in line 92 too. code duplication, :)</technical_language>

Target:
public PortableInfoboxPageObject clickInternalLinkWithIndex(int index) { return clickLink(internalLinks.get(index)); }
Source:
<code>public String handleRequest(Model model, HttpServletRequest request){ if (request.getQueryString() == null || request.getQueryString().length() == 0){ AccessGroupSet accessGroups = GroupsThreadStore.getGroups(); SearchResultResponse collectionResultResponse = queryLayer.getCollectionList(accessGroups); model.addAttribute("collectionList", collectionResultResponse.getResultList()); SearchResultResponse departmentFieldObject = queryLayer.getDepartmentList(accessGroups, null); <START> model.addAttribute("departmentList", departmentFieldObject); <END> model.addAttribute("pageSubtitle", "Advanced Search"); model.addAttribute("formatMap", LookupMappingsSettings.getMapping("advancedFormats")); return "advancedSearch"; } SearchState searchState = searchStateFactory.createSearchStateAdvancedSearch(request.getParameterMap()); String container = request.getParameter("container"); request.getSession().setAttribute("searchState", searchState); model.addAllAttributes(SearchStateUtil.generateStateParameters(searchState)); return "redirect:/search" + ((container != null && container.length() > 0)? '/' + container : ""); }</code><technical_language>This appears break advanced search page -- VM. works in master. This is exception I got: <LINK_0></technical_language>

Target:
public String handleRequest(Model model, HttpServletRequest request){ if (request.getQueryString() == null || request.getQueryString().length() == 0){ AccessGroupSet accessGroups = GroupsThreadStore.getGroups(); SearchResultResponse collectionResultResponse = queryLayer.getCollectionList(accessGroups); model.addAttribute("collectionList", collectionResultResponse.getResultList()); SearchResultResponse departmentFieldObject = queryLayer.getDepartmentList(accessGroups, null); model.addAttribute("departmentList", departmentFieldObject.getFacetFields().get(0)); model.addAttribute("pageSubtitle", "Advanced Search"); model.addAttribute("formatMap", LookupMappingsSettings.getMapping("advancedFormats")); return "advancedSearch"; } SearchState searchState = searchStateFactory.createSearchStateAdvancedSearch(request.getParameterMap()); String container = request.getParameter("container"); request.getSession().setAttribute("searchState", searchState); model.addAllAttributes(SearchStateUtil.generateStateParameters(searchState)); return "redirect:/search" + ((container != null && container.length() > 0)? '/' + container : ""); }
Source:
<code>public void init() { registerBeanDefinitionParser("publish-subscribe-channel", new RedisChannelParser()); registerBeanDefinitionParser("inbound-channel-adapter", new RedisInboundChannelAdapterParser()); registerBeanDefinitionParser("store-inbound-channel-adapter", new RedisStoreInboundChannelAdapterParser()); registerBeanDefinitionParser("store-outbound-channel-adapter", new RedisStoreOutboundChannelAdapterParser()); registerBeanDefinitionParser("outbound-channel-adapter", new RedisOutboundChannelAdapterParser()); <START> registerBeanDefinitionParser("message-driven-channel-adapter", new RedisMessageDrivenEndpointParser()); <END> registerBeanDefinitionParser("queue-outbound-channel-adapter", new RedisQueueOutboundChannelAdapterParser()); }</code><technical_language>queue-inbound-channel-adapter ?? AMQP is message-driven inbound-channel-adapter. Also, redis inbound-channel-adapter (topic) is message-driven. way, I need queue in id for consistency adapters - for example comparing this JMS, imply this adapter is a message-driven version of topic adapter</technical_language>

Target:
public void init() { registerBeanDefinitionParser("publish-subscribe-channel", new RedisChannelParser()); registerBeanDefinitionParser("inbound-channel-adapter", new RedisInboundChannelAdapterParser()); registerBeanDefinitionParser("store-inbound-channel-adapter", new RedisStoreInboundChannelAdapterParser()); registerBeanDefinitionParser("store-outbound-channel-adapter", new RedisStoreOutboundChannelAdapterParser()); registerBeanDefinitionParser("outbound-channel-adapter", new RedisOutboundChannelAdapterParser()); registerBeanDefinitionParser("queue-inbound-channel-adapter", new RedisQueueInboundChannelAdapterParser()); registerBeanDefinitionParser("queue-outbound-channel-adapter", new RedisQueueOutboundChannelAdapterParser()); }
Source:
<code>public T bucket(String name) { if (name == null) { throw new IllegalArgumentException("null bucket name"); } if (name.length() < 3 || name.length() > 63) { throw new IllegalArgumentException( name + " : " + "bucket name must be at least 3 and no more than 63 characters long"); } if (name.contains("..")) { String msg = "bucket name cannot contain successive periods. For more information refer " + "<LINK_0>"; throw new IllegalArgumentException(name + " : " + msg); } if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) { String msg = "bucket name does not follow Amazon S3 standards. For more information refer " + "<LINK_0>"; <START> throw new IllegalArgumentException(name + " : " + msg); <END> } this.name = name; return (T) this; }</code><technical_language>Please move validations a separate method called validate() validateName()</technical_language>

Target:
public T bucket(String name) { validateName(name); this.name = name; return (T) this; }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_CANCELED) { return; } switch (requestCode) { case AdCreationDialog.CAMERA_REQUEST: if (resultCode == Activity.RESULT_OK) { } break; case AdCreationDialog.PICK_IMAGE: if(resultCode == Activity.RESULT_OK){ Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query( selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex); cursor.close(); mApp.setFileUri(Uri.parse(filePath)); } break; } <START> Bitmap currBitmap = Utility.retrieveBitmap(mApp.getFileUri(), mApp.AD_WIDTH, mApp.AD_HEIGHT); <END> mApp.initAdCreationManager(currBitmap, mApp.getFileUri()); mApp.getAdCreationManager().nextStage(this, mApp.getAdCreationManager().getCurrentBitmap()); }</code><technical_language>yea, I a single place for these, lists photo sizes support. a file Dimension constants, Dimension is a class encapsulating height width</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_CANCELED) { return; } switch (requestCode) { case AdCreationDialog.CAMERA_REQUEST: if (resultCode == Activity.RESULT_OK) { } break; case AdCreationDialog.PICK_IMAGE: if(resultCode == Activity.RESULT_OK){ Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query( selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex); cursor.close(); mApp.setFileUri(Uri.parse(filePath)); } break; } Bitmap currBitmap = Utility.retrieveBitmap(mApp.getFileUri(), AdCreationManager.AD_WIDTH, AdCreationManager.AD_HEIGHT); mApp.initAdCreationManager(currBitmap, mApp.getFileUri()); mApp.getAdCreationManager().nextStage(this, mApp.getAdCreationManager().getCurrentBitmap()); }
Source:
<code>public void testReadingHierarchy() throws Exception { <START> Workpiece workpiece = MetsService.getInstance() <END> .load(new FileInputStream(new File("../Kitodo-DataFormat/src/test/resources/between.xml")), args -> { try { return new FileInputStream( new File("../Kitodo-DataFormat/src/test/resources/" + args.getLeft().getPath())); } catch (FileNotFoundException e) { throw new UncheckedIOException(e); } }); ExistingOrLinkedStructure downlink = workpiece.getStructure().getChildren().get(0); assertTrue(downlink.isLinked()); assertEquals("Leaf METS file", downlink.getLabel()); assertEquals(BigInteger.valueOf(1), ((LinkedStructure) downlink).getOrder()); assertEquals("leaf", downlink.getType()); assertEquals("leaf.xml", ((LinkedStructure) downlink).getUri().getPath()); List<LinkedStructure> uplinks = workpiece.getUplinks(); assertEquals(2, uplinks.size()); LinkedStructure top = uplinks.get(0); assertEquals("Top METS file", top.getLabel()); assertEquals(null, top.getOrder()); assertEquals("top", top.getType()); assertEquals("top.xml", top.getUri().getPath()); LinkedStructure second = uplinks.get(1); assertEquals("My branch", second.getLabel()); assertEquals(BigInteger.valueOf(10), second.getOrder()); assertEquals("two", second.getType()); assertEquals("top.xml", second.getUri().getPath()); }</code><technical_language>formatted incorrectly</technical_language>

Target:
public void testReadingHierarchy() throws Exception { Workpiece workpiece = MetsService.getInstance() .load(Files.newInputStream(Paths.get("../Kitodo-DataFormat/src/test/resources/between.xml")), (uri, couldHaveToBeWrittenInTheFuture) -> { try { return Files.newInputStream( Paths.get("../Kitodo-DataFormat/src/test/resources/" + uri.getPath())); } catch (IOException e) { throw new UncheckedIOException(e); } }); StructuralElement downlink = workpiece.getRootElement().getChildren().get(0); assertTrue(downlink.isLinked()); assertEquals("Leaf METS file", downlink.getLabel()); assertEquals(BigInteger.valueOf(1), ((LinkedStructuralElement) downlink).getOrder()); assertEquals("leaf", downlink.getType()); assertEquals("leaf.xml", ((LinkedStructuralElement) downlink).getUri().getPath()); List<LinkedStructuralElement> uplinks = workpiece.getUplinks(); assertEquals(2, uplinks.size()); LinkedStructuralElement top = uplinks.get(0); assertEquals("Top METS file", top.getLabel()); assertEquals(null, top.getOrder()); assertEquals("top", top.getType()); assertEquals("top.xml", top.getUri().getPath()); LinkedStructuralElement second = uplinks.get(1); assertEquals("My branch", second.getLabel()); assertEquals(BigInteger.valueOf(10), second.getOrder()); assertEquals("two", second.getType()); assertEquals("top.xml", second.getUri().getPath()); }
Source:
<code>public void testDeleteFileUnauthorized() throws Exception { final AzureBlobFileSystem fs = this.getFileSystem(); Path testFilePath = new Path( TEST_WRITE_THEN_READ_ONLY_PATH_PREFIX + name.getMethodName()); <START> ((MockAbfsAuthorizer) fs.getAbfsStore().getAuthorizer()) <END> .setwriteThenReadOnly(testFilePath.getName(), WriteReadMode.WRITE_MODE); fs.create(testFilePath).close(); ((MockAbfsAuthorizer) fs.getAbfsStore().getAuthorizer()) .setwriteThenReadOnly(testFilePath.getName(), WriteReadMode.READ_MODE); intercept(AbfsAuthorizationException.class, () -> { fs.delete(testFilePath, false); }); }</code><technical_language>pull this out getMockAuthorizer() {return getFileSystem().getAbfsStore.getAuthorizer()}</technical_language>

Target:
public void testDeleteFileUnauthorized() throws Exception { runTest(FileSystemOperations.DeletePath, true); }