auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SSHCredential build() { <START> if (this.sshDirectory == null) this.sshDirectory = new File(System.getProperty("user.home"), ".ssh"); <END> if (this.privateKeyIdentities == null || this.privateKeyIdentities.length == 0) { this.privateKeyIdentities = new String[]{"id_rsa", "id_dsa", "id_ecdsa"}; } if (this.knownHostsFile == null) this.knownHostsFile = "known_hosts"; return new SSHCredential(this.sshDirectory, this.privateKeyIdentities, this.passphrase, this.knownHostsFile); }</code><technical_language>minor, ".ssh", "id_rsa", "known_hosts", etc. declared constants in this file</technical_language>

Target:
public SSHCredential build() { if (this.sshDirectory == null) this.sshDirectory = DEFAULT_SSH_DIRECTORY; if (this.privateKeyIdentities == null || this.privateKeyIdentities.length == 0) { this.privateKeyIdentities = DEFAULT_PRIVATE_KEYS; } if (this.knownHostsFile == null) this.knownHostsFile = DEFAULT_KNOWN_HOSTS; return new SSHCredential(this.sshDirectory, this.privateKeyIdentities, this.passphrase, this.knownHostsFile); }
Source:
<code>protected void allocateInstance(final AllocationRequest request) { final Instance origInstance = objectManager.loadResource(Instance.class, request.getResourceId()); final List<Instance> instances = getInstancesToAllocate(origInstance); final List<Long> volumeIds = new ArrayList<>(); for (Instance instance : instances) { <START> volumeIds.addAll(InstanceHelpers.extractVolumeIdsFromMounts(instance)); <END> } LockDefinition lock = getInstanceLockDef(origInstance, instances, volumeIds); if (lock != null) { Context c = allocateLockTimer.time(); try { lockManager.lock(lock, new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { allocateInstanceInternal(request, origInstance, instances); } }); } finally { c.stop(); } } else { allocateInstanceInternal(request, origInstance, instances); } }</code><technical_language>Nit: sense volumeIds a set? If volumeId referenced diff instances, duplicates</technical_language>

Target:
protected void allocateInstance(final AllocationRequest request) { final Instance origInstance = objectManager.loadResource(Instance.class, request.getResourceId()); final List<Instance> instances = getInstancesToAllocate(origInstance); final Set<Long> volumeIds = new HashSet<>(); for (Instance instance : instances) { volumeIds.addAll(InstanceHelpers.extractVolumeIdsFromMounts(instance)); } LockDefinition lock = getInstanceLockDef(origInstance, instances, volumeIds); if (lock != null) { Context c = allocateLockTimer.time(); try { lockManager.lock(lock, new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { allocateInstanceInternal(request, origInstance, instances); } }); } finally { c.stop(); } } else { allocateInstanceInternal(request, origInstance, instances); } }
Source:
<code>private void addPrerequisites(BundleDescription bundle, Set<BundleDescription> reachable) { if (reachable.contains(bundle)) return; reachable.add(bundle); List<BundleDescription> depList = ((BundleDescriptionImpl) bundle).getBundleDependencies(); BundleDescription[] dependencies = depList.toArray(new BundleDescription[depList.size()]); for (BundleDescription <START> dependencie : <END> dependencies) { addPrerequisites(dependencie, reachable); } }</code><technical_language>name dependency</technical_language>

Target:
private void addPrerequisites(BundleDescription bundle, Set<BundleDescription> reachable) { if (reachable.contains(bundle)) return; reachable.add(bundle); List<BundleDescription> depList = ((BundleDescriptionImpl) bundle).getBundleDependencies(); BundleDescription[] dependencies = depList.toArray(new BundleDescription[depList.size()]); for (BundleDescription dependency : dependencies) { addPrerequisites(dependency, reachable); } }
Source:
<code>public static void tieSystemOutAndErrToLog() { org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); Appender appender = rootLogger.getAppender(DT_LOG_APPENDER); if (appender instanceof RollingFileAppender) { RollingFileAppender rfa = (RollingFileAppender)appender; if (rfa.getFile() == null || rfa.getFile().isEmpty()) { rfa.setFile(System.getProperty(DT_LOGDIR)); rfa.activateOptions(); } } else if (appender != null) { logger.warn("found appender instead of RollingFileAppender", appender); } System.setOut(createLoggingProxy(System.out)); System.setErr(createLoggingProxy(System.err)); <START> LoggerUtil.addAppender("apex"); <END> }</code><technical_language>DT_LOG_APPENDER is configured above. repurposed for this? Also, createLoggingProxy is a pass system out err out err usual. proxies needed</technical_language>

Target:
public static void tieSystemOutAndErrToLog() { org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); Appender appender = rootLogger.getAppender(DT_LOG_APPENDER); if (appender instanceof RollingFileAppender) { RollingFileAppender rfa = (RollingFileAppender)appender; if (rfa.getFile() == null || rfa.getFile().isEmpty()) { rfa.setFile(System.getProperty(DT_LOGDIR)); rfa.activateOptions(); } } else if (appender != null) { logger.warn("found appender instead of RollingFileAppender", appender); } LoggerUtil.addAppenders(); System.setOut(createLoggingProxy(System.out)); System.setErr(createLoggingProxy(System.err)); }
Source:
<code>public void handle(Request request, Response response) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { QualityGateConditionDto condition = wsSupport.getCondition(dbSession, conditionId); QualityGateDto qualityGateDto = dbClient.qualityGateDao().selectById(dbSession, condition.getQualityGateId()); <START> String message = format("Condition '%s' is linked to an unknown quality gate '%s'", conditionId, condition.getQualityGateId()); <END> checkState(qualityGateDto != null, message); wsSupport.checkCanEdit(qualityGateDto); dbClient.gateConditionDao().delete(condition, dbSession); dbSession.commit(); response.noContent(); } }</code><technical_language>I this message field removed in checkState</technical_language>

Target:
public void handle(Request request, Response response) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { QualityGateConditionDto condition = wsSupport.getCondition(dbSession, conditionId); QualityGateDto qualityGateDto = dbClient.qualityGateDao().selectById(dbSession, condition.getQualityGateId()); checkState(qualityGateDto != null, "Condition '%s' is linked to an unknown quality gate '%s'", conditionId, condition.getQualityGateId()); wsSupport.checkCanEdit(qualityGateDto); dbClient.gateConditionDao().delete(condition, dbSession); dbSession.commit(); response.noContent(); } }
Source:
<code>public void launchTargetsChanged() { <START> targetSelector.refresh(); <END> }</code><technical_language>null check</technical_language>

Target:
public void launchTargetsChanged() { if (targetSelector!=null){ targetSelector.refresh(); } }
Source:
<code>public Object[][] dictionaries() { return new Object[][]{ new Object[]{"test1_comp.interval_list", "test1.dict"}, new Object[]{"test1.vcf", "test1.dict"}, new Object[]{"test1.dict", "test1.dict"}, new Object[]{"empty.interval_list", "test1.dict"}, new Object[]{"Homo_sapiens_assembly18.trimmed.fasta", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"test2_comp.interval_list", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"ScreenSamReads.100.input.sam", "test3_comp.interval_list"}, <START> }; <END> }</code><technical_language>is this test case removed</technical_language>

Target:
public Object[][] dictionaries() { return new Object[][]{ new Object[]{"test1_comp.interval_list", "test1.dict"}, new Object[]{"test1.vcf", "test1.dict"}, new Object[]{"test1.dict", "test1.dict"}, new Object[]{"empty.interval_list", "test1.dict"}, new Object[]{"Homo_sapiens_assembly18.trimmed.fasta", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"test2_comp.interval_list", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"ScreenSamReads.100.input.sam", "test3_comp.interval_list"}, new Object[]{"ScreenSamReads.100.input.sam", "test4_comp.interval_list"}, }; }
Source:
<code>private void detectContainersEvents() { <START> executorService.execute(new Runnable() { <END> @Override public void run() { while (true) { try { dockerConnector.getEvents(lastProcessedEventDate, 0, new Filters().withFilter("event", "die", "oom"), new EventsProcessor()); } catch (IOException ignore) { } } } }); }</code><technical_language>Runnable -> lambda</technical_language>

Target:
private void detectContainersEvents() { executorService.execute(() -> { while (true) { try { dockerConnector.getEvents(lastProcessedEventDate, 0, new Filters().withFilter("event", "die", "oom"), new EventsProcessor()); } catch (IOException e) { LOG.debug(e.getLocalizedMessage(), e); } } }); }
Source:
<code>public static RyaStreamsClient make( final String ryaInstance, final String kafkaHostname, final int kafkaPort) { requireNonNull(kafkaHostname); <START> <END> final Producer<?, QueryChange> queryProducer = makeProducer(kafkaHostname, kafkaPort, StringSerializer.class, QueryChangeSerializer.class); final Consumer<?, QueryChange>queryConsumer = fromStartConsumer(kafkaHostname, kafkaPort, StringDeserializer.class, QueryChangeDeserializer.class); final String changeLogTopic = KafkaTopics.queryChangeLogTopic(ryaInstance); final QueryChangeLog changeLog = new KafkaQueryChangeLog(queryProducer, queryConsumer, changeLogTopic); final QueryRepository queryRepo = new InMemoryQueryRepository(changeLog); return new RyaStreamsClient( new DefaultAddQuery(queryRepo), new DefaultGetQuery(queryRepo), new DefaultDeleteQuery(queryRepo), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityStatementDeserializer.class), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityBindingSetDeserializer.class), new DefaultListQueries(queryRepo), new DefaultStartQuery(queryRepo), new DefaultStopQuery(queryRepo)) { @Override public void close() { try { queryRepo.close(); } catch (final Exception e) { log.warn("Couldn't close a QueryRepository.", e); } } }; }</code><technical_language>Null check ryaInstance</technical_language>

Target:
public static RyaStreamsClient make( final String ryaInstance, final String kafkaHostname, final int kafkaPort) { requireNonNull(ryaInstance); requireNonNull(kafkaHostname); final Producer<?, QueryChange> queryProducer = makeProducer(kafkaHostname, kafkaPort, StringSerializer.class, QueryChangeSerializer.class); final Consumer<?, QueryChange>queryConsumer = fromStartConsumer(kafkaHostname, kafkaPort, StringDeserializer.class, QueryChangeDeserializer.class); final String changeLogTopic = KafkaTopics.queryChangeLogTopic(ryaInstance); final QueryChangeLog changeLog = new KafkaQueryChangeLog(queryProducer, queryConsumer, changeLogTopic); final QueryRepository queryRepo = new InMemoryQueryRepository(changeLog); return new RyaStreamsClient( new DefaultAddQuery(queryRepo), new DefaultGetQuery(queryRepo), new DefaultDeleteQuery(queryRepo), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityStatementDeserializer.class), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityBindingSetDeserializer.class), new DefaultListQueries(queryRepo), new DefaultStartQuery(queryRepo), new DefaultStopQuery(queryRepo)) { @Override public void close() { try { queryRepo.close(); } catch (final Exception e) { log.warn("Couldn't close a QueryRepository.", e); } } }; }
Source:
<code>public static User createUserEntity(String firstName, String lastName, String mobileNumber, String nickname, String vpnPassword) { MessageSource anonymousMessageSource = MessageSource.createInstance(); UserAnonymized johnAnonymized = UserAnonymized.createInstance(anonymousMessageSource.getDestination(), Collections.emptySet()); UserAnonymized.getRepository().save(johnAnonymized); byte[] initializationVector = CryptoSession.getCurrent().generateInitializationVector(); MessageSource namedMessageSource = MessageSource.createInstance(); UserPrivate userPrivate = UserPrivate.createInstance(nickname, vpnPassword, johnAnonymized.getId(), anonymousMessageSource.getId(), namedMessageSource); <START> return new User(UUID.randomUUID(), initializationVector, firstName, lastName, mobileNumber, userPrivate, <END> namedMessageSource.getDestination()); }</code><technical_language>this saved in UserRepository too</technical_language>

Target:
public static User createUserEntity(String firstName, String lastName, String mobileNumber, String nickname, String vpnPassword) { MessageSource anonymousMessageSource = MessageSource.createInstance(); UserAnonymized johnAnonymized = UserAnonymized.createInstance(anonymousMessageSource.getDestination(), Collections.emptySet()); UserAnonymized.getRepository().save(johnAnonymized); byte[] initializationVector = CryptoSession.getCurrent().generateInitializationVector(); MessageSource namedMessageSource = MessageSource.createInstance(); UserPrivate userPrivate = UserPrivate.createInstance(nickname, vpnPassword, johnAnonymized.getId(), anonymousMessageSource.getId(), namedMessageSource); User user = new User(UUID.randomUUID(), initializationVector, firstName, lastName, mobileNumber, userPrivate, namedMessageSource.getDestination()); return User.getRepository().save(user); }
Source:
<code>public PartitionedFile finish() throws IOException { checkState(!isFinished, "File writer is already finished."); checkState(dataFileChannel != null && indexFileChannel != null, "Must open the partitioned file first."); isFinished = true; writeRegionIndex(); flushIndexBuffer(); indexBuffer.rewind(); dataFileChannel.close(); indexFileChannel.close(); <START> <END> ByteBuffer indexDataCache = canCacheAllIndexData ? indexBuffer : null; return new PartitionedFile(numRegions, numSubpartitions, dataFilePath, indexFilePath, indexDataCache); }</code><technical_language>dataFileChannel indexFileChannel created data output driven. I wondering exist case of empty output? operator filters input data output, finished finally. If so, remove check avoid unnecessary failure</technical_language>

Target:
public PartitionedFile finish() throws IOException { checkState(!isFinished, "File writer is already finished."); checkState(!isClosed, "File writer is already closed."); isFinished = true; writeDataCache.flip(); if (writeDataCache.hasRemaining()) { BufferReaderWriterUtil.writeBuffer(dataFileChannel, writeDataCache); } writeDataCache = null; writeRegionIndex(); flushIndexBuffer(); indexBuffer.rewind(); close(); ByteBuffer indexEntryCache = null; if (allIndexEntriesCached) { indexEntryCache = indexBuffer; } indexBuffer = null; return new PartitionedFile( numRegions, numSubpartitions, dataFilePath, indexFilePath, indexEntryCache); }
Source:
<code>boolean execute(boolean batched) throws SQLException { throwIfUnboundParameters(); if (!batched && statement.getOperation().isMutation() && !batch.isEmpty()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.EXECUTE_UPDATE_WITH_NON_EMPTY_BATCH) .build().buildException(); } if (statement.getOperation().isMutation()) { <START> executeMutation(statement, createQueryLogger(statement,query)); <END> return false; } executeQuery(statement, createQueryLogger(statement,query)); return true; }</code><technical_language>nit: spaces commas (applicable everywhere)</technical_language>

Target:
boolean execute(boolean batched) throws SQLException { throwIfUnboundParameters(); if (!batched && statement.getOperation().isMutation() && !batch.isEmpty()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.EXECUTE_UPDATE_WITH_NON_EMPTY_BATCH) .build().buildException(); } if (statement.getOperation().isMutation()) { executeMutation(statement); return false; } executeQuery(statement, createQueryLogger(statement,query)); return true; }
Source:
<code>private Scheduler getScheduler(Config schedulerConfig, ZoneId workflowTimeZone, boolean throwUnusedKeys) { Set<String> shouldBeUsedKeys = new HashSet<>(schedulerConfig.getKeys()); CheckedConfig.UsedKeysSet usedKeys = new CheckedConfig.UsedKeysSet(); Config c = new CheckedConfig(schedulerConfig, usedKeys); String type; if (c.has("_type")) { type = c.get("_type", String.class); } else { java.util.Optional<String> operatorKey = c.getKeys() .stream() .filter(key -> key.endsWith(">")) .findFirst(); if (!operatorKey.isPresent()) { throw new ConfigException("Schedule config requires 'type>: at' parameter: " + c); } type = operatorKey.get().substring(0, operatorKey.get().length() - 1); Object command = c.get(operatorKey.get(), Object.class); c.set("_type", type); c.set("_command", command); } for(String param : BUILT_IN_SCHEDULE_PARAMS){ usedKeys.add(param); } SchedulerFactory factory = types.get(type); if (factory == null) { throw new ConfigException("Unknown scheduler type: " + type); } if (!usedKeys.isAllUsed()) { shouldBeUsedKeys.removeAll(usedKeys); if (!shouldBeUsedKeys.isEmpty()) { for (String key: shouldBeUsedKeys) { if (throwUnusedKeys) <START> throw new UnusedConfigException(getWarnUnusedKey(key, usedKeys)); <END> else logger.error(getWarnUnusedKey(key, usedKeys)); } } } return factory.newScheduler(c, workflowTimeZone); }</code><technical_language>Showing logging in this loop is good (it's consistent OperatorManager) throwing exception a downside. throwing exception leave this loop, users unused key a time. moving throw loop if throwUnusedKeys is set? concatenate messages of getWarnUnusedKey \n message of UnusedConfigException</technical_language>

Target:
private Scheduler getScheduler(Config schedulerConfig, ZoneId workflowTimeZone, boolean throwUnusedKeys) { Set<String> shouldBeUsedKeys = new HashSet<>(schedulerConfig.getKeys()); CheckedConfig.UsedKeysSet usedKeys = new CheckedConfig.UsedKeysSet(); Config c = new CheckedConfig(schedulerConfig, usedKeys); String type; if (c.has("_type")) { type = c.get("_type", String.class); } else { java.util.Optional<String> operatorKey = c.getKeys() .stream() .filter(key -> key.endsWith(">")) .findFirst(); if (!operatorKey.isPresent()) { throw new ConfigException("Schedule config requires 'type>: at' parameter: " + c); } type = operatorKey.get().substring(0, operatorKey.get().length() - 1); Object command = c.get(operatorKey.get(), Object.class); c.set("_type", type); c.set("_command", command); } for(String param : BUILT_IN_SCHEDULE_PARAMS){ usedKeys.add(param); } SchedulerFactory factory = types.get(type); if (factory == null) { throw new ConfigException("Unknown scheduler type: " + type); } if (!usedKeys.isAllUsed()) { shouldBeUsedKeys.removeAll(usedKeys); if (!shouldBeUsedKeys.isEmpty()) { StringBuilder buf = new StringBuilder(); for (String key: shouldBeUsedKeys) { buf.append(getWarnUnusedKey(key, usedKeys)); buf.append("\n"); } if (throwUnusedKeys) throw new UnusedConfigException(buf.toString()); else logger.error(buf.toString()); } } return factory.newScheduler(c, workflowTimeZone); }
Source:
<code>public int get(int index) { <START> return this.data[index] & 0xFFFF; <END> }</code><technical_language>yeah needed</technical_language>

Target:
public int get(int index) { return this.data[index]; }
Source:
<code>Future<HeaderCacheElement> asyncRefresh() { LOG.trace("asyncRefresh"); synchronized (lock) { if (isRefreshing) { LOG.trace("asyncRefresh is already in progress"); return futureToken; } isRefreshing = true; LOG.trace("asyncRefresh taking ownership"); try { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { try { HeaderCacheElement newToken = refreshCredentials(); return updateToken(newToken); } finally { futureToken = null; <START> isRefreshing = false; <END> } } }); } catch (RuntimeException e) { isRefreshing = false; throw e; } return this.futureToken; } }</code><technical_language>this moved updateToken? I needs part of synchronization block</technical_language>

Target:
Future<HeaderCacheElement> asyncRefresh() { LOG.trace("asyncRefresh"); synchronized (lock) { if (isRefreshing) { LOG.trace("asyncRefresh is already in progress"); return futureToken; } isRefreshing = true; LOG.trace("asyncRefresh taking ownership"); try { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { HeaderCacheElement newToken = refreshCredentials(); return updateToken(newToken); } }); } catch (RuntimeException e) { isRefreshing = false; throw e; } return this.futureToken; } }
Source:
<code>private void checkJWT() { RSAPrivateKey rsaPrivateKey = null; try { String pemFileContent = FileUtils .readFileToString(new File(gitHubPrimaryKeyFile), "UTF-8"); pemFileContent = pemFileContent .replaceAll("\\n", "") .replace("-----BEGIN PRIVATE KEY-----", "") .replace("-----END PRIVATE KEY-----", ""); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(pemFileContent)); rsaPrivateKey = (RSAPrivateKey)keyFactory.generatePrivate(pkcs8EncodedKeySpec); } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException ex) { <START> LOG.error(ex.getMessage()); <END> } if (rsaPrivateKey != null) { final int tenMinutes = 600000; try { Algorithm algorithm = Algorithm.RSA256(null, rsaPrivateKey); String jsonWebToken = JWT.create() .withIssuer(gitHubAppId) .withIssuedAt(new Date()) .withExpiresAt(new Date(Calendar.getInstance().getTimeInMillis() + tenMinutes)) .sign(algorithm); CacheConfigManager.setJsonWebToken(jsonWebToken); } catch (JWTCreationException ex) { LOG.error(ex.getMessage()); } } }</code><technical_language>Log exception well. I I harping this, if errors start happening in production, useful exception logged figure out is on</technical_language>

Target:
private void checkJWT() { RSAPrivateKey rsaPrivateKey = null; try { String pemFileContent = FileUtils .readFileToString(new File(gitHubPrivateKeyFile), Charset.forName("UTF-8")); pemFileContent = pemFileContent .replaceAll("\\n", "") .replace("-----BEGIN PRIVATE KEY-----", "") .replace("-----END PRIVATE KEY-----", ""); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(pemFileContent)); rsaPrivateKey = (RSAPrivateKey)keyFactory.generatePrivate(pkcs8EncodedKeySpec); } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException ex) { LOG.error(ex.getMessage(), ex); } if (rsaPrivateKey != null) { final int tenMinutes = 600000; try { Algorithm algorithm = Algorithm.RSA256(null, rsaPrivateKey); String jsonWebToken = JWT.create() .withIssuer(gitHubAppId) .withIssuedAt(new Date()) .withExpiresAt(new Date(Calendar.getInstance().getTimeInMillis() + tenMinutes)) .sign(algorithm); CacheConfigManager.setJsonWebToken(jsonWebToken); } catch (JWTCreationException ex) { LOG.error(ex.getMessage(), ex); } } }
Source:
<code>void unzoom(final MUIElement element) { MWindow win = getWindowFor(element); Shell hostShell = (Shell) win.getWidget(); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); List<MUIElement> elementsToRestore = getElementsToRestore(element); for (MUIElement toRestore : elementsToRestore) { toRestore.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM); toRestore.getTags().remove(IPresentationEngine.MINIMIZED); } adjustCTFButtons(element); if (MPartStack.class.isInstance(element)) { MArea area = getAreaFor(MPartStack.class.cast(element)); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); <START> ignoreTagChanges = true; <END> placeholder.getTags().remove(MAXIMIZED); ignoreTagChanges = false; adjustCTFButtons(placeholder); } } partService.requestActivation(); }</code><technical_language>ignoreTagChanges needs in a try/finally tag add removal trigger a lot of code</technical_language>

Target:
void unzoom(final MUIElement element) { MWindow win = getWindowFor(element); Shell hostShell = (Shell) win.getWidget(); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); List<MUIElement> elementsToRestore = getElementsToRestore(element); for (MUIElement toRestore : elementsToRestore) { toRestore.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM); toRestore.getTags().remove(IPresentationEngine.MINIMIZED); } adjustCTFButtons(element); if (element instanceof MPartStack) { MArea area = getAreaFor((MPartStack) element); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); ignoreTagChanges = true; try { placeholder.getTags().remove(MAXIMIZED); } finally { ignoreTagChanges = false; } adjustCTFButtons(placeholder); } } partService.requestActivation(); }
Source:
<code>HystrixInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch, Object fallback) { this.target = checkNotNull(target, "target"); this.dispatch = checkNotNull(dispatch, "dispatch"); this.fallback = fallback; <START> this.toFallback = toFallbackMethod(dispatch); <END> }</code><technical_language>do need save this? if do this instead? this.fallback = fallback; // invoke fallbacks package-private interfaces for (Method method : dispatch.keySet()) { method.setAccessible(true); }</technical_language>

Target:
HystrixInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch, Object fallback) { this.target = checkNotNull(target, "target"); this.dispatch = checkNotNull(dispatch, "dispatch"); this.fallback = fallback; this.fallbackMethodMap = toFallbackMethod(dispatch); }
Source:
<code>public String getComponentName() { if (this.beanName != null) { return "Final '" + this.beanName + "' channel"; } else { <START> return "Unnamed final channel"; <END> } }</code><technical_language>change final messages too</technical_language>

Target:
public String getComponentName() { if (this.beanName != null) { return this.beanName; } else { return "Unnamed fixed subscriber channel"; } }
Source:
<code>public Consumer createConsumer(Processor processor) { <START> return new WekaConsumer(this, processor); <END> }</code><technical_language>need call configureConsumer too, other components</technical_language>

Target:
public Consumer createConsumer(Processor processor) { throw new UnsupportedOperationException(); }
Source:
<code>protected Collection<Address> getPossibleAddressesForInitialJoin() { long deadLine = System.nanoTime() + SECONDS.toNanos(maximumWaitingTimeBeforeJoinSeconds); <START> for (int i = 0; System.nanoTime() - deadLine < 0; i++) { <END> Collection<Address> possibleAddresses = getPossibleAddresses(); if (!possibleAddresses.isEmpty()) { return possibleAddresses; } idleStrategy.idle(i); } return Collections.emptyList(); }</code><technical_language>this one. Please pull this out of this PR related timing lets run some ad hoc examples run some nasty overflow/sign related problems</technical_language>

Target:
protected Collection<Address> getPossibleAddressesForInitialJoin() { long deadLine = System.nanoTime() + SECONDS.toNanos(maximumWaitingTimeBeforeJoinSeconds); for (int i = 0; System.nanoTime() < deadLine; i++) { Collection<Address> possibleAddresses = getPossibleAddresses(); if (!possibleAddresses.isEmpty()) { return possibleAddresses; } idleStrategy.idle(i); } return Collections.emptyList(); }
Source:
<code>public synchronized void join(long timeout) throws InterruptedException { long now = System.currentTimeMillis(); long end = now + timeout; while (now < end && (inClosed == null || outClosed == null)) { <START> wait(now - end); <END> now = System.currentTimeMillis(); } }</code><technical_language>if clock moves pass a negative 0 wait</technical_language>

Target:
public synchronized void join(long timeout) throws InterruptedException { long now = System.nanoTime(); long end = now + TimeUnit.MILLISECONDS.toNanos(timeout); while ((end - now > 0L) && (inClosed == null || outClosed == null)) { wait(TimeUnit.NANOSECONDS.toMillis(end - now)); now = System.nanoTime(); } }
Source:
<code>private void assertThatTimeAndLockMetricsAreRecorded(String timestampMetric, String lockMetric) { MetricRegistry metrics = MetricRegistries.createWithHdrHistogramReservoirs(); <START> AtlasDbMetrics.setMetricRegistry(metrics); <END> assertThat(metrics.timer(timestampMetric).getCount(), is(equalTo(0L))); assertThat(metrics.timer(lockMetric).getCount(), is(equalTo(0L))); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = getLockAndTimestampServices(); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.timelock().currentTimeMillis(); assertThat(metrics.timer(timestampMetric).getCount(), is(equalTo(1L))); assertThat(metrics.timer(lockMetric).getCount(), is(equalTo(1L))); }</code><technical_language>want MetricsRule handle saving & restoring metrics @Rule public MetricsRule metricsRule = new MetricsRule();</technical_language>

Target:
private void assertThatTimeAndLockMetricsAreRecorded(String timestampMetric, String lockMetric) { assertThat(metricsRule.metrics().timer(timestampMetric).getCount(), is(equalTo(0L))); assertThat(metricsRule.metrics().timer(lockMetric).getCount(), is(equalTo(0L))); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = getLockAndTimestampServices(); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.timelock().currentTimeMillis(); assertThat(metricsRule.metrics().timer(timestampMetric).getCount(), is(equalTo(1L))); assertThat(metricsRule.metrics().timer(lockMetric).getCount(), is(equalTo(1L))); }
Source:
<code><START> public String toString() { <END> return "KafkaEmitterConfig{" + "bootstrap.servers='" + bootstrapServers + ", metric.topic=" + metricTopic + ", alert.topic=" + alertTopic + ", clusterName=" + clusterName + ", producer.config={" + kafkaProducerConfig.toString() + "}}"; }</code><technical_language>a big deal, if IntelliJ, get auto-generate toString, hashCode, equals in style other Druid code automatically</technical_language>

Target:
public String toString() { return "KafkaEmitterConfig{" + "bootstrap.servers='" + bootstrapServers + '\'' + ", metric.topic='" + metricTopic + '\'' + ", alert.topic='" + alertTopic + '\'' + ", clusterName='" + clusterName + '\'' + ", Producer.config=" + kafkaProducerConfig + '}'; }
Source:
<code>public void testBloomFilterVirtualColumnNumber() throws Exception { BloomKFilter filter = new BloomKFilter(1500); <START> filter.addFloat(20.2f); <END> byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = StringUtils.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(2 * CAST(dim1 AS float), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(QSS(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( EXPRESSION_VIRTUAL_COLUMN("v0", "(2 * CAST(\"dim1\", 'DOUBLE'))", ValueType.FLOAT) ) .filters( new BloomDimFilter("v0", BloomKFilterHolder.fromBloomKFilter(filter), null) ) .aggregators(AGGS(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }</code><technical_language>this change is needed</technical_language>

Target:
public void testBloomFilterVirtualColumnNumber() throws Exception { BloomKFilter filter = new BloomKFilter(1500); filter.addFloat(20.2f); byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = StringUtils.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(2 * CAST(dim1 AS float), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(2 * CAST(\"dim1\", 'DOUBLE'))", ValueType.FLOAT) ) .filters( new BloomDimFilter("v0", BloomKFilterHolder.fromBloomKFilter(filter), null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }
Source:
<code>public void testCountStarWithDegenerateFilter() throws Exception { testQuery( "SELECT COUNT(*) FROM druid.foo WHERE dim2 = 'a' and (dim1 > 'a' OR dim1 < 'b')", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .filters( selector("dim2", "a", null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( <START> new Object[]{NullHandling.sqlCompatible() ? 2L : 2L} <END> ) ); }</code><technical_language>drop ternary condition</technical_language>

Target:
public void testCountStarWithDegenerateFilter() throws Exception { testQuery( "SELECT COUNT(*) FROM druid.foo WHERE dim2 = 'a' and (dim1 > 'a' OR dim1 < 'b')", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .filters( selector("dim2", "a", null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{2L} ) ); }
Source:
<code>private static String getSecretStreamXchacha20poly1305EncryptedBase64String(final byte[] state, final String data, final short tag) { final int[] clen = new int[0]; <START> final byte[] ad = new byte[0]; <END> final byte[] dataBytes = data.getBytes(); final byte[] encryptedData = new byte[dataBytes.length + XCHACHA20POLY1305_ABYTES]; NaCl.sodium().crypto_secretstream_xchacha20poly1305_push( state, encryptedData, clen, dataBytes, dataBytes.length, ad, 0, tag); return Base64.encodeToString(encryptedData, BASE64_ENCODE_FLAGS); }</code><technical_language>variable names a unclear - give more descriptive names</technical_language>

Target:
private static String getSecretStreamXchacha20poly1305EncryptedBase64String(final byte[] state, final String data, final short tag) { final int[] encryptedDataLengthOutput = new int[0]; final byte[] additionalData = new byte[0]; final int additionalDataLength = 0; final byte[] dataBytes = data.getBytes(); final byte[] encryptedData = new byte[dataBytes.length + XCHACHA20POLY1305_ABYTES]; NaCl.sodium().crypto_secretstream_xchacha20poly1305_push( state, encryptedData, encryptedDataLengthOutput, dataBytes, dataBytes.length, additionalData, additionalDataLength, tag); return Base64.encodeToString(encryptedData, BASE64_ENCODE_FLAGS); }
Source:
<code><START> private static GatewaySenderEventImpl createMockGatewaySenderEventImpl(int transactionId, <END> boolean isLastEventInTransaction, Region region) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); when(event.getRegion()).thenReturn(region); return event; }</code><technical_language>This method need static</technical_language>

Target:
private GatewaySenderEventImpl createMockGatewaySenderEventImpl(int transactionId, boolean isLastEventInTransaction, Region region) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); when(event.getRegion()).thenReturn(region); return event; }
Source:
<code>private static Integer getSelectionIndex(SWTBotView viewBot) { final TimeGraphControl timegraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); <START> return UIThreadRunnable.syncExec(new IntResult() { <END> @Override public Integer run() { return timegraph.getSelectedIndex(); } }); }</code><technical_language>lambda</technical_language>

Target:
private static Integer getSelectionIndex(SWTBotView viewBot) { final TimeGraphControl timegraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); return UIThreadRunnable.syncExec(() -> { return timegraph.getSelectedIndex(); }); }
Source:
<code>protected CompletionStage<Void> asyncWrite(MultipartOutput multipartOutput, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, AsyncOutputStream entityStream) { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) boundary = multipartOutput.getBoundary(); httpHeaders.putSingle(HttpHeaderNames.CONTENT_TYPE, mediaType.toString() + "; boundary=" + multipartOutput.getBoundary()); <START> byte[] boundaryBytes = ("--" + boundary).getBytes(); <END> return asyncWriteParts(multipartOutput, entityStream, boundaryBytes) .thenCompose(v -> entityStream.asyncWrite(boundaryBytes)) .thenCompose(v -> entityStream.asyncWrite("--".getBytes())); }</code><technical_language>getBytes a charset</technical_language>

Target:
protected CompletionStage<Void> asyncWrite(MultipartOutput multipartOutput, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, AsyncOutputStream entityStream) { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) boundary = multipartOutput.getBoundary(); httpHeaders.putSingle(HttpHeaderNames.CONTENT_TYPE, mediaType.toString() + "; boundary=" + multipartOutput.getBoundary()); byte[] boundaryBytes = ("--" + boundary).getBytes(StandardCharsets.US_ASCII); return asyncWriteParts(multipartOutput, entityStream, boundaryBytes) .thenCompose(v -> entityStream.asyncWrite(boundaryBytes)) .thenCompose(v -> entityStream.asyncWrite(DOUBLE_DASH_BYTES)); }
Source:
<code><START> public void setExpirationTimer(String number, int messageExpirationTimer) throws InvalidNumberException { <END> ContactInfo c = account.getContactStore().getContact(canonicalizeAndResolveSignalServiceAddress(number)); c.messageExpirationTime = messageExpirationTimer; System.err.println("Set message expiration " + c.number + " -> " + c.messageExpirationTime + " seconds"); account.getContactStore().updateContact(c); account.save(); }</code><technical_language>please method SignalServiceAddress parameter add a new method (with name) takes a String canonicalizeAndResolveSignalServiceAddress conversion</technical_language>

Target:
public void setExpirationTimer(String number, int messageExpirationTimer) throws IOException, InvalidNumberException { SignalServiceAddress address = canonicalizeAndResolveSignalServiceAddress(number); setExpirationTimer(address, messageExpirationTimer); }
Source:
<code>public SimpleMapPersistable(IMemento memento) throws ClassNotFoundException { <START> IMemento type = memento.getChild(KEY_TYPE); <END> fType = (Class<V>)Class.forName(type.getTextData()); IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = new TreeMap<String, V>(); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } synchronized(fValues) { fValues.clear(); fValues.putAll(values); } }</code><technical_language>is receive a memento populated KEY_TYPE causing type null generating a null pointer exception, This present in logic of "restore" method, nice more robust throw types of exceptions wrap a CoreException</technical_language>

Target:
public SimpleMapPersistable(IMemento memento) throws CoreException { IMemento type = memento.getChild(KEY_TYPE); if (type == null) { throw new CoreException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Missing key for type.", null)); } try { fType = (Class<V>)Class.forName(type.getTextData()); } catch (ClassNotFoundException e) { throw new CoreException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, e.getMessage(), e)); } IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = new TreeMap<String, V>(); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } synchronized(fValues) { fValues.clear(); fValues.putAll(values); } }
Source:
<code>public RulesProcessor build() { ObjectMapper mapper = new ObjectMapper(); RulesProcessor rulesProcessor = null; try { rulesProcessor = mapper.readValue(json, RulesProcessor.class); } catch (IOException e) { <START> log.error("Error creating RulesProcessor object when deserializing JSON string. Check JSON string.", e); <END> } return rulesProcessor; }</code><technical_language>if log JSON string , helps in debugging storm side</technical_language>

Target:
public RulesProcessor build() { ObjectMapper mapper = new ObjectMapper(); RulesProcessor rulesProcessor = null; try { rulesProcessor = mapper.readValue(rulesProcessorJson, RulesProcessor.class); } catch (IOException e) { LOG.error("Error during deserialization of JSON string: {}", rulesProcessorJson, e); } return rulesProcessor; }
Source:
<code>public void createWithPrimaryKeyField_invalidFieldNameThrows() { <START> String[] fieldNames = new String[] { null, "", "foo.bar", TestHelper.getRandomString(65) }; <END> for (String fieldName : fieldNames) { try { realmSchema.createWithPrimaryKeyField("Foo", fieldName, int.class); fail(); } catch (IllegalArgumentException ignored) { } } }</code><technical_language>invalidNamesor invalidFieldNames is fieldNames</technical_language>

Target:
public void createWithPrimaryKeyField_invalidFieldNameThrows() { String[] invalidFieldNames = new String[] { null, "", "foo.bar", TestHelper.getRandomString(65) }; for (String fieldName : invalidFieldNames) { try { realmSchema.createWithPrimaryKeyField("Foo", fieldName, int.class); fail(); } catch (IllegalArgumentException ignored) { } } }
Source:
<code><START> protected Map<String, Object> getEntityFromResultSet(ResultSet resultSet) <END> throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); Map<String, Object> resultsMap = new HashMap<>(); for (int i = 1; i <= columnCount; ++i) { String columnName = metaData.getColumnName(i).toLowerCase(); Object object = resultSet.getObject(i); resultsMap.put(columnName, object); } return resultsMap; }</code><technical_language>this method member variables a static method</technical_language>

Target:
protected static Map<String, Object> getEntityFromResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); Map<String, Object> resultsMap = new HashMap<>(); for (int i = 1; i <= columnCount; ++i) { String columnName = metaData.getColumnName(i).toLowerCase(); Object object = resultSet.getObject(i); resultsMap.put(columnName, object); } return resultsMap; }
Source:
<code>public void reconfigure(Map<String, ?> configs) { synchronized (LOCK) { <START> this.mbeanPredicate = JmxReporter.compilePredicate(configPrefix, configs); <END> mbeans.forEach((name, mbean) -> { if (mbeanPredicate.test(name)) { reregister(mbean); } else { unregister(mbean); } }); } }</code><technical_language>I a good reason this a java.util.function.Predicate a regular instance method call. calling function (the predicate function is else). I agree compile whitelist blacklist regex of time, more straightforward do in reconfigure function itself</technical_language>

Target:
public void reconfigure(Map<String, ?> configs) { synchronized (LOCK) { this.mbeanPredicate = JmxReporter.compilePredicate(configs); mbeans.forEach((name, mbean) -> { if (mbeanPredicate.test(name)) { reregister(mbean); } else { unregister(mbean); } }); } }
Source:
<code>public UpdateQuery build() { <START> Checks.checkNotNull(uri, "Please specify uri"); <END> return new UpdateQuery( uri, where, whereArgs ); }</code><technical_language>Static import</technical_language>

Target:
public UpdateQuery build() { checkNotNull(uri, "Please specify uri"); return new UpdateQuery( uri, where, whereArgs ); }
Source:
<code><START> protected DocumentModel createFileDocument(CoreSession session, boolean withBlobContent, ACE... aces) { return createFileDocument(session, withBlobContent, "MyFile", aces); } <END></code><technical_language>removing this method 2 times, give a doc name calls</technical_language>

Target:
protected DocumentModel createFileDocument(CoreSession session, boolean withBlobContent, ACE... aces) { DocumentModel documentModel = session.createDocumentModel("/", "MyFile", "File"); if (withBlobContent) { documentModel.setPropertyValue(ColdStorageHelper.FILE_CONTENT_PROPERTY, (Serializable) Blobs.createBlob(FILE_CONTENT)); } DocumentModel document = session.createDocument(documentModel); if (aces.length > 0) { ACP acp = documentModel.getACP(); ACL acl = acp.getOrCreateACL(); acl.addAll(List.of(aces)); document.setACP(acp, true); } return document; }
Source:
<code>protected boolean populateCache(final IProgressMonitor monitor) { if (fProjects == null) initialize(monitor); if (!fProjects.isEmpty()) { final IProject project = fProjects.remove(0); IFile manifest = project.getFile("META-INF/MANIFEST.MF"); if (manifest.exists()) { try { final String pluginName = getPluginName(manifest.getContents()); if (pluginName == null) { <START> return !fProjects.isEmpty(); <END> } project.accept((IResourceProxyVisitor) proxy -> { switch (proxy.getType()) { case IResource.PROJECT : case IResource.FOLDER : return true; case IResource.FILE : if (isImageName(proxy.getName())) { try { IFile resource = (IFile) proxy.requestResource(); addImageElement(new ImageElement(createImageData(resource), pluginName, resource.getProjectRelativePath().toPortableString())); } catch (Exception e) { } if (monitor.isCanceled()) throw new OperationCanceledException(); } break; } return false; }, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); } catch (CoreException | IOException e) { PDEPlugin.log(e); } } return true; } return false; }</code><technical_language>consistent surrounding code return true (as is a part of manifest.exists() check). needs a bit deeper rework Optional<String> extractPluginName(IProject project)</technical_language>

Target:
protected boolean populateCache(final IProgressMonitor monitor) { if (fProjects == null) initialize(monitor); if (!fProjects.isEmpty()) { final IProject project = fProjects.remove(0); IFile manifest = project.getFile("META-INF/MANIFEST.MF"); if (manifest.exists()) { try { Optional<String> name = getPluginName(manifest.getContents()); if (!name.isPresent()) { return !fProjects.isEmpty(); } final String pluginName = name.get(); project.accept((IResourceProxyVisitor) proxy -> { switch (proxy.getType()) { case IResource.PROJECT : case IResource.FOLDER : return true; case IResource.FILE : if (isImageName(proxy.getName())) { try { IFile resource = (IFile) proxy.requestResource(); addImageElement(new ImageElement(createImageData(resource), pluginName, resource.getProjectRelativePath().toPortableString())); } catch (Exception e) { } if (monitor.isCanceled()) throw new OperationCanceledException(); } break; } return false; }, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); } catch (CoreException | IOException e) { PDEPlugin.log(e); } } return true; } return false; }
Source:
<code>public void postProcessWorkflowDefinitions() { if (persistWorkflowDefinitions) { workflowDefinitions.values().forEach(workflowDefinitionDao::storeWorkflowDefinition); <START> } <END> }</code><technical_language>store definitions in addWorkflowDefinition already, remove this postProcessWorkflowDefinitions method. nicely clean some dependencies other components</technical_language>

Target:
public void postProcessWorkflowDefinitions() { if (!autoInit && persistWorkflowDefinitions) { workflowDefinitions.values().forEach(workflowDefinitionDao::storeWorkflowDefinition); } }