auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Type visitLambdaExpression(LambdaExpression node, StackableAstVisitorContext<Context> context) { verifyNoAggregatesOrWindowFunctions(functionRegistry, node.getBody(), "Lambda expression"); if (!context.getContext().isExpectingLambda()) { throw new SemanticException(STANDALONE_LAMBDA, node, "Lambda expression should always be used inside a function"); } List<Type> types = context.getContext().getFunctionInputTypes(); List<LambdaArgumentDeclaration> lambdaArguments = node.getArguments(); if (types.size() != lambdaArguments.size()) { throw new SemanticException(INVALID_PARAMETER_USAGE, node, format("expected a lambda function takes %s parameters (actual: %s)", types.size(), lambdaArguments.size())); } verify(types.size() == lambdaArguments.size()); Map<String, LambdaArgumentDeclaration> nameToLambdaArgumentDeclarationMap = new HashMap<>(); if (context.getContext().isInLambda()) { nameToLambdaArgumentDeclarationMap.putAll(context.getContext().getNameToLambdaArgumentDeclarationMap()); } for (int i = 0; i < lambdaArguments.size(); i++) { LambdaArgumentDeclaration lambdaArgument = lambdaArguments.get(i); nameToLambdaArgumentDeclarationMap.put(lambdaArgument.getName(), lambdaArgument); setExpressionType(lambdaArgument, types.get(i)); } Type returnType = process(node.getBody(), new StackableAstVisitorContext<Context>(Context.inLambda(nameToLambdaArgumentDeclarationMap))); FunctionType functionType = new FunctionType(types, returnType); return setExpressionType(node, functionType); }

Target:
protected Type visitLambdaExpression(LambdaExpression node, StackableAstVisitorContext<Context> context) { verifyNoAggregatesOrWindowFunctions(functionRegistry, node.getBody(), "Lambda expression"); if (!context.getContext().isExpectingLambda()) { throw new SemanticException(STANDALONE_LAMBDA, node, "Lambda expression should always be used inside a function"); } List<Type> types = context.getContext().getFunctionInputTypes(); List<LambdaArgumentDeclaration> lambdaArguments = node.getArguments(); if (types.size() != lambdaArguments.size()) { throw new SemanticException(INVALID_PARAMETER_USAGE, node, format("Expected a lambda that takes %s argument(s) but got %s", types.size(), lambdaArguments.size())); } verify(types.size() == lambdaArguments.size()); Map<String, LambdaArgumentDeclaration> nameToLambdaArgumentDeclarationMap = new HashMap<>(); if (context.getContext().isInLambda()) { nameToLambdaArgumentDeclarationMap.putAll(context.getContext().getNameToLambdaArgumentDeclarationMap()); } for (int i = 0; i < lambdaArguments.size(); i++) { LambdaArgumentDeclaration lambdaArgument = lambdaArguments.get(i); nameToLambdaArgumentDeclarationMap.put(lambdaArgument.getName(), lambdaArgument); setExpressionType(lambdaArgument, types.get(i)); } Type returnType = process(node.getBody(), new StackableAstVisitorContext<Context>(Context.inLambda(nameToLambdaArgumentDeclarationMap))); FunctionType functionType = new FunctionType(types, returnType); return setExpressionType(node, functionType); }
Source:
private static boolean streamExists(AmazonKinesisClient kinesisClient, String streamName) { DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); describeStreamRequest.setStreamName(streamName); try { kinesisClient.describeStream(describeStreamRequest); return true; } catch (ResourceNotFoundException e) { return false; } }

Target:
private static boolean streamExists(AmazonKinesisClient kinesisClient, String streamName) { try { getStreamState(kinesisClient, streamName); return true; } catch (ResourceNotFoundException e) { return false; } }
Source:
static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { String[] prefixes = new String[keyPrefix.length + 1]; prefixes[0] = SUBSYSTEM_NAME; System.arraycopy(keyPrefix, 0, prefixes, 1, keyPrefix.length); return getResourceDescriptionResolver(false, prefixes); }

Target:
static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { return getResourceDescriptionResolver(false, keyPrefix); }
Source:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; if (fExecNamesCache.containsEntry(status, interval)) { NavigableSet<ITmfStateInterval> intervalSet = fExecNamesCache.get(status); for (ITmfStateInterval i : intervalSet) { if (CACHE_COMPARATOR.compare(i, interval) == 0) { processName = i.getValue(); break; } } } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }

Target:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; synchronized (fExecNamesCache) { if (fExecNamesCache.containsEntry(status, interval)) { NavigableSet<ITmfStateInterval> intervalSet = fExecNamesCache.get(status); ITmfStateInterval execNameInterval = intervalSet.ceiling(interval); if (execNameInterval != null && CACHE_COMPARATOR.compare(execNameInterval, interval) == 0) { processName = execNameInterval.getValue(); } } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
public void setChecked(boolean checked) { if (item instanceof Checkable) { ((Checkable) item).setChecked(checked); } this.checked = checked; }

Target:
public void setChecked(boolean checked) { if (checkable) { ((Checkable) item).setChecked(checked); } }
Source:
public static boolean hasSnapshot(String version) { return StringUtils.isNotEmpty(version) && version.endsWith(SNAPSHOT); }

Target:
public static boolean hasSnapshot(String version) { return StringUtils.endsWith(version, SNAPSHOT); }
Source:
public DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { super(vertx, createChannel(options.isIpV6() ? io.vertx.core.datagram.impl.InternetProtocolFamily.IPv6 : io.vertx.core.datagram.impl.InternetProtocolFamily.IPv4, new DatagramSocketOptions(options)), vertx.getOrCreateContext()); ContextImpl creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel().config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel().pipeline().addLast("logging", new LoggingHandler()); } channel.pipeline().addLast("handler", new DatagramServerHandler(this)); channel().config().setMaxMessagesPerRead(1); channel().config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); VertxMetrics metrics = vertx.metricsSPI(); this.metrics = metrics != null ? metrics.createMetrics(this, options) : null; }

Target:
private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { DatagramChannel channel = createChannel(options.isIpV6() ? io.vertx.core.datagram.impl.InternetProtocolFamily.IPv6 : io.vertx.core.datagram.impl.InternetProtocolFamily.IPv4, new DatagramSocketOptions(options)); ContextImpl context = vertx.getOrCreateContext(); if (context.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); channel.config().setMaxMessagesPerRead(1); channel.config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } VertxMetrics metrics = vertx.metricsSPI(); this.metrics = metrics != null ? metrics.createMetrics(this, options) : null; this.channel = channel; this.context = context; }
Source:
public Expression find(HumanTaskDefinition humanTaskDefinition, long expressionDefinitionId) { return humanTaskDefinition != null ? humanTaskDefinition.getUserFilter().accept(this, expressionDefinitionId) : null; }

Target:
public Expression find(HumanTaskDefinition humanTaskDefinition, long expressionDefinitionId) { return humanTaskDefinition != null ? getExpressionFromContainer(humanTaskDefinition.getUserFilter(), expressionDefinitionId) : null; }
Source:
public void testConvertAdHocSubprocessNode_SlaDueDate() { final String SLA_DUE_DATE = "12/25/1983"; SubProcess subProcess = bpmn2.createAdHocSubProcess(); subProcess.setId(UUID.randomUUID().toString()); subProcess.setTriggeredByEvent(Boolean.TRUE); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); AdHocSubprocess adHocSubprocess = (AdHocSubprocess) node.value().getContent().getDefinition(); assertNotNull(adHocSubprocess); assertNotNull(adHocSubprocess.getExecutionSet()); AdHocSubprocessTaskExecutionSet executionSet = adHocSubprocess.getExecutionSet(); SLADueDate slaDueDate = executionSet.getSlaDueDate(); assertNotNull(slaDueDate); assertTrue(slaDueDate.getValue().contains(SLA_DUE_DATE)); }

Target:
public void testConvertAdHocSubprocessNode_SlaDueDate() { SubProcess subProcess = bpmn2.createAdHocSubProcess(); subProcess.setTriggeredByEvent(Boolean.TRUE); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); AdHocSubprocess adHocSubprocess = (AdHocSubprocess) node.value().getContent().getDefinition(); assertNotNull(adHocSubprocess); assertBaseSubprocessExecutionSet(adHocSubprocess.getExecutionSet()); }
Source:
public Maybe<A> filter(@NotNull F<A, Boolean> f) { return this.value == null ? this : f.apply(this.value) ? this : empty(); }

Target:
public Maybe<A> filter(@NotNull F<A, Boolean> f) { return this.filter((Predicate<A>) f::apply); }
Source:
public APISession login(final String userName, final String password) throws LoginException { try { return loginInternal(userName, password, null); } catch (final UnknownUserException e) { throw e; } catch (final LoginException e) { throw e; } catch (final Exception e) { throw new LoginException(e); } }

Target:
public APISession login(final String userName, final String password) throws LoginException { try { return loginInternal(userName, password, null); } catch (final LoginException e) { throw e; } catch (final Exception e) { throw new LoginException(e); } }
Source:
@Test public void deleteChildlessDirectoryTest() { boolean deleted; if (Files.exists(DIRECTORY)) { try { deleted = BundleGeneratorUtils.delete(DIRECTORY); } catch (IOException e) { deleted = false; } } else { deleted = false; } Assert.assertTrue(deleted); }

Target:
public void deleteChildlessDirectoryTest() { boolean deleted; if (Files.exists(DIRECTORY)) { try { deleted = BundleGeneratorUtils.delete(DIRECTORY); } catch (IOException e) { deleted = false; } } else { deleted = false; } Assert.assertTrue(deleted); }
Source:
public void start() { if (!enabled || started.getAndSet(true)) { log.info("ShardOrganizationManager return"); return; } startDiscovery(); }

Target:
public void start() { if (!enabled || started.getAndSet(true)) { return; } startDiscovery(); }
Source:
private void restorePrivateDnsSetting() { Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldMode); if (mOldMode == "hostname") { Settings.Global.putString( mCR, Settings.Global.PRIVATE_DNS_SPECIFIER, mOldDnsSpecifier); CountDownLatch latch = new CountDownLatch(1); NetworkRequest request = new NetworkRequest.Builder().clearCapabilities().build(); NetworkCallback callback = new NetworkCallback() { @Override public void onLinkPropertiesChanged(Network n, LinkProperties lp) { if (!lp.getValidatedPrivateDnsServers().isEmpty() && mOldDnsSpecifier.equals(lp.getPrivateDnsServerName())) { latch.countDown(); } } }; mCM.registerNetworkCallback(request, callback); try { latch.await(PRIVATE_DNS_SETTING_TIMEOUT_MS, TimeUnit.MILLISECONDS); Thread.sleep(PRIVATE_DNS_PROBE_MS); } catch (InterruptedException e) { } finally { mCM.unregisterNetworkCallback(callback); } } }

Target:
private void restorePrivateDnsSetting() throws InterruptedException { Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldMode); if ("hostname".equals(mOldMode)) { Settings.Global.putString( mCR, Settings.Global.PRIVATE_DNS_SPECIFIER, mOldDnsSpecifier); mCtsNetUtils.awaitPrivateDnsSetting("restorePrivateDnsSetting timeout", mCM.getActiveNetwork(), mOldDnsSpecifier, PRIVATE_DNS_SETTING_TIMEOUT_MS, true); } }
Source:
public void testNameToFullModuleNameMap() throws Exception { final Reflections reflections = new Reflections(new ConfigurationBuilder() .setUrls(new URL("file:target/classes")) .setScanners(new SubTypesScanner())); final Set<Class<? extends AbstractViolationReporter>> classes = reflections.getSubTypesOf(AbstractViolationReporter.class); final Class<PackageObjectFactory> packageObjectFactoryClass = PackageObjectFactory.class; final Field field = packageObjectFactoryClass.getDeclaredField("NAME_TO_FULL_MODULE_NAME"); field.setAccessible(true); final Collection<String> canonicalNames = ((Map<String, String>) field.get(null)).values(); assertFalse(classes.stream() .anyMatch(clazz -> !canonicalNames.contains(clazz.getCanonicalName()) && !Modifier.isAbstract(clazz.getModifiers()) && !"Check".equals(clazz.getSimpleName()))); }

Target:
public void testNameToFullModuleNameMap() throws Exception { final Set<Class<?>> classes = CheckUtil.getCheckstyleModules(); final Class<PackageObjectFactory> packageObjectFactoryClass = PackageObjectFactory.class; final Field field = packageObjectFactoryClass.getDeclaredField("NAME_TO_FULL_MODULE_NAME"); field.setAccessible(true); final Collection<String> canonicalNames = ((Map<String, String>) field.get(null)).values(); assertFalse(classes.stream() .anyMatch(clazz -> !canonicalNames.contains(clazz.getCanonicalName()))); }
Source:
public SftpSession getSession() { JSchSessionWrapper jschSession = this.sharedJschSession; SftpSession sftpSession; if (this.sharedSessionLock != null) { this.sharedSessionLock.lock(); } try { if (jschSession == null || !jschSession.isConnected()) { jschSession = new JSchSessionWrapper(initJschSession()); } sftpSession = new SftpSession(jschSession); sftpSession.connect(); } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } finally { if (this.sharedSessionLock != null) { this.sharedSessionLock.unlock(); } } if (this.isSharedSession) { this.sharedJschSession = jschSession; } jschSession.addChannel(); return sftpSession; }

Target:
public SftpSession getSession() { JSchSessionWrapper jschSession = this.sharedJschSession; SftpSession sftpSession; if (this.sharedSessionLock != null) { this.sharedSessionLock.lock(); } try { boolean freshJschSession = false; if (jschSession == null || !jschSession.isConnected()) { jschSession = new JSchSessionWrapper(initJschSession()); freshJschSession = true; } sftpSession = new SftpSession(jschSession); sftpSession.connect(); if (this.isSharedSession && freshJschSession) { this.sharedJschSession = jschSession; } } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } finally { if (this.sharedSessionLock != null) { this.sharedSessionLock.unlock(); } } jschSession.addChannel(); return sftpSession; }
Source:
public void loadListTable(final String key, final Consumer<ListTable<T>> readyCallback) { preferences.load(preferences -> { final GridGlobalPreferences pref = new GridGlobalPreferences(key, getInitColumns(), getBannedColumns()); pref.setPageSize(preferences.getItemsPerPage()); final ListTable<T> newListGrid = new ListTable<>(pref); newListGrid.setShowLastPagerButton(false); newListGrid.setShowFastFordwardPagerButton(false); newListGrid.enableDataGridMinWidth(true); initSelectionModel(newListGrid); addColumnSortHandler(newListGrid); userPreferencesService.call((GridPreferencesStore preferencesStore) -> { if (preferencesStore == null) { newListGrid.setGridPreferencesStore(new GridPreferencesStore(pref)); } else { newListGrid.setGridPreferencesStore(preferencesStore); } initColumns(newListGrid); newListGrid.loadPageSizePreferences(); newListGrid.setPreferencesService(userPreferencesService); addNewTableToColumn(newListGrid); listTable = newListGrid; reloadColumnSortList(); listTable.getGridPreferencesStore().setPreferenceKey(null); readyCallback.accept(listTable); }).loadUserPreferences(key, UserPreferencesType.GRIDPREFERENCES); }, error -> new DefaultWorkbenchErrorCallback().error(error)); }

Target:
public void loadListTable(final String key, final Consumer<ListTable<T>> readyCallback) { preferences.load(preferences -> { final GridGlobalPreferences pref = new GridGlobalPreferences(key, getInitColumns(), getBannedColumns()); pref.setPageSize(preferences.getItemsPerPage()); final ListTable<T> newListGrid = new ListTable<>(pref); newListGrid.setShowLastPagerButton(false); newListGrid.setShowFastFordwardPagerButton(false); newListGrid.enableDataGridMinWidth(true); initSelectionModel(newListGrid); addColumnSortHandler(newListGrid); userPreferencesService.call((GridPreferencesStore preferencesStore) -> { if (preferencesStore == null) { newListGrid.setGridPreferencesStore(new GridPreferencesStore(pref)); } else { newListGrid.setGridPreferencesStore(preferencesStore); } initColumns(newListGrid); newListGrid.loadPageSizePreferences(); newListGrid.setPreferencesService(userPreferencesService); addNewTableToColumn(newListGrid); listTable = newListGrid; listTable.setPersistPreferencesOnChange(false); reloadColumnSortList(); readyCallback.accept(listTable); }).loadUserPreferences(key, UserPreferencesType.GRIDPREFERENCES); }, error -> new DefaultWorkbenchErrorCallback().error(error)); }
Source:
public void run() { { try { int addCount = 0; Collection curC = null; if (CollectionClass.TrecText.equals(collectionClass)) { curC = new TrecCollection((TrecCollection)c); } else if (CollectionClass.GOV2.equals(collectionClass)) { curC = new Gov2Collection((Gov2Collection)c); } else if (CollectionClass.CW09.equals(collectionClass)) { curC = new ClueWeb09Collection((ClueWeb09Collection)c); } else if (CollectionClass.CW12.equals(collectionClass)) { curC = new ClueWeb12Collection((ClueWeb12Collection)c); } curC.prepareInput(inputFile); while (curC.hasNext()) { Indexable d = (Indexable)curC.next(); if (d != null) { switch (collectionClass) { case CW09: case CW12: addCount += indexWarcRecord((WarcRecord) d); break; default: addCount += indexSimpleRecord(d); } } } curC.finishInput(); System.out.println("./" + inputFile.getParent().getFileName().toString() + File.separator + inputFile.getFileName().toString() + "\t" + addCount); } catch (IOException ioe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IOException:", ioe); } } }

Target:
public void run() { { try { int addCount = 0; Collection curC = (Collection)Class.forName("io.anserini.index.collections."+collectionClass+"Collection").newInstance(); curC.prepareInput(inputFile); while (curC.hasNext()) { Indexable d = (Indexable)curC.next(); if (d != null) { addCount += indexRecord(d); } } curC.finishInput(); System.out.println("./" + inputFile.getParent().getFileName().toString() + File.separator + inputFile.getFileName().toString() + "\t" + addCount); } catch (IOException ioe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IOException:", ioe); } catch (ClassNotFoundException cfe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected ClassNotFoundException:", cfe); } catch (IllegalAccessException iae) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IllegalAccessException:", iae); } catch (InstantiationException ie) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected InstantiationException:", ie); } } }
Source:
protected void determineRailDirection() { EnumRailDirection dir = TrackTools.getTrackDirection(getWorld(), getPos()); if (TrackTools.isRailBlockAt(getWorld(), getPos().east()) && TrackTools.isRailBlockAt(getWorld(), getPos().west())) { if (dir != EnumRailDirection.EAST_WEST) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.EAST_WEST); } else if (dir != EnumRailDirection.NORTH_SOUTH) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.NORTH_SOUTH); }

Target:
protected void determineRailDirection() { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(getWorld().getBlockState(getPos())); if (TrackTools.isRailBlockAt(getWorld(), getPos().east()) && TrackTools.isRailBlockAt(getWorld(), getPos().west())) { if (dir != EnumRailDirection.EAST_WEST) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.EAST_WEST); } else if (dir != EnumRailDirection.NORTH_SOUTH) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.NORTH_SOUTH); }
Source:
private void assertOpen() { if (status == State.CLOSED) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager."); } if (status == State.CLOSED_BY_CALLBACK_FAILURE) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager." + " Closed due to a callback throw.", callbackException); } }

Target:
private void assertOpen() { if (status == State.CLOSED) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager."); } if (status == State.CLOSED_BY_CALLBACK_FAILURE) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager." + " Closed due to a callback failure.", callbackThrowable); } }
Source:
public void deleteNetworkInterfaceCardResourceDoesNotExist() { final NetworkInterfaceCardApi nicApi = api.getNetworkInterfaceCardApi(resourcegroup); URI uri = nicApi.delete(NETWORKINTERFACECARD_NAME); if (uri != null) { assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.FAILED == api.getJobApi().jobStatus(uri); } }, 60 * 2 * 1000 ).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } }

Target:
public void deleteNetworkInterfaceCardResourceDoesNotExist() { final NetworkInterfaceCardApi nicApi = api.getNetworkInterfaceCardApi(resourcegroup); URI uri = nicApi.delete(NETWORKINTERFACECARD_NAME); assertNull(uri); }
Source:
public void testGetAllVariablesWithExclusionsForReporters() { MetricRegistry registry = TestingMetricRegistry.builder().setNumberReporters(2).build(); AbstractMetricGroup<?> group = new GenericMetricGroup(registry, null, "test") { @Override protected void putVariables(Map<String, String> variables) { variables.put("k1", "v1"); variables.put("k2", "v2"); } }; group.getAllVariables(-1, Collections.emptySet()); assertThat(group.getAllVariables(0, Collections.singleton("k1")), not(IsMapContaining.hasKey("k1"))); assertThat(group.getAllVariables(0, Collections.singleton("k1")), (IsMapContaining.hasKey("k2"))); assertThat(group.getAllVariables(1, Collections.singleton("k2")), (IsMapContaining.hasKey("k1"))); assertThat(group.getAllVariables(1, Collections.singleton("k2")), not(IsMapContaining.hasKey("k2"))); }

Target:
public void testGetAllVariablesWithExclusionsForReporters() { MetricRegistry registry = TestingMetricRegistry.builder().setNumberReporters(2).build(); AbstractMetricGroup<?> group = new GenericMetricGroup(registry, null, "test") { @Override protected void putVariables(Map<String, String> variables) { variables.put("k1", "v1"); variables.put("k2", "v2"); } }; group.getAllVariables(-1, Collections.emptySet()); assertThat(group.getAllVariables(0, Collections.singleton("k1")), not(IsMapContaining.hasKey("k1"))); assertThat(group.getAllVariables(0, Collections.singleton("k1")), IsMapContaining.hasKey("k2")); assertThat(group.getAllVariables(1, Collections.singleton("k2")), IsMapContaining.hasKey("k1")); assertThat(group.getAllVariables(1, Collections.singleton("k2")), not(IsMapContaining.hasKey("k2"))); }
Source:
public static String decodeUriPath(String path) { if (path == null) { return null; } try { return URLDecoder.decode(path.replace("+", "%2B"), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }

Target:
public static String decodeUriPath(String path) { if (path == null) { return null; } try { return URLDecoder.decode(path.replace("+", "%2B"), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
public void reset() { pathTextField.setText(null); j2GBBreakupRadioButton.setSelected(true); }

Target:
void reset() { pathTextField.setText(null); j2GBBreakupRadioButton.setSelected(true); }
Source:
public void switchToNewUser(String jwt, String url) { switchToNewUserInternal(jwt, url); }

Target:
public void switchToNewUser(String jwt, String url) { if (TextUtils.isEmpty(jwt) || TextUtils.isEmpty(url)) { super.switchToNewUser(); } else { super.switchToNewUser(jwt, url); } final UserAccount userAccount = SmartSyncUserAccountManager.getInstance().getCurrentUser(); CacheManager.softReset(userAccount); MetadataManager.reset(userAccount); }
Source:
public void captureFile(Path src, Digest digest, boolean isActionCache) throws IOException { Path target = toPath(digest.getHash(), isActionCache); ensureParentExists(target); src.renameTo(target); }

Target:
public void captureFile(Path src, Digest digest, boolean isActionCache) throws IOException { Path target = toPath(digest.getHash(), isActionCache); target.getParentDirectory().createDirectoryAndParents(); src.renameTo(target); }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!server.getPluginManager().isPluginEnabled("Essentials")) { playerMsg("Essentials is not enabled on this server"); return true; } TFM_Util.adminAction(sender.getName(), "Wiping Essentials Warps", true); TFM_Util.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "warps")); playerMsg("All Warps deleted."); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!server.getPluginManager().isPluginEnabled("Essentials")) { playerMsg("Essentials is not enabled on this server"); return true; } TFM_Util.adminAction(sender.getName(), "Wiping Essentials warps", true); TFM_Util.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "warps")); playerMsg("All Warps deleted."); return true; }
Source:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }

Target:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { close(dbConnection); } }
Source:
public void syncAssetNodes() { List<String> syncPaths = new ArrayList<>(); syncPaths.addAll(this.remoteAssetsConfig.getTagSyncPaths()); syncPaths.addAll(this.remoteAssetsConfig.getDamSyncPaths()); try { for (String syncPath : syncPaths) { this.session.refresh(true); JSONObject topLevelJson = getJsonFromUri(syncPath); Node topLevelSyncNode = getOrCreateNode(syncPath, (String) topLevelJson.get(JcrConstants.JCR_PRIMARYTYPE)); createOrUpdateNodes(topLevelJson, topLevelSyncNode); this.session.save(); } } catch (IOException e) { LOG.error("IO Exception {}", e); } catch (JSONException e) { LOG.error("Json Exception {}", e); } catch (RepositoryException e) { LOG.error("Repository Exception {}", e); } }

Target:
public void syncAssetNodes() { ResourceResolver remoteAssetsResolver = this.remoteAssetsConfig.getResourceResolver(); try { List<String> syncPaths = new ArrayList<>(); syncPaths.addAll(this.remoteAssetsConfig.getTagSyncPaths()); syncPaths.addAll(this.remoteAssetsConfig.getDamSyncPaths()); for (String syncPath : syncPaths) { LOG.info("Starting sync of nodes for {}", syncPath); remoteAssetsResolver.refresh(); JsonObject topLevelJsonWithChildren = getJsonFromUri(syncPath); String resourcePrimaryType = topLevelJsonWithChildren.getAsJsonPrimitive(JcrConstants.JCR_PRIMARYTYPE).getAsString(); Resource topLevelSyncResource = getOrCreateNode(remoteAssetsResolver, syncPath, resourcePrimaryType); createOrUpdateNodes(remoteAssetsResolver, topLevelJsonWithChildren, topLevelSyncResource); remoteAssetsResolver.commit(); LOG.info("Completed sync of nodes for {}", syncPath); } } catch (Exception e) { LOG.error("Unexpected error sync'ing remote asset nodes", e); } finally { this.remoteAssetsConfig.closeResourceResolver(remoteAssetsResolver); } }
Source:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { final Optional<String> clientId = Optional.ofNullable(authorizationService.getSubject().isPresent() ? authorizationService.getSubject().get().getName():"unauthenticated"); if (clientId.filter(settings.getAdminClientId()::equals).isPresent() || settings.getAuthMode() == OFF) { return new FullAccessClient(clientId.orElse(FULL_ACCESS_CLIENT_ID)); } return clientId.map(client -> new NakadiClient(client, getRealm())) .orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }

Target:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) { final String clientId = authorizationService.getSubject().map(Subject::getName) .orElse(SecuritySettings.UNAUTHENTICATED_CLIENT_ID); if(settings.getAuthMode() == OFF) { return new FullAccessClient(clientId); } else { if (clientId.equals(settings.getAdminClientId())) { return new FullAccessClient(FULL_ACCESS_CLIENT_ID); } else if (!authorizationService.getSubject().isPresent()) { throw new UnauthorizedUserException("Client unauthorized"); } else { return new NakadiClient(clientId, getRealm()); } } }
Source:
private String getPrintedJndiTree(ByteArrayOutputStream buffer) { try { return buffer.toString("utf-8"); } catch (UnsupportedEncodingException e) { return null; } }

Target:
private String getPrintedJndiTree(ByteArrayOutputStream buffer) { try { return buffer.toString(StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return null; } }
Source:
private static byte[] compress(final byte[] raw) throws IOException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final GZIPOutputStream gz = new GZIPOutputStream(out); gz.write(raw); gz.finish(); gz.flush(); return out.toByteArray(); }

Target:
private static byte[] compress(final byte[] raw) throws IOException { final int maxLen = raw.length + 32; final ByteArrayOutputStream out = new ByteArrayOutputStream(maxLen); final GZIPOutputStream gz = new GZIPOutputStream(out); gz.write(raw); gz.finish(); gz.flush(); return out.toByteArray(); }
Source:
private void assertMatchesEvery(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(CatchUpStation.matches(job, message)) .isTrue(); } }

Target:
private void assertMatchesEvery(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(job.matches(message)) .isTrue(); } }
Source:
public void testRepeater() throws Exception { Task<?> t; t = Tasks.requiring(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); t.get(Duration.ONE_SECOND); t = Tasks.testing(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.ONE_SECOND), true); t = Tasks.requiring(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); try { t.get(Duration.ONE_SECOND); Assert.fail("Should have failed"); } catch (Exception e) { } t = Tasks.testing(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.ONE_SECOND), false); }

Target:
public void testRepeater() throws Exception { Task<?> t; t = Tasks.requiring(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); t.get(Duration.TEN_SECONDS); t = Tasks.testing(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.TEN_SECONDS), true); t = Tasks.requiring(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); try { t.get(Duration.TEN_SECONDS); Assert.fail("Should have failed"); } catch (Exception e) { } t = Tasks.testing(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.TEN_SECONDS), false); }
Source:
private int selectNextReadingInputIndex() throws IOException { updateAvailability(); checkInputSelectionAgainstIsFinished(); if (inputSelectionHandler.isInputUnavailable(0) && inputSelectionHandler.isInputUnavailable(1)) { fullCheckAndSetAvailable(); } int readingInputIndex = inputSelectionHandler.selectNextInputIndex(lastReadInputIndex); if (readingInputIndex == InputSelection.NONE_AVAILABLE) { return InputSelection.NONE_AVAILABLE; } if (inputSelectionHandler.shouldSetAvailableForAnotherInput()) { checkAndSetAvailable(1 - readingInputIndex); } return readingInputIndex; }

Target:
private int selectNextReadingInputIndex() throws IOException { updateAvailability(); checkInputSelectionAgainstIsFinished(); int readingInputIndex = inputSelectionHandler.selectNextInputIndex(lastReadInputIndex); if (readingInputIndex == InputSelection.NONE_AVAILABLE) { return InputSelection.NONE_AVAILABLE; } if (inputSelectionHandler.shouldSetAvailableForAnotherInput()) { checkAndSetAvailable(1 - readingInputIndex); } return readingInputIndex; }
Source:
private boolean pathMatch() { Byte[] curr; int size = 0; try { outputStream.close(); outputStream = new ByteArrayOutputStream(); for (Byte[] bb : allKeys) { if (bb[0] == 0x19) { size = size + 9; } else { size = size + ArrayUtils.toPrimitive(bb).length; } outputStream.write(ArrayUtils.toPrimitive(bb)); } } catch (IOException e1) { e1.printStackTrace(); } curr = ArrayUtils.toObject(Arrays.copyOfRange(outputStream.toByteArray(), 0, size)); boolean contains = false; this.matched = false; Byte[] prefix; for (Byte[] path : paths) { if (path.length < curr.length) { prefix = Arrays.copyOfRange(curr, 0, path.length); contains = contains || Arrays.equals(prefix, path); } else { prefix = Arrays.copyOfRange(path, 0, curr.length); contains = contains || Arrays.equals(prefix, curr); } if (path.length == curr.length && contains) { this.objectMatchLevel = this.levelObject; this.matched = true; this.literal = false; } } return contains; }

Target:
private boolean pathMatch() { outputStream.reset(); for (Byte[] bb : allKeys) { outputStream.write(ArrayUtils.toPrimitive(bb), 0, ArrayUtils.toPrimitive(bb).length); } boolean contains = false; this.matched = false; prefixStream.reset(); if (pathStream.size() < outputStream.size()) { prefixStream.write(outputStream.toByteArray(), 0, pathStream.size()); contains = Arrays.equals(prefixStream.toByteArray(), pathStream.toByteArray()); } else { prefixStream.write(pathStream.toByteArray(), 0, outputStream.size()); contains = Arrays.equals(prefixStream.toByteArray(), outputStream.toByteArray()); } if (pathStream.size() == outputStream.size() && contains) { this.objectMatchLevel = this.levelObject; this.matched = true; this.literal = false; } return contains; }
Source:
public static SyncConfiguration automatic() { SyncUser user = SyncUser.currentUser(); if (user == null) { throw new IllegalStateException("No user was logged in."); } return getDefaultConfig(user); }

Target:
public static SyncConfiguration automatic() { SyncUser user = SyncUser.current(); if (user == null) { throw new IllegalStateException("No user was logged in."); } return getDefaultConfig(user); }
Source:
private synchronized void addEntryTodnsToUuidMap( String dnsName, String uuid) { Set<String> dnList = dnsToUuidMap.get(dnsName); if (dnList == null) { dnList = new HashSet<>(); dnsToUuidMap.put(dnsName, dnList); } dnList.add(uuid); }

Target:
private synchronized void addEntryTodnsToUuidMap( String dnsName, String uuid) { Set<String> dnList = dnsToUuidMap.get(dnsName); if (dnList == null) { dnList = ConcurrentHashMap.newKeySet(); dnsToUuidMap.put(dnsName, dnList); } dnList.add(uuid); }
Source:
public Candidate getCandidate() { double[] values = selectionOperator.buildNextGenes(); Object value = null; Exception e = null; try { value = parameterSpace.getValue(values); } catch (Exception e2) { e = e2; } return new Candidate(value, candidateCounter.getAndIncrement(), values, dataParameters, e); }

Target:
public Candidate getCandidate() { double[] values = null; Object value = null; Exception e = null; try { values = selectionOperator.buildNextGenes(); value = parameterSpace.getValue(values); } catch (GeneticGenerationException e2) { log.warn("Error generating candidate", e2); e = e2; hasMoreCandidates = false; } catch (Exception e2) { log.warn("Error getting configuration for candidate", e2); e = e2; } return new Candidate(value, candidateCounter.getAndIncrement(), values, dataParameters, e); }
Source:
public void onSettingsClick(MenuItem item) { Toast.makeText(this, "Open settings", Toast.LENGTH_SHORT).show(); showSettingsDialog(); }

Target:
public void onSettingsClick(MenuItem item) { showSettingsDialog(); }
Source:
private void estimateCommandsMachineName( WorkspaceConfig workspaceConfig, Tool tool, List<HasMetadata> toolsObjects) { List<? extends Command> toolCommands = workspaceConfig .getCommands() .stream() .filter( c -> tool.getName() .equals(c.getAttributes().get(Constants.TOOL_NAME_COMMAND_ATTRIBUTE))) .collect(toList()); if (toolCommands.isEmpty()) { return; } List<PodData> podsData = new ArrayList<>(); toolsObjects .stream() .filter(hasMetadata -> hasMetadata instanceof Pod) .map(hasMetadata -> (Pod) hasMetadata) .forEach(p -> podsData.add(new PodData(p))); toolsObjects .stream() .filter(hasMetadata -> hasMetadata instanceof Deployment) .map(hasMetadata -> (Deployment) hasMetadata) .forEach(d -> podsData.add(new PodData(d))); PodData pod; if (podsData.size() != 1 || (pod = podsData.get(0)).getSpec().getContainers().isEmpty()) { return; } String machineName = Names.machineName(pod, pod.getSpec().getContainers().get(0)); toolCommands.forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }

Target:
private void estimateCommandsMachineName( WorkspaceConfig workspaceConfig, Tool tool, List<HasMetadata> toolsObjects) { List<? extends Command> toolCommands = workspaceConfig .getCommands() .stream() .filter( c -> tool.getName() .equals(c.getAttributes().get(Constants.TOOL_NAME_COMMAND_ATTRIBUTE))) .collect(toList()); if (toolCommands.isEmpty()) { return; } List<PodData> podsData = new ArrayList<>(); toolsObjects .stream() .filter(hasMetadata -> hasMetadata instanceof Pod) .map(hasMetadata -> (Pod) hasMetadata) .forEach(p -> podsData.add(new PodData(p))); toolsObjects .stream() .filter(hasMetadata -> hasMetadata instanceof Deployment) .map(hasMetadata -> (Deployment) hasMetadata) .forEach(d -> podsData.add(new PodData(d))); if (podsData.size() != 1) { return; } PodData pod = podsData.get(0); if (pod.getSpec().getContainers().size() != 1) { return; } String machineName = Names.machineName(pod, pod.getSpec().getContainers().get(0)); toolCommands.forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }
Source:
protected boolean deploymentNeverDisabled(List<String> previewListItems) { return itemInListExistsLowerCase(previewListItems, "the deployment was never disabled"); }

Target:
public boolean deploymentNeverDisabled(List<String> previewListItems) { return itemInListExistsLowerCase(previewListItems, "the deployment was never disabled"); }
Source:
public void checkpoint(ManagementPlaneSyncRecord record) { init(); for (ManagementNodeSyncRecord node : record.getManagementNodes().values()) { if (node.getNodeId() != null) { persist(node); } } }

Target:
public void checkpoint(ManagementPlaneSyncRecord record) { init(); for (ManagementNodeSyncRecord node : record.getManagementNodes().values()) { if (!ManagementNodeState.INITIALIZING.equals(node.getStatus()) && node.getNodeId() != null) { persist(node); } } }
Source:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); OpenSpan callState = Tracer.startSpan(request.method() + " " + request.url()); Request.Builder tracedRequest = request.newBuilder() .addHeader(TraceHttpHeaders.TRACE_ID, Tracer.getTraceId()) .addHeader(TraceHttpHeaders.SPAN_ID, callState.getSpanId()); if (callState.getParentSpanId().isPresent()) { tracedRequest.header(TraceHttpHeaders.PARENT_SPAN_ID, callState.getParentSpanId().get()); } try { return chain.proceed(tracedRequest.build()); } finally { Tracer.completeSpan(); } }

Target:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); OpenSpan span = Tracer.startSpan(request.method() + " " + request.url()); Request.Builder tracedRequest = request.newBuilder() .addHeader(TraceHttpHeaders.TRACE_ID, Tracer.getTraceId()) .addHeader(TraceHttpHeaders.SPAN_ID, span.getSpanId()) .addHeader(TraceHttpHeaders.IS_SAMPLED, Tracer.isTraceObservable() ? "1" : "0"); if (span.getParentSpanId().isPresent()) { tracedRequest.header(TraceHttpHeaders.PARENT_SPAN_ID, span.getParentSpanId().get()); } try { return chain.proceed(tracedRequest.build()); } finally { Tracer.completeSpan(); } }
Source:
public int deduplicate(String crawlId, String batchId) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long start = System.currentTimeMillis(); LOG.info("DeduplicatorJob: starting at " + sdf.format(start)); if (batchId.equals(Nutch.ALL_BATCH_ID_STR)) { LOG.info("DeduplicatorJob: deduplicating all"); } else { LOG.info("DeduplicatorJob: batchId: "+ batchId); } run(ToolUtil.toArgMap(Nutch.ARG_CRAWL, crawlId, Nutch.ARG_BATCH, batchId)); long finish = System.currentTimeMillis(); LOG.info("DeduplicatorJob: finished at " + sdf.format(finish) + ", time elapsed: " + TimingUtil.elapsedTime(start, finish)); return 0; }

Target:
public int deduplicate(String crawlId, String batchId) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long start = System.currentTimeMillis(); LOG.info("DeduplicatorJob: starting at {}", sdf.format(start)); if (batchId.equals(Nutch.ALL_BATCH_ID_STR)) { LOG.info("DeduplicatorJob: deduplicating all"); } else { LOG.info("DeduplicatorJob: batchId: {}", batchId); } run(ToolUtil.toArgMap(Nutch.ARG_CRAWL, crawlId, Nutch.ARG_BATCH, batchId)); long finish = System.currentTimeMillis(); LOG.info("DeduplicatorJob: finished at {}, time elapsed: {}", sdf.format(finish), TimingUtil.elapsedTime(start, finish)); return 0; }
Source:
public static boolean isMoeFile(IResource resource) { if(resource instanceof IFile ) { String fileExtension = resource.getFileExtension(); return fileExtension != null && resource.getFileExtension().equals(MODEL_OBJECT_ELEMENTFILE_EXTENSION); } return false; }

Target:
public static boolean isMoeFile(IResource resource) { return resource instanceof IFile && MODEL_OBJECT_ELEMENTFILE_EXTENSION.equals(resource.getFileExtension()); }