auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected synchronized void replyReceived() { timeoutcounter = 0; switch (readState[currentPin]) { case NONE: break; case READVALUE1: case READINGVALUE1: readState[currentPin] = READVALUE2; return; case READVALUE2: case READINGVALUE2: readState[currentPin] = READMODE; return; case READMODE: case READINGMODE: readState[currentPin] = NONE; return; default: log.error("Pin unexpected read state, can't advance {}", currentPin, readState[currentPin]); readState[currentPin] = NONE; return; } switch (writeState[currentPin]) { case NONE: return; case WRITEVALUE1: case WRITINGVALUE1: writeState[currentPin] = WRITEVALUE2; return; case WRITEVALUE2: case WRITINGVALUE2: writeState[currentPin] = WRITEMODE; return; case WRITEMODE: case WRITINGMODE: writeState[currentPin] = NONE; return; default: log.error("Pin unexpected write state, can't advance {}", currentPin, writeState[currentPin]); writeState[currentPin] = NONE; } }

Target:
protected synchronized void replyReceived() { timeoutcounter = 0; switch (readState[currentPin]) { case NONE: break; case READVALUE1: case READINGVALUE1: readState[currentPin] = READVALUE2; return; case READVALUE2: case READINGVALUE2: readState[currentPin] = READMODE; return; case READMODE: case READINGMODE: readState[currentPin] = NONE; return; default: log.error("Pin unexpected read state, can't advance {}", currentPin, readState[currentPin]); readState[currentPin] = NONE; return; } switch (writeState[currentPin]) { case NONE: return; case WRITEVALUE1: case WRITINGVALUE1: writeState[currentPin] = WRITEVALUE2; return; case WRITEVALUE2: case WRITINGVALUE2: writeState[currentPin] = WRITEMODE; return; case WRITEMODE: case WRITINGMODE: writeState[currentPin] = NONE; return; default: log.error("Pin unexpected write state, can't advance {}", currentPin, writeState[currentPin]); writeState[currentPin] = NONE; return; } }
Source:
private int encode(int bucketIndex, int value) { return (bucketIndex << VALUE_BITS) | value; }

Target:
private static int encode(int bucketIndex, int value) { return (bucketIndex << VALUE_BITS) | value; }
Source:
public List<InventoryDetails> createInventoryDetailList(final Integer numOfEntries) { final List<InventoryDetails> inventoryDetails = new ArrayList<InventoryDetails>(); for (int i = 0; i < numOfEntries; i++) { final int id = i + 1; final InventoryDetails invDetails = new InventoryDetails(); invDetails.setLotId(id); invDetails.setGid(id); invDetails.setGermplasmName("GermplsmName"+i); invDetails.setCross("Cross"+i); invDetails.setSource("SeedSource"+i); invDetails.setGroupId(i); invDetails.setReplicationNumber(1); invDetails.setPlotNumber(1); invDetails.setInstanceNumber(1); invDetails.setInstanceNumber(1); invDetails.setEntryId(1); inventoryDetails.add(invDetails); } return inventoryDetails; }

Target:
public List<InventoryDetails> createInventoryDetailList(final Integer numOfEntries) { final List<InventoryDetails> inventoryDetails = new ArrayList<InventoryDetails>(); for (int i = 0; i < numOfEntries; i++) { final int id = i + 1; final InventoryDetails invDetails = new InventoryDetails(); invDetails.setLotId(id); invDetails.setGid(id); invDetails.setGermplasmName("GermplsmName"+i); invDetails.setCross("Cross"+i); invDetails.setSource("SeedSource"+i); invDetails.setGroupId(i); invDetails.setReplicationNumber(1); invDetails.setPlotNumber(1); invDetails.setInstanceNumber(1); invDetails.setEntryId(1); inventoryDetails.add(invDetails); } return inventoryDetails; }
Source:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) && !DSpaceRestPermission.WRITE.equals(restPermission) && !DSpaceRestPermission.DELETE.equals(restPermission)) { return false; } if (!StringUtils.equalsIgnoreCase(targetType, WorkspaceItemRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; WorkspaceItem witem = null; try { ePerson = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); Integer dsoId = Integer.parseInt(targetId.toString()); if (ePerson == null) { return false; } witem = wis.find(context, dsoId); if (witem == null) { return true; } if (witem.getSubmitter() != null) { if (witem.getSubmitter().getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }

Target:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) && !DSpaceRestPermission.WRITE.equals(restPermission) && !DSpaceRestPermission.DELETE.equals(restPermission)) { return false; } if (!StringUtils.equalsIgnoreCase(targetType, WorkspaceItemRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; WorkspaceItem witem = null; try { ePerson = context.getCurrentUser(); Integer dsoId = Integer.parseInt(targetId.toString()); if (ePerson == null) { return false; } witem = wis.find(context, dsoId); if (witem == null) { return true; } if (witem.getSubmitter() != null) { if (witem.getSubmitter().getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }
Source:
private void recalculateMemory() { if(isPersistent()) { int mem = DataUtils.PAGE_MEMORY; DataType keyType = map.getKeyType(); for (int i = 0; i < keys.length; i++) { mem += keyType.getMemory(keys[i]); } if (this.isLeaf()) { DataType valueType = map.getValueType(); for (int i = 0; i < keys.length; i++) { mem += valueType.getMemory(values[i]); } } else { mem += this.getRawChildPageCount() * DataUtils.PAGE_MEMORY_CHILD; } addMemory(mem - memory); } }

Target:
private void recalculateMemory() { int mem = DataUtils.PAGE_MEMORY; DataType keyType = map.getKeyType(); for (int i = 0; i < keys.length; i++) { mem += keyType.getMemory(keys[i]); } if (this.isLeaf()) { DataType valueType = map.getValueType(); for (int i = 0; i < keys.length; i++) { mem += valueType.getMemory(values[i]); } } else { mem += this.getRawChildPageCount() * DataUtils.PAGE_MEMORY_CHILD; } addMemory(mem - memory); }
Source:
public void testDynamicProviderExceptionsAreNotPropagated() { MetricsCollector collectorMock = mock(MetricsCollector.class); MetricsRegistry metricsRegistry = new MetricsRegistryImpl(Logger.getLogger(MetricsRegistryImpl.class), MANDATORY); metricsRegistry.registerDynamicMetricsProvider((taggerSupplier, context) -> { throw new RuntimeException("Intentionally failing metrics collection"); }); try { metricsRegistry.collect(collectorMock); } catch (AssertionError ex) { } }

Target:
public void testDynamicProviderExceptionsAreNotPropagated() { MetricsCollector collectorMock = mock(MetricsCollector.class); MetricsRegistry metricsRegistry = new MetricsRegistryImpl(Logger.getLogger(MetricsRegistryImpl.class), MANDATORY); metricsRegistry.registerDynamicMetricsProvider((taggerSupplier, context) -> { throw new RuntimeException("Intentionally failing metrics collection"); }); try { metricsRegistry.collect(collectorMock); fail("Should throw AssertionError"); } catch (AssertionError ex) { } }
Source:
public int getApplicationStartedOrder() { return ((MetricsServiceImpl) Framework.getRuntime().getComponent(MetricsService.class.getName())).getApplicationStartedOrder() + 1; }

Target:
public int getApplicationStartedOrder() { Component component = (Component) Framework.getRuntime().getComponent(MetricsService.class.getName()); return component.getApplicationStartedOrder() + 1; }
Source:
public static void generate( Project project, BuckFileManager buckFileManager, VisibilityExtension visibilityExtension, TestExtension testExtension) { File moduleDir = project.getBuildFile().getParentFile(); File visibilityFile = new File(moduleDir, visibilityExtension.visibilityFileName); boolean hasVisibilityFile = visibilityFile.isFile(); File integrationTestsFile = new File(moduleDir, testExtension.integrationTestDir); boolean hasIntegrationTests = testExtension.enableIntegrationTests && integrationTestsFile.isDirectory(); List<Rule> rules = createRules(project, hasIntegrationTests); Multimap<String, String> extraLoadStatements = TreeMultimap.create(); if (hasVisibilityFile) { rules.forEach(rule -> rule.fileConfiguredVisibility(true)); extraLoadStatements.put( ":" + visibilityExtension.visibilityFileName, visibilityExtension.visibilityFunction); } File buckFile = project.file(OkBuckGradlePlugin.BUCK); buckFileManager.writeToBuckFile(rules, buckFile, extraLoadStatements); }

Target:
public static void generate( Project project, BuckFileManager buckFileManager, VisibilityExtension visibilityExtension, TestExtension testExtension) { File moduleDir = project.getBuildFile().getParentFile(); File visibilityFile = new File(moduleDir, visibilityExtension.visibilityFileName); boolean hasVisibilityFile = visibilityFile.isFile(); boolean hasIntegrationTests = testExtension.enableIntegrationTests; List<Rule> rules = createRules(project, hasIntegrationTests); Multimap<String, String> extraLoadStatements = TreeMultimap.create(); if (hasVisibilityFile) { rules.forEach(rule -> rule.fileConfiguredVisibility(true)); extraLoadStatements.put( ":" + visibilityExtension.visibilityFileName, visibilityExtension.visibilityFunction); } File buckFile = project.file(OkBuckGradlePlugin.BUCK); buckFileManager.writeToBuckFile(rules, buckFile, extraLoadStatements); }
Source:
private Module getAdditionalBindings() { return new AbstractModule() { @Override protected void configure() { bind(AdminContainerConfig.class).to(AdminConfigImpl.class); bind(AdminResourcesFilter.class); } }; }

Target:
private Module getAdditionalBindings() { return new AbstractModule() { @Override protected void configure() { bind(AdminResourcesFilter.class); } }; }
Source:
private Map<String, String> createUniqueWorkspaceNameMap() { Map<String, String> uniqueWorkspaceNameMap = new HashMap<>(); List<String[]> splittedWorkspaceNames = Arrays.asList(launchData.getRecentWorkspaces()).stream() .filter(s -> s != null && !s.isEmpty()).map(s -> s.split("\\\\")) .collect(Collectors.toList()); for (int i = 1; !splittedWorkspaceNames.isEmpty(); i++) { final int c = i; Function<String[], String> stringArraytoName = s -> String.join("\\", Arrays.copyOfRange(s, s.length - c, s.length)); List<String> uniqueNames = splittedWorkspaceNames.stream().map(stringArraytoName) .collect(Collectors.groupingBy(s -> s, Collectors.counting())).entrySet().stream() .filter(e -> e.getValue() == 1).map(e -> e.getKey()).collect(Collectors.toList()); splittedWorkspaceNames.removeIf(a -> { String joined = stringArraytoName.apply(a); if (uniqueNames.contains(joined)) { uniqueWorkspaceNameMap.put(joined, String.join("\\", a)); return true; } return false; }); } return uniqueWorkspaceNameMap; }

Target:
private Map<String, String> createUniqueWorkspaceNameMap() { final String fileSeparator = File.separator; Map<String, String> uniqueWorkspaceNameMap = new HashMap<>(); List<String[]> splittedWorkspaceNames = Arrays.asList(launchData.getRecentWorkspaces()).stream() .filter(s -> s != null && !s.isEmpty()).map(s -> s.split(Pattern.quote(fileSeparator))) .collect(Collectors.toList()); for (int i = 1; !splittedWorkspaceNames.isEmpty(); i++) { final int c = i; Function<String[], String> stringArraytoName = s -> String.join(fileSeparator, Arrays.copyOfRange(s, s.length - c, s.length)); List<String> uniqueNames = splittedWorkspaceNames.stream().map(stringArraytoName) .collect(Collectors.groupingBy(s -> s, Collectors.counting())).entrySet().stream() .filter(e -> e.getValue() == 1).map(e -> e.getKey()).collect(Collectors.toList()); splittedWorkspaceNames.removeIf(a -> { String joined = stringArraytoName.apply(a); if (uniqueNames.contains(joined)) { uniqueWorkspaceNameMap.put(joined, String.join(fileSeparator, a)); return true; } return false; }); } return uniqueWorkspaceNameMap; }
Source:
public JdbcPageSink(JdbcOutputTableHandle handle, JdbcClient jdbcClient) { try { connection = jdbcClient.getConnection(handle); connection.setAutoCommit(false); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } try { statement = connection.prepareStatement(jdbcClient.buildInsertSql(handle)); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } columnTypes = handle.getColumnTypes(); }

Target:
public JdbcPageSink(JdbcOutputTableHandle handle, JdbcClient jdbcClient) { try { connection = jdbcClient.getConnection(handle); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } try { connection.setAutoCommit(false); statement = connection.prepareStatement(jdbcClient.buildInsertSql(handle)); } catch (SQLException e) { closeWithSuppression(connection, e); throw new PrestoException(JDBC_ERROR, e); } columnTypes = handle.getColumnTypes(); }
Source:
public static String formatDateToIso8601Utc(Date dateInUtc) { if (dateInUtc == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat(Const.TIME_FORMAT_ISO_8601_UTC); return sdf.format(dateInUtc); }

Target:
public static String formatDateToIso8601Utc(Date dateInUtc) { if (dateInUtc == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat(Const.TIME_FORMAT_ISO_8601_UTC); sdf.setTimeZone(SystemParams.TIME_ZONE); return sdf.format(dateInUtc); }
Source:
public Optional<Scoreboard> getServerScoreboard() { final Optional<WorldServer> optWorldServer = DimensionManager.getWorldByDimensionId(0); return optWorldServer.isPresent() ? Optional.of((Scoreboard) optWorldServer.get().getScoreboard()) : Optional.empty(); }

Target:
public Optional<Scoreboard> getServerScoreboard() { return DimensionManager.getWorldByDimensionId(0).map(worldServer -> (Scoreboard) worldServer.getScoreboard()); }
Source:
ReadableByteChannel open() throws IOException { boolean isDefaultFileSystem = pageCache.getCachedFileSystem() instanceof DefaultFileSystemAbstraction; if ( !isDefaultFileSystem ) { Optional<PagedFile> existingMapping = pageCache.getExistingMapping( file ); if ( existingMapping.isPresent() ) { try ( PagedFile pagedFile = existingMapping.get() ) { return pagedFile.openReadableByteChannel(); } } } return fs.open( file, "r" ); }

Target:
ReadableByteChannel open() throws IOException { if ( !pageCache.fileSystemSupportsFileOperations() ) { Optional<PagedFile> existingMapping = pageCache.getExistingMapping( file ); if ( existingMapping.isPresent() ) { try ( PagedFile pagedFile = existingMapping.get() ) { return pagedFile.openReadableByteChannel(); } } } return fs.open( file, "r" ); }
Source:
private void advance() { next = null; while (next == null && mapIterator.hasNext()) { Map.Entry<K, OffHeapValueHolder<V>> entry = mapIterator.next(); final long now = timeSource.getTimeMillis(); if (entry.getValue().isExpired(now, TimeUnit.MILLISECONDS)) { onExpiration(entry.getKey(), entry.getValue()); continue; } next = entry; } }

Target:
private void advance() { next = null; while (next == null && mapIterator.hasNext()) { Map.Entry<K, OffHeapValueHolder<V>> entry = mapIterator.next(); final long now = timeSource.getTimeMillis(); if (entry.getValue().isExpired(now, TimeUnit.MILLISECONDS)) { containsKey(entry.getKey()); continue; } next = entry; } }
Source:
public synchronized Map<String, ? extends DockerMachine> getMachines() { if (machines != null) { return Collections.unmodifiableMap(machines); } return Collections.emptyMap(); }

Target:
public synchronized Map<String, ? extends DockerMachine> getMachines() { return machines != null ? machines : Collections.emptyMap(); }
Source:
public void validatesMultipleXmlsInThreads() throws Exception { final int zero = 0; final int hundred = 100; final int ten = 10; final Random rand = new SecureRandom(); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema xmlns:xs ='<LINK_0>' >", "<xs:element name='r'><xs:complexType>", "<xs:sequence>", "<xs:element name='x' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(hundred); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<r>", StringUtils.repeat("<x>hey</x>", cnt), "</r>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = zero; count < ten; count = count + 1) { executorService.submit(callable); } executorService.awaitTermination(ten, TimeUnit.SECONDS); executorService.shutdown(); }

Target:
public void validatesMultipleXmlsInThreads() throws Exception { final int random = 100; final int loop = 10; final int timeout = 30; final Random rand = new SecureRandom(); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema xmlns:xs ='<LINK_0>' >", "<xs:element name='r'><xs:complexType>", "<xs:sequence>", "<xs:element name='x' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(random); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<r>", StringUtils.repeat("<x>hey</x>", cnt), "</r>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = 0; count < loop; count = count + 1) { executorService.submit(callable); } executorService.shutdown(); MatcherAssert.assertThat( executorService.awaitTermination(timeout, TimeUnit.SECONDS), Matchers.is(true) ); executorService.shutdownNow(); }
Source:
public static ObaRegion getRegionFromBuildFlavor() { final int regionId = Integer.MAX_VALUE; ObaRegionElement.Bounds[] boundsArray = new ObaRegionElement.Bounds[1]; ObaRegionElement.Bounds bounds = new ObaRegionElement.Bounds( BuildConfig.FIXED_REGION_BOUNDS_LAT, BuildConfig.FIXED_REGION_BOUNDS_LON, BuildConfig.FIXED_REGION_BOUNDS_LAT_SPAN, BuildConfig.FIXED_REGION_BOUNDS_LON_SPAN); boundsArray[0] = bounds; ObaRegionElement.Open311Server[] open311Array = new ObaRegionElement.Open311Server[1]; ObaRegionElement.Open311Server open311Server; if (BuildConfig.FIXED_REGION_OPEN311_BASE_URL != null) { open311Server = new ObaRegionElement.Open311Server ( BuildConfig.FIXED_REGION_OPEN311_JURISDICTION_ID, BuildConfig.FIXED_REGION_OPEN311_API_KEY, BuildConfig.FIXED_REGION_OPEN311_BASE_URL); open311Array[0] = open311Server; } else { open311Array = null; } ObaRegionElement region = new ObaRegionElement(regionId, BuildConfig.FIXED_REGION_NAME, true, BuildConfig.FIXED_REGION_OBA_BASE_URL, BuildConfig.FIXED_REGION_SIRI_BASE_URL, boundsArray, open311Array, BuildConfig.FIXED_REGION_LANG, BuildConfig.FIXED_REGION_CONTACT_EMAIL, BuildConfig.FIXED_REGION_SUPPORTS_OBA_DISCOVERY_APIS, BuildConfig.FIXED_REGION_SUPPORTS_OBA_REALTIME_APIS, BuildConfig.FIXED_REGION_SUPPORTS_SIRI_REALTIME_APIS, BuildConfig.FIXED_REGION_SUPPORTS_EMBEDDEDSOCIAL, BuildConfig.FIXED_REGION_TWITTER_URL, false, BuildConfig.FIXED_REGION_STOP_INFO_URL, BuildConfig.FIXED_REGION_OTP_BASE_URL, BuildConfig.FIXED_REGION_OTP_CONTACT_EMAIL); return region; }

Target:
public static ObaRegion getRegionFromBuildFlavor() { final int regionId = Integer.MAX_VALUE; ObaRegionElement.Bounds[] boundsArray = new ObaRegionElement.Bounds[1]; ObaRegionElement.Bounds bounds = new ObaRegionElement.Bounds( BuildConfig.FIXED_REGION_BOUNDS_LAT, BuildConfig.FIXED_REGION_BOUNDS_LON, BuildConfig.FIXED_REGION_BOUNDS_LAT_SPAN, BuildConfig.FIXED_REGION_BOUNDS_LON_SPAN); boundsArray[0] = bounds; ObaRegionElement.Open311Server[] open311Array = new ObaRegionElement.Open311Server[1]; ObaRegionElement.Open311Server open311Server; if (BuildConfig.FIXED_REGION_OPEN311_BASE_URL != null) { open311Server = new ObaRegionElement.Open311Server ( BuildConfig.FIXED_REGION_OPEN311_JURISDICTION_ID, BuildConfig.FIXED_REGION_OPEN311_API_KEY, BuildConfig.FIXED_REGION_OPEN311_BASE_URL); open311Array[0] = open311Server; } else { open311Array = null; } ObaRegionElement region = new ObaRegionElement(regionId, BuildConfig.FIXED_REGION_NAME, true, BuildConfig.FIXED_REGION_OBA_BASE_URL, BuildConfig.FIXED_REGION_SIRI_BASE_URL, boundsArray, open311Array, BuildConfig.FIXED_REGION_LANG, BuildConfig.FIXED_REGION_CONTACT_EMAIL, BuildConfig.FIXED_REGION_SUPPORTS_OBA_DISCOVERY_APIS, BuildConfig.FIXED_REGION_SUPPORTS_OBA_REALTIME_APIS, BuildConfig.FIXED_REGION_SUPPORTS_SIRI_REALTIME_APIS, BuildConfig.FIXED_REGION_TWITTER_URL, false, BuildConfig.FIXED_REGION_STOP_INFO_URL, BuildConfig.FIXED_REGION_OTP_BASE_URL, BuildConfig.FIXED_REGION_OTP_CONTACT_EMAIL, BuildConfig.FIXED_REGION_SUPPORTS_OTP_BIKESHARE, BuildConfig.FIXED_REGION_SUPPORTS_EMBEDDEDSOCIAL); return region; }
Source:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { ITask review = (ITask) delta.getElement(); AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { TaskData taskData; try { taskData = taskDataManager.getTaskData(review); String reviewUrl = taskData.getRoot().getAttribute(TaskAttribute.TASK_URL).getValue(); String reviewDescription = taskData.getRoot() .getMappedAttribute(TaskAttribute.DESCRIPTION) .getValue(); switch (delta.getKind()) { case DELETED: deleteMappingsTo(reviewUrl); break; case ADDED: case CONTENT: updateMapping(reviewUrl, reviewDescription); break; default: } } catch (CoreException e) { e.printStackTrace(); } } } }

Target:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { ITask review = (ITask) delta.getElement(); AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { TaskData taskData; try { taskData = taskDataManager.getTaskData(review); String reviewUrl = taskData.getRoot().getAttribute(TaskAttribute.TASK_URL).getValue(); String reviewDescription = taskData.getRoot() .getMappedAttribute(TaskAttribute.DESCRIPTION) .getValue(); switch (delta.getKind()) { case DELETED: deleteMappingsTo(reviewUrl); break; case ADDED: case CONTENT: updateMapping(reviewUrl, reviewDescription); break; default: StatusHandler.log(new Status(IStatus.ERROR, ReviewsCoreConstants.PLUGIN_ID, "Unknown change")); } } catch (CoreException e) { StatusHandler.log( new Status(IStatus.ERROR, ReviewsCoreConstants.PLUGIN_ID, "Error getting taskData.", e)); } } } }
Source:
public RemoteOperationResult(boolean success, HttpMethod httpMethod) throws IOException { this( success, httpMethod.getStatusCode(), httpMethod.getStatusText(), httpMethod.getResponseHeaders() ); if (mHttpCode == HttpStatus.SC_BAD_REQUEST) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); InvalidCharacterExceptionParser xmlParser = new InvalidCharacterExceptionParser(); try { if (xmlParser.parseXMLResponse(is)) { mCode = ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } if (mHttpCode == HttpStatus.SC_FORBIDDEN) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); ErrorMessageParser xmlParser = new ErrorMessageParser(); try { String errorMessage = xmlParser.parseXMLResponse(is); if (errorMessage != "" && errorMessage != null) { mCode = ResultCode.SPECIFIC_FORBIDDEN; mHttpPhrase = errorMessage; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } }

Target:
public RemoteOperationResult(boolean success, HttpMethod httpMethod) throws IOException { this( success, httpMethod.getStatusCode(), httpMethod.getStatusText(), httpMethod.getResponseHeaders() ); if (mHttpCode == HttpStatus.SC_BAD_REQUEST) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); InvalidCharacterExceptionParser xmlParser = new InvalidCharacterExceptionParser(); try { if (xmlParser.parseXMLResponse(is)) { mCode = ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } if (mHttpCode == HttpStatus.SC_FORBIDDEN) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); ErrorMessageParser xmlParser = new ErrorMessageParser(); try { String errorMessage = xmlParser.parseXMLResponse(is); if (errorMessage != null && errorMessage != "") { mCode = ResultCode.SPECIFIC_FORBIDDEN; mHttpPhrase = errorMessage; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } }
Source:
private void terminatedPodsInMainThread(List<KubernetesPod> pods) { getMainThreadExecutor().execute(() -> { for (KubernetesPod pod : pods) { if (pod.isTerminated()) { final String podName = pod.getName(); log.info("TaskManager pod is terminated.", podName); final CompletableFuture<KubernetesWorkerNode> requestResourceFuture = requestResourceFutures.remove(podName); if (requestResourceFuture != null) { log.warn("Pod is terminated before receiving the ADDED event.", podName); requestResourceFuture.completeExceptionally(new FlinkException("Pod is terminated.")); } getResourceEventHandler().onWorkerTerminated(new ResourceID(podName)); removePod(podName); } } }); }

Target:
private void terminatedPodsInMainThread(List<KubernetesPod> pods) { getMainThreadExecutor().execute(() -> { for (KubernetesPod pod : pods) { if (pod.isTerminated()) { final String podName = pod.getName(); log.info("TaskManager pod is terminated.", podName); final CompletableFuture<KubernetesWorkerNode> requestResourceFuture = requestResourceFutures.remove(podName); if (requestResourceFuture != null) { log.warn("Pod is terminated before receiving the ADDED event.", podName); requestResourceFuture.completeExceptionally(new FlinkException("Pod is terminated.")); } getResourceEventHandler().onWorkerTerminated(new ResourceID(podName)); stopPod(podName); } } }); }
Source:
public boolean contains(Object o) { Map.Entry entry = toEntry(o); if (entry != null) { V value = remoteCache.get(entry.getKey()); return value != null && value.equals(entry.getValue()); } return false; }

Target:
public boolean contains(Object o) { if (!(o instanceof Map.Entry)) { return false; } Map.Entry<K, V> entry = (Map.Entry<K, V>) o; V value = remoteCache.get(entry.getKey()); return value != null && value.equals(entry.getValue()); }
Source:
public void setup() throws Exception { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(metadata.getProfileId()).thenReturn(DEFAULT_PROFILE.getProfileId()); when(domainProfile.getProfileId()).thenReturn(PROFILE_DOMAIN_ID); Predicate<String> domainProfileFilter = DEF1::equals; when(domainProfile.definitionAllowedFilter()).thenReturn(domainProfileFilter); when(definitionManager.definitionSets()).thenReturn(definitionSets); when(definitionSets.getDefinitionSetById(eq(DEF_SET_ID))).thenReturn(definitionSet); when(definitionManager.adapters()).thenReturn(adapterManager); when(adapterManager.forDefinitionSet()).thenReturn(definitionSetAdapter); when(definitionSetAdapter.getDefinitions(eq(definitionSet))) .thenReturn(Arrays.asList(DEF1, DEF2).stream().collect(Collectors.toSet())); when(profileManager.getProfile(eq(DEF_SET_ID), eq(DEFAULT_PROFILE.getProfileId()))) .thenReturn(DEFAULT_PROFILE); when(profileManager.getProfile(eq(DEF_SET_ID), eq(PROFILE_DOMAIN_ID))) .thenReturn(domainProfile); tested = new DomainProfileManager(definitionManager, profileManager, DEFAULT_PROFILE); }

Target:
public void setup() throws Exception { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(metadata.getProfileId()).thenReturn(DEFAULT_PROFILE.getProfileId()); when(domainProfile.getProfileId()).thenReturn(PROFILE_DOMAIN_ID); Predicate<String> domainProfileFilter = DEF1::equals; when(domainProfile.definitionAllowedFilter()).thenReturn(domainProfileFilter); when(definitionManager.definitionSets()).thenReturn(definitionSets); when(definitionSets.getDefinitionSetById(eq(DEF_SET_ID))).thenReturn(definitionSet); when(definitionManager.adapters()).thenReturn(adapterManager); when(adapterManager.forDefinitionSet()).thenReturn(definitionSetAdapter); when(definitionSetAdapter.getDefinitions(eq(definitionSet))) .thenReturn(Stream.of(DEF1, DEF2).collect(Collectors.toSet())); when(profileManager.getProfile(eq(DEF_SET_ID), eq(DEFAULT_PROFILE.getProfileId()))) .thenReturn(DEFAULT_PROFILE); when(profileManager.getProfile(eq(DEF_SET_ID), eq(PROFILE_DOMAIN_ID))) .thenReturn(domainProfile); tested = new DomainProfileManager(definitionManager, profileManager, DEFAULT_PROFILE); }
Source:
private String getDemoCourseIdRoot(String instructorEmail) { final String[] splitedEmail = instructorEmail.split("@"); final String head = splitedEmail[0].replaceAll(FieldValidator.REGEX_COURSE_ID_ILLEGAL, "_"); final String emailAbbreviation = splitedEmail[1].substring(0, 3); return head + "." + emailAbbreviation + "-demo"; }

Target:
private String getDemoCourseIdRoot(String instructorEmail) { String[] emailSplit = instructorEmail.split("@"); String username = emailSplit[0]; String host = emailSplit[1]; String head = StringHelper.replaceIllegalChars(username, FieldValidator.REGEX_COURSE_ID, '_'); String hostAbbreviation = host.substring(0, 3); return head + "." + hostAbbreviation + "-demo"; }
Source:
public void emit() { String hrefOrHashName = group(1); if (!hrefOrHashName.contains("#")) { hrefOrHashName = "#" + hrefOrHashName; } else if (hrefOrHashName.charAt(hrefOrHashName.length() - 1) == '#') { hrefOrHashName = hrefOrHashName.substring(0, hrefOrHashName.length() - 1); } StringBuilder sb = new StringBuilder(); if (group(2) != null) { sb.append(group(2).substring(offsetGroup2).trim()); } else { sb.append("["); String text = group(1); int hashPosition = text.indexOf("#"); if (hashPosition > 0) { int extStart = text.substring(0, hashPosition).lastIndexOf("."); if (extStart > 0) { sb.append(text.substring(0, extStart)); } else { sb.append(text.substring(0, hashPosition)); } if (hashPosition != text.length() - 1) { sb.append(text.substring(hashPosition)); } } else { sb.append(text); } sb.append("]"); } builder.link(hrefOrHashName, sb.toString()); }

Target:
public void emit() { final String linkTarget = group(1); final String linkText = group(2); String hrefOrHashName = linkTarget; if (!hrefOrHashName.contains("#")) { hrefOrHashName = "#" + hrefOrHashName; } else if (hrefOrHashName.charAt(hrefOrHashName.length() - 1) == '#') { hrefOrHashName = hrefOrHashName.substring(0, hrefOrHashName.length() - 1); } StringBuilder sb = new StringBuilder(); if (linkText != null && linkText.length() > linkTextOffset) { sb.append(linkText.substring(linkTextOffset).trim()); } else { sb.append("["); String text = linkTarget; int hashPosition = text.indexOf("#"); if (hashPosition > 0) { int extStart = text.substring(0, hashPosition).lastIndexOf("."); if (extStart > 0) { sb.append(text.substring(0, extStart)); } else { sb.append(text.substring(0, hashPosition)); } if (hashPosition != text.length() - 1) { sb.append(text.substring(hashPosition)); } } else { sb.append(text); } sb.append("]"); } builder.link(hrefOrHashName, sb.toString()); }
Source:
public void testOnlyEnvScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingUser(); FlowScript fs = flowScriptWithoutApiBinding(); Script s2 = scriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); assertEquals(true, result); }

Target:
public void testOnlyEnvScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingUser(); FlowScript fs = flowScriptWithoutApiBinding(); Script s2 = scriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd)); }
Source:
public void onCompleted(Exception e) { synchronized (listeners) { for (RestRequestInfoEventListener listener : listeners) { listener.onCompleted(this, e); } } }

Target:
public void onCompleted(Exception e) { synchronized (listeners) { handlingException = e; if (operationComplete.compareAndSet(false, true)) { for (RestRequestInfoEventListener listener : listeners) { listener.onCompleted(this, e); } } } }
Source:
private void postNicInit() { initSelectedType(); getName().setEntity(getNic().getName()); initMAC(); initLinked(); initProfiles(); getPlugged().setEntity(getNic().isPlugged()); if (!hotPlugSupported) { getPlugged().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } getPlugged().setIsChangable(allowHotPlug()); initCommands(); }

Target:
private void postNicInit() { initSelectedType(); getName().setEntity(getNic().getName()); initMAC(); initLinked(); initProfiles(); getPlugged().setEntity(getNic().isPlugged()); if (!hotPlugSupported) { getPlugged().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } getPlugged().setIsChangable(allowPlug()); initCommands(); }
Source:
public UserRole[] getAllowedRoles() { return new UserRole[] { UserRole.MANAGER, UserRole.STUDY_PROGRAMME_LEADER, UserRole.ADMINISTRATOR }; }

Target:
public UserRole[] getAllowedRoles() { return new UserRole[] { UserRole.ADMINISTRATOR }; }
Source:
public void run() { try { SessionState ss = new SessionState(db.getConf()); ss.setIsHiveServerQuery(true); SessionState.start(ss); if (initialized.get()) { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { RelOptMaterialization existingMV = getRewritingMaterializedView(mvTable.getDbName(), mvTable.getTableName()); if (existingMV != null) { Table existingMVTable = extractTable(existingMV); if (existingMVTable.getCreateTime() < mvTable.getCreateTime() || (existingMVTable.getCreateTime() == mvTable.getCreateTime() && existingMVTable.getCreationMetadata().getMaterializationTime() <= mvTable.getCreationMetadata().getMaterializationTime())) { refreshMaterializedView(db.getConf(), existingMVTable, mvTable); } } else { refreshMaterializedView(db.getConf(), null, mvTable); } } LOG.info("Materialized views registry has been refreshed"); } else { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { refreshMaterializedView(db.getConf(), null, mvTable); } initialized.set(true); LOG.info("Materialized views registry has been initialized"); } } catch (HiveException e) { if (initialized.get()) { LOG.error("Problem connecting to the metastore when refreshing the view registry", e); } else { LOG.error("Problem connecting to the metastore when initializing the view registry", e); } } }

Target:
public void run() { SessionState ss = new SessionState(db.getConf()); ss.setIsHiveServerQuery(true); SessionState.start(ss); PerfLogger perfLogger = SessionState.getPerfLogger(); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH); try { if (initialized.get()) { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { RelOptMaterialization existingMV = getRewritingMaterializedView(mvTable.getDbName(), mvTable.getTableName()); if (existingMV != null) { Table existingMVTable = extractTable(existingMV); if (existingMVTable.getCreateTime() < mvTable.getCreateTime() || (existingMVTable.getCreateTime() == mvTable.getCreateTime() && existingMVTable.getCreationMetadata().getMaterializationTime() <= mvTable.getCreationMetadata().getMaterializationTime())) { refreshMaterializedView(db.getConf(), existingMVTable, mvTable); } } else { refreshMaterializedView(db.getConf(), null, mvTable); } } LOG.info("Materialized views registry has been refreshed"); } else { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { refreshMaterializedView(db.getConf(), null, mvTable); } initialized.set(true); LOG.info("Materialized views registry has been initialized"); } } catch (HiveException e) { if (initialized.get()) { LOG.error("Problem connecting to the metastore when refreshing the view registry", e); } else { LOG.error("Problem connecting to the metastore when initializing the view registry", e); } } perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH); }
Source:
public final Observable<T> doOnCompleted(final Action0 onCompleted) { Action1<T> onNext = Actions.empty(); Action1<Throwable> onError = Actions.empty(); Observer<T> observer = new ActionSubscriber<T>(onNext, onError, onCompleted); return create(new OnSubscribeDoOnEach<T>(this, observer)); }

Target:
public final Observable<T> doOnCompleted(final Action0 onCompleted) { Action1<T> onNext = Actions.empty(); Action1<Throwable> onError = Actions.empty(); Observer<T> observer = new ActionObserver<T>(onNext, onError, onCompleted); return create(new OnSubscribeDoOnEach<T>(this, observer)); }
Source:
public void visit(MetricsVisitor visitor) { updateGaugeValues(); visitor.gauge(this); }

Target:
public void visit(MetricsVisitor visitor) { updateGaugeValues(percentile); visitor.gauge(this); }
Source:
private void performDiskUpdate(final boolean unlockImage) { final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); diskImage.setDiskProfileId(((DiskImage) getNewDisk()).getDiskProfileId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(diskImage); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }

Target:
private void performDiskUpdate(final boolean unlockImage) { final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(diskImage); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }
Source:
private void applyCloseSentTimeout(ChannelHandlerContext ctx) { if (closeSent.isDone() || forceCloseTimeoutMillis < 0) { return; } final ScheduledFuture<?> timeoutTask = ctx.executor().schedule(new Runnable() { @Override public void run() { closeSent.tryFailure(new WebSocketHandshakeException("send close frame timed out")); } }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS); closeSent.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { timeoutTask.cancel(false); } }); }

Target:
private void applyCloseSentTimeout(ChannelHandlerContext ctx) { if (closeSent.isDone() || forceCloseTimeoutMillis < 0) { return; } final ScheduledFuture<?> timeoutTask = ctx.executor().schedule(new Runnable() { @Override public void run() { if (!closeSent.isDone()) { closeSent.tryFailure(new WebSocketHandshakeException("send close frame timed out")); } } }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS); closeSent.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { timeoutTask.cancel(false); } }); }
Source:
public void updateByUser(final Version version) { reference = version.reference; hidden = version.hidden; if (!isDirtyBit()) { setDirtyBit(false); } }

Target:
public void updateByUser(final Version version) { reference = version.reference; hidden = version.hidden; }
Source:
protected boolean requiresRuntime(OperationContext context) { return super.requiresRuntime(context) || context.getRunningMode() == RunningMode.ADMIN_ONLY; }

Target:
protected boolean requiresRuntime(OperationContext context) { return super.requiresRuntime(context) || context.getProcessType().isServer(); }
Source:
static int findEndPosition(int startPosition, int endPosition, BiFunction<Integer, Integer, Boolean> comparator) { checkArgument(startPosition >= 0, "startPosition must be greater or equal than zero: %d", startPosition); checkArgument(endPosition > 0, "endPosition must be greater than zero: %d", endPosition); checkArgument(startPosition < endPosition, "startPosition must be less than endPosition: %d < %d", startPosition, endPosition); for (int first = startPosition, second = startPosition + 1; second < endPosition; first++, second++) { if (!comparator.apply(first, second)) { return second; } } return endPosition; }

Target:
static int findEndPosition(int startPosition, int endPosition, BiFunction<Integer, Integer, Boolean> comparator) { checkArgument(startPosition >= 0, "startPosition must be greater or equal than zero: %d", startPosition); checkArgument(endPosition > 0, "endPosition must be greater than zero: %d", endPosition); checkArgument(startPosition < endPosition, "startPosition must be less than endPosition: %d < %d", startPosition, endPosition); int left = startPosition; int right = endPosition - 1; for (int i = 0; i < endPosition - startPosition; i++) { int distance = right - left; if (distance == 0) { return right + 1; } if (distance == 1) { if (comparator.apply(left, right)) { return right + 1; } else { return right; } } int mid = left + distance / 2; if (comparator.apply(left, mid)) { left = mid; } else { right = mid; } } for (int first = startPosition; first < endPosition; first++) { boolean previousPairsWereEqual = true; for (int second = first + 1; second < endPosition; second++) { boolean currentPairIsEqual = comparator.apply(first, second); if (!currentPairIsEqual) { previousPairsWereEqual = false; } if (currentPairIsEqual && !previousPairsWereEqual) { throw new IllegalArgumentException("The input is not sorted"); } } } throw new IllegalArgumentException("failed to find a group ending"); }
Source:
static <T> Stringifier<T> getStringifier(Type typeOfT) { checkNotNull(typeOfT); final Optional<Stringifier<T>> stringifierOptional = getInstance().get(typeOfT); if (stringifierOptional.isPresent()) { final Stringifier<T> stringifier = stringifierOptional.get(); return stringifier; } if (typeOfT instanceof Class) { final Class<?> aClass = (Class)typeOfT; final boolean isMessage = Message.class.isAssignableFrom(aClass); if(isMessage) { return (Stringifier<T>) Stringifiers.defaultStringifier((Class<Message>) typeOfT); } } final String errMsg = format("No stringifier registered for the type: %s", typeOfT); throw new MissingStringifierException(errMsg); }

Target:
static <T> Stringifier<T> getStringifier(Type typeOfT) { checkNotNull(typeOfT); final Optional<Stringifier<T>> stringifierOptional = getInstance().get(typeOfT); if (stringifierOptional.isPresent()) { final Stringifier<T> stringifier = stringifierOptional.get(); return stringifier; } if (isMessage(typeOfT)) { return getDefaultStringifier(typeOfT); } final String errMsg = format("No stringifier registered for the type: %s", typeOfT); throw new MissingStringifierException(errMsg); }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Arrays.asList( MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("setHeader").withAnyParameters(), MethodMatcher.create().typeDefinition("java.net.URLConnection").name("setRequestProperty").withAnyParameters() ); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Arrays.asList( MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("setHeader").withAnyParameters(), MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("addHeader").addParameter(LANG_STRING).addParameter(LANG_STRING), MethodMatcher.create().typeDefinition("org.apache.http.message.BasicHeader").name("<init>").addParameter(LANG_STRING).addParameter(LANG_STRING), MethodMatcher.create().typeDefinition("java.net.URLConnection").name("setRequestProperty").withAnyParameters(), MethodMatcher.create().typeDefinition("java.net.URLConnection").name("addRequestProperty").withAnyParameters() ); }
Source:
@Override public void onPause() { super.onPause(); mShouldRefreshNotifications = true; }

Target:
public void onPause() { super.onPause(); mShouldRefreshNotifications = true; }
Source:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } String broadcastAddressConf = (String) config.get(BROADCAST_ADDRESS); if (broadcastAddressConf == null || broadcastAddressConf.isEmpty() || !isValidIPConfig(broadcastAddressConf)) { configuredBroadcastAddress = getPrimaryBroadcastAddress(); } else { configuredBroadcastAddress = broadcastAddressConf; } scheduleToPollNI(config); }

Target:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } String broadcastAddressConf = (String) config.get(BROADCAST_ADDRESS); if (broadcastAddressConf == null || broadcastAddressConf.isEmpty() || !isValidIPConfig(broadcastAddressConf)) { configuredBroadcastAddress = getPrimaryBroadcastAddress(); } else { configuredBroadcastAddress = broadcastAddressConf; } Object pollIntervalSecondsObj = null; int pollIntervalSeconds = POLL_INTERVAL_SECONDS; try { pollIntervalSecondsObj = config.get(POLL_INTERVAL); if (pollIntervalSecondsObj != null) { pollIntervalSeconds = Integer.parseInt(pollIntervalSecondsObj.toString()); } } catch (NumberFormatException e) { LOGGER.warn("Cannot parse value from key {}, will use default {}", pollIntervalSecondsObj, POLL_INTERVAL, pollIntervalSeconds); } scheduleToPollNetworkInterface(pollIntervalSeconds); }