auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = mInflater.inflate(mResource, parent, false); } else { view = convertView; } final DishDetail current = getItem(position); ImageView image = (ImageView) view.findViewById(R.id.dish_image); image.setImageBitmap(ImageHelper.getImage(current.getDishImage())); TextView name = (TextView) view.findViewById(R.id.dish_name); name.setText(current.getDishName()); TextView price = (TextView) view.findViewById(R.id.dish_price); price.setText(String.valueOf(current.getDishPrice())); final TextView amount = (TextView) view.findViewById(R.id.count); amount.setText(String.valueOf(current.getDishCount())); Button rm = (Button) view.findViewById(R.id.descend_copy); rm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int count = current.getDishCount() - 1; if (count < 0) { return; } current.setDishCount(count); mOrderManager.setDishCopy(current.getId(), count); amount.setText(String.valueOf(current.getDishCount())); showDishCount(); showTotalPrice(mOrderManager.getTotalPrice()); } }); Button add = (Button) view.findViewById(R.id.add_copy); add.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int count = current.getDishCount() + 1; current.setDishCount(count); mOrderManager.setDishCopy(current.getId(), count); amount.setText(String.valueOf(current.getDishCount())); showDishCount(); showTotalPrice(mOrderManager.getTotalPrice()); } }); return view; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = mInflater.inflate(mResource, parent, false); viewHolder = new ViewHolder(); viewHolder.dishImage = (ImageView) convertView.findViewById(R.id.dish_image); viewHolder.dishName = (TextView) convertView.findViewById(R.id.dish_name); viewHolder.dishPrice = (TextView) convertView.findViewById(R.id.dish_price); viewHolder.dishAmount = (TextView) convertView.findViewById(R.id.count); viewHolder.increaseButton = (Button) convertView.findViewById(R.id.add_copy); viewHolder.decreaseButton = (Button) convertView.findViewById(R.id.descend_copy); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } setDishDetails(viewHolder, position); return convertView; }
Source:
public boolean accept(Issue issue, IssueFilterChain chain) { Integer line = issue.line(); RuleKey ruleKey = issue.ruleKey(); if (line != null) { Multimap<Integer, String> suppressWarningsLines = suppressWarningsLinesByResource.get(issue.componentKey()); if (suppressWarningsLines != null && suppressWarningsLines.containsKey(line)) { Collection<String> lineWarnings = suppressWarningsLines.get(line); for (String warning : lineWarnings) { if ((warningIsTheRuleName(warning, ruleKey) || "all".equals(warning)) && !"S1309".equals(ruleKey.rule())) { return false; } } } } return chain.accept(issue); }

Target:
public boolean accept(Issue issue, IssueFilterChain chain) { for (String warning : getWarningsByLine(issue)) { if (issueShouldNotBeReported(warning, issue)) { return false; } } return chain.accept(issue); }
Source:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ModelNode address = operation.require(OP_ADDR); final String driverName = PathAddress.pathAddress(address).getLastElement().getValue(); if (context.isNormalServer()) { context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService( ConnectorServices.JDBC_DRIVER_REGISTRY_SERVICE); DriverRegistry driverRegistry = DriverRegistry.class.cast(sc.getValue()); ModelNode result = new ModelNode(); InstalledDriver driver = driverRegistry.getInstalledDriver(driverName); String dataSourceClsName = driver.getDataSourceClassName(); String xaDataSourceClsName = driver.getXaDataSourceClassName(); if (dataSourceClsName != null) { ModelNode dsNode = new ModelNode(); dsNode.get(dataSourceClsName).set( mapToModelNode(findPropsFromCls(driver.getModuleName(), dataSourceClsName))); result.add(dsNode); } if (xaDataSourceClsName != null) { ModelNode xaDsNode = new ModelNode(); xaDsNode.get(xaDataSourceClsName).set( mapToModelNode(findPropsFromCls(driver.getModuleName(), xaDataSourceClsName))); result.add(xaDsNode); } context.getResult().set(result); } }, OperationContext.Stage.RUNTIME); } }

Target:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final String driverName = context.getCurrentAddressValue(); if (context.isNormalServer()) { context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService( ConnectorServices.JDBC_DRIVER_REGISTRY_SERVICE); DriverRegistry driverRegistry = DriverRegistry.class.cast(sc.getValue()); ModelNode result = new ModelNode(); InstalledDriver driver = driverRegistry.getInstalledDriver(driverName); String dataSourceClsName = driver.getDataSourceClassName(); String xaDataSourceClsName = driver.getXaDataSourceClassName(); if (dataSourceClsName != null) { ModelNode dsNode = new ModelNode(); dsNode.get(dataSourceClsName).set( mapToModelNode(findPropsFromCls(driver.getModuleName(), dataSourceClsName))); result.add(dsNode); } if (xaDataSourceClsName != null) { ModelNode xaDsNode = new ModelNode(); xaDsNode.get(xaDataSourceClsName).set( mapToModelNode(findPropsFromCls(driver.getModuleName(), xaDataSourceClsName))); result.add(xaDsNode); } context.getResult().set(result); } }, OperationContext.Stage.RUNTIME); } }
Source:
protected byte[] getFastDigest(Path path) throws IOException { if (hashAttributeName.isEmpty()) return null; return getxattr(path, hashAttributeName, true); }

Target:
protected byte[] getFastDigest(Path path) throws IOException { return hashAttributeName.isEmpty() ? null : getxattr(path, hashAttributeName, true); }
Source:
public static void output(SpatialPartitioningState state, BlockBuilder out) { if (state.getCount() == 0) { out.appendNull(); return; } List<Rectangle> samples = state.getSamples(); int partitionCount = state.getPartitionCount(); int maxItemsPerNode = (int) (Math.ceil(samples.size() * 1.0 / partitionCount)); Rectangle envelope = state.getExtent(); Rectangle paddedExtent = new Rectangle(envelope.getXMin(), envelope.getYMin(), envelope.getXMax() + 0.01, envelope.getYMax() + 0.01); VARCHAR.writeString(out, KDB_TREE_CODEC.toJson(buildKDBTree(maxItemsPerNode, partitionCount, paddedExtent, samples))); }

Target:
public static void output(SpatialPartitioningState state, BlockBuilder out) { if (state.getCount() == 0) { out.appendNull(); return; } List<Rectangle> samples = state.getSamples(); int partitionCount = state.getPartitionCount(); int maxItemsPerNode = (samples.size() + partitionCount - 1) / partitionCount; Rectangle envelope = state.getExtent(); Rectangle paddedExtent = new Rectangle(envelope.getXMin(), envelope.getYMin(), Math.nextUp(envelope.getXMax()), Math.nextUp(envelope.getYMax())); VARCHAR.writeString(out, KdbTreeUtils.toJson(buildKdbTree(maxItemsPerNode, paddedExtent, samples))); }
Source:
private void copyToClipboard(String url) { Context context = new ContextThemeWrapper(CredentialsActivity.this, getTheme()); try { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.app_name), url); if (clipboard != null) { clipboard.setPrimaryClip(clip); } Toast.makeText(context, R.string.simperium_error_browser_copy_success, Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(context, R.string.simperium_error_browser_copy_failure, Toast.LENGTH_SHORT).show(); } }

Target:
private void copyToClipboard(String url) { Context context = new ContextThemeWrapper(CredentialsActivity.this, getTheme()); try { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.app_name), url); if (clipboard != null) { clipboard.setPrimaryClip(clip); Toast.makeText(context, R.string.simperium_error_browser_copy_success, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(context, R.string.simperium_error_browser_copy_failure, Toast.LENGTH_SHORT).show(); } } catch (Exception e) { Toast.makeText(context, R.string.simperium_error_browser_copy_failure, Toast.LENGTH_SHORT).show(); } }
Source:
protected void tick(Block b) { BlockMenu inv = BlockStorage.getInventory(b); if (isProcessing(b)) { int timeleft = progress.get(b); if (timeleft > 0) { ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar()); if (!takeCharge(b.getLocation())) { return; } progress.put(b, timeleft - 1); } else { if (!takeCharge(b.getLocation())) { return; } inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " ")); for (ItemStack output : processing.get(b).getOutput()) { inv.pushItem(output.clone(), getOutputSlots()); } Bukkit.getPluginManager().callEvent(new AsyncMachineProcessCompleteEvent(b.getLocation(), AContainer.this, getProcessing(b))); progress.remove(b); processing.remove(b); } } else { MachineRecipe next = findNextRecipe(inv); if (next != null) { processing.put(b, next); progress.put(b, next.getTicks()); } } }

Target:
protected void tick(Block b) { BlockMenu inv = BlockStorage.getInventory(b); if (isProcessing(b)) { if (takeCharge(b.getLocation())) { int timeleft = progress.get(b); if (timeleft > 0) { ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar()); progress.put(b, timeleft - 1); } else { inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " ")); for (ItemStack output : processing.get(b).getOutput()) { inv.pushItem(output.clone(), getOutputSlots()); } Bukkit.getPluginManager().callEvent(new AsyncMachineProcessCompleteEvent(b.getLocation(), AContainer.this, getProcessing(b))); progress.remove(b); processing.remove(b); } } } else { MachineRecipe next = findNextRecipe(inv); if (next != null) { processing.put(b, next); progress.put(b, next.getTicks()); } } }
Source:
public void testCustomDepthDimensionConvertion() throws IOException, ParseException { MockDimensionReader reader = new MockDimensionReader(); reader.metadata.put("HAS_MYDIM_DOMAIN", "true"); reader.metadata.put("MYDIM_DOMAIN_DATATYPE", "java.lang.Double"); ReaderDimensionsAccessor accessor = new ReaderDimensionsAccessor(reader); List<Object> converted = accessor.convertDimensionValue("MYDIM", Arrays.asList("10/20")); assertEquals(1, converted.size()); NumberRange<Double> range = new NumberRange<Double>(Double.class, 10d, 20d); assertEquals(range, converted.get(0)); }

Target:
public void testCustomDepthDimensionConvertion() throws IOException, ParseException { MockDimensionReader reader = new MockDimensionReader(); reader.metadata.put("HAS_MYDIM_DOMAIN", "true"); reader.metadata.put("MYDIM_DOMAIN_DATATYPE", "java.lang.Double"); ReaderDimensionsAccessor accessor = new ReaderDimensionsAccessor(reader); List<Object> converted = accessor.convertDimensionValue("MYDIM", Arrays.asList("10/20")); assertEquals(1, converted.size()); NumberRange<Double> expected = new NumberRange<Double>(Double.class, 10d, 20d); assertEquals(expected, converted.get(0)); }
Source:
Observable createRequestObservable(final Callable<ResponseWrapper> request) { return Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call(Subscriber<? super Object> subscriber) { try { ResponseWrapper wrapper = request.call(); if (subscriber.isUnsubscribed()){ return; } subscriber.onNext(wrapper.responseBody); subscriber.onCompleted(); } catch (RetrofitError e) { subscriber.onError(e); } catch (Exception e) { throw new RuntimeException(e); } } }).subscribeOn(scheduler); }

Target:
Observable createRequestObservable(final Callable<ResponseWrapper> request) { return Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call(Subscriber<? super Object> subscriber) { if (subscriber.isUnsubscribed()) { return; } try { ResponseWrapper wrapper = request.call(); if (subscriber.isUnsubscribed()) { return; } subscriber.onNext(wrapper.responseBody); subscriber.onCompleted(); } catch (RetrofitError e) { subscriber.onError(e); } catch (Exception e) { throw new RuntimeException(e); } } }).subscribeOn(scheduler); }
Source:
private void pollWorkers() { AllNodes allNodes = getAllNodes(); Set<InternalNode> aliveNodes = ImmutableSet.<InternalNode>builder() .addAll(allNodes.getActiveNodes()) .addAll(allNodes.getShuttingDownNodes()) .build(); ImmutableSet<String> aliveNodeIds = aliveNodes.stream() .map(InternalNode::getNodeIdentifier) .collect(toImmutableSet()); Set<String> deadNodes = difference(nodeStates.keySet(), aliveNodeIds).immutableCopy(); nodeStates.keySet().removeAll(deadNodes); for (InternalNode node : aliveNodes) { if (protocol.equals(CommunicationProtocol.THRIFT) && node.getThriftPort().isPresent()) { RemoteNodeState remoteNodeState = nodeStates.get(node.getNodeIdentifier()); if (!(remoteNodeState instanceof ThriftRemoteNodeState)) { nodeStates.put(node.getNodeIdentifier(), new ThriftRemoteNodeState(driftClient, uriBuilderFrom(node.getInternalUri()).scheme("thrift").port(node.getThriftPort().getAsInt()).build())); } } else { nodeStates.putIfAbsent(node.getNodeIdentifier(), new HttpRemoteNodeState(httpClient, uriBuilderFrom(node.getInternalUri()).appendPath("/v1/info/state").build())); } } nodeStates.values().forEach(RemoteNodeState::asyncRefresh); refreshNodesInternal(); }

Target:
private void pollWorkers() { AllNodes allNodes = getAllNodes(); Set<InternalNode> aliveNodes = ImmutableSet.<InternalNode>builder() .addAll(allNodes.getActiveNodes()) .addAll(allNodes.getShuttingDownNodes()) .build(); ImmutableSet<String> aliveNodeIds = aliveNodes.stream() .map(InternalNode::getNodeIdentifier) .collect(toImmutableSet()); Set<String> deadNodes = difference(nodeStates.keySet(), aliveNodeIds).immutableCopy(); nodeStates.keySet().removeAll(deadNodes); for (InternalNode node : aliveNodes) { switch (protocol) { case HTTP: nodeStates.putIfAbsent(node.getNodeIdentifier(), new HttpRemoteNodeState(httpClient, uriBuilderFrom(node.getInternalUri()).appendPath("/v1/info/state").build())); break; case THRIFT: if (node.getThriftPort().isPresent()) { nodeStates.put(node.getNodeIdentifier(), new ThriftRemoteNodeState(driftClient, uriBuilderFrom(node.getInternalUri()).scheme("thrift").port(node.getThriftPort().getAsInt()).build())); } else { } break; } } nodeStates.values().forEach(RemoteNodeState::asyncRefresh); refreshNodesInternal(); }
Source:
private KalturaLiveEntry onClientConnect(IClient client) { WMSProperties properties = client.getProperties(); String rtmpUrl = properties.getPropertyStr(LiveStreamEntry.CLIENT_PROPERTY_CONNECT_URL); logger.debug("Geting url: " + rtmpUrl); String queryString = getRtmpUrlParameters(rtmpUrl); if (queryString ==null) { logger.error("Invalid rtmp url provided: " + rtmpUrl); client.rejectConnection("Invalid rtmp url provided: " + rtmpUrl); client.shutdownClient(); return null; } try { return onClientConnect(properties, queryString); } catch (KalturaApiException | ClientConnectException e) { logger.error("Entry authentication failed [" + queryString + "]: " + e.getMessage()); client.rejectConnection("Unable to authenticate entry [" + queryString + "]", "Unable to authenticate entry [" + queryString + "]"); client.shutdownClient(); } return null; }

Target:
private KalturaLiveEntry onClientConnect(IClient client) { WMSProperties properties = client.getProperties(); String rtmpUrl = properties.getPropertyStr(LiveStreamEntry.CLIENT_PROPERTY_CONNECT_URL); logger.debug("Geting url: " + rtmpUrl+ " from client "+client.getIp()); String queryString = getRtmpUrlParameters(rtmpUrl); if (queryString ==null) { logger.error("Invalid rtmp url provided: " + rtmpUrl); client.rejectConnection("Invalid rtmp url provided: " + rtmpUrl); client.shutdownClient(); return null; } try { return onClientConnect(properties, queryString); } catch (KalturaApiException | ClientConnectException e) { logger.error("Entry authentication failed with url [" + rtmpUrl + "]: " + e.getMessage()); client.rejectConnection("Unable to authenticate ur; [" + rtmpUrl + "]"); client.shutdownClient(); } return null; }
Source:
public static void deleteProperty(String key) throws IOException, KuraException { Properties properties = KuranetConfig.getProperties(); if (!properties.isEmpty()) { if (properties.containsKey(key)) { s_logger.debug("Deleting property {}", key); properties.remove(key); KuranetConfig.storeProperties(properties); } else { s_logger.debug("Property does not exist {}", key); } } }

Target:
public static void deleteProperty(String key) throws IOException, KuraException { Properties properties = KuranetConfig.getProperties(); if (properties.containsKey(key)) { s_logger.debug("Deleting property {}", key); properties.remove(key); KuranetConfig.storeProperties(properties); } else { s_logger.debug("Property does not exist {}", key); } }
Source:
public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { if (s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW) { return -1; } if (s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW) { return 1; } return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }

Target:
public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { int typeCompare = Boolean.compare( s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW, s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW); if (typeCompare != 0) { return typeCompare; } return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }
Source:
public List<Developer> getDevelopersForCertificationBody(final Long certificationBodyId) { String hql = "FROM DeveloperCertificationBodyMapEntity " + "JOIN FETCH main.developer dev " + "JOIN FETCH main.certificationBody cb " + "WHERE cb.id = :certificationBodyId"; return entityManager .createQuery(hql, DeveloperCertificationBodyMapEntity.class) .setParameter("certificationBodyId", certificationBodyId) .getResultList().stream() .map(item -> new Developer(new DeveloperDTO(item.getDeveloper()))) .collect(Collectors.<Developer> toList()); }

Target:
public List<Developer> getDevelopersForCertificationBody(final Long certificationBodyId) { String hql = "FROM DeveloperCertificationBodyMapEntity main" + "JOIN FETCH main.developer dev " + "JOIN FETCH main.certificationBody cb " + "WHERE cb.id = :certificationBodyId"; return entityManager .createQuery(hql, DeveloperCertificationBodyMapEntity.class) .setParameter("certificationBodyId", certificationBodyId) .getResultList().stream() .map(item -> new Developer(new DeveloperDTO(item.getDeveloper()))) .collect(Collectors.<Developer> toList()); }
Source:
private static ImmutableMap<BulkObject,Long> computeRealBlobOffset(final ImmutableMap<BulkObject, Long> blobLengths) { if (Guard.isMapNullOrEmpty(blobLengths)) { return ImmutableMap.of(); } final Map<BulkObject, Long> realOffsets = new HashMap<>(); final ImmutableSortedSet<BulkObject> bulkObjects = ImmutableSortedSet.copyOf(BlobComparator.create(), blobLengths.keySet()); final ImmutableList<BulkObject> sortedList = ImmutableList.copyOf(bulkObjects); final int listLength = sortedList.size(); for(int i = 0; i < listLength; i++) { if(i == 0) { realOffsets.put(sortedList.get(0), 0L); continue; } final BulkObject previous = sortedList.get(i-1); final long previousOffset = realOffsets.get(previous); final long previousSize = blobLengths.get(previous); realOffsets.put(sortedList.get(i), previousOffset + previousSize); } return ImmutableMap.copyOf(realOffsets); }

Target:
private static ImmutableMap<BulkObject,Long> computeRealBlobOffset(final ImmutableMap<BulkObject, Long> blobLengths) { if (Guard.isMapNullOrEmpty(blobLengths)) { return ImmutableMap.of(); } final Map<BulkObject, Long> realOffsets = new HashMap<>(); final ImmutableSortedSet<BulkObject> bulkObjects = ImmutableSortedSet.copyOf(BlobComparator.create(), blobLengths.keySet()); final ImmutableList<BulkObject> sortedList = ImmutableList.copyOf(bulkObjects); final int listLength = sortedList.size(); realOffsets.put(sortedList.get(0), 0L); for(int i = 1; i < listLength; i++) { final BulkObject previous = sortedList.get(i-1); final long previousOffset = realOffsets.get(previous); final long previousSize = blobLengths.get(previous); realOffsets.put(sortedList.get(i), previousOffset + previousSize); } return ImmutableMap.copyOf(realOffsets); }
Source:
private static IThemeEngine createThemeEngine(Display display, IEclipseContext appContext) { IContributionFactory contribution = (IContributionFactory) appContext .get(IContributionFactory.class.getName()); IEclipseContext cssContext = EclipseContextFactory.create(); cssContext.set(IContributionFactory.class.getName(), contribution); display.setData("org.eclipse.e4.ui.css.context", cssContext); Bundle bundle = WorkbenchSWTActivator.getDefault().getBundle(); BundleContext context = bundle.getBundleContext(); ServiceReference<?> ref = context .getServiceReference(IThemeManager.class.getName()); IThemeManager mgr = (IThemeManager) context.getService(ref); IThemeEngine themeEngine = mgr.getEngineForDisplay(display); appContext.set(IThemeEngine.class.getName(), themeEngine); return themeEngine; }

Target:
private static IThemeEngine createThemeEngine(Display display, IEclipseContext appContext) { IContributionFactory contribution = (IContributionFactory) appContext .get(IContributionFactory.class.getName()); IEclipseContext cssContext = EclipseContextFactory.create(); cssContext.set(IContributionFactory.class.getName(), contribution); display.setData("org.eclipse.e4.ui.css.context", cssContext); IThemeManager mgr = appContext.get(IThemeManager.class); IThemeEngine themeEngine = mgr.getEngineForDisplay(display); appContext.set(IThemeEngine.class.getName(), themeEngine); return themeEngine; }
Source:
public void testExecuteSimpleRuleFlowProcessWithAsyncResponseHandler() { Marshaller marshaller = MarshallerFactory.getMarshaller(new HashSet<Class<?>>(extraClasses.values()), configuration.getMarshallingFormat(), client.getClassLoader()); ResponseCallback responseCallback = new BlockingResponseCallback(marshaller); ResponseHandler asyncResponseHandler = new AsyncResponseHandler(responseCallback); ruleClient.setResponseHandler(asyncResponseHandler); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME)); commands.add(commandsFactory.newStartProcess(PROCESS_ID)); commands.add(commandsFactory.newFireAllRules()); commands.add(commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME)); BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION); assertNoResponse(ruleClient.executeCommandsWithResults(CONTAINER_ID, batchExecution)); ExecutionResults result = responseCallback.get(ExecutionResults.class); List<String> outcome = (List<String>) result.getValue(LIST_OUTPUT_NAME); assertThat(outcome).isNotNull(); assertThat(outcome).containsExactly("Rule from first ruleflow group executed", "Rule from second ruleflow group executed"); }

Target:
public void testExecuteSimpleRuleFlowProcessWithAsyncResponseHandler() { Marshaller marshaller = MarshallerFactory.getMarshaller(new HashSet<Class<?>>(extraClasses.values()), configuration.getMarshallingFormat(), client.getClassLoader()); ResponseCallback responseCallback = new BlockingResponseCallback(marshaller); ResponseHandler asyncResponseHandler = new AsyncResponseHandler(responseCallback); ruleClient.setResponseHandler(asyncResponseHandler); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME)); commands.add(commandsFactory.newStartProcess(PROCESS_ID)); commands.add(commandsFactory.newFireAllRules()); commands.add(commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME)); BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION); ServiceResponse<?> response = ruleClient.executeCommandsWithResults(CONTAINER_ID, batchExecution); assertThat(response).isNull(); ExecutionResults result = responseCallback.get(ExecutionResultImpl.class); List<String> outcome = (List<String>) result.getValue(LIST_OUTPUT_NAME); assertThat(outcome).isNotNull(); assertThat(outcome).containsExactly("Rule from first ruleflow group executed", "Rule from second ruleflow group executed"); }
Source:
public String[] getLocalOnlyIfaces() { ArrayList<String> list = new ArrayList<String>(); synchronized (mPublicSync) { for (int i = 0; i < mTetherStates.size(); i++) { TetherState tetherState = mTetherStates.valueAt(i); if (tetherState.lastState == IpServer.STATE_LOCAL_ONLY) { list.add(mTetherStates.keyAt(i)); } } } return list.toArray(new String[list.size()]); }

Target:
public String[] getLocalOnlyIfaces() { final List<String> list; synchronized (mPublicSync) { list = CollectionUtils.filter( mTetherStates, state -> state.lastState == IpServer.STATE_LOCAL_ONLY); } return list.toArray(new String[0]); }
Source:
public void convertFromStructuredJsonIntoString() throws Exception { String payload = "{\"id\":1}"; Message message = MessageBuilder.withPayload(payload.getBytes()).setHeader(MessageHeaders.CONTENT_TYPE,"application/json").build(); CustomJackson2MappingMessageConverter converter = new CustomJackson2MappingMessageConverter(); Object converted = converter.convertFromInternal(message, String.class,null); }

Target:
public void convertFromStructuredJsonIntoString() throws Exception { String payload = "{\"id\":1}"; Message message = MessageBuilder.withPayload(payload.getBytes()).setHeader(MessageHeaders.CONTENT_TYPE,"application/json").build(); CustomJackson2MappingMessageConverter converter = new CustomJackson2MappingMessageConverter(); Object converted = converter.convertFromInternal(message, String.class,null); assertThat(converted).isNotNull(); assertThat(payload).isEqualTo(new String((byte[])converted)); }
Source:
private File getRunDirectory(Repository repository, @NonNull String hookName) { if (repository.isBare()) { return repository.getDirectory(); } else { switch (hookName) { case "pre-receive": case "update": case "post-receive": case "post-update": case "push-to-checkout": return repository.getDirectory(); default: return repository.getWorkTree(); } } }

Target:
private File getRunDirectory(Repository repository, @NonNull String hookName) { if (repository.isBare()) { return repository.getDirectory(); } switch (hookName) { case "pre-receive": case "update": case "post-receive": case "post-update": case "push-to-checkout": return repository.getDirectory(); default: return repository.getWorkTree(); } }
Source:
@Test public void testInterpretIntersectAllWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + " (cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" + "intersect all\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1)))) as t2(x, y))\n"; SqlNode validate = planner.validate(planner.parse(sql)); RelNode convert = planner.rel(validate).rel; final Interpreter interpreter = new Interpreter(dataContext, convert); assertRows(interpreter, "[null, null]", "[null, null]"); }

Target:
@Test public void testInterpretIntersectAllWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + " (cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" + "intersect all\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1)))) as t2(x, y))"; interpretSqlAndCheck(sql, "[null, null]"); }
Source:
public static void send(InternalDistributedMember recipient, int processorId, ReplySender replySender, boolean result, ReplyException ex) { Assert.assertTrue(recipient != null, "ClearReplyMessage NULL recipient."); ClearReplyMessage message = new ClearReplyMessage(processorId, result, ex); message.setRecipient(recipient); replySender.putOutgoing(message); }

Target:
public static void send(InternalDistributedMember recipient, int processorId, ReplySender replySender, boolean result, ReplyException ex) { Assert.assertNotNull(recipient, "ClearReplyMessage recipient was NULL."); ClearReplyMessage message = new ClearReplyMessage(processorId, result, ex); message.setRecipient(recipient); replySender.putOutgoing(message); }
Source:
public String getRuleLogsForVms() { final Script cmd = new Script(_securityGroupPath, _timeout.getMillis(), s_logger); cmd.add("get_rule_logs_for_vms"); final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); final String result = cmd.execute(parser); if (result == null) { return parser.getLine(); } return null; }

Target:
public String getRuleLogsForVms() { final Script cmd = new Script(_securityGroupPath, _timeout, s_logger); cmd.add("get_rule_logs_for_vms"); final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); final String result = cmd.execute(parser); if (result == null) { return parser.getLine(); } return null; }
Source:
private void verifyUCFValueInSysCat(String tableName, String createTableString, Properties props, long expectedUCFInSysCat) throws SQLException { String readSysCatQuery = "SELECT TABLE_NAME, UPDATE_CACHE_FREQUENCY FROM SYSTEM.CATALOG WHERE " + "TABLE_NAME = '" + tableName + "' AND TABLE_TYPE='u'"; Connection connection = DriverManager.getConnection(getUrl(), props); connection.createStatement().execute(createTableString); ResultSet rs = connection.createStatement().executeQuery(readSysCatQuery); assertTrue(rs.next()); assertEquals(expectedUCFInSysCat, rs.getLong(2)); connection.createStatement().execute("drop table " + tableName); connection.close(); }

Target:
private void verifyUCFValueInSysCat(String tableName, String createTableString, Properties props, long expectedUCFInSysCat) throws SQLException { String readSysCatQuery = "SELECT TABLE_NAME, UPDATE_CACHE_FREQUENCY FROM SYSTEM.CATALOG " + "WHERE TABLE_NAME = '" + tableName + "' AND TABLE_TYPE='u'"; try (Connection connection = DriverManager.getConnection(getUrl(), props); Statement stmt = connection.createStatement()) { stmt.execute(createTableString); try (ResultSet rs = stmt.executeQuery(readSysCatQuery)) { assertTrue(rs.next()); assertEquals(expectedUCFInSysCat, rs.getLong(2)); } stmt.execute("drop table " + tableName); } }
Source:
protected String getIndexesAsString(String[] indexNames) { String indexes = ""; if (indexNames != null && indexNames.length > 0) { indexes = String.join(",", indexNames); } return indexes; }

Target:
protected String getIndexesAsString(String[] indexNames) { return indexNames == null ? "" : String.join(",", indexNames); }
Source:
public RowFilter adapt(FilterAdapterContext context, FuzzyRowFilter filter) throws IOException { Interleave.Builder interleaveBuilder = Interleave.newBuilder(); List<Pair<byte[], byte[]>> pairs = extractFuzzyRowFilterPairs(filter); if (pairs.size() == 0) { return ALL_VALUES_FILTER; } for (Pair<byte[], byte[]> pair : pairs) { Preconditions.checkArgument( pair.getFirst().length == pair.getSecond().length, "Fuzzy info and match mask must have the same length"); interleaveBuilder.addFilters( createSingleRowFilter( pair.getFirst(), pair.getSecond())); } return RowFilter.newBuilder().setInterleave(interleaveBuilder).build(); }

Target:
public RowFilter adapt(FilterAdapterContext context, FuzzyRowFilter filter) throws IOException { Interleave.Builder interleaveBuilder = Interleave.newBuilder(); List<Pair<byte[], byte[]>> pairs = extractFuzzyRowFilterPairs(filter); if (pairs.isEmpty()) { return ALL_VALUES_FILTER; } for (Pair<byte[], byte[]> pair : pairs) { Preconditions.checkArgument( pair.getFirst().length == pair.getSecond().length, "Fuzzy info and match mask must have the same length"); interleaveBuilder.addFilters( createSingleRowFilter( pair.getFirst(), pair.getSecond())); } return RowFilter.newBuilder().setInterleave(interleaveBuilder).build(); }
Source:
public void validate(final EventType eventType) throws InvalidEventTypeException { if (eventType.getCategory() == EventCategory.UNDEFINED && !eventType.getEnrichmentStrategies().isEmpty()) { throw new InvalidEventTypeException("must not define enrichment strategy for undefined event type"); } final Set<EnrichmentStrategyDescriptor> uniqueStrategies = new HashSet<EnrichmentStrategyDescriptor>(); uniqueStrategies.addAll(eventType.getEnrichmentStrategies()); if (eventType.getEnrichmentStrategies().size() != uniqueStrategies.size()) { throw new InvalidEventTypeException("enrichment strategies must not contain duplicated entries"); } if (eventType.getCategory() != EventCategory.UNDEFINED && !eventType.getEnrichmentStrategies().contains(EnrichmentStrategyDescriptor.METADATA_ENRICHMENT)) { throw new InvalidEventTypeException("must define metadata enrichment strategy"); } }

Target:
public void validate(final EventType eventType) throws InvalidEventTypeException { if (eventType.getCategory() == EventCategory.UNDEFINED && !eventType.getEnrichmentStrategies().isEmpty()) { throw new InvalidEventTypeException("must not define enrichment strategy for undefined event type"); } final Set<EnrichmentStrategyDescriptor> uniqueStrategies = new HashSet<>(eventType.getEnrichmentStrategies()); if (eventType.getEnrichmentStrategies().size() != uniqueStrategies.size()) { throw new InvalidEventTypeException("enrichment strategies must not contain duplicated entries"); } if (eventType.getCategory() != EventCategory.UNDEFINED && !eventType.getEnrichmentStrategies().contains(EnrichmentStrategyDescriptor.METADATA_ENRICHMENT)) { throw new InvalidEventTypeException("must define metadata enrichment strategy"); } }
Source:
default public boolean noTransaction() { return false; }

Target:
default boolean noTransaction() { return false; }
Source:
public Fake(final String... dispositions) throws IOException { this( new RqWithHeaders( new RqFake(), Arrays.asList( "Host: www.example.com", "Content-Type: multipart/form-data; boundary=AaB02x", "Content-Length: 100001" ) ), dispositions ); }

Target:
public Fake(final String... dispositions) throws IOException { this(new RqFake(), dispositions); }
Source:
private static File fetchSystemVmKeyFile() { String filePath = s_relativePathSystemVmKeyFileInstallDir; s_logger.debug("Looking for file [" + filePath + "] in the classpath."); URL url = Script.class.getClassLoader().getResource(filePath); File keyFile = null; if (url != null) { keyFile = new File(url.getPath()); } if (keyFile == null || !keyFile.exists()) { filePath = s_defaultPathSystemVmKeyFile; keyFile = new File(filePath); s_logger.debug("Looking for file [" + filePath + "] in the classpath."); } assert (keyFile != null); if (!keyFile.exists()) { s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString()); } return keyFile; }

Target:
private static File fetchSystemVmKeyFile() { String filePath = s_relativePathSystemVmKeyFileInstallDir; s_logger.debug("Looking for file [" + filePath + "] in the classpath."); URL url = Script.class.getClassLoader().getResource(filePath); File keyFile = null; if (url != null) { keyFile = new File(url.getPath()); } if (keyFile == null || !keyFile.exists()) { filePath = s_defaultPathSystemVmKeyFile; keyFile = new File(filePath); s_logger.debug("Looking for file [" + filePath + "] in the classpath."); } if (!keyFile.exists()) { s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString()); } return keyFile; }
Source:
static void keepNewServicesOnly(Map<String,Map<String,Set<String>>> recommendedLayout, Map<String,Map<String,Set<String>>> newServices) { recommendedLayout.keySet().removeIf(service -> !newServices.containsKey(service)); }

Target:
static void keepNewServicesOnly(Map<String,Map<String,Set<String>>> recommendedLayout, Map<String,Map<String,Set<String>>> newServices) { recommendedLayout.keySet().retainAll(newServices.keySet()); }
Source:
private boolean isJTATransactionAvailable() { Transaction transaction = null; try { transaction = TransactionManager.transactionManager(new InitialContext()).getTransaction(); } catch (javax.transaction.SystemException | NamingException e) { } return transaction != null; }

Target:
private boolean isJTATransactionAvailable() { Transaction transaction = null; try { transaction = TransactionManager.transactionManager(new InitialContext()).getTransaction(); } catch (javax.transaction.SystemException | NamingException ignore) { } return transaction != null; }
Source:
public void testClone() throws Exception { createInitialCommit(); File gitDir = db.getDirectory(); String sourcePath = gitDir.getAbsolutePath(); String targetPath = (new File(sourcePath)).getParentFile() .getParentFile().getAbsolutePath() + "/target"; StringBuilder cmd = new StringBuilder("git clone ").append(sourcePath + " " + targetPath); String[] result = execute(cmd.toString()); assertArrayEquals(new String[] { "Cloning into '" + targetPath + "'...", "", "" }, result); Git git2 = Git.open(new File(targetPath)); List<Ref> branches = git2.branchList().call(); assertEquals("expected 1 branch", 1, branches.size()); }

Target:
public void testClone() throws Exception { createInitialCommit(); File gitDir = db.getDirectory(); String sourceURI = gitDir.toURI().toString(); File target = createTempDirectory("target"); StringBuilder cmd = new StringBuilder("git clone ").append(sourceURI + " " + target.getPath()); String[] result = execute(cmd.toString()); assertArrayEquals(new String[] { "Cloning into '" + target.getPath() + "'...", "", "" }, result); Git git2 = Git.open(target); List<Ref> branches = git2.branchList().call(); assertEquals("expected 1 branch", 1, branches.size()); }
Source:
public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { Context contextForHandler = Context.get(); OAuthHandler oaHandler = (OAuthHandler) contextForHandler.getSessionMap().get( Configuration.OAUTH_HANDLER); OAProvider oaProvider = (OAProvider) contextForHandler.getSessionMap().get("oaProvider"); String authorizationheader = null; if (oaHandler.getClass().equals(HMACOAuth1Handler.class)) { Map<String, String> mapOfParams = new TreeMap<String, String>(); String requestUri = request.getRequestLine().getUri().toString(); if (requestUri.contains("?")) { String queryStr = requestUri.substring(requestUri.indexOf("?") + 1, requestUri.length()); requestUri = requestUri.substring(0, requestUri.indexOf("?")); String[] paramsList = queryStr.split("&"); for (String i : paramsList) { String[] parameter = i.split("="); mapOfParams.put(parameter[0], parameter[1]); } } try { requestUri = PathUtil.concat(oaProvider.getUrl(), requestUri, '/'); authorizationheader = ((HMACOAuth1Handler) oaHandler).createAuthorizationHeader( requestUri, mapOfParams); } catch (OAuthException e) { throw new HttpException( "OAuthException thrown while creating Authorization header in OAuthInterceptor", e); } request.addHeader("Authorization", authorizationheader); } else { authorizationheader = oaHandler.createAuthorizationHeader(); request.addHeader("Authorization", authorizationheader); } }

Target:
public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { Context contextForHandler = Context.get(); OAuthHandler oaHandler = (OAuthHandler) contextForHandler.getSessionMap().get( Configuration.OAUTH_HANDLER); contextForHandler.getSessionMap().get("oaProvider"); String authorizationheader = null; if (oaHandler.getClass().equals(HMACOAuth1Handler.class)) { Map<String, String> mapOfParams = new TreeMap<String, String>(); String requestUri = request.getRequestLine().getUri().toString(); if (requestUri.contains("?")) { String queryStr = requestUri.substring(requestUri.indexOf("?") + 1, requestUri.length()); requestUri = requestUri.substring(0, requestUri.indexOf("?")); String[] paramsList = queryStr.split("&"); for (String i : paramsList) { String[] parameter = i.split("="); mapOfParams.put(parameter[0], parameter[1]); } } try { requestUri = PathUtil.concat(applicationUrl, requestUri, '/'); authorizationheader = ((HMACOAuth1Handler) oaHandler).createAuthorizationHeader( requestUri, mapOfParams); } catch (OAuthException e) { throw new HttpException( "OAuthException thrown while creating Authorization header in OAuthInterceptor", e); } request.addHeader("Authorization", authorizationheader); } else { authorizationheader = oaHandler.createAuthorizationHeader(); request.addHeader("Authorization", authorizationheader); } }
Source:
public void exceptionInCleanupClosesTransactionManager() { RuntimeException cause = new RuntimeException("VALID REASON"); doThrow(cause).when(mockCallback).runWithRetry(); setInitializationStatus(true, true, true, true); assertClosedWitoutInitializingWithinTwoSeconds(); Assertions.assertThatThrownBy(() -> manager.runTaskWithRetry($ -> null)) .isInstanceOf(IllegalStateException.class) .hasCause(cause); }

Target:
public void exceptionInCleanupClosesTransactionManager() { RuntimeException cause = new RuntimeException("VALID REASON"); doThrow(cause).when(mockCallback).runWithRetry(any(SerializableTransactionManager.class)); everythingInitialized(); assertNotInitializedWithinTwoSecondsBecauseClosed(); assertTrue(((SerializableTransactionManager.InitializeCheckingWrapper) manager).isClosedByCallbackFailure()); Assertions.assertThatThrownBy(() -> manager.runTaskWithRetry($ -> null)) .isInstanceOf(IllegalStateException.class) .hasCause(cause); }
Source:
private BuildCommand info(String workingDir) { return exec("svn", "info").setWorkingDirectory(workingDir); }

Target:
private BuildCommand info(String workingDir) { return exec("svn", "info", "--non-interactive").setWorkingDirectory(workingDir); }
Source:
public static String readString(ByteArrayInputStream inputStream) { StringBuilder sb = new StringBuilder(); byte readByte; while (((readByte = (byte)inputStream.read()) != 0x00) && readByte != -1) sb.append((char)readByte); return sb.toString(); }

Target:
public static String readString(ByteArrayInputStream inputStream) { if (inputStream == null) throw new NullPointerException("Input stream cannot be null."); StringBuilder sb = new StringBuilder(); byte readByte; while (((readByte = (byte)inputStream.read()) != 0x00) && readByte != -1) sb.append((char)readByte); return sb.toString(); }
Source:
public static <T> T buildInterface(Class<T> clazz, Context context) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(context); restAdapter.setLogLevel(RestAdapter.LogLevel.FULL); return restAdapter.create(clazz); }

Target:
public static <T> T buildInterface(Class<T> clazz, Context context) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(context); restAdapter.setLogLevel(LOG_LEVEL); return restAdapter.create(clazz); }
Source:
private boolean isCheckmarkDeselectOther() { if (_ckDeselectOther == null) _ckDeselectOther = Boolean .valueOf("true".equals(Library.getProperty("org.zkoss.zul.tree.checkmarkDeselectOthers"))); return Utils.testAttribute(this, "org.zkoss.zul.listbox.checkmarkDeselectOthers", _ckDeselectOther.booleanValue(), true); }

Target:
private boolean isCheckmarkDeselectOther() { if (_ckDeselectOther == null) _ckDeselectOther = Boolean .valueOf("true".equals(Library.getProperty("org.zkoss.zul.tree.checkmarkDeselectOthers"))); return Utils.testAttribute(this, "org.zkoss.zul.tree.checkmarkDeselectOthers", _ckDeselectOther.booleanValue(), true); }
Source:
public void propertyChange(PropertyChangeEvent event) { if(event.getProperty() == serverChoice.VALUE && event.getSource() == serverChoice) { serverPath.setStringValue(CPPStreamConnectionProvider.getDefaultLSLocation((String) event.getNewValue()).getAbsolutePath()); serverPath.load(); } }

Target:
public void propertyChange(PropertyChangeEvent event) { if(event.getSource() == serverChoice && event.getProperty() == FieldEditor.VALUE) { String changedLSLocation = CPPStreamConnectionProvider.getDefaultLSLocation((String) event.getNewValue()).getAbsolutePath(); if(changedLSLocation != null) { serverPath.setStringValue(changedLSLocation); } } }
Source:
public void register(final StateRestorer restorer) { if (!stateRestorers.containsKey(restorer.partition())) { restorer.setUserRestoreListener(userStateRestoreListener); stateRestorers.put(restorer.partition(), restorer); log.trace("Added restorer for changelog {}", restorer.partition()); } else { log.trace("Already added restorer for changelog {}", restorer.partition()); } needsInitializing.add(restorer.partition()); }

Target:
public void register(final StateRestorer restorer) { if (!stateRestorers.containsKey(restorer.partition())) { restorer.setUserRestoreListener(userStateRestoreListener); stateRestorers.put(restorer.partition(), restorer); log.trace("Added restorer for changelog {}", restorer.partition()); } else { log.debug("Skip re-adding restorer for changelog {}", restorer.partition()); } needsInitializing.add(restorer.partition()); }
Source:
public void modelChanged(String modelName, EventType type) { if (modelName.endsWith(SITEMAP_FILEEXT)) { if (type == EventType.REMOVED) { sitemapModelCache.remove(modelName); } else { EObject sitemap = modelRepo.getModel(modelName); if (sitemap instanceof Sitemap) { sitemapModelCache.put(modelName, (Sitemap) modelRepo.getModel(modelName)); } } } for (ModelRepositoryChangeListener listener : modelChangeListeners) { listener.modelChanged(modelName, type); } }

Target:
public void modelChanged(String modelName, EventType type) { if (modelName.endsWith(SITEMAP_FILEEXT)) { if (type == EventType.REMOVED) { sitemapModelCache.remove(modelName); } else { EObject sitemap = modelRepo.getModel(modelName); if (sitemap instanceof Sitemap) { sitemapModelCache.put(modelName, (Sitemap) sitemap); } } } for (ModelRepositoryChangeListener listener : modelChangeListeners) { listener.modelChanged(modelName, type); } }