auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Class<? extends IndexManager> getIndexManagerType(XClass entity, SearchConfiguration cfg, WorkerBuildContext buildContext) { ServiceManager serviceManager = buildContext.getServiceManager(); IndexManagerFactory indexManagerFactory = serviceManager.requestService( IndexManagerFactory.class ); String indexName = getIndexName( entity, cfg ); Properties[] indexProperties = getIndexProperties( cfg, indexName ); String indexManagerImplementationName = indexProperties[0].getProperty( Environment.INDEX_MANAGER_IMPL_NAME ); String indexManagerImplementationKey = indexManagerImplementationName != null ? indexManagerImplementationName : DEFAULT_INDEX_MANAGER_KEY; if ( indexManagerImplementationsRegistry.containsKey( indexManagerImplementationKey ) ) { return indexManagerImplementationsRegistry.get( indexManagerImplementationKey ); } try { Class<? extends IndexManager> indexManagerType; if ( StringHelper.isEmpty( indexManagerImplementationName ) ) { indexManagerType = indexManagerFactory.createDefaultIndexManager().getClass(); } else { indexManagerType = indexManagerFactory.createIndexManagerByName( indexManagerImplementationName ).getClass(); } indexManagerImplementationsRegistry.put( indexManagerImplementationKey, indexManagerType ); return indexManagerType; } finally { serviceManager.releaseService( IndexManagerFactory.class ); } }

Target:
public Class<? extends IndexManager> getIndexManagerType(XClass entity, SearchConfiguration cfg, WorkerBuildContext buildContext) { ServiceManager serviceManager = buildContext.getServiceManager(); IndexManagerFactory indexManagerFactory = serviceManager.requestService( IndexManagerFactory.class ); String indexName = getIndexName( entity, cfg ); Properties[] indexProperties = getIndexProperties( cfg, indexName ); String indexManagerImplementationName = indexProperties[0].getProperty( Environment.INDEX_MANAGER_IMPL_NAME ); String indexManagerImplementationKey = StringHelper.isEmpty( indexManagerImplementationName ) ? DEFAULT_INDEX_MANAGER_KEY : indexManagerImplementationName; if ( indexManagerImplementationsRegistry.containsKey( indexManagerImplementationKey ) ) { return indexManagerImplementationsRegistry.get( indexManagerImplementationKey ); } try { Class<? extends IndexManager> indexManagerType; if ( StringHelper.isEmpty( indexManagerImplementationName ) ) { indexManagerType = indexManagerFactory.createDefaultIndexManager().getClass(); } else { indexManagerType = indexManagerFactory.createIndexManagerByName( indexManagerImplementationName ).getClass(); } indexManagerImplementationsRegistry.put( indexManagerImplementationKey, indexManagerType ); return indexManagerType; } finally { serviceManager.releaseService( IndexManagerFactory.class ); } }
Source:
public int lastIndexOf(Object o) { int last = -1; for (Entry<Integer, E> entry : fInnerElements.entrySet()) { if (Objects.equals(entry.getValue(), o)) { last = Math.max(last, entry.getKey()); } } return last; }

Target:
public int lastIndexOf(Object o) { int last = -1; if (o == null && contains(null)) { for (int i = size() -1; i >= 0; i--) { if (!fInnerElements.containsKey(i)) { return i; } } } for (Entry<Integer, E> entry : fInnerElements.entrySet()) { if (Objects.equals(entry.getValue(), o)) { last = Math.max(last, entry.getKey()); } } return last; }
Source:
public void tryInstallFailed() { synchronized (failedInstalls) { Iterator<File> iterator = failedInstalls.iterator(); while (iterator.hasNext()) { File f = iterator.next(); if (doInstall(f)) { iterator.remove(); } } } }

Target:
public void tryInstallFailed() { synchronized (failedInstalls) { Iterator<File> failedInstallsIterator = failedInstalls.iterator(); while (failedInstallsIterator.hasNext()) { File fileToInstall = failedInstallsIterator.next(); if (doInstall(fileToInstall)) { failedInstallsIterator.remove(); } } } }
Source:
protected String getWarningMessage(PrestoWarning warning) { return REAL_TERMINAL ? format("%sWARNING: %s%s", WARNING_BEGIN, warning.getMessage(), WARNING_END) : format("WARNING: %s", warning.getMessage()); }

Target:
private String getWarningMessage(PrestoWarning warning) { if (REAL_TERMINAL) { return format("%sWARNING: %s%s", WARNING_BEGIN, warning.getMessage(), WARNING_END); } return format("WARNING: %s", warning.getMessage()); }
Source:
public List<Type> typeArguments() { if (typeArguments == null) { ITypeBinding[] typeArgs = typeBinding.getTypeArguments(); Type[] result = new Type[typeArgs.length]; for (int i = 0; i < typeArgs.length; i++) { result[i] = sema.type(typeArgs[i]); } typeArguments = Arrays.asList(result); } return typeArguments; }

Target:
public List<Type> typeArguments() { if (typeArguments == null) { convertTypeArguments(); } return typeArguments; }
Source:
private void initUI() { addStyleName("gerrit-ChangeScreen"); descriptionBlock = new ChangeDescriptionBlock(); add(descriptionBlock); dependencies = new ChangeTable(); dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn()); neededBy = new ChangeTable.Section(Util.C.changeScreenNeededBy()); dependencies.addSection(dependsOn); dependencies.addSection(neededBy); dependenciesPanel = new DisclosurePanel(Util.C.changeScreenDependencies()); dependenciesPanel.setContent(dependencies); dependenciesPanel.setWidth("95%"); add(dependenciesPanel); approvals = new ApprovalTable(changeId); approvalsPanel = new DisclosurePanel(Util.C.changeScreenApprovals()); approvalsPanel.setContent(wrap(approvals)); dependenciesPanel.setWidth("95%"); add(approvalsPanel); patchSetPanels = new FlowPanel(); add(patchSetPanels); messagesContent = new FlowPanel(); messagesContent.setStyleName("gerrit-ChangeMessages"); messagesPanel = new DisclosurePanel(Util.C.changeScreenMessages()); messagesPanel.setContent(messagesContent); add(messagesPanel); }

Target:
private void initUI() { addStyleName("gerrit-ChangeScreen"); descriptionBlock = new ChangeDescriptionBlock(); add(descriptionBlock); dependencies = new ChangeTable(); dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn()); neededBy = new ChangeTable.Section(Util.C.changeScreenNeededBy()); dependencies.addSection(dependsOn); dependencies.addSection(neededBy); dependenciesPanel = new DisclosurePanel(Util.C.changeScreenDependencies()); dependenciesPanel.setContent(dependencies); dependenciesPanel.setWidth("95%"); add(dependenciesPanel); approvals = new ApprovalTable(); approvalsPanel = new DisclosurePanel(Util.C.changeScreenApprovals()); approvalsPanel.setContent(wrap(approvals)); dependenciesPanel.setWidth("95%"); add(approvalsPanel); patchSetPanels = new FlowPanel(); add(patchSetPanels); messagesContent = new FlowPanel(); messagesContent.setStyleName("gerrit-ChangeMessages"); messagesPanel = new DisclosurePanel(Util.C.changeScreenMessages()); messagesPanel.setContent(messagesContent); add(messagesPanel); }
Source:
public static String collectionString(Collection<?> c) { StringBuilder res = new StringBuilder("["); boolean subsequent = false; synchronized (c) { for (Object o: c) { if (subsequent) { res.append(", "); } res.append(o); subsequent = true; } } return res.append("]").toString(); }

Target:
public static String collectionString(Collection<?> c) { StringBuilder res = new StringBuilder("["); boolean subsequent = false; try { for (Object o: c) { if (subsequent) { res.append(", "); } res.append(o); subsequent = true; } } catch (ConcurrentModificationException e) { return "[...] (size=" + c.size() + ")"; } return res.append("]").toString(); }
Source:
public void createsFork() throws Exception { final MkForks forks = new MkForks(new MkStorage.InFile(), "Test", new Coordinates.Simple("tests", "forks") ); MatcherAssert.assertThat( forks.create(), Matchers.notNullValue() ); }

Target:
public void createsFork() throws Exception { final Fork.Smart fork = new Fork.Smart(this.repo().forks().create()); MatcherAssert.assertThat( this.repo().forks().get(Integer.parseInt(fork.forkId())), Matchers.notNullValue() ); }
Source:
public String toString() { return this.getClass().getSimpleName() + ": " + fboToBind; }

Target:
public String toString() { return String.format("%16s: %s(%s)", this.getClass().getSimpleName(), fboName, fboId); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (logger.isDebugEnabled()) { String pathInfo = req.getPathInfo(); logger.warn("Serving request from " + pathInfo); } final String className = extractClassName(req.getPathInfo()); final FileProcess fp = new FileProcess(null, className); boolean ok = true; byte[] bytes = null; try { bytes = fp.getBytes(); resp.setContentType("application/java"); resp.setStatus(HttpServletResponse.SC_OK); resp.getOutputStream().write(bytes); } catch (ClassNotFoundException e) { ok = false; resp.setContentType("text/plain"); resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } if (logger.isDebugEnabled()) { final String from = req.getLocalAddr() + ":" + req.getLocalPort(); final String status = ok ? "OK" : "Class Not Found"; if (logger.isDebugEnabled()) { logger.debug("Served request from " + from + " for " + className + " status: " + status + (bytes != null ? " bytes: " + bytes.length : "")); } } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (logger.isDebugEnabled()) { String pathInfo = req.getPathInfo(); logger.warn("Serving request from " + pathInfo); } final String className = extractClassName(req.getPathInfo()); final FileProcess fp = new FileProcess(null, className); boolean ok = true; byte[] bytes = null; try { bytes = fp.getBytes(); resp.setContentType("application/java"); resp.setStatus(HttpServletResponse.SC_OK); resp.getOutputStream().write(bytes); } catch (ClassNotFoundException e) { ok = false; resp.setContentType("text/plain"); resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } if (logger.isDebugEnabled()) { final String from = req.getLocalAddr() + ":" + req.getLocalPort(); final String status = ok ? "OK" : "Class Not Found"; logger.debug("Served request from " + from + " for " + className + " status: " + status + (bytes != null ? " bytes: " + bytes.length : "")); } }
Source:
public void testDeployRoot_alreadyDeployed() throws Exception { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); String targetId = this.manager.targetsMngr().createTarget( "id:tid\nprop: ok\nhandler: test" ); this.manager.targetsMngr().associateTargetWith( targetId, app, null ); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); Utils.createDirectory( dir ); Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir, Constants.TARGET_SCRIPT_FILE_NAME )); Assert.assertNotNull( this.manager.targetsMngr().findScriptResources(targetId) ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertEquals( 0, ma.getScopedInstanceToAwaitingMessages().size()); app.getMySqlVm().data.put( Instance.MACHINE_ID, "something" ); this.manager.instancesMngr().changeInstanceState( ma, app.getMySqlVm(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); Assert.assertEquals( 0, ma.getScopedInstanceToAwaitingMessages().size()); }

Target:
public void testDeployRoot_alreadyDeployed() throws Exception { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); String targetId = this.manager.targetsMngr().createTarget( "id:tid\nprop: ok\nhandler: test" ); this.manager.targetsMngr().associateTargetWith( targetId, app, null ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertEquals( 0, ma.getScopedInstanceToAwaitingMessages().size()); app.getMySqlVm().data.put( Instance.MACHINE_ID, "something" ); this.manager.instancesMngr().changeInstanceState( ma, app.getMySqlVm(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); Assert.assertEquals( 0, ma.getScopedInstanceToAwaitingMessages().size()); }
Source:
protected boolean canDoAction() { final VM vm = getVm(); if (vm == null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (!canRunActionOnNonManagedVm()) { return false; } if (getVm().getStatus() != VMStatus.Up && getVm().getStatus() != VMStatus.PoweringUp) { return failVmStatusIllegal(); } return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (!canRunActionOnNonManagedVm()) { return false; } if (getVm().getStatus() != VMStatus.Up && getVm().getStatus() != VMStatus.PoweringUp) { return failVmStatusIllegal(); } return true; }
Source:
private void showProgress(final boolean show) { final CGeoMap map = mapRef.get(); if (map == null) { return; } final ProgressBar progress = ButterKnife.findById(map.activity, R.id.actionbar_progress); if (progress != null) { final int visibility = show ? View.VISIBLE : View.GONE; progress.setVisibility(visibility); } map.activity.setProgressBarIndeterminateVisibility(show); map.spinner.setVisibility(show ? View.VISIBLE : View.GONE); }

Target:
private void showProgress(final boolean show) { final CGeoMap map = mapRef.get(); if (map == null) { return; } map.spinner.setVisibility(show ? View.VISIBLE : View.GONE); }
Source:
public void visitNode(Tree tree) { if (hasSemantic()) { Type varType; ExpressionTree expr; if (tree.is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree aet = (AssignmentExpressionTree) tree; varType = aet.symbolType(); expr = aet.expression(); checkExpression(varType, expr); } else if (tree.is(Tree.Kind.VARIABLE)) { VariableTree variableTree = (VariableTree) tree; varType = variableTree.type().symbolType(); expr = variableTree.initializer(); checkExpression(varType, expr); } else if (tree.is(Tree.Kind.METHOD_INVOCATION)) { checkMethodInvocationArgument((MethodInvocationTree) tree); } else if (tree.is(Tree.Kind.METHOD)) { MethodTreeImpl methodTree = (MethodTreeImpl) tree; Type returnType = methodTree.returnType() != null ? methodTree.returnType().symbolType() : null; if (returnType != null && isVarTypeErrorProne(returnType)) { methodTree.accept(new ReturnStatementVisitor(returnType)); } } else if (tree.is(Tree.Kind.DIVIDE)) { BinaryExpressionTree binaryExpr = (BinaryExpressionTree) tree; if (isIntOrLong(binaryExpr.symbolType())) { checkIntegerDivisionInsideFloatingPointExpression(binaryExpr); } } } }

Target:
public void visitNode(Tree tree) { if (hasSemantic()) { Type varType; ExpressionTree expr; switch (tree.kind()) { case ASSIGNMENT: AssignmentExpressionTree aet = (AssignmentExpressionTree) tree; varType = aet.symbolType(); expr = aet.expression(); checkExpression(varType, expr); break; case VARIABLE: VariableTree variableTree = (VariableTree) tree; varType = variableTree.type().symbolType(); expr = variableTree.initializer(); checkExpression(varType, expr); break; case METHOD_INVOCATION: checkMethodInvocationArgument((MethodInvocationTree) tree); break; case METHOD: checkMethodTree((MethodTreeImpl) tree); break; case DIVIDE: BinaryExpressionTree binaryExpr = (BinaryExpressionTree) tree; if (isIntOrLong(binaryExpr.symbolType())) { checkIntegerDivisionInsideFloatingPointExpression(binaryExpr); } break; default: throw new IllegalArgumentException("Tree " + tree.kind() + " not handled."); } } }
Source:
private TenderDto mapTender(Tender tender) { TenderDto tenderDto = new TenderDto(); List<String> locations = new ArrayList<>(); Set<String> categories = new HashSet<>(); List<String> roles = new ArrayList<>(); tenderDto.setId(tender.getId()); tenderDto.setTitle(tender.getTitle()); tenderDto.setAuthorName(tender.getAuthor().getFirstName()); tenderDto.setCreateDate(tender.getCreateDate()); tenderDto.setEndDate(tender.getEndDate()); tenderDto.setStatus(tender.getStatus().getName()); tenderDto.setSuitablePrice(tender.getSuitablePrice()); for (Location location : tender.getLocations()) { locations.add(location.getName()); } tenderDto.setLocations(locations); for (Unit unit : tender.getUnits()) { categories.add(unit.getItem().getCategory().getName()); } tenderDto.setCategories(categories); if (tender.getProposals()!=null){tenderDto.setProposals(tender.getProposals().size());} if (tender.getDescription()!=null){ tenderDto.setDescription(tender.getDescription()); } if (USER_LOGIN!=null){ for (Role role:userService.findByLogin(USER_LOGIN).getRoles()){ roles.add(role.getName()); } } tenderDto.setRoles(roles); return tenderDto; }

Target:
private TenderDto mapTender(Tender tender) { TenderDto tenderDto = new TenderDto(); List<String> locations = new ArrayList<>(); Set<String> categories = new HashSet<>(); List<String> roles = new ArrayList<>(); tenderDto.setId(tender.getId()); tenderDto.setTitle(tender.getTitle()); tenderDto.setAuthorName(tender.getAuthor().getFirstName()); tenderDto.setCreateDate(tender.getCreateDate()); tenderDto.setEndDate(tender.getEndDate()); tenderDto.setStatus(tender.getStatus().getName()); tenderDto.setSuitablePrice(tender.getSuitablePrice()); for (Location location : tender.getLocations()) { locations.add(location.getName()); } tenderDto.setLocations(locations); for (Unit unit : tender.getUnits()) { categories.add(unit.getItem().getCategory().getName()); } tenderDto.setCategories(categories); if (tender.getProposals()!=null){tenderDto.setProposals(tender.getProposals().size());} if (tender.getDescription()!=null){ tenderDto.setDescription(tender.getDescription()); } if (SecurityContextHolder.getContext().getAuthentication().getName()!="anonymousUser"){ for (Role role:userService.findByLogin(SecurityContextHolder.getContext().getAuthentication().getName()).getRoles()){ roles.add(role.getName()); } } tenderDto.setRoles(roles); return tenderDto; }
Source:
public void userCanReassignClaimedTaskToCandidateUsers() { String taskId = createTask("garth"); userAssignTask(taskId,"garth", "dean"); userAssignTask(taskId,"dean", "garth"); test_shouldReturnIllegalStateExceptionWhenUserIsNotAssigneeOrOwner(taskId,"dean", "garth"); cleanUp(taskId); }

Target:
public void userCanReassignClaimedTaskToCandidateUsers() { String taskId = createTask("garth"); claimTask(taskId,"garth"); userAssignTask(taskId, "garth", "dean"); userAssignTask(taskId, "dean", "john"); }
Source:
public void doGetRole(@QueryParameter(required = true) String type, @QueryParameter(required = true) String roleName) throws IOException{ checkAdminPerm(); JSONObject responseJson = new JSONObject(); RoleMap roleMap = this.grantedRoles.get(type); if (roleMap != null){ Role role = roleMap.getRole(roleName); if (role != null){ Set<Permission> permissions = role.getPermissions(); Map<String,Boolean> permissionsMap = new HashMap<String, Boolean>(); for (Permission permission : permissions) { permissionsMap.put(permission.getId(),permission.getEnabled()); } responseJson.put("permissionIds",permissionsMap); if (type.equals(RoleBasedAuthorizationStrategy.PROJECT)){ responseJson.put("pattern",role.getPattern().pattern()); } } } Stapler.getCurrentResponse().setContentType("application/json;charset=UTF-8"); Writer writer = Stapler.getCurrentResponse().getCompressedWriter(Stapler.getCurrentRequest()); responseJson.write(writer); writer.close(); }

Target:
public void doGetRole(@QueryParameter(required = true) String type, @QueryParameter(required = true) String roleName) throws IOException{ checkAdminPerm(); JSONObject responseJson = new JSONObject(); RoleMap roleMap = this.grantedRoles.get(type); if (roleMap != null){ Role role = roleMap.getRole(roleName); if (role != null){ Set<Permission> permissions = role.getPermissions(); Map<String,Boolean> permissionsMap = new HashMap<String, Boolean>(); for (Permission permission : permissions) { permissionsMap.put(permission.getId(),permission.getEnabled()); } responseJson.put("permissionIds",permissionsMap); if (!type.equals(RoleBasedAuthorizationStrategy.GLOBAL)){ responseJson.put("pattern",role.getPattern().pattern()); } } } Stapler.getCurrentResponse().setContentType("application/json;charset=UTF-8"); Writer writer = Stapler.getCurrentResponse().getCompressedWriter(Stapler.getCurrentRequest()); responseJson.write(writer); writer.close(); }
Source:
public Optional<List<Class>> getResultType(List<Class> inputTypes) { if (inputTypes == null || inputTypes.size() != 1) throw new IllegalArgumentException( "Expecting a single type in input, not " + inputTypes); Class type = inputTypes.get(0); if (Number.class.isAssignableFrom(type)) { return Optional.of(inputTypes); } throw new IllegalArgumentException( "The input type for sum must be numeric, instead this was found: " + type); }

Target:
public Optional<List<Class>> getResultType(List<Class> inputTypes) { if (inputTypes == null || inputTypes.size() != 1) throw new IllegalArgumentException( "Expecting a single type in input, not " + inputTypes); Class type = inputTypes.get(0); if (Number.class.isAssignableFrom(type)) { return Optional.of(Collections.singletonList(Double.class)); } throw new IllegalArgumentException( "The input type for sum must be numeric, instead this was found: " + type); }
Source:
private Topology loadTopologyAttempt(File file) throws IOException, SAXException { Topology topology = parse(FileUtils.openInputStream(file)); if (topology != null) { topology.setUri(file.toURI()); topology.setName(FilenameUtils.removeExtension(file.getName())); topology.setTimestamp(file.lastModified()); } return topology; }

Target:
private Topology loadTopologyAttempt(File file) throws IOException, SAXException { Topology topology; try (InputStream in = FileUtils.openInputStream(file)) { topology = parse(in); if (topology != null) { topology.setUri(file.toURI()); topology.setName(FilenameUtils.removeExtension(file.getName())); topology.setTimestamp(file.lastModified()); } } return topology; }
Source:
public void open(final Map<String, Object> conf, final TopologyContext context, final SpoutOutputCollector spoutOutputCollector) { if (jmsProvider == null) { throw new IllegalStateException( "JMS provider has not been set."); } if (tupleProducer == null) { throw new IllegalStateException( "JMS Tuple Producer has not been set."); } collector = spoutOutputCollector; try { ConnectionFactory cf = jmsProvider.connectionFactory(); Destination dest = jmsProvider.destination(); connection = cf.createConnection(); session = messageHandler.createSession(connection); consumer = session.createConsumer(dest); connection.start(); } catch (Exception e) { LOG.warn("Error creating JMS connection.", e); } }

Target:
public void open(final Map<String, Object> conf, final TopologyContext context, final SpoutOutputCollector spoutOutputCollector) { if (jmsProvider == null) { throw new IllegalStateException( "JMS provider has not been set."); } if (tupleProducer == null) { throw new IllegalStateException( "JMS Tuple Producer has not been set."); } validateJmsAckMode(); collector = spoutOutputCollector; try { ConnectionFactory cf = jmsProvider.connectionFactory(); Destination dest = jmsProvider.destination(); connection = cf.createConnection(); session = messageHandler.createSession(connection); consumer = session.createConsumer(dest); connection.start(); } catch (Exception e) { LOG.warn("Error creating JMS connection.", e); } }
Source:
private Set<String> moduleNames() { if (fModuleNames != null) return fModuleNames; Set<String> moduleNames= new HashSet<>(); if (fJavaElements != null) { for (IJavaElement fJavaElement : fJavaElements) { if (fJavaElement instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) fJavaElement).getModuleDescription(); if (module != null) { recordModule(module, moduleNames); } else { try { recordModule(JavaCore.getAutomaticModuleDescription(fJavaElement), moduleNames); }catch (JavaModelException e) { JavaPlugin.log(e); } } } else if (fJavaElement instanceof IJavaProject) { try { IModuleDescription module= ((IJavaProject) fJavaElement).getModuleDescription(); if (module != null) { recordModule(module, moduleNames); } else { recordModule(JavaCore.getAutomaticModuleDescription(fJavaElement), moduleNames); } }catch (JavaModelException e) { JavaPlugin.log(e); } } } } return fModuleNames= moduleNames; }

Target:
private Set<String> moduleNames() { if (fModuleNames != null) return fModuleNames; Set<String> moduleNames= new HashSet<>(); if (fJavaElements != null) { for (IJavaElement element : fJavaElements) { if (element instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) element).getModuleDescription(); if (module != null) { recordModule(module, moduleNames); } else { try { recordModule(JavaCore.getAutomaticModuleDescription(element), moduleNames); }catch (JavaModelException e) { JavaPlugin.log(e); } } } else if (element instanceof IJavaProject) { try { IModuleDescription module= ((IJavaProject) element).getModuleDescription(); if (module != null) { recordModule(module, moduleNames); } else { recordModule(JavaCore.getAutomaticModuleDescription(element), moduleNames); } } catch (JavaModelException e) { JavaPlugin.log(e); } } } } return fModuleNames= moduleNames; }
Source:
private void testParseJavaNameFailure(String[] inputs, char[] stopCharacters) throws Exception { for (int i = 0; i < inputs.length; i++) { try { ParsingUtils.parseJavaName(inputs[i], 0, stopCharacters); Assert.fail("An exception was expected for input value: " + inputs[i]); } catch (ParseException e) { } } }

Target:
private void testParseJavaNameFailure(String[] inputs, char[] stopCharacters) { Arrays.stream(inputs).forEach(input -> { try { ParsingUtils.parseJavaName(input, 0, stopCharacters); Assert.fail("An exception was expected for input value: " + input); } catch (ParseException e) { } }); }
Source:
public boolean isValid() { if (this.urlString == null || httpMethod == null) { return true; } else { return false; } }

Target:
protected boolean isValid() { return this.urlString == null || httpMethod == null; }
Source:
private ConfigStatusInfo getConfigStatus(ConfigStatusProvider configStatusProvider, String entityId, Locale locale) { Collection<ConfigStatusMessage> configStatus = configStatusProvider.getConfigStatus(); if (configStatus == null) { logger.debug("Cannot provide config status for entity because its config status provider returned null.", entityId); return null; } Bundle bundle = FrameworkUtil.getBundle(configStatusProvider.getClass()); ConfigStatusInfo info = new ConfigStatusInfo(); for (ConfigStatusMessage configStatusMessage : configStatus) { String message = i18nProvider.getText(bundle, configStatusMessage.messageKey, null, locale, configStatusMessage.arguments); info.add(new ConfigStatusMessage(configStatusMessage.parameterName, configStatusMessage.type, message, configStatusMessage.statusCode)); } return info; }

Target:
private ConfigStatusInfo getConfigStatus(ConfigStatusProvider configStatusProvider, String entityId, Locale locale) { Collection<ConfigStatusMessage> configStatus = configStatusProvider.getConfigStatus(); if (configStatus == null) { logger.debug("Cannot provide config status for entity because its config status provider returned null.", entityId); return null; } Bundle bundle = FrameworkUtil.getBundle(configStatusProvider.getClass()); ConfigStatusInfo info = new ConfigStatusInfo(); for (ConfigStatusMessage configStatusMessage : configStatus) { String message = null; if (configStatusMessage.messageKey != null) { message = i18nProvider.getText(bundle, configStatusMessage.messageKey, null, locale, configStatusMessage.arguments); if (message == null) { logger.warn( "No translation found for key and config status provider {}. Will ignore the config status message.", configStatusMessage.messageKey, configStatusProvider.getClass().getSimpleName()); continue; } } info.add(new ConfigStatusMessage(configStatusMessage.parameterName, configStatusMessage.type, message, configStatusMessage.statusCode)); } return info; }
Source:
private byte[] readCertificate(String certName) throws IOException { String pemPath = getClass().getClassLoader().getResource(certName).getPath(); if (pemPath.contains(":")) { pemPath = pemPath.substring(1); } return Files.readAllBytes(Paths.get(pemPath)); }

Target:
private byte[] readCertificate(String certName) throws IOException { String pemPath = getClass().getClassLoader().getResource(certName).getPath(); String pemCert = ""; BufferedReader br = new BufferedReader(new FileReader(pemPath)); try { String line; while ((line = br.readLine()) != null) { pemCert += line + "\n"; } } finally { br.close(); } return pemCert.getBytes(); }
Source:
public void initMetaAndIndex(HFile.Reader reader) throws IOException { ReaderContext context = reader.getContext(); HFileBlock.FSReader blockReader = reader.getUncachedBlockReader(); blockIter = blockReader.blockRange(trailer.getLoadOnOpenDataOffset(), context.getFileSize() - trailer.getTrailerSize()); try { this.dataIndexReader = new HFileBlockIndex.CellBasedKeyBlockIndexReader(trailer.createComparator(), trailer.getNumDataIndexLevels()); dataIndexReader .readMultiLevelIndexRoot(blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); reader.setDataBlockIndexReader(dataIndexReader); this.metaIndexReader = new HFileBlockIndex.ByteArrayKeyBlockIndexReader(1); metaIndexReader.readRootIndex(blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getMetaIndexCount()); reader.setMetaBlockIndexReader(metaIndexReader); loadMetaInfo(blockIter, hfileContext); reader.setDataBlockEncoder(HFileDataBlockEncoderImpl.createFromFileInfo(this)); HFileBlock b; while ((b = blockIter.nextBlock()) != null) { loadOnOpenBlocks.add(b); } } catch (Throwable t) { IOUtils.closeQuietly(context.getInputStreamWrapper()); throw new CorruptHFileException("Problem reading data index and meta index from file " + context.getFilePath(), t); } finally { context.getInputStreamWrapper().unbuffer(); } }

Target:
public void initMetaAndIndex(HFile.Reader reader) throws IOException { ReaderContext context = reader.getContext(); try { HFileBlock.FSReader blockReader = reader.getUncachedBlockReader(); blockIter = blockReader.blockRange(trailer.getLoadOnOpenDataOffset(), context.getFileSize() - trailer.getTrailerSize()); this.dataIndexReader = new HFileBlockIndex.CellBasedKeyBlockIndexReader(trailer.createComparator(), trailer.getNumDataIndexLevels()); dataIndexReader .readMultiLevelIndexRoot(blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); reader.setDataBlockIndexReader(dataIndexReader); this.metaIndexReader = new HFileBlockIndex.ByteArrayKeyBlockIndexReader(1); metaIndexReader.readRootIndex(blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getMetaIndexCount()); reader.setMetaBlockIndexReader(metaIndexReader); loadMetaInfo(blockIter, hfileContext); reader.setDataBlockEncoder(HFileDataBlockEncoderImpl.createFromFileInfo(this)); HFileBlock b; while ((b = blockIter.nextBlock()) != null) { loadOnOpenBlocks.add(b); } context.getInputStreamWrapper().unbuffer(); } catch (Throwable t) { IOUtils.closeQuietly(context.getInputStreamWrapper()); throw new CorruptHFileException("Problem reading data index and meta index from file " + context.getFilePath(), t); } }
Source:
private void selectStrutsFunctionality(HttpServletRequest request) { Functionality functionality = RenderersAnnotationProcessor.getFunctionalityForType(getFunctionalityType()); MenuFunctionality menuItem = MenuFunctionality.findFunctionality(functionality.getProvider(), functionality.getKey()); if (!menuItem.isAvailableForCurrentUser()) { throw AuthorizationException.unauthorized(); } BennuPortalDispatcher.selectFunctionality(request, menuItem); }

Target:
private void selectStrutsFunctionality(HttpServletRequest request) { Functionality functionality = RenderersAnnotationProcessor.getFunctionalityForType(getFunctionalityType()); MenuFunctionality menuItem = MenuFunctionality.findFunctionality(functionality.getProvider(), functionality.getKey()); if (menuItem == null || !menuItem.isAvailableForCurrentUser()) { throw AuthorizationException.unauthorized(); } BennuPortalDispatcher.selectFunctionality(request, menuItem); }
Source:
protected String getSessionId() { String sessionId = null; if (getContext() != null && getContext().getEngineContext() != null) { sessionId = getContext().getEngineContext().getSessionId(); } return sessionId; }

Target:
protected long getSessionId() { String sessionId = getParameters().getSessionId(); if (sessionId == null && getContext() != null && getContext().getEngineContext() != null) { sessionId = getContext().getEngineContext().getSessionId(); } return SessionDataContainer.getInstance().getSessionId(sessionId); }
Source:
public static String generateFileName(String string) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (Character.isSpaceChar(c) && (buf.length() == 0 || Character.isSpaceChar(buf.charAt(buf.length() - 1)))) { continue; } if (ArrayUtils.contains(validChars, c)) { buf.append(c); } } String filename = buf.toString().trim(); if (TextUtils.isEmpty(filename)) { return randomString(8); } else if (filename.length() >= MAX_FILENAME_LENGTH) { return filename.substring(0, MAX_FILENAME_LENGTH - MD5_HEX_LENGTH - 1) + "filterdialog_" + md5(filename); } else { return filename; } }

Target:
public static String generateFileName(String string) { string = StringUtils.stripAccents(string); StringBuilder buf = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (Character.isSpaceChar(c) && (buf.length() == 0 || Character.isSpaceChar(buf.charAt(buf.length() - 1)))) { continue; } if (ArrayUtils.contains(validChars, c)) { buf.append(c); } } String filename = buf.toString().trim(); if (TextUtils.isEmpty(filename)) { return randomString(8); } else if (filename.length() >= MAX_FILENAME_LENGTH) { return filename.substring(0, MAX_FILENAME_LENGTH - MD5_HEX_LENGTH - 1) + "_" + md5(filename); } else { return filename; } }
Source:
public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request) { AuthenticationResult authResult = null; verifyNotOnMainThread(); Account[] accountList = mAcctManager .getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); Logger.v(TAG, "Account list length:" + accountList.length); String accountLookupUsername = getAccountLookupUsername(request); Account targetAccount = getAccount(accountList, accountLookupUsername); if (targetAccount != null) { Bundle brokerOptions = getBrokerOptions(request); AccountManagerFuture<Bundle> result = null; try { result = mAcctManager.getAuthToken(targetAccount, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, brokerOptions, false, null , mHandler); Logger.v(TAG, "Received result from Authenticator"); Bundle bundleResult = result.getResult(); authResult = getResultFromBrokerResponse(bundleResult); } catch (OperationCanceledException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.AUTH_FAILED_CANCELLED, e); } catch (AuthenticatorException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); } catch (IOException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_IO_EXCEPTION); } Logger.v(TAG, "Returning result from Authenticator"); return authResult; } return null; }

Target:
public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request) { AuthenticationResult authResult = null; verifyNotOnMainThread(); Account[] accountList = mAcctManager .getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); Logger.v(TAG, "Account list length:" + accountList.length); Account targetAccount = getAccount(accountList, getAccountLookupUsername(request)); if (targetAccount != null) { Bundle brokerOptions = getBrokerOptions(request); AccountManagerFuture<Bundle> result = null; try { result = mAcctManager.getAuthToken(targetAccount, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, brokerOptions, false, null , mHandler); Logger.v(TAG, "Received result from Authenticator"); Bundle bundleResult = result.getResult(); authResult = getResultFromBrokerResponse(bundleResult); } catch (OperationCanceledException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.AUTH_FAILED_CANCELLED, e); } catch (AuthenticatorException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); } catch (IOException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_IO_EXCEPTION); } Logger.v(TAG, "Returning result from Authenticator"); return authResult; } return null; }
Source:
private ClusterSummary getClusterInfoImpl() throws Exception, AuthorizationException { IStormClusterState state = stormClusterState; Map<String, SupervisorInfo> infos = state.allSupervisorInfo(); List<SupervisorSummary> summaries = new ArrayList<>(infos.size()); for (Entry<String, SupervisorInfo> entry : infos.entrySet()) { summaries.add(makeSupervisorSummary(entry.getKey(), entry.getValue())); } int uptime = this.uptime.upTime(); List<NimbusSummary> nimbuses = state.nimbuses(); NimbusInfo leader = leaderElector.getLeader(); for (NimbusSummary nimbusSummary : nimbuses) { nimbusSummary.set_uptime_secs(Time.deltaSecs(nimbusSummary.get_uptime_secs())); boolean isLeader = leader.getHost().equals(nimbusSummary.get_host()) && leader.getPort() == nimbusSummary.get_port(); if (isLeader && this.nimbusHostPortInfo.getHost().equals(leader.getHost()) && !this.isLeader()) { isLeader = false; } nimbusSummary.set_isLeader(isLeader); } List<TopologySummary> topologySummaries = getTopologySummaries(); ClusterSummary ret = new ClusterSummary(summaries, topologySummaries, nimbuses); return ret; }

Target:
private ClusterSummary getClusterInfoImpl() throws Exception { IStormClusterState state = stormClusterState; Map<String, SupervisorInfo> infos = state.allSupervisorInfo(); List<SupervisorSummary> summaries = new ArrayList<>(infos.size()); for (Entry<String, SupervisorInfo> entry : infos.entrySet()) { summaries.add(makeSupervisorSummary(entry.getKey(), entry.getValue())); } int uptime = this.uptime.upTime(); List<NimbusSummary> nimbuses = state.nimbuses(); NimbusInfo leader = leaderElector.getLeader(); for (NimbusSummary nimbusSummary : nimbuses) { nimbusSummary.set_uptime_secs(Time.deltaSecs(nimbusSummary.get_uptime_secs())); boolean isLeader = leader.getHost().equals(nimbusSummary.get_host()) && leader.getPort() == nimbusSummary.get_port(); if (isLeader && this.nimbusHostPortInfo.getHost().equals(leader.getHost()) && !this.isLeader()) { isLeader = false; } nimbusSummary.set_isLeader(isLeader); } List<TopologySummary> topologySummaries = getTopologySummariesImpl(); ClusterSummary ret = new ClusterSummary(summaries, topologySummaries, nimbuses); return ret; }
Source:
public void traceOpened(TmfTraceOpenedSignal signal) { assert (signal != null); fTrace = signal.getTrace(); ITmfTrace[] traces = TmfTraceManager.getTraceSet(fTrace); if (traces != null) { this.showTraceAction.setEnabled(traces.length < fFullTraceHistogram.getMaxNbTraces()); } loadTrace(); }

Target:
public void traceOpened(TmfTraceOpenedSignal signal) { assert (signal != null); fTrace = signal.getTrace(); loadTrace(); }
Source:
public CauseOfBlockage canTake(Queue.BuildableItem item) { Label l = item.getAssignedLabel(); if(l!=null && !l.contains(this)) return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getDisplayName(), l)); if(l==null && getMode() == Mode.EXCLUSIVE) { if (this instanceof Jenkins && item.task instanceof Queue.FlyweightTask) { for (Node node: Jenkins.getInstance().getNodes()) { if (node.getMode() != Mode.EXCLUSIVE) return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getDisplayName())); } } } else { return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getDisplayName())); } Authentication identity = item.authenticate(); if (!getACL().hasPermission(identity,Computer.BUILD)) { return CauseOfBlockage.fromMessage(Messages._Node_LackingBuildPermission(identity.getName(), getDisplayName())); } for (NodeProperty prop: getNodeProperties()) { CauseOfBlockage c = prop.canTake(item); if (c!=null) return c; } if (!isAcceptingTasks()) { return new CauseOfBlockage.BecauseNodeIsNotAcceptingTasks(this); } return null; }

Target:
public CauseOfBlockage canTake(Queue.BuildableItem item) { Label l = item.getAssignedLabel(); if(l!=null && !l.contains(this)) return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getDisplayName(), l)); if(l==null && getMode()== Mode.EXCLUSIVE) { if (this instanceof Jenkins && item.task instanceof Queue.FlyweightTask) { for (Node node: Jenkins.getInstance().getNodes()) { if (node.getMode() != Mode.EXCLUSIVE) return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getDisplayName())); } } else { return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getDisplayName())); } } Authentication identity = item.authenticate(); if (!getACL().hasPermission(identity,Computer.BUILD)) { return CauseOfBlockage.fromMessage(Messages._Node_LackingBuildPermission(identity.getName(), getDisplayName())); } for (NodeProperty prop: getNodeProperties()) { CauseOfBlockage c = prop.canTake(item); if (c!=null) return c; } if (!isAcceptingTasks()) { return new CauseOfBlockage.BecauseNodeIsNotAcceptingTasks(this); } return null; }
Source:
public void testConfigurationProviderDoNotOverwrite() { try { ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), false); assertEquals(configuration.getProperty(USE_CROSS_SITE_ORIGIN_FILTER, null), "false"); } catch (Exception e) { fail("Error in test", e); } }

Target:
public void testConfigurationProviderDoNotOverwrite() { try { final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), false); assertEquals(configuration.getProperty(USE_CROSS_SITE_ORIGIN_FILTER, null), "false"); } catch (Exception e) { fail("Error in test", e); } }
Source:
private static Set<Entry<Node, List<Throwable>>> groupByNode( Iterable<Entry<Node, Throwable>> errors) { Map<Node, List<Throwable>> map = new LinkedHashMap<>(); for (Entry<Node, Throwable> entry : errors) { Node node = entry.getKey(); Throwable error = entry.getValue(); map.compute( node, (k, v) -> { if (v == null) { v = new ArrayList<>(); } v.add(error); return v; }); } return map.entrySet(); }

Target:
private static Map<Node, List<Throwable>> groupByNode(Iterable<Entry<Node, Throwable>> errors) { Map<Node, List<Throwable>> map = new LinkedHashMap<>(); for (Entry<Node, Throwable> entry : errors) { Node node = entry.getKey(); Throwable error = entry.getValue(); map.compute( node, (k, v) -> { if (v == null) { v = new ArrayList<>(); } v.add(error); return v; }); } return map; }
Source:
public AutomatonHitEnum build(String source, HitWeigher queryWeigher, HitWeigher corpusWeigher) { if (reverse == null) { return new AutomatonHitEnum.Forward(forward, source, queryWeigher, corpusWeigher); } else { BitSet startPositions = reverse.runAllReverse(source); return new AutomatonHitEnum.TwoPass(forward, startPositions, source, queryWeigher, corpusWeigher); } }

Target:
public AutomatonHitEnum build(String source, HitWeigher queryWeigher, HitWeigher corpusWeigher) { if (reverse == null) { return new AutomatonHitEnum.Forward(forward, source, queryWeigher, corpusWeigher); } else { startPositions = reverse.run(source, startPositions); return new AutomatonHitEnum.TwoPass(forward, startPositions, source, queryWeigher, corpusWeigher); } }
Source:
public BodyReadStream handler(@Nullable Handler<Buffer> handler) { if (handler == null) { return this; } this.handler = handler; stream.handler(b -> connection.getContext().runOnContext(v -> { Buffer buffer = streamBuffer.appendBuffer(b); int start = 0; while(start + size < buffer.length()) { final String theLine = Utils.base64(buffer.getBytes(start, start + size)); handler.handle(Buffer.buffer(theLine + "\r\n")); start += size; } streamBuffer = buffer.getBuffer(start, buffer.length()); })); return this; }

Target:
public BodyReadStream handler(@Nullable Handler<Buffer> handler) { if (handler == null) { return this; } this.handler = handler; stream.handler(b -> connection.getContext().runOnContext(v -> { Buffer buffer = streamBuffer.appendBuffer(b); Buffer bufferToSent = Buffer.buffer(); int start = 0; while(start + size < buffer.length()) { final String theLine = Utils.base64(buffer.getBytes(start, start + size)); bufferToSent.appendBuffer(Buffer.buffer(theLine + "\r\n")); start += size; } streamBuffer = buffer.getBuffer(start, buffer.length()); handler.handle(bufferToSent); })); return this; }
Source:
public void initialize() { Configuration configuration = getConfig(); super.initialize(); if (getThing().getStatus() == ThingStatus.OFFLINE) { return; } if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO)) { sensors.add(new DS2405(sensorIds.get(0), this)); } else if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO2)) { sensors.add(new DS2406_DS2413(sensorIds.get(0), this)); } else if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO8)) { sensors.add(new DS2408(sensorIds.get(0), this)); } try { sensors.get(0).configureChannels(); } catch (OwException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); return; } validConfig = true; refreshInterval = 10 * 1000; updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE); }

Target:
public void initialize() { Configuration configuration = getConfig(); Map<String, String> properties = editProperties(); if (!super.configure()) { return; } if (getThing().getStatus() == ThingStatus.OFFLINE) { return; } if (!properties.containsKey(PROPERTY_MODELID)) { scheduler.execute(() -> { updateSensorProperties(); }); } if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO)) { sensors.add(new DS2405(sensorIds.get(0), this)); } else if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO2)) { sensors.add(new DS2406_DS2413(sensorIds.get(0), this)); } else if (this.thing.getThingTypeUID().equals(THING_TYPE_DIGITALIO8)) { sensors.add(new DS2408(sensorIds.get(0), this)); } try { sensors.get(0).configureChannels(); } catch (OwException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); return; } validConfig = true; if (configuration.get(CONFIG_REFRESH) == null) { refreshInterval = 10 * 1000; } updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE); }
Source:
public static List<PostAggregator> prunePostAggregators(TopNQuery query) { return AggregatorUtil.pruneDependentPostAgg( query.getPostAggregatorSpecs(), query.getTopNMetricSpec().getMetricName(query.getDimensionSpec()) ); }

Target:
private static List<PostAggregator> prunePostAggregators(TopNQuery query) { return AggregatorUtil.pruneDependentPostAgg( query.getPostAggregatorSpecs(), query.getTopNMetricSpec().getMetricName(query.getDimensionSpec()) ); }
Source:
public void testVerticalAlignment() { m_label.setVerticalAlignmentFromScout(0); String text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"middle\"")); m_label.setVerticalAlignmentFromScout(-1); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"top\"")); m_label.setVerticalAlignmentFromScout(1); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"bottom\"")); }

Target:
public void testVerticalAlignment() { m_label.setVerticalAlignmentFromScout(LABEL_VERTICAL_ALIGNMENT_MIDDLE); String text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"middle\"")); m_label.setVerticalAlignmentFromScout(LABEL_VERTICAL_ALIGNMENT_TOP); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"top\"")); m_label.setVerticalAlignmentFromScout(LABEL_VERTICAL_ALIGNMENT_BOTTOM); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("valign=\"bottom\"")); }
Source:
public Map<String, Object> getAttributes() { synchronized (this) { return new HashMap<>(attributes); } }

Target:
public Map<String, Object> getAttributes() { return new HashMap<>(attributes); }