auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.tank.getFluidInstance().isEmpty()) { info.add(new LiteralText(this.tank.getFluidAmount() + " of " + this.tank.getFluid())); } else { info.add(new LiteralText("Empty")); } } info.add(new LiteralText(Formatting.GRAY + "Capacity: " + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")")); }

Target:
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.tank.getFluidInstance().isEmpty()) { info.add(new LiteralText(this.tank.getFluidAmount() + StringUtils.t("techreborn.tooltip.unit.divider") + this.tank.getFluid())); } else { info.add(new TranslatableText("techreborn.tooltip.unit.empty")); } } info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + ":" + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")")); }
Source:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); metrics.leaderElection.inc(); zkController.subscribeToProcessorChange(); debounceTimer.scheduleAfterDebounceTime( ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }

Target:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); metrics.isLeader.set(true); zkController.subscribeToProcessorChange(); debounceTimer.scheduleAfterDebounceTime( ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }
Source:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { if (firstParent && i > 0) { break; } RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) { continue; } if ((p.flags & PARSED) == 0) { p.parseHeaders(walker); } p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; if (firstParent && i > 0) { continue; } pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }
Source:
public void startClientAwakeTimer() { try { timerSemaphore.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } if (clientAwakeTime != 0) { if (clientAwakeTimer != null) { clientAwakeTimer.cancel(); clientAwakeTimer.purge(); } clientAwakeTimer = new Timer(); clientAwakeTask = new TimerTask() { @Override public void run() { if (!isClientSleeping()) { setSleeping(); } } }; clientAwakeTimer.schedule(clientAwakeTask, clientAwakeTime); } timerSemaphore.release(); }

Target:
public void startClientAwakeTimer() { try { timerSemaphore.acquire(); try { if (clientAwakeTime != 0) { if (clientAwakeTimer != null) { clientAwakeTimer.cancel(); clientAwakeTimer.purge(); } clientAwakeTimer = new Timer(); clientAwakeTask = new TimerTask() { @Override public void run() { if (!isClientSleeping()) { setSleeping(); } } }; clientAwakeTimer.schedule(clientAwakeTask, clientAwakeTime); } } finally { timerSemaphore.release(); } } catch (InterruptedException e) { LOG.warn("Unable to restart the client timer due to semaphore exception", e); } }
Source:
public void setFetchAtomic(final boolean atomic) { this.fetchAtomic = Optional.of(atomic); }

Target:
public void setFetchAtomic(final boolean atomic) { this.fetchAtomic = atomic; }
Source:
public void finalizeCompileActionBuilder( BuildConfiguration configuration, FeatureConfiguration featureConfiguration, CppCompileActionBuilder actionBuilder) { CcToolchainProvider toolchain = actionBuilder.getToolchain(); actionBuilder .addTransitiveMandatoryInputs( configuration.getFragment(CppConfiguration.class).useSpecificToolFiles() ? (actionBuilder.getActionName() == CppActionNames.ASSEMBLE ? toolchain.getAsFiles() : toolchain.getCompilerFiles()) : toolchain.getAllFiles()) .setShouldScanIncludes(false); }

Target:
public void finalizeCompileActionBuilder( BuildConfiguration configuration, FeatureConfiguration featureConfiguration, CppCompileActionBuilder actionBuilder) { CcToolchainProvider toolchain = actionBuilder.getToolchain(); actionBuilder .addTransitiveMandatoryInputs( configuration.getFragment(CppConfiguration.class).useSpecificToolFiles() ? (actionBuilder.getActionName().equals(CppActionNames.ASSEMBLE) ? toolchain.getAsFiles() : toolchain.getCompilerFiles()) : toolchain.getAllFiles()) .setShouldScanIncludes(false); }
Source:
private String generateRandomPassword() { String acceptable = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),."; char[] chars = new char[8]; for (int i = 0; i < chars.length; i++) { char r = acceptable.charAt(rand.nextInt(acceptable.length())); chars[i] = r; } return new String(chars); }

Target:
private String generateRandomPassword() { String acceptable = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),."; char[] chars = new char[8]; char last = 'a'; for (int i = 0; i < chars.length; i++) { char r = acceptable.charAt(rand.nextInt(acceptable.length())); while (checkSimilar(last, r)) r = acceptable.charAt(rand.nextInt(acceptable.length())); last = r; chars[i] = r; } return new String(chars); }
Source:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users"); massUpdate.select("SELECT u.id, g.id FROM users u " + "INNER JOIN organization_members om ON om.user_id=u.id " + "INNER JOIN groups g ON g.organization_uuid=om.organization_uuid AND g.name=? " + "WHERE u.active=? AND NOT EXISTS " + "(SELECT 1 FROM groups_users gu " + "INNER JOIN groups g on g.id=gu.group_id AND g.name=? " + "WHERE gu.user_id=u.id)") .setString(1, MEMBERS_NAME) .setBoolean(2, true) .setString(3, MEMBERS_NAME); massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); update.setLong(2, row.getLong(2)); return true; }); }

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users not belonging to 'members' group"); massUpdate.select("SELECT u.id, g.id FROM users u " + "INNER JOIN organization_members om ON om.user_id=u.id " + "INNER JOIN groups g ON g.organization_uuid=om.organization_uuid AND g.name=? " + "WHERE u.active=? AND NOT EXISTS " + "(SELECT 1 FROM groups_users gu " + "INNER JOIN groups g on g.id=gu.group_id AND g.name=? " + "WHERE gu.user_id=u.id)") .setString(1, MEMBERS_NAME) .setBoolean(2, true) .setString(3, MEMBERS_NAME); massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); update.setLong(2, row.getLong(2)); return true; }); }
Source:
public void prepare() { if ( isPreparing ) { return; } isPreparing = true; try { for ( PojoContainedTypeWorkPlan<?> delegate : containedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.prepare(); } } finally { isPreparing = false; } }

Target:
public void prepare() { if ( isPreparing ) { throw log.recursiveWorkPlanPrepare(); } isPreparing = true; try { for ( PojoContainedTypeWorkPlan<?> delegate : containedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.prepare(); } } finally { isPreparing = false; } }
Source:
private void addSystemProperties(){ Properties properties = new Properties(); String filePath = System.getProperty(CONF_DIRECTORY_PATH) + File.separator + CARBON_PROPERTIES; File file = new File(filePath); if (file.exists()) { InputStream in = null; try { in = new FileInputStream(file); properties.load(in); } catch (IOException e) { e.printStackTrace(); System.exit(1); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } } Set<Object> keys = properties.keySet(); for (Object key: keys) { System.setProperty((String)key, (String)properties.get(key)); } System.setProperty("javax.xml.bind.JAXBContextFactory", "com.sun.xml.bind.v2.ContextFactory"); }

Target:
private void addSystemProperties(){ Properties properties = new Properties(); String filePath = System.getProperty(CONF_DIRECTORY_PATH) + File.separator + CARBON_PROPERTIES; File file = new File(filePath); if (file.exists()) { InputStream in = null; try { in = new FileInputStream(file); properties.load(in); } catch (IOException e) { e.printStackTrace(); System.exit(1); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } } Set<Object> keys = properties.keySet(); for (Object key: keys) { System.setProperty((String)key, (String)properties.get(key)); } }
Source:
public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 10); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); }

Target:
public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 10); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); routerMaxSlippedPutAttempts = verifiableProperties.getInt("router.max.slipped.put.attempts", 1); }
Source:
public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { try { final int numDataBlocksOnServer = metrics.getNumModelParamBlocks(); final int numDataBlocksOnDriver = numBlockOwnershipByEvalIdForServer.get(serverId); if (numDataBlocksOnServer == numDataBlocksOnDriver) { final DataInfo dataInfo = new DataInfoImpl(numDataBlocksOnServer); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); serverEvalParams.computeIfAbsent(serverId, metricList -> new ArrayList<>()).add(evaluatorParameters); } else { LOG.log(Level.FINE, "{0} contains {1} blocks, driver says {2} blocks. Dropping metric.", new Object[]{serverId, numDataBlocksOnServer, numDataBlocksOnDriver}); } } catch (NullPointerException e) { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } }

Target:
public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { final int numModelBlocksOnServer = metrics.getNumModelBlocks(); if (numBlockByEvalIdForServer != null && numBlockByEvalIdForServer.containsKey(serverId)) { final int numModelBlocksOnDriver = numBlockByEvalIdForServer.get(serverId); if (numModelBlocksOnServer == numModelBlocksOnDriver) { final DataInfo dataInfo = new DataInfoImpl(numModelBlocksOnServer); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); synchronized (serverEvalParams) { if (!serverEvalParams.containsKey(serverId)) { serverEvalParams.put(serverId, new ArrayList<>()); } serverEvalParams.get(serverId).add(evaluatorParameters); } } else { LOG.log(Level.FINE, "{0} contains {1} blocks, driver says {2} blocks. Dropping metric.", new Object[]{serverId, numModelBlocksOnServer, numModelBlocksOnDriver}); } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } if (this.dashboardEnabled) { sendMetricsToDashboard(serverId, metrics.toString()); } }
Source:
public void testDelete() throws Exception { checkIsSuccess(mAppSearch.setSchema(AppSearchEmail.SCHEMA)); AppSearchEmail email1 = new AppSearchEmail.Builder("uri1") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example") .setBody("This is the body of the testPut email") .build(); AppSearchEmail email2 = new AppSearchEmail.Builder("uri2") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example 2") .setBody("This is the body of the testPut second email") .build(); checkIsSuccess(mAppSearch.putDocuments(ImmutableList.of(email1, email2))); assertThat(doGet("uri1")).hasSize(1); assertThat(doGet("uri2")).hasSize(1); checkIsSuccess(mAppSearch.delete(ImmutableList.of("uri1"))); AppSearchBatchResult<String, AppSearchDocument> getResult = mAppSearch.getDocuments(ImmutableList.of("uri1", "uri2")).get(); assertThat(getResult.isSuccess()).isFalse(); assertThat(getResult.getFailures().get("uri1").getResultCode()) .isEqualTo(AppSearchResult.RESULT_NOT_FOUND); assertThat(getResult.getSuccesses().get("uri2")).isEqualTo(email2); AppSearchBatchResult<String, Void> getResultNonexistentUri = mAppSearch.delete(ImmutableList.of("uri1")).get(); assertThat(getResultNonexistentUri.getFailures()).containsExactly("uri1", AppSearchResult.newFailedResult( AppSearchResult.RESULT_NOT_FOUND, null)); }

Target:
public void testDelete() throws Exception { checkIsSuccess(mAppSearch.setSchema(AppSearchEmail.SCHEMA)); AppSearchEmail email1 = new AppSearchEmail.Builder("uri1") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example") .setBody("This is the body of the testPut email") .build(); AppSearchEmail email2 = new AppSearchEmail.Builder("uri2") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example 2") .setBody("This is the body of the testPut second email") .build(); checkIsSuccess(mAppSearch.putDocuments(ImmutableList.of(email1, email2))); assertThat(doGet("uri1")).hasSize(1); assertThat(doGet("uri2")).hasSize(1); checkIsSuccess(mAppSearch.delete(ImmutableList.of("uri1"))); AppSearchBatchResult<String, AppSearchDocument> getResult = mAppSearch.getDocuments(ImmutableList.of("uri1", "uri2")).get(); assertThat(getResult.isSuccess()).isFalse(); assertThat(getResult.getFailures().get("uri1").getResultCode()) .isEqualTo(AppSearchException.RESULT_NOT_FOUND); assertThat(getResult.getSuccesses().get("uri2")).isEqualTo(email2); AppSearchBatchResult<String, Void> getResultNonexistentUri = mAppSearch.delete(ImmutableList.of("uri1")).get(); assertThat(getResultNonexistentUri.getFailures().keySet()).containsExactly("uri1"); assertThat(getResultNonexistentUri.getFailures().get("uri1").getResultCode()).isEqualTo( AppSearchException.RESULT_NOT_FOUND); assertThat(getResultNonexistentUri.getFailures().get("uri1").getMessage()).isEqualTo( null); }
Source:
public final boolean IsDynamicVariable(String strMessage) { return strMessage.startsWith("$"); }

Target:
public final boolean IsDynamicVariable(String strMessage) { final String startsWithVariableDefinitionRegex = "^\\$[^{}\\s]+ .*"; return strMessage.matches(startsWithVariableDefinitionRegex); }
Source:
public void register(@NonNull Context context, @Nullable Looper thread, @Nullable UserHandle user) { if (mRegisteredContext != null) { throw new IllegalStateException("Already registered"); } Handler handler = new Handler(thread == null ? getStaticLooper() : thread); mRegisteredContext = context; if (handler != null) { Context contextForUser = user == null ? context : context.createContextAsUser(user, 0); contextForUser.registerReceiver(this, sPackageIntentFilter, null, handler); } else { throw new NullPointerException(); } }

Target:
public void register(@NonNull Context context, @Nullable Looper thread, @Nullable UserHandle user) { if (mRegisteredContext != null) { throw new IllegalStateException("Already registered"); } Handler handler = new Handler(thread == null ? getStaticLooper() : thread); mRegisteredContext = user == null ? context : context.createContextAsUser(user, 0); mRegisteredContext.registerReceiver(this, sPackageIntentFilter, null, handler); }
Source:
public void testUdp() throws Exception { InInt32UDP udp = new InInt32UDP(ImmutableSet.of(42)); InInt32UDP udp1 = new InInt32UDP(ImmutableSet.of(205)); assertTrue("Should drop block for non-matching UDP", canDrop(FilterApi.userDefined(intColumn("int32_field"), udp), ccmd, dictionaries)); assertFalse("Should not drop block for matching UDP", canDrop(FilterApi.userDefined(intColumn("int32_field"), udp1), ccmd, dictionaries)); }

Target:
public void testUdp() throws Exception { InInt32UDP dropabble = new InInt32UDP(ImmutableSet.of(42)); InInt32UDP undroppable = new InInt32UDP(ImmutableSet.of(205)); assertTrue("Should drop block for non-matching UDP", canDrop(userDefined(intColumn("int32_field"), dropabble), ccmd, dictionaries)); assertFalse("Should not drop block for matching UDP", canDrop(userDefined(intColumn("int32_field"), undroppable), ccmd, dictionaries)); }
Source:
public void activate() { for (ExtensionEntry entry: loadedEntries.values()) { if (entry.enabled) { activatedEntries.put(entry.name, entry); List<ExtensionEntry> entries = serviceEntries.get(entry.service); if (entries == null) { entries = new ArrayList<>(); serviceEntries.put(entry.service, entries); } entries.add(entry); } } }

Target:
private void activate() { for (ExtensionEntry entry: loadedEntries.values()) { if (entry.enabled) { activatedEntries.put(entry.name, entry); List<ExtensionEntry> entries = serviceEntries.get(entry.service); if (entries == null) { entries = new ArrayList<>(); serviceEntries.put(entry.service, entries); } entries.add(entry); } } }
Source:
private boolean hasStatementFor(String sql) { try { return statementMap.containsKey(sql) && !statementMap.get(sql).getConnection().isClosed(); } catch (SQLException e) { return false; } }

Target:
private boolean hasStatementFor(String sql) { try { Statement statement = statementMap.get(sql); return statement != null && !statement.getConnection().isClosed(); } catch (SQLException e) { return false; } }
Source:
private static Pair<String, String> getAttribute(String value) { Pair<String, String> attrs = new Pair<>("", ""); if (value.indexOf(':') != -1) { String[] values = value.split(":"); attrs = new Pair<>(cleanProp(values[0]), cleanProp(values[1])); } return attrs; }

Target:
private static Map.Entry<String, String> getAttribute(String value) { Map.Entry<String, String> attrs = new SimpleEntry<>("", ""); if (value.indexOf(':') != -1) { String[] values = value.split(":"); attrs = new SimpleEntry<>(cleanProp(values[0]), cleanProp(values[1])); } return attrs; }
Source:
private Long decodeViewIndexId(Cell viewIndexIdKv, PDataType viewIndexType) { boolean useLongViewIndex = MetaDataUtil.getViewIndexIdDataType().equals(viewIndexType); return new Long( useLongViewIndex ? viewIndexType.getCodec().decodeLong(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()) : MetaDataUtil.getLegacyViewIndexIdDataType().getCodec().decodeShort(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()) ); }

Target:
private Long decodeViewIndexId(Cell viewIndexIdKv, PDataType viewIndexType) { return viewIndexType.getCodec().decodeLong(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()); }
Source:
public void getServerRuntime() { NewRuntimeWizardDialog wizardDialog = preferencePage.addRuntime(); NewRuntimeWizardPage wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); List<Runtime> runtimes = preferencePage.getServerRuntimes(); assertThat(runtimes.size(), is(3)); Runtime runtime1 = preferencePage.getServerRuntime(SERVER_NAME, SERVER_NAME); assertThat(runtime1, is(new Runtime(SERVER_NAME, SERVER_NAME))); Runtime runtime2 = preferencePage.getServerRuntime(new Runtime(SERVER_NAME_2, SERVER_NAME_2)); assertThat(runtime2, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); Runtime runtime3 = null; try { runtime3 = preferencePage.getServerRuntime(SERVER_NAME_2); } catch (IllegalStateException exc) { fail(exc.getMessage()); } assertThat(runtime3, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); }

Target:
public void getServerRuntime() { NewRuntimeWizardDialog wizardDialog = preferencePage.addRuntime(); NewRuntimeWizardPage wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); List<Runtime> runtimes = preferencePage.getServerRuntimes(); assertThat(runtimes.size(), is(3)); Runtime runtime1 = preferencePage.getServerRuntime(SERVER_NAME, SERVER_NAME); assertThat(runtime1, is(new Runtime(SERVER_NAME, SERVER_NAME))); Runtime runtime2 = preferencePage.getServerRuntime(new Runtime(SERVER_NAME_2, SERVER_NAME_2)); assertThat(runtime2, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); Runtime runtime3 = null; try { runtime3 = preferencePage.getServerRuntime(SERVER_NAME_2); } catch (EclipseLayerException exc) { fail(exc.getMessage()); } assertThat(runtime3, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); }
Source:
private static InputStream openStream(URI uri) throws IOException { if (uri.toString().startsWith("level://")) { return new FileInputStream(new File(DimensionManager.getCurrentSaveRootDirectory(), uri.toString().substring("level://".length()))); } return uri.toURL().openStream(); }

Target:
private static InputStream openStream(URI uri) throws IOException { if (uri.toString().startsWith(SpongeWorldResourcePack.LEVEL_PACK_PROTOCOL)) { return new FileInputStream(new File(DimensionManager.getCurrentSaveRootDirectory().getParent(), uri.toString().substring(SpongeWorldResourcePack.LEVEL_PACK_PROTOCOL.length()))); } return uri.toURL().openStream(); }
Source:
public void collisions() throws Exception { WorkspaceLocatorImpl.MODE = WorkspaceLocatorImpl.Mode.ENABLED; FilePath firstWs = r.buildAndAssertSuccess(r.createFreeStyleProject("first_project-with-a-rather-long-name")).getWorkspace(); assertEquals("_project-with-a-rather-long-name", firstWs.getName()); firstWs.deleteRecursive(); assertEquals("roject-with-a-rather-long-name_2", r.buildAndAssertSuccess(r.createFreeStyleProject("second_project-with-a-rather-long-name")).getWorkspace().getName()); }

Target:
public void collisions() throws Exception { WorkspaceLocatorImpl.MODE = WorkspaceLocatorImpl.Mode.ENABLED; FilePath firstWs = r.buildAndAssertSuccess(r.createFreeStyleProject("first-project-with-a-rather-long-name")).getWorkspace(); assertEquals("_project-with-a-rather-long-name", firstWs.getName()); firstWs.deleteRecursive(); assertEquals("roject-with-a-rather-long-name_2", r.buildAndAssertSuccess(r.createFreeStyleProject("second-project-with-a-rather-long-name")).getWorkspace().getName()); }
Source:
public PreparedRead prepareRead(List<DriverRecord> driverRecords) { requireNonNull(driverRecords); OpcUaPreparedRead preparedRead = new OpcUaPreparedRead(); preparedRead.driverRecords = driverRecords; for (DriverRecord record : driverRecords) { OpcUaRequestInfo.extract(record).ifPresent(preparedRead.requestInfos::add); } return preparedRead; }

Target:
public PreparedRead prepareRead(List<DriverRecord> driverRecords) { requireNonNull(driverRecords, message.recordListNonNull()); OpcUaPreparedRead preparedRead = new OpcUaPreparedRead(); preparedRead.driverRecords = driverRecords; for (DriverRecord record : driverRecords) { OpcUaRequestInfo.extract(record).ifPresent(preparedRead.requestInfos::add); } return preparedRead; }
Source:
protected boolean AddVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getstatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getVmTemplate().getDiskMap().values()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getit_guid(), getParameters().getVmStaticData().getId()); tempVar.setStorageDomainId(getStorageDomainId().getValue()); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityId(getParameters().getEntityId()); tempVar.setParentParemeters(getParameters()); VdcReturnValueBase result = Backend.getInstance().runInternalAction( VdcActionType.CreateSnapshotFromTemplate, tempVar); getParameters().getImagesParameters().add(tempVar); if (!result.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } else { getTaskIdList().addAll(result.getInternalTaskIdList()); } } } return true; }

Target:
protected boolean AddVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getstatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getVmTemplate().getDiskMap().values()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getId(), getParameters().getVmStaticData().getId()); tempVar.setStorageDomainId(getStorageDomainId().getValue()); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityId(getParameters().getEntityId()); tempVar.setParentParemeters(getParameters()); VdcReturnValueBase result = Backend.getInstance().runInternalAction( VdcActionType.CreateSnapshotFromTemplate, tempVar); getParameters().getImagesParameters().add(tempVar); if (!result.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } else { getTaskIdList().addAll(result.getInternalTaskIdList()); } } } return true; }
Source:
public void setUp() { mockConnectionFactory = mock(ConnectionFactory.class); mockConnection = mock(Connection.class); amqpConfig = new AmqpBrokerConfig(host, port, Optional.of(username), Optional.of(password), Optional.of(virtualHost), groupId, durable, consumerThreadPoolSize); try { when(mockConnectionFactory.newConnection()).thenReturn(mockConnection); } catch (IOException e) { fail("Can't create MockConnectionFactory"); } amqpConnectionManager = new AmqpConnectionManager(amqpConfig) { protected ConnectionFactory createConnectionFactory() { return mockConnectionFactory; } }; }

Target:
public void setUp() { mockConnection = mock(Connection.class); amqpConnectionManager = new AmqpConnectionManager(mockConnection); }
Source:
public GeneralPurposeArtifactViewer() { orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); initComponents(); }

Target:
public GeneralPurposeArtifactViewer() { orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); initComponents(); }
Source:
private IFolder copyExperiment(final String newName) { WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask("", 1000); if (monitor.isCanceled()) { throw new OperationCanceledException(); } fExperiment.copy(newName, fExperimentFolder, true); if (monitor.isCanceled()) { throw new OperationCanceledException(); } } finally { monitor.done(); } } }; try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation); } catch (InterruptedException exception) { return null; } catch (InvocationTargetException exception) { MessageDialog.openError(getShell(), "", NLS.bind("", exception.getTargetException().getMessage())); return null; } catch (RuntimeException exception) { return null; } return fExperiment.getResource(); }

Target:
private IFolder copyExperiment(final String newName) { WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask("", 1000); if (monitor.isCanceled()) { throw new OperationCanceledException(); } fExperiment.copy(newName, true); if (monitor.isCanceled()) { throw new OperationCanceledException(); } } finally { monitor.done(); } } }; try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation); } catch (InterruptedException exception) { return null; } catch (InvocationTargetException exception) { MessageDialog.openError(getShell(), "", NLS.bind("", exception.getTargetException().getMessage())); return null; } catch (RuntimeException exception) { return null; } return fExperiment.getResource(); }
Source:
public static void refreshPlugins() throws Exception { List<File> refreshedFiles = new ArrayList<File>(); List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class); boolean changed = false; List<RepositoryPlugin> changedRepos = new ArrayList<>(); for (Refreshable rp : rps) { if (rp.refresh()) { changed = true; File root = rp.getRoot(); if (root != null) refreshedFiles.add(root); if (rp instanceof RepositoryPlugin) { changedRepos.add((RepositoryPlugin) rp); } } } if (changed) { try { for (File file : refreshedFiles) { refreshFile(file); } for (Project p : Central.getWorkspace().getAllProjects()) { p.setChanged(); for (ModelListener l : getInstance().listeners) l.modelChanged(p); } for (RepositoryPlugin rp : changedRepos) { repositoriesViewRefresher.repositoryRefreshed(rp); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } }

Target:
public static void refreshPlugins() throws Exception { List<File> refreshedFiles = new ArrayList<File>(); List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class); boolean changed = false; boolean repoChanged = false; for (Refreshable rp : rps) { if (rp.refresh()) { changed = true; File root = rp.getRoot(); if (root != null) refreshedFiles.add(root); if (rp instanceof RepositoryPlugin) { repoChanged = true; } } } if (changed) { try { for (File file : refreshedFiles) { refreshFile(file); } for (Project p : Central.getWorkspace().getAllProjects()) { p.setChanged(); for (ModelListener l : getInstance().listeners) l.modelChanged(p); } if (repoChanged) { repositoriesViewRefresher.repositoriesRefreshed(); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } }
Source:
public Node visitColumnCheckConstraint(SqlBaseParser.ColumnCheckConstraintContext context) { SqlBaseParser.ColumnDefinitionContext columnCtx = (SqlBaseParser.ColumnDefinitionContext) context.parent; String columnName = getIdentText(columnCtx.ident()); return visitCheckConstraint(context.checkConstraint(), columnName); }

Target:
public Node visitColumnCheckConstraint(SqlBaseParser.ColumnCheckConstraintContext context) { SqlBaseParser.CheckConstraintContext ctx = context.checkConstraint(); String name = ctx.CONSTRAINT() != null ? getIdentText(ctx.name) : null; Expression expression = (Expression) visit(ctx.expression); String expressionStr = ExpressionFormatter.formatStandaloneExpression(expression); return new CheckColumnConstraint<>(name, null, expression, expressionStr); }
Source:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); symbol = symbolManager.create(new SymbolOptions() .withLatLng(new LatLng(60.169091, 24.939876)) .withIconImage(MAKI_ICON_HARBOR) .withIconSize(2.0f) .setDraggable(true)); symbolManager.addClickListener(new OnSymbolClickListener() { @Override public void onAnnotationClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_CAFE); symbolManager.update(symbol); } }); symbolManager.addLongClickListener((new OnSymbolLongClickListener() { @Override public void onAnnotationLongClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol long clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_AIRPORT); symbolManager.update(symbol); } })); symbolManager.addDragListener(new OnSymbolDragListener() { @Override public void onAnnotationDragStarted(Symbol annotation) { } @Override public void onAnnotationDrag(Symbol symbol) { } @Override public void onAnnotationDragFinished(Symbol annotation) { } }); } }); }

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); symbol = symbolManager.create(new SymbolOptions() .withLatLng(new LatLng(60.169091, 24.939876)) .withIconImage(MAKI_ICON_HARBOR) .withIconSize(2.0f) .setDraggable(true)); symbolManager.addClickListener(new OnSymbolClickListener() { @Override public void onAnnotationClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_CAFE); symbolManager.update(symbol); } }); symbolManager.addLongClickListener((new OnSymbolLongClickListener() { @Override public void onAnnotationLongClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol long clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_AIRPORT); symbolManager.update(symbol); } })); symbolManager.addDragListener(new OnSymbolDragListener() { @Override public void onAnnotationDragStarted(Symbol annotation) { } @Override public void onAnnotationDrag(Symbol symbol) { } @Override public void onAnnotationDragFinished(Symbol annotation) { } }); } }); }
Source:
public void start() { if (getArguments().emailLink != null) { setResult(Resource.<IdpResponse>forFailure(new IntentRequiredException( EmailLinkCatcherActivity.createIntent(getApplication(), getArguments()), RequestCodes.EMAIL_FLOW))); return; } EmailLinkPersistenceManager.getInstance().clearAllData(getApplication()); boolean supportPasswords = ProviderUtils.getConfigFromIdps( getArguments().providers, EmailAuthProvider.PROVIDER_ID) != null; List<String> accountTypes = getCredentialAccountTypes(); boolean willRequestCredentials = supportPasswords || accountTypes.size() > 0; if (getArguments().enableCredentials && willRequestCredentials) { setResult(Resource.<IdpResponse>forLoading()); GoogleApiUtils.getCredentialsClient(getApplication()) .request(new CredentialRequest.Builder() .setPasswordLoginSupported(supportPasswords) .setAccountTypes(accountTypes.toArray(new String[accountTypes.size()])) .build()) .addOnCompleteListener(new OnCompleteListener<CredentialRequestResponse>() { @Override public void onComplete(@NonNull Task<CredentialRequestResponse> task) { try { handleCredential( task.getResult(ApiException.class).getCredential()); } catch (ResolvableApiException e) { if (e.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { setResult(Resource.<IdpResponse>forFailure( new PendingIntentRequiredException( e.getResolution(), RequestCodes.CRED_HINT))); } else { startAuthMethodChoice(); } } catch (ApiException e) { startAuthMethodChoice(); } } }); } else { startAuthMethodChoice(); } }

Target:
public void start() { if (!TextUtils.isEmpty(getArguments().emailLink)) { setResult(Resource.<IdpResponse>forFailure(new IntentRequiredException( EmailLinkCatcherActivity.createIntent(getApplication(), getArguments()), RequestCodes.EMAIL_FLOW))); return; } boolean supportPasswords = ProviderUtils.getConfigFromIdps( getArguments().providers, EmailAuthProvider.PROVIDER_ID) != null; List<String> accountTypes = getCredentialAccountTypes(); boolean willRequestCredentials = supportPasswords || accountTypes.size() > 0; if (getArguments().enableCredentials && willRequestCredentials) { setResult(Resource.<IdpResponse>forLoading()); GoogleApiUtils.getCredentialsClient(getApplication()) .request(new CredentialRequest.Builder() .setPasswordLoginSupported(supportPasswords) .setAccountTypes(accountTypes.toArray(new String[accountTypes.size()])) .build()) .addOnCompleteListener(new OnCompleteListener<CredentialRequestResponse>() { @Override public void onComplete(@NonNull Task<CredentialRequestResponse> task) { try { handleCredential( task.getResult(ApiException.class).getCredential()); } catch (ResolvableApiException e) { if (e.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { setResult(Resource.<IdpResponse>forFailure( new PendingIntentRequiredException( e.getResolution(), RequestCodes.CRED_HINT))); } else { startAuthMethodChoice(); } } catch (ApiException e) { startAuthMethodChoice(); } } }); } else { startAuthMethodChoice(); } }
Source:
public void outputHTML(String file) throws FileNotFoundException, UnsupportedEncodingException { Date d = new Date(); String outputfile = String.format("%s%d.html", file, d.getTime()); PrintWriter writer = new PrintWriter(outputfile, "UTF-8"); writer.println("<!DOCTYPE html PUBLIC \"- writer.println("<html>"); writer.println("<head>"); writer.println("<title> Testing reading requirements and outputting them </title>"); writer.println("</head>"); writer.println("<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#EE0000\" alink=\"#808080\" vlink=\"#808080\">"); writer.println("<table border=\"\">"); writer.println("<tbody>"); for (DoorsTableRow dr : rawRows) { writer.println("<tr>"); for (Element e : dr.getRows()) { writer.println(e.toString()); } if (dr == getFirstRow()) { writer.println("<th width=\"100\" align=\"Left\">Combination</th>"); } else { writer.println(String.format("<td>%s</td>", dr.getType().toString())); } writer.println("</tr>"); } writer.println("</tbody>"); writer.println("</table>"); writer.println("</body>"); writer.println("</html>"); writer.close(); }

Target:
private void outputHTML(String file) throws FileNotFoundException, UnsupportedEncodingException { String outputfile = String.format("%s%s.html", file, Lib.getDateTimeString()); PrintWriter writer = new PrintWriter(outputfile, "UTF-8"); try { outputHTML(writer); } finally { writer.close(); } }
Source:
public Response awaitResponse() throws Exception { return Objects.requireNonNull(remoteFuture).get(); }

Target:
public Response awaitResponse() throws Exception { return remoteFuture.get(); }
Source:
private void takePictureInternal() { final TakePictureState state = new TakePictureState(); FluentFuture.from(preTakePicture(state)) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.issueTakePicture(); } }, mExecutor) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.postTakePicture(state); } }, mExecutor) .addCallback( new FutureCallback<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable t) { Log.e(TAG, "takePictureInternal onFailure", t); if (t instanceof IllegalCaptureStageException) { ImageCaptureRequest request = mImageCaptureRequests.poll(); request.mListener.onError(UseCaseError.UNKNOWN_ERROR, t.getMessage(), t); issueImageCaptureRequests(); } } }, mExecutor); }

Target:
private void takePictureInternal() { final TakePictureState state = new TakePictureState(); FluentFuture.from(preTakePicture(state)) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.issueTakePicture(state); } }, mExecutor) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.postTakePicture(state); } }, mExecutor) .addCallback( new FutureCallback<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable t) { Log.e(TAG, "takePictureInternal onFailure", t); if (!state.mIsTakePictureRequestSubmitted) { ImageCaptureRequest request = mImageCaptureRequests.poll(); if (request != null) { request.callbackError(UseCaseError.UNKNOWN_ERROR, t.getMessage(), t); issueImageCaptureRequests(); } } } }, mExecutor); }
Source:
private void toggleComments() { XWikiWebDriver driver = getDriver(); List<WebElement> openCommentForm = driver.findElementsById("OpenCommentForm"); if (openCommentForm.size() > 0) { openCommentForm.get(0).click(); } driver.waitUntilElementIsVisible(By.id("AddComment")); }

Target:
private void toggleComments() { String commentFormId = "AddComment"; String openFormId = "openCommentForm"; XWikiWebDriver driver = getDriver(); if (!driver.findElementWithoutWaiting(By.id(commentFormId)).isDisplayed()) { driver.findElementWithoutWaiting(By.id(openFormId)).click(); driver.waitUntilElementIsVisible(By.id(commentFormId)); } }
Source:
public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (!(module instanceof AbstractCheck)) { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Checks is standard."); } final AbstractCheck check = (AbstractCheck) module; check.contextualize(childContext); check.configure(childConf); check.init(); registerCheck(check); }

Target:
public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (!(module instanceof AbstractCheck)) { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } final AbstractCheck check = (AbstractCheck) module; check.contextualize(childContext); check.configure(childConf); check.init(); registerCheck(check); }
Source:
private void updateEnvVarsIfNecessary() { EnvironmentVariablesNodeProperty envVarsProp = Jenkins.getActiveInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); EnvVars globalEnvVars = envVarsProp.getEnvVars(); int newSystemEnvVarsHash = EnvVars.masterEnvVars.hashCode(); int newGlobalEnvVarsHash = globalEnvVars.hashCode(); if (newSystemEnvVarsHash != systemEnvVarsHash || newGlobalEnvVarsHash != globalHashVarsHash) { this.envVars.clear(); this.envVars.putAll(EnvVars.masterEnvVars); this.envVars.putAll(globalEnvVars); systemEnvVarsHash = newSystemEnvVarsHash; globalHashVarsHash = newGlobalEnvVarsHash; } }

Target:
private synchronized void updateEnvVarsIfNecessary() { EnvironmentVariablesNodeProperty envVarsProp = Jenkins.getActiveInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); EnvVars globalEnvVars = envVarsProp.getEnvVars(); int newSystemEnvVarsHash = EnvVars.masterEnvVars.hashCode(); int newGlobalEnvVarsHash = globalEnvVars.hashCode(); if (newSystemEnvVarsHash != systemEnvVarsHash || newGlobalEnvVarsHash != globalHashVarsHash) { this.envVars.clear(); this.envVars.putAll(EnvVars.masterEnvVars); this.envVars.putAll(globalEnvVars); systemEnvVarsHash = newSystemEnvVarsHash; globalHashVarsHash = newGlobalEnvVarsHash; } }