auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testReferenceCountingWhileQueryExecuting() throws Exception { loadQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); Future future = assertQueryable( QueryGranularity.DAY, "test", new Interval("2011-04-04/2011-04-06"), ImmutableList.<Pair<String, Interval>>of( new Pair<String, Interval>("3", new Interval("2011-04-04/2011-04-05")) ) ); queryNotifyLatch.await(); Assert.assertEquals(1, factory.getSegmentReferences().size()); for (ReferenceCountingSegment referenceCountingSegment : factory.getSegmentReferences()) { Assert.assertEquals(1, referenceCountingSegment.getNumReferences()); } queryWaitYieldLatch.countDown(); Assert.assertEquals(1, factory.getAdapters().size()); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } dropQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } queryWaitLatch.countDown(); future.get(); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertTrue(segmentForTesting.isClosed()); } }

Target:
public void testReferenceCountingWhileQueryExecuting() throws Exception { loadQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); Future future = assertQueryable( QueryGranularity.DAY, "test", new Interval("2011-04-04/2011-04-06"), ImmutableList.<Pair<String, Interval>>of( new Pair<String, Interval>("3", new Interval("2011-04-04/2011-04-05")) ) ); queryNotifyLatch.await(1000, TimeUnit.MILLISECONDS); Assert.assertEquals(1, factory.getSegmentReferences().size()); for (ReferenceCountingSegment referenceCountingSegment : factory.getSegmentReferences()) { Assert.assertEquals(1, referenceCountingSegment.getNumReferences()); } queryWaitYieldLatch.countDown(); Assert.assertEquals(1, factory.getAdapters().size()); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } dropQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } queryWaitLatch.countDown(); future.get(); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertTrue(segmentForTesting.isClosed()); } }
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); List<ITmfTreeViewerEntry> entryList = root.getChildren(); if (isSelection) { setStats(start, end, entryList, module, getSelectionLabel(), new NullProgressMonitor()); } setStats(start, end, entryList, module, getTotalLabel(), new NullProgressMonitor()); return root; }

Target:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); List<ITmfTreeViewerEntry> entryList = root.getChildren(); if (isSelection) { setStats(start, end, entryList, module, true, new NullProgressMonitor()); } setStats(start, end, entryList, module, false, new NullProgressMonitor()); return root; }
Source:
public void prefetchChildren(AlluxioURI path, MountTable mountTable) { if (mPrefetchExecutor == null) { return; } try { Future<Collection<UfsStatus>> fute = mPrefetchExecutor.submit(() -> getChildrenIfAbsent(path, mountTable)); Future<Collection<UfsStatus>> prev = mActivePrefetchJobs.put(path, fute); if (prev != null) { prev.cancel(true); } } catch (RejectedExecutionException e) { LOG.debug("Failed to submit prefetch job", e); } }

Target:
public Future<Collection<UfsStatus>> prefetchChildren(AlluxioURI path, MountTable mountTable) { if (mPrefetchExecutor == null) { return null; } try { Future<Collection<UfsStatus>> job = mPrefetchExecutor.submit(() -> getChildrenIfAbsent(path, mountTable)); Future<Collection<UfsStatus>> prev = mActivePrefetchJobs.put(path, job); if (prev != null) { prev.cancel(true); } return job; } catch (RejectedExecutionException e) { LOG.debug("Failed to submit prefetch job for path {}", path, e); return null; } }
Source:
public String getRegexToolPattern() { return String.format("%1$s(?<%2$s>[0-9]{1,}.[0-9])[_|-]{1}(?<%3$s>[0-9]{1,})[.0-9a-z]*.[i|I][s|S][o|O]$", getGuestToolsSetupIsoPrefix(), TOOL_CLUSTER_LEVEL, TOOL_VERSION); }

Target:
public String getRegexToolPattern() { return String.format("%1$s(?<%2$s>[0-9]{1,}.[0-9])[_|-]{1}(?<%3$s>[0-9]{1,})[.\\w]*.[i|I][s|S][o|O]$", getGuestToolsSetupIsoPrefix(), TOOL_CLUSTER_LEVEL, TOOL_VERSION); }
Source:
public String getCategoryId() { return "uncategorized"; }

Target:
public String getCategoryId() { return "nested-projects"; }
Source:
public static boolean isNotResolved(Bundle bundle) { return bundle.getState() == Bundle.INSTALLED || bundle.getState() == Bundle.UNINSTALLED; }

Target:
public static boolean isNotResolved(Bundle bundle) { return (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) != 0; }
Source:
private void start(boolean cleanQueues) { this.getLifeCycleLock().writeLock().lock(); try { if (isRunning()) { logger.warn("Gateway Sender is already running", this.getId()); return; } if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) { String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators(); if (locators.length() == 0) { throw new IllegalStateException( "Locators must be configured before starting gateway-sender."); } } eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this, getThreadMonitorObj(), cleanQueues); if (startEventProcessorInPausedState) { pauseEvenIfProcessorStopped(); } eventProcessor.start(); waitForRunningStatus(); if (!isAsyncEventQueue()) { getCache().getPdxRegistry().gatewaySenderStarted(this); } new UpdateAttributesProcessor(this).distribute(false); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this); logger.info("Started {}", this); enqueueTempEvents(); startTime = System.currentTimeMillis(); } finally { this.getLifeCycleLock().writeLock().unlock(); } }

Target:
private void start(boolean cleanQueues) { this.getLifeCycleLock().writeLock().lock(); try { if (isRunning()) { logger.warn("Gateway Sender is already running", this.getId()); return; } if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) { String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators(); if (locators.length() == 0) { throw new IllegalStateException( "Locators must be configured before starting gateway-sender."); } } eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this, getThreadMonitorObj(), cleanQueues); if (startEventProcessorInPausedState) { pauseEvenIfProcessorStopped(); } eventProcessor.start(); waitForRunningStatus(); startTime = System.currentTimeMillis(); if (!isAsyncEventQueue()) { getCache().getPdxRegistry().gatewaySenderStarted(this); } new UpdateAttributesProcessor(this).distribute(false); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this); logger.info("Started {}", this); enqueueTempEvents(); } finally { this.getLifeCycleLock().writeLock().unlock(); } }
Source:
public DepthwiseConvolution2D clone() { DepthwiseConvolution2D clone = (DepthwiseConvolution2D) super.clone(); if (clone.kernelSize != null) clone.kernelSize = clone.kernelSize.clone(); if (clone.stride != null) clone.stride = clone.stride.clone(); if (clone.padding != null) clone.padding = clone.padding.clone(); return clone; }

Target:
public DepthwiseConvolution2D clone() { DepthwiseConvolution2D clone = (DepthwiseConvolution2D) super.clone(); clone.depthMultiplier = depthMultiplier; return clone; }
Source:
public List<ClientModel> getClients(RealmModel realm) { TypedQuery<ClientEntity> query = em.createNamedQuery("getClientsByRealm", ClientEntity.class); Set<ClientEntity> result = null; Map<String, Set<RoleModel>> rolesMap = new TreeMap<>(); query.setParameter("realm", realm.getId()); for (Tuple t : em.createNamedQuery("realmScopeMappingIds", Tuple.class).setParameter("realm", realm.getId()).getResultList()) { rolesMap.computeIfAbsent(t.get(0, String.class), k -> new HashSet<>()) .add(realm.getRoleById(t.get(1, String.class))); } result = new HashSet<>(query.getResultList()); if (!result.isEmpty()) { for (String name : GET_CLIENTS_REALM_GRAPH_JOIN) { query.setHint(JPAConstants.LOADGRAPH, em.getEntityGraph(name)); result.addAll(query.getResultList()); } } result.forEach(clientEntity -> { if (!rolesMap.containsKey(clientEntity.getId())) { rolesMap.put(clientEntity.getId(), Collections.emptySet()); } }); return result.stream().map(app -> new PrefetchClientAdapter(realm, em, session, app, rolesMap.get(app.getId()))) .collect(Collectors.collectingAndThen( Collectors.toList(), Collections::unmodifiableList)); }

Target:
public List<ClientModel> getClients(RealmModel realm) { TypedQuery<String> query = em.createNamedQuery("getClientIdsByRealm", String.class); query.setParameter("realm", realm.getId()); List<String> clients = query.getResultList(); if (clients.isEmpty()) return Collections.EMPTY_LIST; List<ClientModel> list = new LinkedList<>(); for (String id : clients) { ClientModel client = session.realms().getClientById(id, realm); if (client != null) list.add(client); } return Collections.unmodifiableList(list); }
Source:
public StoreClientFactory( Configs configs, int requestTimeoutInSeconds, int maxConcurrentConnectionOpenRequests, UserAgentContainer userAgent, boolean enableTransportClientSharing) { this.configs = configs; this.protocol = configs.getProtocol(); this.requestTimeoutInSeconds = requestTimeoutInSeconds; this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; this. enableTransportClientSharing = enableTransportClientSharing; if (protocol == Protocol.HTTPS) { this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); } else if (protocol == Protocol.TCP){ if (enableTransportClientSharing) { this.transportClient = SharedRntbdTransportClient.getOrCreateInstance(configs, requestTimeoutInSeconds, userAgent); } else { this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); } } else { throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); } }

Target:
public StoreClientFactory( Configs configs, int requestTimeoutInSeconds, int maxConcurrentConnectionOpenRequests, UserAgentContainer userAgent, boolean enableTransportClientSharing) { this.configs = configs; this.protocol = configs.getProtocol(); this.requestTimeoutInSeconds = requestTimeoutInSeconds; this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; this.enableTransportClientSharing = enableTransportClientSharing; if (enableTransportClientSharing) { this.transportClient = SharedTransportClient.getOrCreateInstance(protocol, configs, requestTimeoutInSeconds, userAgent); } else { if (protocol == Protocol.HTTPS) { this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); } else if (protocol == Protocol.TCP) { this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); } else { throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); } } }
Source:
public void setup() { ClassOrInterfaceDeclaration fakeObject = new ClassOrInterfaceDeclaration(); fakeObject.setName(new SimpleName("java.lang.Object")); final MethodDeclaration equals = fakeObject.addMethod("equals", Modifier.PUBLIC); equals.addParameter("java.lang.Object", "obj"); final BlockStmt body = new BlockStmt(); body.addStatement("return this == obj;"); equals.setBody(body); TypeSolver typeSolver = new TypeSolver() { @Override public TypeSolver getParent() { return null; } @Override public void setParent(TypeSolver parent) { } @Override public SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveType(String name) { if ("java.lang.Object".equals(name)) { return SymbolReference.solved(new JavaParserClassDeclaration(fakeObject, this)); } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); } }; ParserConfiguration config = new ParserConfiguration(); config.setSymbolResolver(new JavaSymbolSolver(typeSolver)); javaParser = new JavaParser(config); }

Target:
public void setup() { final CompilationUnit compilationUnit = new CompilationUnit(); compilationUnit.setPackageDeclaration("java.lang"); final ClassOrInterfaceDeclaration clazz = compilationUnit.addClass("Object", Modifier.PUBLIC); final MethodDeclaration equals = clazz.addMethod("equals", Modifier.PUBLIC); equals.addParameter("Object", "obj"); final BlockStmt body = new BlockStmt(); body.addStatement("return this == obj;"); equals.setBody(body); TypeSolver typeSolver = new TypeSolver() { @Override public TypeSolver getParent() { return null; } @Override public void setParent(TypeSolver parent) { } @Override public SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveType(String name) { if ("java.lang.Object".equals(name)) { return SymbolReference.solved(new JavaParserClassDeclaration(clazz, this)); } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); } }; ParserConfiguration config = new ParserConfiguration(); config.setSymbolResolver(new JavaSymbolSolver(typeSolver)); javaParser = new JavaParser(config); }
Source:
public void testNotFoundKey() { final List<String> testStrings = new ArrayList<>(3); Method getLineNumber = null; try { getLineNumber = UniquePropertiesCheck.class.getDeclaredMethod( "getLineNumber", FileText.class, String.class); } catch (NoSuchMethodException ex) { LOG.debug("NoSuchMethodException occurred.", ex); } getLineNumber.setAccessible(true); testStrings.add(""); testStrings.add("0 = 0"); testStrings.add("445"); final FileText fileText = new FileText(new File("some.properties"), testStrings); Object lineNumber = null; try { lineNumber = getLineNumber.invoke(UniquePropertiesCheck.class, fileText, "some key"); } catch (IllegalAccessException ex) { LOG.debug("IllegalAccessException occurred.", ex); } catch (InvocationTargetException ex) { LOG.debug("InvocationTargetException occurred.", ex); } assertEquals("Invalid line number", 0, lineNumber); }

Target:
public void testNotFoundKey() throws Exception { final List<String> testStrings = new ArrayList<>(3); final Method getLineNumber = UniquePropertiesCheck.class.getDeclaredMethod( "getLineNumber", FileText.class, String.class); Assert.assertNotNull(getLineNumber); getLineNumber.setAccessible(true); testStrings.add(""); testStrings.add("0 = 0"); testStrings.add("445"); final FileText fileText = new FileText(new File("some.properties"), testStrings); final Object lineNumber = getLineNumber.invoke(UniquePropertiesCheck.class, fileText, "some key"); Assert.assertNotNull(lineNumber); assertEquals("Invalid line number", 0, lineNumber); }
Source:
public void nest(Node node){ Pane nestSPace = (Pane) this.lookup("#nest_space"); ((Label) this.lookup("#label_function_name")).setText("Higher order function"); nestSPace.getChildren().add(node); }

Target:
public void nest(Node node) { Pane nestSpace = (Pane) this.lookup("#nest_space"); ((Label) this.lookup("#label_function_name")).setText("Higher order function"); nestSpace.getChildren().add(node); }
Source:
public URLStreamHandler createURLStreamHandler(String protocol) { LOG.debug("createURLStreamHandler("+protocol+")"); removeInvalidRefs(); for(WeakReference<PluginRepository> ref: prs) { PluginRepository pr = ref.get(); if(pr != null) { return pr.createURLStreamHandler(protocol); } } return null; }

Target:
public URLStreamHandler createURLStreamHandler(String protocol) { LOG.debug("createURLStreamHandler({})", protocol); removeInvalidRefs(); for(WeakReference<PluginRepository> ref: prs) { PluginRepository pr = ref.get(); if(pr != null) { return pr.createURLStreamHandler(protocol); } } return null; }
Source:
public ResultSet executeQuery(String query) { ResultSet result = null; try { Statement s = mConnection.createStatement(); s.execute("Select 1;"); } catch (SQLException e) { reconnection(); } try { Statement statement = mConnection.createStatement(); result = statement.executeQuery(query); } catch (SQLException e) { System.out.println(e.getMessage()); return null; } return result; }

Target:
public ResultSet executeQuery(String query) { ResultSet result = null; try { Statement statement = mConnection.createStatement(); statement.execute("Select 1;"); } catch (SQLException e) { reconnect(); } try { Statement statement = mConnection.createStatement(); result = statement.executeQuery(query); } catch (SQLException e) { System.out.println(e.getMessage()); return null; } return result; }
Source:
public boolean matchesSafely(final Response item) { try { final String head = item.head().iterator().next(); return head.contains(String.valueOf(this.expected)); } catch (final IOException exception) { throw new IllegalStateException(exception); } }

Target:
public boolean matchesSafely(final Response item) { try { final String head = item.head().iterator().next(); final String[] parts = head.split(" "); return this.expected.equals(parts[1]); } catch (final IOException exception) { throw new IllegalStateException(exception); } }
Source:
public void closeWindow() { if (!shouldClose(programs())) { return; } closeViewer(); }

Target:
public void closeWindow() { if (shouldClose(programs())) { closeViewer(); } }
Source:
private static byte[] createRequestBody(String query, String resultFormat, boolean queryHeader) { if (!queryHeader) { return format("{\"query\":\"%s\",\"resultFormat" + "\":\"%s\",\"header\": false }\n", query, resultFormat).getBytes(); } else { return format("{\"query\":\"%s\"}\n", query).getBytes(); } }

Target:
private static byte[] createRequestBody(String query, String resultFormat, boolean queryHeader) { if (queryHeader) { return format("{\"query\":\"%s\"}\n", query).getBytes(); } else { return format("{\"query\":\"%s\",\"resultFormat" + "\":\"%s\",\"header\": false }\n", query, resultFormat).getBytes(); } }
Source:
public UserUsage getUsage(String username) { int userId = getUserId(username); try (PreparedStatement search = conn.prepareStatement("SELECT total_bytes, errored FROM userusage WHERE user_id = ?;")) { search.setInt(1, userId); ResultSet resultSet = search.executeQuery(); resultSet.next(); long totalBytes = resultSet.getLong(1); boolean errored = resultSet.getBoolean(2); Map<PublicKeyHash, Long> pending = new HashMap<>(); try (PreparedStatement pendingSearch = conn.prepareStatement("SELECT writer_id, pending_bytes FROM pendingusage WHERE user_id = ?;")) { pendingSearch.setInt(1, userId); ResultSet pendingResults = pendingSearch.executeQuery(); while (pendingResults.next()) pending.put(getWriter(pendingResults.getInt(1)), pendingResults.getLong(2)); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } return new UserUsage(totalBytes, errored, pending); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }

Target:
public UserUsage getUsage(String username) { int userId = getUserId(username); try (Connection conn = getNonCommittingConnection(); PreparedStatement search = conn.prepareStatement("SELECT pu.writer_id, pu.pending_bytes, uu.total_bytes, uu.errored " + "FROM userusage uu, pendingusage pu WHERE uu.user_id = pu.user_id AND uu.user_id = ?;"); PreparedStatement writerSearch = conn.prepareStatement("SELECT key_hash FROM writers WHERE id = ?;")) { try { search.setInt(1, userId); ResultSet resultSet = search.executeQuery(); Map<PublicKeyHash, Long> pending = new HashMap<>(); long totalBytes = -1; boolean errored = false; while (resultSet.next()) { writerSearch.setInt(1, resultSet.getInt(1)); ResultSet writerRes = writerSearch.executeQuery(); writerRes.next(); PublicKeyHash writer = PublicKeyHash.decode(writerRes.getBytes(1)); pending.put(writer, resultSet.getLong(2)); if (totalBytes == -1) { totalBytes = resultSet.getLong(3); errored = resultSet.getBoolean(4); } } conn.commit(); return new UserUsage(totalBytes, errored, pending); } catch (SQLException e) { conn.rollback(); throw e; } } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }
Source:
public void handleContainerLaunchFail(String containerID, String resourceID, ContainerAllocator containerAllocator) { if (StandbyTaskUtil.isStandbyContainer(containerID)) { log.info("Handling launch fail for standby-container {}, requesting resource on any host {}", containerID); containerAllocator.requestResource(containerID, ResourceRequestState.ANY_HOST, faultDomainManager.getAllowedFaultDomainsForSchedulingContainer(getActiveContainerHost(containerID))); } else { initiateStandbyAwareAllocation(containerID, resourceID, containerAllocator); } }

Target:
public void handleContainerLaunchFail(String containerID, String resourceID, ContainerAllocator containerAllocator) { if (StandbyTaskUtil.isStandbyContainer(containerID)) { log.info("Handling launch fail for standby-container {}, requesting resource on any host {}", containerID); String activeContainerHost = getActiveContainerHost(containerID) .orElse(null); requestResource(containerAllocator, containerID, ResourceRequestState.ANY_HOST, Duration.ZERO, activeContainerHost); } else { initiateStandbyAwareAllocation(containerID, resourceID, containerAllocator); } }
Source:
private void addMultipleEntries(ListDialogField<String> field) { String title, message; if (isExclusion(field)) { title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description; } else { title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description; } IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true); if (res != null) { for (IPath re : res) { field.addElement(re.toString()); } } }

Target:
private void addMultipleEntries(ListDialogField<String> field) { String title, message; if (isExclusion(field)) { title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description; } else { title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description; } IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true); if (res != null) { for (IPath p : res) { field.addElement(p.toString()); } } }
Source:
public void notification_onCommitModelObject() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<AllJavaTypes> listener = new RealmChangeListener<AllJavaTypes>() { @Override public void onChange(AllJavaTypes object) { counter.incrementAndGet(); } }; child.addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); looperThread.postRunnable( new Runnable() { @Override public void run() { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); looperThread.testComplete(); } } ); }

Target:
public void notification_onCommitModelObject() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<AllJavaTypes> listener = new RealmChangeListener<AllJavaTypes>() { @Override public void onChange(AllJavaTypes object) { counter.incrementAndGet(); } }; child.addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); verifyPostConditions( looperThreadRealm, new PostConditions() { public void run(Realm realm) { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); } }, child, parent); }
Source:
public void executeListener() { ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine(); processEngine.getRepositoryService().createDeployment().addBpmnModel("simpleTestProcess.bpmn", getSimpleTestProcess()).deploy(); processEngine.getRuntimeService().addEventListener(eventListener); processEngine.getRuntimeService().startProcessInstanceByKey("simpleTestProcess"); ProcessEngineEvent[] events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(7); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); assertThat(events[4].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[5].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[6].getClass()).isEqualTo(ProcessCompletedEventImpl.class); }

Target:
public void executeListener() throws Exception { ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine(); deploy("SimpleProcess", processEngine); deploy("RollbackProcess", processEngine); deploy("AsyncErrorProcess", processEngine); processEngine.getRuntimeService().addEventListener(eventListener); processEngine.getRuntimeService().startProcessInstanceByKey("simpleProcess"); ProcessEngineEvent[] events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(7); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); assertThat(events[4].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[5].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[6].getClass()).isEqualTo(ProcessCompletedEventImpl.class); MockMessageChannel.messageResult = null; try { processEngine.getRuntimeService().startProcessInstanceByKey("rollbackProcess"); } catch (Exception e) { } assertThat(MockMessageChannel.messageResult).isEqualTo(null); MockMessageChannel.messageResult = null; try { processEngine.getRuntimeService().startProcessInstanceByKey("asyncErrorProcess"); } catch (Exception e) { } assertThat(MockMessageChannel.messageResult).isNotNull(); events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(4); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); }
Source:
public void start(BundleContext context) throws Exception { ArchiveCommand.registerFormat("tar", new TarFormat()); ArchiveCommand.registerFormat("tgz", new TgzFormat()); ArchiveCommand.registerFormat("txz", new TxzFormat()); ArchiveCommand.registerFormat("zip", new ZipFormat()); }

Target:
public void start(BundleContext context) throws Exception { start(); }
Source:
public DifferenceFilterManager(Preferences preferenceStore) { map = new LinkedHashMap<String, DifferenceFilterDefaultConfWrapper>(); this.preferenceStore = preferenceStore; }

Target:
public DifferenceFilterManager(Preferences preferenceStore) { map = Collections.synchronizedMap(new LinkedHashMap<String, DifferenceFilterDefaultConfiguration>()); this.preferenceStore = preferenceStore; }
Source:
private Context makeContext(Tomcat tomcat, Path noSuchBaseDir) throws IOException { Path contextPath = noSuchBaseDir.resolve("context"); Files.createDirectories(contextPath); Context context = tomcat.addContext(contextPathURIBase, contextPath.toAbsolutePath().toString()); context.setWebappVersion("3.1"); context.setName("Oryx"); ContextConfig contextConfig = new ContextConfig(); String webxml = "oryx-ml-oryx-serving/src/main/resources/web.xml"; if(new File(webxml).exists()) { contextConfig.setDefaultWebXml(webxml); } else { log.info("Could not read %s",webxml); } context.addLifecycleListener(contextConfig); boolean needHTTPS = keystoreFile != null; boolean needAuthentication = userName != null; if (needHTTPS || needAuthentication) { SecurityCollection securityCollection = new SecurityCollection(); securityCollection.addPattern("/*"); SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.addCollection(securityCollection); if (needHTTPS) { securityConstraint.setUserConstraint("CONFIDENTIAL"); } if (needAuthentication) { LoginConfig loginConfig = new LoginConfig(); loginConfig.setAuthMethod("DIGEST"); loginConfig.setRealmName(InMemoryRealm.NAME); context.setLoginConfig(loginConfig); securityConstraint.addAuthRole(InMemoryRealm.AUTH_ROLE); context.addSecurityRole(InMemoryRealm.AUTH_ROLE); DigestAuthenticator authenticator = new DigestAuthenticator(); authenticator.setNonceValidity(10 * 1000L); authenticator.setNonceCacheSize(20000); context.getPipeline().addValve(authenticator); } context.addConstraint(securityConstraint); } context.setCookies(false); return context; }

Target:
private Context makeContext(Tomcat tomcat, Path noSuchBaseDir) throws IOException { Path contextPath = noSuchBaseDir.resolve("context"); Files.createDirectories(contextPath); Context context = tomcat.addContext(contextPathURIBase, contextPath.toAbsolutePath().toString()); context.setWebappVersion("3.1"); context.setName("Oryx"); ContextConfig contextConfig = new ContextConfig(); context.addLifecycleListener(contextConfig); boolean needHTTPS = keystoreFile != null; boolean needAuthentication = userName != null; if (needHTTPS || needAuthentication) { SecurityCollection securityCollection = new SecurityCollection(); securityCollection.addPattern("/*"); SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.addCollection(securityCollection); if (needHTTPS) { securityConstraint.setUserConstraint("CONFIDENTIAL"); } if (needAuthentication) { LoginConfig loginConfig = new LoginConfig(); loginConfig.setAuthMethod("DIGEST"); loginConfig.setRealmName(InMemoryRealm.NAME); context.setLoginConfig(loginConfig); securityConstraint.addAuthRole(InMemoryRealm.AUTH_ROLE); context.addSecurityRole(InMemoryRealm.AUTH_ROLE); DigestAuthenticator authenticator = new DigestAuthenticator(); authenticator.setNonceValidity(10 * 1000L); authenticator.setNonceCacheSize(20000); context.getPipeline().addValve(authenticator); } context.addConstraint(securityConstraint); } context.setCookies(false); return context; }
Source:
private void appendUnsafe( final Write write, boolean sync ) { index(write); content.putInt(write.size()); write.copyTo(content); inventory.add(write.getRecord().longValue()); if ( sync ) { sync(); exec.execute( new Runnable() { @Override public void run() { BINARY_QUEUE.add( new WriteEvent( write, environment ) ); } } ); } }

Target:
private void appendUnsafe(final Write write, boolean sync) { index(write); content.putInt(write.size()); write.copyTo(content); inventory.add(write.getRecord().longValue()); if(sync) { sync(); } executor.execute(new Runnable() { @Override public void run() { BINARY_QUEUE.add(new WriteEvent(write, environment)); } }); }
Source:
static <T> ChangeEvent<T> fromBsonDocument(final BsonDocument document, final Class<T> documentClass, CodecRegistry codecRegistry) { keyPresent(Fields.ID_FIELD, document); keyPresent(Fields.OPERATION_TYPE_FIELD, document); keyPresent(Fields.NS_FIELD, document); keyPresent(Fields.DOCUMENT_KEY_FIELD, document); final BsonDocument nsDoc = document.getDocument(Fields.NS_FIELD); final UpdateDescription updateDescription; if (document.containsKey(Fields.UPDATE_DESCRIPTION_FIELD)) { updateDescription = UpdateDescription.fromBsonDocument( document.getDocument(Fields.UPDATE_DESCRIPTION_FIELD) ); } else { updateDescription = null; } final T fullDocument; if (document.containsKey(Fields.FULL_DOCUMENT_FIELD)) { final BsonValue fdVal = document.get(Fields.FULL_DOCUMENT_FIELD); if (fdVal.isDocument()) { fullDocument = codecRegistry.get(documentClass).decode(fdVal.asDocument().asBsonReader(), DecoderContext.builder().build()); } else { fullDocument = null; } } else { fullDocument = null; } return new ChangeEvent<>( document.getDocument(Fields.ID_FIELD), fromRemote(document.getString(Fields.OPERATION_TYPE_FIELD).getValue()), fullDocument, new MongoNamespace( nsDoc.getString(Fields.NS_DB_FIELD).getValue(), nsDoc.getString(Fields.NS_COLL_FIELD).getValue()), document.getDocument(Fields.DOCUMENT_KEY_FIELD), updateDescription, document.getBoolean(Fields.WRITE_PENDING_FIELD, BsonBoolean.FALSE).getValue()); }

Target:
static <T> ChangeEvent<T> fromBsonDocument(final BsonDocument document, final Class<T> documentClass, CodecRegistry codecRegistry) { try { checkContainsKey(Fields.ID_FIELD, document, "document"); checkContainsKey(Fields.OPERATION_TYPE_FIELD, document, "document"); checkContainsKey(Fields.NS_FIELD, document, "document"); checkContainsKey(Fields.DOCUMENT_KEY_FIELD, document, "document"); } catch (IllegalArgumentException exception) { throw new AppException(ErrorCode.EVENT_DESERIALIZING, exception); } final BsonDocument nsDoc = document.getDocument(Fields.NS_FIELD); final UpdateDescription updateDescription; if (document.containsKey(Fields.UPDATE_DESCRIPTION_FIELD)) { updateDescription = UpdateDescription.fromBsonDocument( document.getDocument(Fields.UPDATE_DESCRIPTION_FIELD) ); } else { updateDescription = null; } final T fullDocument; if (document.containsKey(Fields.FULL_DOCUMENT_FIELD)) { final BsonValue fdVal = document.get(Fields.FULL_DOCUMENT_FIELD); if (fdVal.isDocument()) { fullDocument = codecRegistry.get(documentClass).decode(fdVal.asDocument().asBsonReader(), DecoderContext.builder().build()); } else { fullDocument = null; } } else { fullDocument = null; } return new ChangeEvent<>( document.getDocument(Fields.ID_FIELD), fromRemote(document.getString(Fields.OPERATION_TYPE_FIELD).getValue()), fullDocument, new MongoNamespace( nsDoc.getString(Fields.NS_DB_FIELD).getValue(), nsDoc.getString(Fields.NS_COLL_FIELD).getValue()), document.getDocument(Fields.DOCUMENT_KEY_FIELD), updateDescription, document.getBoolean(Fields.WRITE_PENDING_FIELD, BsonBoolean.FALSE).getValue()); }
Source:
public void deleteUser(PrincipalUser user) { requireNotDisposed(); requireArgument(user != null && user.getId() != null && user.getId().compareTo(ZERO) > 0, "User cannot be null and must have a valid ID."); _logger.debug("Deleting user {}.", user); EntityManager em = emf.get(); deleteEntity(em, user); em.flush(); USERCACHE.invalidate(user.getUserName()); }

Target:
public void deleteUser(PrincipalUser user) { requireNotDisposed(); requireArgument(user != null && user.getId() != null && user.getId().compareTo(ZERO) > 0, "User cannot be null and must have a valid ID."); _logger.debug("Deleting user {}.", user); USERCACHE.invalidate(user.getUserName()); EntityManager em = emf.get(); deleteEntity(em, user); em.flush(); }
Source:
default HasSettings setSettings(EnumMap<Setting, Object> settings) { Map<String, Object> convertedSettings = settings.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().toString(), Entry::getValue)); CommandExecutionHelper.execute(this, setSettingsCommand(convertedSettings)); return this; }

Target:
default HasSettings setSettings(EnumMap<Setting, Object> settings) { Map<String, Object> convertedSettings = settings.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().toString(), Entry::getValue)); return setSettings(convertedSettings); }
Source:
public void reloadSession(String path, String userName, String botName, Boolean killAimlIf) { loading = true; broadcastState(); if (sessions.containsKey(botName) && sessions.get(botName).containsKey(userName)) { if (sessions.containsKey(botName)) sessions.get(botName).remove(userName); } bot = null; startSession(path, userName, getCurrentBotName()); }

Target:
public void reloadSession(String path, String userName, String botName, Boolean killAimlIf) { loading = true; broadcastState(); if (sessions.containsKey(botName) && sessions.get(botName).containsKey(userName)) { sessions.get(botName).remove(userName); } else { log.warn("Reloading an unknown session {}", botName, userName); } bot = null; startSession(path, userName, getCurrentBotName()); }
Source:
void onMouseEnterGameStatus() { if (playerInfoBean.getGameStatus() != GameStatus.NONE) { GameStatusTooltipController gameStatusTooltipController = applicationContext.getBean(GameStatusTooltipController.class); gameStatusTooltipController.setGameInfoBean(gameService.getByUid(playerInfoBean.getGameUID())); Tooltip statusTooltip = new Tooltip(); statusTooltip.setGraphic(gameStatusTooltipController.getRoot()); Tooltip.install(statusImageView, statusTooltip); } }

Target:
void onMouseEnterGameStatus() { if (playerInfoBean.getGameStatus() == GameStatus.NONE) { return; } GameStatusTooltipController gameStatusTooltipController = applicationContext.getBean(GameStatusTooltipController.class); gameStatusTooltipController.setGameInfoBean(gameService.getByUid(playerInfoBean.getGameUid())); Tooltip statusTooltip = new Tooltip(); statusTooltip.setGraphic(gameStatusTooltipController.getRoot()); Tooltip.install(statusImageView, statusTooltip); }
Source:
static void reTryKerberos(boolean enabled) { if (enabled) { log.debug("Try relogin kerberos at first!"); try { if (UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().reloginFromKeytab(); } else if (UserGroupInformation.isLoginTicketBased()) { UserGroupInformation.getLoginUser().reloginFromTicketCache(); } } catch (IOException e) { log.error("Try relogin kerberos failed!"); throw new RuntimeException(e); } } }

Target:
static void reTryKerberos(boolean enabled) { if (enabled) { log.debug("Try relogin kerberos at first!"); try { if (UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().reloginFromKeytab(); } else if (UserGroupInformation.isLoginTicketBased()) { UserGroupInformation.getLoginUser().reloginFromTicketCache(); } } catch (IOException e) { throw new RuntimeException(e); } } }
Source:
public void finishBundle(Context context) { Iterator<Entry<KV<String, String>, KV<Double, Integer>>> it = accumulator.entrySet().iterator(); while (it.hasNext()) { Map.Entry<KV<String, String>, KV<Double, Integer>> entry = it.next(); context.output(KV.of(entry.getKey(), entry.getValue())); } }

Target:
public void finishBundle(Context context) { output(context, accumulator); }
Source:
public static OrderSubclass parse(String s) { try { return OrderSubclass.valueOf(s); } catch (Exception e) { throw new RuntimeException("Unknown OrderSubclass " + s + "."); } }

Target:
public static OrderSubclass parse(String s) { try { return OrderSubclass.valueOf(s); } catch (Exception e) { throw new ExchangeException("Unknown OrderSubclass " + s + "."); } }
Source:
public void testGetOperatorClassesCommandLineInfo() throws Exception { String arg2 = "com.example.mydtapp.Application"; String arg3 = appFile.getAbsolutePath(); ApexCli.GetOperatorClassesCommandLineInfo commandLineOptions = ApexCli.getGetOperatorClassesCommandLineInfo(new String[] {"-parent", arg2, arg3 }); Assert.assertEquals(commandLineOptions.parent, arg2); Assert.assertEquals(commandLineOptions.args.length, 1); if (commandLineOptions.args.length == 1) { Assert.assertEquals(commandLineOptions.args[0], arg3); } }

Target:
public void testGetOperatorClassesCommandLineInfo() throws Exception { String arg2 = "option value"; String arg3 = "regular parameter"; ApexCli.GetOperatorClassesCommandLineInfo commandLineOptions = ApexCli.getGetOperatorClassesCommandLineInfo(new String[] {"-parent", arg2, arg3}); Assert.assertEquals(commandLineOptions.parent, arg2); Assert.assertEquals(commandLineOptions.args.length, 1); Assert.assertEquals(commandLineOptions.args[0], arg3); }
Source:
public long skip(long n) throws IOException { if (isClosed) { throw new IOException("closed stream"); } if (available <= 0) { throw new EOFException("no more data available"); } if (size - available < n) { n = size - available; available = 0; } else { available -= n; } return n; }

Target:
public long skip(long n) throws IOException { if (isClosed) { throw new IOException("closed stream"); } if (available <= 0) { throw new IOException("no more data"); } if (size - available < n) { n = size - available; available = 0; } else { available -= n; } return n; }
Source:
public void writeToXml(PrintWriter pw1, int indent) { pw1.println(MekHqXmlUtil.indentStr(indent) + "<mothballInfo>"); if (tech != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techId", tech.getId()); } if (forceID > 0) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "forceID", forceID); } for (Person driver : drivers) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "driverId", driver.getId()); } for (Person gunner : gunners) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "gunnerId", gunner.getId()); } for (Person crew : vesselCrew) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "vesselCrewId", crew.getId()); } if (navigator != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "navigatorId", navigator.getId()); } if (techOfficer != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techOfficerId", techOfficer.getId()); } pw1.println(MekHqXmlUtil.indentStr(indent) + "</mothballInfo>"); }

Target:
public void writeToXml(PrintWriter pw1, int indent) { pw1.println(MekHqXmlUtil.indentStr(indent++) + "<mothballInfo>"); if (tech != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techId", tech.getId()); } if (forceID > 0) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "forceID", forceID); } for (Person driver : drivers) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "driverId", driver.getId()); } for (Person gunner : gunners) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "gunnerId", gunner.getId()); } for (Person crew : vesselCrew) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "vesselCrewId", crew.getId()); } if (navigator != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "navigatorId", navigator.getId()); } if (techOfficer != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techOfficerId", techOfficer.getId()); } pw1.println(MekHqXmlUtil.indentStr(--indent) + "</mothballInfo>"); }
Source:
public void testGetBadLazyArgument_shouldThrow() { Lazy<Object> badEvaluatingLazy = Lazy.of(() -> { throw new TestSpecificException(); }); unit.build(new GenericType<Lazy<Integer>>() {}.getType(), badEvaluatingLazy, null); }

Target:
public void testGetBadLazyArgument_shouldThrow() { Lazy<Object> badEvaluatingLazy = Lazy.of(() -> { throw new TestSpecificException(); }); assertThatThrownBy(() -> unit.build(new GenericType<Lazy<Integer>>() {}.getType(), badEvaluatingLazy, null)) .isInstanceOf(TestSpecificException.class); }
Source:
public FoundIndication scan(Run build) throws IOException { String currentFile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(build.getLogReader()); List<FailureCause> causes = new ArrayList<>(1); FailureCause fc = new FailureCause("somename", "somedescription"); causes.add(fc); fc.addIndication(indication); List<FoundFailureCause> foundFailureCauses = FailureReader.scanSingleLinePatterns(causes, build, reader, currentFile); if (foundFailureCauses.isEmpty()) { return null; } else { return foundFailureCauses.get(0).getIndications().get(0); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }

Target:
public FoundIndication scan(Run build) throws IOException { String currentFile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(build.getLogReader()); List<FailureCause> causes = new ArrayList<FailureCause>(1); FailureCause fc = new FailureCause("somename", "somedescription"); causes.add(fc); fc.addIndication(indication); List<FoundFailureCause> foundFailureCauses = FailureReader.scanSingleLinePatterns(causes, build, reader, currentFile); if (foundFailureCauses.isEmpty()) { return null; } else { return foundFailureCauses.get(0).getIndications().get(0); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }
Source:
public void run() throws InterruptedException, IOException { while (!this.shutDown) { final Job job = this.getJob(); if (null == job) { LOGGER.info("empty job list and sleep " + this.intervalInSeconds + " seconds"); Thread.sleep(this.intervalInSeconds * 1000); continue; } this.setCurrentJid(job.getJid()); LOGGER.info("working on " + job.getKlassName() + ":" + this.getCurrentJid()); job.process(); } }

Target:
public void run() throws InterruptedException, IOException { while (!this.shutDown) { final Job job = this.getJob(); if (null == job) { LOGGER.info("empty job list and sleep seconds", this.intervalInSeconds); Thread.sleep(this.intervalInSeconds * 1000); continue; } this.setCurrentJid(job.getJid()); LOGGER.info("working on : {}", job.getKlassName(), this.getCurrentJid()); job.process(); } }