auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AbstractLayoutEditPartProvider getLayoutNodeProvider(final IGraphicalEditPart container) { ExtendableLayoutProvider layoutProvider = (ExtendableLayoutProvider) getGenericLayoutProvider(container); if (layoutProvider != null) { final CompoundLayoutProvider clp = new CompoundLayoutProvider(); clp.addProvider((AbstractLayoutEditPartProvider) layoutProvider); clp.addProvider(new PinnedElementsLayoutProvider(layoutProvider)); ArrangeSelectionLayoutProvider layoutNodeProvider = null; if (ENABLE_BORDERED_NODES_ARRANGE_ALL) { AbstractLayoutProvider abstractLayoutProvider = new BorderItemAwareLayoutProvider(clp); layoutNodeProvider = new ArrangeSelectionLayoutProvider(abstractLayoutProvider); } else { layoutNodeProvider = new ArrangeSelectionLayoutProvider(clp); } return new ArrangeSelectionLayoutProvider(layoutNodeProvider); } return null; }

Target:
public AbstractLayoutEditPartProvider getLayoutNodeProvider(final IGraphicalEditPart container) { DefaultLayoutProvider defaultLayoutProvider = getGenericLayoutProvider(container); if (defaultLayoutProvider != null) { final CompoundLayoutProvider clp = new CompoundLayoutProvider(); clp.addProvider(defaultLayoutProvider); if (defaultLayoutProvider instanceof ExtendableLayoutProvider) { ExtendableLayoutProvider layoutProvider = (ExtendableLayoutProvider) getGenericLayoutProvider(container); clp.addProvider(new PinnedElementsLayoutProvider(layoutProvider)); } ArrangeSelectionLayoutProvider layoutNodeProvider = null; if (ENABLE_BORDERED_NODES_ARRANGE_ALL) { AbstractLayoutProvider abstractLayoutProvider = new BorderItemAwareLayoutProvider(clp); layoutNodeProvider = new ArrangeSelectionLayoutProvider(abstractLayoutProvider); } else { layoutNodeProvider = new ArrangeSelectionLayoutProvider(clp); } return layoutNodeProvider; } return null; }
Source:
public static boolean sameElementValues(AnnotationMirror am1, AnnotationMirror am2) { if (am1 == am2) { return true; } Map<? extends ExecutableElement, ? extends AnnotationValue> vals1 = am1.getElementValues(); Map<? extends ExecutableElement, ? extends AnnotationValue> vals2 = am2.getElementValues(); for (ExecutableElement meth : ElementFilter.methodsIn( am1.getAnnotationType().asElement().getEnclosedElements())) { AnnotationValue aval1 = vals1.get(meth); AnnotationValue aval2 = vals2.get(meth); if (aval1 == null) { aval1 = meth.getDefaultValue(); } if (aval2 == null) { aval2 = meth.getDefaultValue(); } if (0 != compareAnnotationValue(aval1, aval2)) { return false; } } return true; }

Target:
public static boolean sameElementValues(AnnotationMirror am1, AnnotationMirror am2) { if (am1 == am2) { return true; } Map<? extends ExecutableElement, ? extends AnnotationValue> vals1 = am1.getElementValues(); Map<? extends ExecutableElement, ? extends AnnotationValue> vals2 = am2.getElementValues(); for (ExecutableElement meth : ElementFilter.methodsIn( am1.getAnnotationType().asElement().getEnclosedElements())) { AnnotationValue aval1 = vals1.get(meth); AnnotationValue aval2 = vals2.get(meth); if (aval1 == null) { aval1 = meth.getDefaultValue(); } if (aval2 == null) { aval2 = meth.getDefaultValue(); } if (!sameAnnotationValue(aval1, aval2)) { return false; } } return true; }
Source:
public FenceOperationResult getFenceAgentStatus(FenceAgent fenceAgent) { if (fenceAgent == null) { return new FenceOperationResult( Status.ERROR, PowerStatus.UNKNOWN, "Invalid fence agent specified."); } List<FenceAgent> fenceAgents = new ArrayList<>(); fenceAgents.add(fenceAgent); return fence(FenceActionType.STATUS, fenceAgents); }

Target:
public FenceOperationResult getFenceAgentStatus(FenceAgent fenceAgent) { if (fenceAgent == null) { return new FenceOperationResult( Status.ERROR, PowerStatus.UNKNOWN, "Invalid fence agent specified."); } return fence(FenceActionType.STATUS, Arrays.asList(fenceAgent)); }
Source:
public static void setAppContext(@NonNull Context context) { OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) called!"); if (context == null) { Log(LOG_LEVEL.WARN, "context is null, ignoring!"); return; } boolean wasAppContextNull = (appContext == null); appContext = context.getApplicationContext(); setupActivityLifecycleListener(wasAppContextNull); OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) finished, checking if appId has been set before proceeding..."); if (appId == null) { String oldAppId = getSavedAppId(); if (oldAppId == null) { OneSignal.onesignalLog(LOG_LEVEL.WARN, "appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!"); } else { OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "appContext set and an old appId was found, attempting to call setAppId(oldAppId)"); setAppId(oldAppId); } return; } OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) successful and appId is set, continuing OneSignal init..."); init(context); }

Target:
public static void setAppContext(@NonNull Context context) { logger.verbose("setAppContext(context) called!"); if (context == null) { Log(LOG_LEVEL.WARN, "context is null, ignoring!"); return; } boolean wasAppContextNull = (appContext == null); appContext = context.getApplicationContext(); setupActivityLifecycleListener(wasAppContextNull); logger.verbose("setAppContext(context) finished, checking if appId has been set before proceeding..."); if (appId == null) { String oldAppId = getSavedAppId(); if (oldAppId == null) { logger.warning("appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!"); } else { logger.verbose("appContext set and an old appId was found, attempting to call setAppId(oldAppId)"); setAppId(oldAppId); } return; } logger.verbose("setAppContext(context) successful and appId is set, continuing OneSignal init..."); init(context); }
Source:
public UpdateExecutionPageJob(TreeViewer treeViewer) { super("Updating duration of non-finished operations"); this.treeViewer = treeViewer; this.operationItems = Sets.newConcurrentHashSet(); this.removeableItems = Sets.newConcurrentHashSet(); this.running = true; }

Target:
public UpdateExecutionPageJob(TreeViewer treeViewer) { super("Updating duration of non-finished operations"); this.treeViewer = treeViewer; this.activeItems = new MapMaker().concurrencyLevel(2).makeMap(); this.running = true; }
Source:
public HudsonP4Executor newExecutor() { return new HudsonP4RemoteExecutor(hudsonLauncher, env, filePath); }

Target:
public HudsonP4Executor newExecutor() { if(hudsonLauncher instanceof RemoteLauncher){ return new HudsonP4RemoteExecutor(hudsonLauncher, env, filePath); } else { return new HudsonP4DefaultExecutor(hudsonLauncher, env, filePath); } }
Source:
public MultiBucketContentRepoEndpoint getCorpusStorage() { return (corpusStorageView != null) ? corpusStorageView : (input.contentRepo == null) ? NULL_CONTENT_REPO_ENDPOINT : (input.contentRepo.corpus == null) ? NULL_CONTENT_REPO_ENDPOINT : (corpusStorageView = new MultiBucketContentRepoEndpoint() { private final ImmutableSet<String> buckets; { ImmutableSet.Builder<String> buckets = ImmutableSet.builder(); buckets.add(getDefaultBucket()); if (input.contentRepo.corpus.secondaryBuckets != null) { buckets.addAll(input.contentRepo.corpus.secondaryBuckets); } this.buckets = null; } @Override public URI getAddress() { return input.contentRepo.corpus.address; } @Override public String getDefaultBucket() { return input.contentRepo.corpus.bucket; } @Override public ImmutableSet<String> getAllBuckets() { return buckets; } }); }

Target:
public MultiBucketContentRepoEndpoint getCorpusStorage() { return (corpusStorageView != null) ? corpusStorageView : (input.contentRepo == null) ? NULL_CONTENT_REPO_ENDPOINT : (input.contentRepo.corpus == null) ? NULL_CONTENT_REPO_ENDPOINT : (corpusStorageView = new MultiBucketContentRepoEndpoint() { private final ImmutableSet<String> buckets; { ImmutableSet.Builder<String> buckets = ImmutableSet.builder(); buckets.add(getDefaultBucket()); if (input.contentRepo.corpus.secondaryBuckets != null) { buckets.addAll(input.contentRepo.corpus.secondaryBuckets); } this.buckets = buckets.build(); } @Override public URI getAddress() { return input.contentRepo.corpus.address; } @Override public String getDefaultBucket() { return input.contentRepo.corpus.bucket; } @Override public ImmutableSet<String> getAllBuckets() { return buckets; } }); }
Source:
public boolean shouldRefreshCoordinator(Errors error) { return error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.COORDINATOR_NOT_AVAILABLE; }

Target:
public static boolean shouldRefreshCoordinator(Errors error) { return error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.COORDINATOR_NOT_AVAILABLE; }
Source:
public String renderArticleRelatedContent(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam("id") String articleId) throws IOException { enforceDevFeature("relatedContentTab"); Map<?, ?> articleMetadata = requestArticleMetadata(articleId); validateArticleVisibility(site, articleMetadata); model.addAttribute("article", articleMetadata); model.addAttribute("containingLists", getContainingArticleLists(articleId, site)); model.addAttribute("categoryTerms", getCategoryTerms(articleMetadata)); addCrossPublishedJournals(request, model, site, articleMetadata); requestAuthors(model, articleId); requestComments(model, articleId); String recaptchaPublicKey = site.getTheme().getConfigMap("captcha").get("publicKey").toString(); model.addAttribute("recaptchaPublicKey", recaptchaPublicKey); return site + "/ftl/article/relatedContent"; }

Target:
public String renderArticleRelatedContent(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam("id") String articleId) throws IOException { enforceDevFeature("relatedContentTab"); requireNonemptyParameter(articleId); Map<?, ?> articleMetadata = requestArticleMetadata(articleId); validateArticleVisibility(site, articleMetadata); model.addAttribute("article", articleMetadata); model.addAttribute("containingLists", getContainingArticleLists(articleId, site)); model.addAttribute("categoryTerms", getCategoryTerms(articleMetadata)); addCrossPublishedJournals(request, model, site, articleMetadata); requestAuthors(model, articleId); requestComments(model, articleId); String recaptchaPublicKey = site.getTheme().getConfigMap("captcha").get("publicKey").toString(); model.addAttribute("recaptchaPublicKey", recaptchaPublicKey); return site + "/ftl/article/relatedContent"; }
Source:
private void update() { DebugCollector.update(); if (DebugOptions.SHOW_FPS) { DebugCollector.debug("Fps", Gdx.graphics.getFramesPerSecond()); } inputManager.update(this); if (solGame == null) { menuBackgroundManager.update(); } else { solGame.update(); } SolMath.checkVectorsTaken(null); }

Target:
private void update() { DebugCollector.update(); if (DebugOptions.SHOW_FPS) { DebugCollector.debug("Fps", Gdx.graphics.getFramesPerSecond()); } inputManager.update(this); if (solGame != null) { solGame.update(); } SolMath.checkVectorsTaken(null); }
Source:
private void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < 16; k++) { int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockZCoord = chunkZ + rand.nextInt(16); int basaltHeight = 35; int marbleHeight = 100; int limestoneHeight = 40; int basaltY = rand.nextInt(basaltHeight); BlockPos basaltPos = new BlockPos(firstBlockXCoord, basaltY, firstBlockZCoord); if (Configurations.basaltAmount > 0) (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "basaltextra")).getStateFromMeta(7), Configurations.basaltAmount)).generate(world, rand, basaltPos); int marbleY = rand.nextInt(marbleHeight); BlockPos marblePos = new BlockPos(firstBlockXCoord, marbleY, firstBlockZCoord); if (Configurations.marbleAmount > 0) (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "marbleextra")).getStateFromMeta(7), Configurations.marbleAmount)).generate(world, rand, marblePos); int limestoneY = rand.nextInt(limestoneHeight); BlockPos limestonePos = new BlockPos(firstBlockXCoord, limestoneY, firstBlockZCoord); if (Configurations.limestoneAmount > 0) (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "limestoneextra")).getStateFromMeta(7), Configurations.limestoneAmount)).generate(world, rand, limestonePos); } }

Target:
private void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < 16; k++) { int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockZCoord = chunkZ + rand.nextInt(16); int basaltY = rand.nextInt(basaltHeight); BlockPos basaltPos = new BlockPos(firstBlockXCoord, basaltY, firstBlockZCoord); if (Configurations.basaltAmount > 0) (new WorldGenMinable(ChiselBlocks.basaltextra.getStateFromMeta(7), Configurations.basaltAmount)).generate(world, rand, basaltPos); int marbleY = rand.nextInt(marbleHeight); BlockPos marblePos = new BlockPos(firstBlockXCoord, marbleY, firstBlockZCoord); if (Configurations.marbleAmount > 0) (new WorldGenMinable(ChiselBlocks.marbleextra.getStateFromMeta(7), Configurations.marbleAmount)).generate(world, rand, marblePos); int limestoneY = rand.nextInt(limestoneHeight); BlockPos limestonePos = new BlockPos(firstBlockXCoord, limestoneY, firstBlockZCoord); if (Configurations.limestoneAmount > 0) (new WorldGenMinable(ChiselBlocks.limestoneextra.getStateFromMeta(7), Configurations.limestoneAmount)).generate(world, rand, limestonePos); } }
Source:
public void testConcurrency() throws InterruptedException, IOException, ConfigurationException { double badness = DatabaseDescriptor.getDynamicBadnessThreshold(); DatabaseDescriptor.setDynamicBadnessThreshold(0.0); try { final int ITERATIONS = 10000; StorageService.instance.unsafeInitialize(); SimpleSnitch ss = new SimpleSnitch(); DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode())); InetAddressAndPort self = FBUtilities.getBroadcastAddressAndPort(); ReplicaList replicas = new ReplicaList(); for (int i = 0; i < 100; i++) for (int j = 0; j < 256; j++) replicas.add(Replica.fullStandin(InetAddressAndPort.getByAddress(new byte[]{ 127, 0, (byte)i, (byte)j}))); ScoreUpdater updater = new ScoreUpdater(dsnitch, replicas); updater.start(); ReplicaList result = null; for (int i = 0; i < ITERATIONS; i++) result = dsnitch.getSortedListByProximity(self, replicas); updater.stopped = true; updater.join(); } finally { DatabaseDescriptor.setDynamicBadnessThreshold(badness); } }

Target:
public void testConcurrency() throws InterruptedException, IOException, ConfigurationException { double badness = DatabaseDescriptor.getDynamicBadnessThreshold(); DatabaseDescriptor.setDynamicBadnessThreshold(0.0); try { final int ITERATIONS = 10000; StorageService.instance.unsafeInitialize(); SimpleSnitch ss = new SimpleSnitch(); DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode())); InetAddressAndPort self = FBUtilities.getBroadcastAddressAndPort(); ReplicaList replicas = new ReplicaList(); for (int i = 0; i < 100; i++) for (int j = 0; j < 256; j++) replicas.add(ReplicaUtils.full(InetAddressAndPort.getByAddress(new byte[]{ 127, 0, (byte)i, (byte)j}))); ScoreUpdater updater = new ScoreUpdater(dsnitch, replicas); updater.start(); ReplicaList result = null; for (int i = 0; i < ITERATIONS; i++) result = dsnitch.getSortedListByProximity(self, replicas); updater.stopped = true; updater.join(); } finally { DatabaseDescriptor.setDynamicBadnessThreshold(badness); } }
Source:
public MafEntry(String entry) { String fields = entry.split("\\s+"); if (fields.length != 7) throw new RuntimeException("Unexpected MAF line: "+entry); if (! fields[0].equals("s")) throw new RuntimeException("Unexpected MAF line: "+entry); src = fields[1]; start = new Position0(Long.parseLong(fields[2])); size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException("Unexpected MAF line: "+entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }

Target:
public MafEntry(String entry) { String fields = entry.split("\\s+"); if (fields.length != 7) throw new RuntimeException("Unexpected MAF line: "+entry); if (! fields[0].equals("s")) throw new RuntimeException("Unexpected MAF line: "+entry); src = fields[1]; start = Position0.valueOf(fields[2],0); size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException("Unexpected MAF line: "+entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }
Source:
public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) .map(id -> (String)id) .filter(id -> isValidUUID(id)) .toArray(String[]::new); } }

Target:
public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) .map(String.class::cast) .filter(this::isValidUUID) .toArray(String[]::new); } }
Source:
public byte[] transform(String name, String transformedName, @Nullable byte[] basicClass) { if (basicClass == null) return null; ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(basicClass); classReader.accept(classNode, 0); if ((classNode.access & ACC_ENUM) == 0) return basicClass; for (FieldNode f : classNode.fields) { if ((f.name.equals("$VALUES") || f.name.equals("ENUM$VALUES")) && (f.access & ACC_STATIC) != 0) { f.access &= ~ACC_FINAL; } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); }

Target:
public byte[] transform(String name, String transformedName, @Nullable byte[] basicClass) { if (basicClass == null) return null; ClassReader classReader = new ClassReader(basicClass); if ((classReader.getAccess() & ACC_ENUM) == 0) return basicClass; ClassNode classNode = new ClassNode(); classReader.accept(classNode, 0); for (FieldNode f : classNode.fields) { if ((f.name.equals("$VALUES") || f.name.equals("ENUM$VALUES")) && (f.access & ACC_STATIC) != 0) { f.access &= ~ACC_FINAL; } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); }
Source:
protected String getStagingLocation() { String result = null; @SuppressWarnings("rawtypes") Iterator i = mets.getDescendants(new ElementFilter("stagingLocation", JDOMNamespaceUtil.SIMPLE_METS_PROFILE_NS)); while(i.hasNext()) { Element e = (Element)i.next(); String loc = e.getTextTrim(); if(loc.length() > 0) result = loc; } return result; }

Target:
protected String getStagingLocation() { String result = null; @SuppressWarnings("rawtypes") Iterator i = mets.getDescendants(new ElementFilter("stagingLocation", JDOMNamespaceUtil.SIMPLE_METS_PROFILE_NS)); while(i.hasNext()) { Element e = (Element)i.next(); String loc = e.getTextTrim(); if(loc.length() > 0) { result = loc; break; } } return result; }
Source:
public void testCoLocationConstraintThrowsException() { final ExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator(); final CoLocationConstraint coLocationConstraint = new CoLocationGroup().getLocationConstraint(0); final List<ExecutionVertexSchedulingRequirements> schedulingRequirements = Arrays.asList( new ExecutionVertexSchedulingRequirements.Builder() .withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 0)) .withCoLocationConstraint(coLocationConstraint) .build() ); executionSlotAllocator.allocateSlotsFor(schedulingRequirements); }

Target:
public void testCoLocationConstraintThrowsException() { final ExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator(); final CoLocationConstraint coLocationConstraint = new CoLocationGroup().getLocationConstraint(0); final List<ExecutionVertexSchedulingRequirements> schedulingRequirements = Collections.singletonList( new ExecutionVertexSchedulingRequirements.Builder() .withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 0)) .withCoLocationConstraint(coLocationConstraint) .build() ); executionSlotAllocator.allocateSlotsFor(schedulingRequirements); }
Source:
private static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) { List<String> arguments = new ArrayList<String>(); if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ arguments.add ("--registry=" + npmRegistryURL); } if(!proxyConfig.isEmpty()){ Proxy proxy = null; if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ proxy = proxyConfig.getProxyForUrl(npmRegistryURL); } if(proxy == null){ proxy = proxyConfig.getSecureProxy(); } if(proxy == null){ proxy = proxyConfig.getInsecureProxy(); } arguments.add("--https-proxy=" + proxy.getUri().toString()); arguments.add("--proxy=" + proxy.getUri().toString()); arguments.add("--noproxy=" + proxy.getNonProxyHosts()); } return arguments; }

Target:
static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) { List<String> arguments = new ArrayList<String>(); if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ arguments.add ("--registry=" + npmRegistryURL); } if(!proxyConfig.isEmpty()){ Proxy proxy = null; if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ proxy = proxyConfig.getProxyForUrl(npmRegistryURL); } if(proxy == null){ proxy = proxyConfig.getSecureProxy(); } if(proxy == null){ proxy = proxyConfig.getInsecureProxy(); } arguments.add("--https-proxy=" + proxy.getUri().toString()); arguments.add("--proxy=" + proxy.getUri().toString()); final String nonProxyHosts = proxy.getNonProxyHosts(); if (nonProxyHosts != null && !nonProxyHosts.isEmpty()) { arguments.add("--noproxy=" + nonProxyHosts); } } return arguments; }
Source:
public Job recoverWriteJob(final UUID jobId) throws SignatureException, IOException, XmlProcessingException, JobRecoveryException { ModifyJobResponse jobResponse = this.client.modifyJob(new ModifyJobRequest(jobId)); if (RequestType.PUT != jobResponse.getMasterObjectList().getRequestType()){ throw new JobRecoveryException("PUT", jobResponse.getMasterObjectList().getRequestType().toString() ); } return new WriteJobImpl(this.client, jobResponse.getMasterObjectList()); }

Target:
public Ds3ClientHelpers.Job recoverWriteJob(final UUID jobId) throws SignatureException, IOException, XmlProcessingException, JobRecoveryException { final ModifyJobResponse jobResponse = this.client.modifyJob(new ModifyJobRequest(jobId)); if (RequestType.PUT != jobResponse.getMasterObjectList().getRequestType()){ throw new JobRecoveryException(RequestType.PUT.toString(), jobResponse.getMasterObjectList().getRequestType().toString() ); } return new WriteJobImpl(this.client, jobResponse.getMasterObjectList()); }
Source:
public void run(ExtendedHiveMetastore metastore) { try { metastore.createTable(table, privileges); done = true; } catch (Throwable t) { try { Optional<Table> remoteTable = metastore.getTable(table.getDatabaseName(), table.getTableName()); if (remoteTable.isPresent() && getPrestoQueryId(remoteTable.get()).equals(getPrestoQueryId(table))) { done = true; } } catch (Throwable ignored) { } if (!done) { throw t; } } }

Target:
public void run(ExtendedHiveMetastore metastore) { try { metastore.createTable(table, privileges); done = true; } catch (RuntimeException e) { try { Optional<Table> remoteTable = metastore.getTable(table.getDatabaseName(), table.getTableName()); if (remoteTable.isPresent() && getPrestoQueryId(remoteTable.get()).equals(getPrestoQueryId(table))) { done = true; } } catch (RuntimeException ignored) { } if (!done) { throw e; } } }
Source:
private synchronized void loadConfigs() { try (InputStream is = settingsFacade.getRawConfig(CONFIG_FILE_NAME)) { String jsonText = IOUtils.toString(is); LOGGER.debug("Loading {}", CONFIG_FILE_NAME); Gson gson = new Gson(); configs = gson.fromJson(jsonText, Configs.class); } catch (Exception e) { String message = String.format("There seems to be a problem with the json text in %s: %s", CONFIG_FILE_NAME, e.getMessage()); LOGGER.debug(message); throw new JsonIOException(message, e); } for (Config config : configs.getConfigList()) { configMap.put(config.getName(), config); } defaultConfig = configs.getDefaultConfig(); }

Target:
private synchronized void loadConfigs() { try (InputStream is = settingsFacade.getRawConfig(CONFIG_FILE_NAME)) { String jsonText = IOUtils.toString(is); LOGGER.debug("Loading {}", CONFIG_FILE_NAME); Gson gson = new Gson(); configs = gson.fromJson(jsonText, Configs.class); } catch (Exception e) { String message = String.format("There seems to be a problem with the json text in %s: %s", CONFIG_FILE_NAME, e.getMessage()); LOGGER.debug(message); throw new JsonIOException(message, e); } configMap = new HashMap<>(); for (Config config : configs.getConfigList()) { configMap.put(config.getName(), config); } defaultConfig = configs.getDefaultConfig(); }
Source:
public String getLayerConfigPath(String layer, String configFileName) throws Exception { LayerInfo layerInfo = catalog.getLayerByName(layer); String layerDirectory = dataDirectory.get(layerInfo).dir().getAbsolutePath(); String layerConfigFilePath = layerDirectory + "/" + configFileName; if (new File(layerConfigFilePath).exists()) { return layerConfigFilePath.replace(this.resourceDirectory.getAbsolutePath().toString()+"/",""); } File storeDirectory = dataDirectory.findStoreDir(layerInfo.getResource().getStore()); String storeConfigFilePath = storeDirectory.toString() + "/" + configFileName; if (new File(storeConfigFilePath).exists()) { return storeConfigFilePath.replace(this.resourceDirectory.getAbsolutePath().toString()+"/",""); } throw new Exception("Unable to find config file for layer " + layer); }

Target:
public String getLayerConfigPath(String layer, String configFileName) throws Exception { LayerInfo layerInfo = catalog.getLayerByName(layer); String layerDirectory = dataDirectory.get(layerInfo).dir().getAbsolutePath(); String layerConfigFilePath = layerDirectory + "/" + configFileName; if (new File(layerConfigFilePath).exists()) { return layerConfigFilePath.replace(this.resourceDirectory.getAbsolutePath().toString()+"/",""); } File storeDirectory = dataDirectory.findStoreDir(layerInfo.getResource().getStore()); String storeConfigFilePath = storeDirectory.toString() + "/" + configFileName; if (new File(storeConfigFilePath).exists()) { return storeConfigFilePath.replace(this.resourceDirectory.getAbsolutePath().toString()+"/",""); } return getDefaultConfigFile(); }
Source:
public static void postProblem(String email, String location, String room, String problem, String description, String photo, Callback<Response> callback) { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("<LINK_0>") .build(); MitFacilityService service = restAdapter.create(MitFacilityService.class); service._post_problem(email, location, room, problem, description, photo, callback); }

Target:
public static void postProblem(String email, String location, String room, String problem, String description, String photo, Callback<Response> callback) { MIT_FACILITY_SERVICE._post_problem(email, location, room, problem, description, photo, callback); }
Source:
protected IPath getCompilationPath(ISourceContainer[] containers, String sourceName) { for (ISourceContainer container : containers) { if (container instanceof IMappingSourceContainer) { if (container instanceof MappingSourceContainer && ((MappingSourceContainer) container).isMappingWithBackendEnabled()) { return null; } return ((IMappingSourceContainer) container).getCompilationPath(sourceName); } ISourceContainer[] childContainers = null; try { childContainers = container.getSourceContainers(); } catch (CoreException e) { } if (childContainers != null) { IPath path = getCompilationPath(childContainers, sourceName); if (path != null) { return path; } } } return null; }

Target:
protected IPath getCompilationPath(ISourceContainer[] containers, String sourceName) { for (ISourceContainer container : containers) { if (container instanceof IMappingSourceContainer) { if (container instanceof MappingSourceContainer && ((MappingSourceContainer) container).isMappingWithBackendEnabled()) { } else { IPath path = ((IMappingSourceContainer) container).getCompilationPath(sourceName); if (path != null) { return path; } } } else if (container.isComposite()) { ISourceContainer[] childContainers = null; try { childContainers = container.getSourceContainers(); } catch (CoreException e) { } if (childContainers != null) { IPath path = getCompilationPath(childContainers, sourceName); if (path != null) { return path; } } } } return null; }
Source:
public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } completedPositions += batchSize; long filePosition = recordReader.getFilePosition(); Optional<BitSet> rowsDeleted = deltaShardLoader.get(); RowsToKeepResult rowsToKeep = loadRowsToKeep(rowsDeleted, batchSize, filePosition); Block[] blocks = new Block[columnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, rowsToKeep.isKeepAll ? batchSize : rowsToKeep.size()); } else if (columnIndexes[fieldId] == ROWID_COLUMN) { blocks[fieldId] = buildSequenceBlock(filePosition, batchSize, rowsToKeep); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(columnIndexes[fieldId], rowsToKeep)); } } return new Page(rowsToKeep.isKeepAll ? batchSize : rowsToKeep.size(), blocks); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(RAPTOR_ERROR, e); } }

Target:
public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } completedPositions += batchSize; long filePosition = recordReader.getFilePosition(); RowsToKeepResult rowsToKeep = deltaShardLoader.getRowsToKeep(batchSize, filePosition); Block[] blocks = new Block[columnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, rowsToKeep.keepAll() ? batchSize : rowsToKeep.size()); } else if (columnIndexes[fieldId] == ROWID_COLUMN) { blocks[fieldId] = buildSequenceBlock(filePosition, batchSize, rowsToKeep); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(columnIndexes[fieldId], rowsToKeep)); } } return new Page(rowsToKeep.keepAll() ? batchSize : rowsToKeep.size(), blocks); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(RAPTOR_ERROR, e); } }
Source:
public void test() { connect(); click(findButtonByContent("setWidth(\"300px\")")); waitResponse(); Assert.assertEquals(getToolbarChildrenLength(), 2); JQuery overflowButton = jq(".z-toolbar-overflow > .z-icon-ellipsis-v"); Assert.assertTrue(overflowButton.isVisible()); click(overflowButton); waitResponse(); Assert.assertEquals(getPopupChildrenLength(), 4); click(findButtonByContent("setWidth(\"500px\")")); waitResponse(); Assert.assertEquals(getToolbarChildrenLength(), 4); click(overflowButton); waitResponse(); Assert.assertEquals(getPopupChildrenLength(), 2); click(findButtonByContent("setWidth(\"700px\")")); waitResponse(); Assert.assertEquals(getToolbarChildrenLength(), 6); Assert.assertFalse(overflowButton.isVisible()); }

Target:
public void test() { driver = connect(); JQuery overflowButton = jq(".z-toolbar-overflowpopup-button"); click(jq("$setWidth200")); waitResponse(); Assert.assertTrue(overflowButton.isVisible()); click(overflowButton); waitResponse(); Assert.assertTrue(getNumberOfPopupChildren() > 0); Assert.assertEquals(6, getNumberOfToolbarChildren() + getNumberOfPopupChildren()); click(jq("$resetWidth")); waitResponse(); driver.manage().window().maximize(); waitResponse(); Assert.assertFalse(overflowButton.isVisible()); Assert.assertEquals(6, getNumberOfToolbarChildren()); }
Source:
public static boolean convertSegment(File toConvert, File converted, IndexSpec indexSpec, boolean forceIfCurrent) throws IOException { final int version = SegmentUtils.getVersionFromDir(toConvert); switch (version) { case 1: case 2: case 3: log.makeAlert("Attempt to load segment of version <= 3.") .addData("version", version) .emit(); return false; case 4: case 5: case 6: case 7: log.info("Old version, re-persisting."); IndexMerger.append( Arrays.<IndexableAdapter>asList(new QueryableIndexIndexableAdapter(loadIndex(toConvert))), converted, indexSpec ); return true; case 8: DefaultIndexIOHandler.convertV8toV9(toConvert, converted, indexSpec); return true; default: if(forceIfCurrent){ IndexMerger.reprocess(toConvert, converted, indexSpec); DefaultIndexIOHandler.validateTwoSegments(toConvert, converted); return true; } else { log.info("Version[%s], skipping.", version); return false; } } }

Target:
public static boolean convertSegment(File toConvert, File converted, IndexSpec indexSpec, boolean forceIfCurrent) throws IOException { final int version = SegmentUtils.getVersionFromDir(toConvert); switch (version) { case 1: case 2: case 3: log.makeAlert("Attempt to load segment of version <= 3.") .addData("version", version) .emit(); return false; case 4: case 5: case 6: case 7: log.info("Old version, re-persisting."); IndexMerger.append( Arrays.<IndexableAdapter>asList(new QueryableIndexIndexableAdapter(loadIndex(toConvert))), converted, indexSpec ); return true; case 8: DefaultIndexIOHandler.convertV8toV9(toConvert, converted, indexSpec); return true; default: if (forceIfCurrent) { IndexMaker.convert(toConvert, converted, indexSpec); DefaultIndexIOHandler.validateTwoSegments(toConvert, converted); return true; } else { log.info("Version[%s], skipping.", version); return false; } } }
Source:
public synchronized void removeMatching(MetricFilter filter) { for (String name : getNames()) { if (filter.matches(name, metrics.get(name))) remove(name); } }

Target:
public void removeMatching(MetricFilter filter) { Iterator<String> namesIterator = metrics.keySet().iterator(); while (namesIterator.hasNext()) { String name = namesIterator.next(); Metric metric = metrics.get(name); if (metric != null && filter.matches(name, metric)) { namesIterator.remove(); onMetricRemoved(name, metric); } } }
Source:
FilterSupportStatus isTypedFilterSupported(FilterContext context, ColumnRangeFilter filter) { int familyCount = context.getScan().getFamilyMap().size(); if (familyCount != 1) { return FilterSupportStatus.newNotSupported(UNSUPPORTED_EXCEPTION_MESSAGE); } return FilterSupportStatus.SUPPORTED; }

Target:
FilterSupportStatus isTypedFilterSupported(FilterContext context, ColumnRangeFilter filter) { int familyCount = context.getScan().numFamilies(); if (familyCount != 1) { return FilterSupportStatus.newNotSupported(UNSUPPORTED_EXCEPTION_MESSAGE); } return FilterSupportStatus.SUPPORTED; }
Source:
@Override protected void readExternalData( byte protoVer, ObjectInput in ) throws IOException, ClassNotFoundException { partRes = readMap(in); if (protoVer >= V2) idxRes = readMap(in); if (protoVer >= V3) integrityCheckFailures = readCollection(in); if (protoVer >= V4) checkSizeRes = readMap(in); }

Target:
@Override protected void readExternalData( byte protoVer, ObjectInput in ) throws IOException, ClassNotFoundException { partRes = readMap(in); idxRes = readMap(in); integrityCheckFailures = readCollection(in); checkSizeRes = readMap(in); }
Source:
public void connect(SocketAddress endpoint, int timeout) throws IOException { long startedAt = System.currentTimeMillis(); timeout = Math.max(timeout, 10_000); while (true) { try { channel = new AsynchronousFileByteChannel( AsynchronousFileChannel.open( Paths.get(socketFileName), StandardOpenOption.READ, StandardOpenOption.WRITE ) ); break; } catch (FileNotFoundException e) { if (System.currentTimeMillis() - startedAt >= timeout) { throw new RuntimeException(e); } else { Kernel32.INSTANCE.WaitNamedPipe(socketFileName, 100); } } } }

Target:
public void connect(SocketAddress endpoint, int timeout) throws IOException { long startedAt = System.currentTimeMillis(); timeout = Math.max(timeout, 10_000); while (true) { try { channel = new AsynchronousFileByteChannel( AsynchronousFileChannel.open( Paths.get(socketFileName), StandardOpenOption.READ, StandardOpenOption.WRITE ) ); break; } catch (NoSuchFileException e) { if (System.currentTimeMillis() - startedAt >= timeout) { throw new RuntimeException(e); } else { Kernel32.INSTANCE.WaitNamedPipe(socketFileName, 100); } } } }
Source:
private int numMethodsRelatedByAttributeAccess(Map<String, Set<String>> usagesByMethod) { List<String> methods = new ArrayList<>(usagesByMethod.keySet()); int methodCount = methods.size(); int pairs = 0; if (methodCount > 1) { for (int i = 0; i < methodCount; i++) { for (int j = i + 1; j < methodCount; j++) { String firstMethodName = methods.get(i); String secondMethodName = methods.get(j); if (!Collections.disjoint(usagesByMethod.get(firstMethodName), usagesByMethod.get(secondMethodName))) { pairs++; } } } } return pairs; }

Target:
private int numMethodsRelatedByAttributeAccess(Map<String, Set<String>> usagesByMethod) { List<String> methods = new ArrayList<>(usagesByMethod.keySet()); int methodCount = methods.size(); int pairs = 0; if (methodCount > 1) { for (int i = 0; i < methodCount - 1; i++) { for (int j = i + 1; j < methodCount; j++) { String firstMethodName = methods.get(i); String secondMethodName = methods.get(j); if (!Collections.disjoint(usagesByMethod.get(firstMethodName), usagesByMethod.get(secondMethodName))) { pairs++; } } } } return pairs; }
Source:
public static synchronized CacheManager get(AlluxioConfiguration conf) throws IOException { if (sCacheManager == null) { try { sCacheManager = Optional.of(create(conf)); } catch (IOException e) { sCacheManager = Optional.empty(); throw e; } } return sCacheManager.orElse(null); }

Target:
public static synchronized CacheManager get(AlluxioConfiguration conf) throws IOException { if (sCacheManager == null) { sCacheManager = create(conf); } return sCacheManager; }
Source:
public IdentityHashMap<TableScanNode, Void> visitTableScan(TableScanNode node, Void context) { IdentityHashMap<TableScanNode, Void> ret = new IdentityHashMap<>(); ret.put(node, null); return ret; }

Target:
public Map<TableScanNode, Void> visitTableScan(TableScanNode node, Void context) { Map<TableScanNode, Void> ret = new IdentityHashMap<>(); ret.put(node, null); return ret; }
Source:
public int getLaunchTimeoutInMillis() { return launchTimeout * 1000; }

Target:
public long getLaunchTimeoutInMillis() { return (long)launchTimeout * 1000L; }
Source:
public synchronized void close() throws IOException { if (m_closed) { return; } m_closed = true; for (ReadCursor cursor : m_readCursors.values()) { cursor.close(); } m_readCursors.clear(); for (PBDSegment segment : m_segments.values()) { segment.close(); } m_cursorsWriter.close(); m_closed = true; }

Target:
public synchronized void close() throws IOException { if (m_closed) { return; } m_readCursors.clear(); for (PBDSegment segment : m_segments.values()) { segment.close(); } m_cursorsWriter.close(); m_closed = true; }
Source:
public void readsManyChunks() throws IOException { final String first = "Takes is"; final String second = "a true object-"; final String third = "oriented framework"; final String data = first + second + third; final Integer length = data.length(); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=2", "Host: b.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( Integer.toHexString(first.length()), first, Integer.toHexString(second.length()), second, Integer.toHexString(third.length()), third, END_OF_CHUNK ) ) ).body(); final byte[] buf = new byte[length]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(length) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }

Target:
public void readsManyChunks() throws IOException { final String first = "Takes is"; final String second = "a true object-"; final String third = "oriented framework"; final String data = first + second + third; final Integer length = data.length(); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=2", "Host: b.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( Integer.toHexString(first.length()), first, Integer.toHexString(second.length()), second, Integer.toHexString(third.length()), third, END_OF_CHUNK, "" ) ) ).body(); final byte[] buf = new byte[length]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(length) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }
Source:
public Void call() throws Exception { final ClusterNodeManager clusterNodeManager = this.clusterContext.nodeManagers.get(this.nodeName); if (clusterNodeManager == null) { logger.debug("Cannot create EJBReceiver since no cluster node manager found for node " + nodeName + " in cluster context for cluster " + clusterName); return null; } final EJBReceiver ejbReceiver = clusterNodeManager.getEJBReceiver(); if (ejbReceiver == null) { return null; } this.clusterContext.registerEJBReceiver(ejbReceiver); return null; }

Target:
public Void call() throws Exception { final ClusterNodeManager clusterNodeManager = this.clusterContext.nodeManagers.get(this.nodeName); if (clusterNodeManager == null) { logger.debugf("Cannot create EJBReceiver since no cluster node manager found for node %s in cluster context for cluster %s", nodeName, clusterName); return null; } final EJBReceiver ejbReceiver = clusterNodeManager.getEJBReceiver(); if (ejbReceiver == null) { return null; } this.clusterContext.registerEJBReceiver(ejbReceiver); return null; }
Source:
public void init() { asyncExec.init(); EventDispatcherDescriptor dispatcherDescriptor = dispatchers.getDispatcherDescriptor(); if (dispatcherDescriptor != null) { List<EventPipeDescriptor> pipes = registeredPipes.getPipes(); if (pipes.size() > 0) { pipeDispatcher = dispatcherDescriptor.getInstance(); pipeDispatcher.init(pipes, dispatcherDescriptor.getParameters()); } } }

Target:
public void init() { asyncExec.init(); EventDispatcherDescriptor dispatcherDescriptor = dispatchers.getDispatcherDescriptor(); if (dispatcherDescriptor != null) { List<EventPipeDescriptor> pipes = registeredPipes.getPipes(); if (!pipes.isEmpty()) { pipeDispatcher = dispatcherDescriptor.getInstance(); pipeDispatcher.init(pipes, dispatcherDescriptor.getParameters()); } } }
Source:
public void testStatsManagerWithProblematicStores() throws StoreException, IOException { Map<PartitionId, Store> problematicStoreMap = new HashMap<>(); problematicStoreMap.put(getTestPartitionId(1), null); problematicStoreMap.put(getTestPartitionId(2), new MockBlobStore(new MockBlobStoreStats(null, true))); StatsManager testStatsManager = new StatsManager(new MockStorageManager(problematicStoreMap), new ArrayList<>(storeMap.keySet()), new MetricRegistry(), config, new MockTime()); ; List<String> unreachableStores = new ArrayList<>(); StatsSnapshot actualSnapshot = new StatsSnapshot(0L, null); for (PartitionId partitionId : problematicStoreMap.keySet()) { testStatsManager.collectAndAggregate(actualSnapshot, partitionId, unreachableStores); } assertEquals("Aggregated StatsSnapshot should not contain any value", 0L, actualSnapshot.getValue().longValue()); assertEquals("Unreachable store count mismatch with expected value", 2, unreachableStores.size()); }

Target:
public void testStatsManagerWithProblematicStores() throws StoreException, IOException { Map<PartitionId, Store> problematicStoreMap = new HashMap<>(); problematicStoreMap.put(new Partition(1, PartitionState.READ_WRITE, CAPACITY), null); Store exceptionStore = new MockBlobStore(new MockBlobStoreStats(null, true)); problematicStoreMap.put(new Partition(2, PartitionState.READ_WRITE, CAPACITY), exceptionStore); StatsManager testStatsManager = new StatsManager(new MockStorageManager(problematicStoreMap), new ArrayList<>(problematicStoreMap.keySet()), new MetricRegistry(), config, new MockTime()); List<String> unreachableStores = new ArrayList<>(); StatsSnapshot actualSnapshot = new StatsSnapshot(0L, null); for (PartitionId partitionId : problematicStoreMap.keySet()) { testStatsManager.collectAndAggregate(actualSnapshot, partitionId, unreachableStores); } assertEquals("Aggregated StatsSnapshot should not contain any value", 0L, actualSnapshot.getValue().longValue()); assertEquals("Unreachable store count mismatch with expected value", 2, unreachableStores.size()); Map<PartitionId, Store> mixedStoreMap = new HashMap<>(storeMap); unreachableStores.clear(); mixedStoreMap.put(new Partition(3, PartitionState.READ_WRITE, CAPACITY), null); mixedStoreMap.put(new Partition(4, PartitionState.READ_WRITE, CAPACITY), exceptionStore); testStatsManager = new StatsManager(new MockStorageManager(mixedStoreMap), new ArrayList<>(mixedStoreMap.keySet()), new MetricRegistry(), config, new MockTime()); actualSnapshot = new StatsSnapshot(0L, null); for (PartitionId partitionId : mixedStoreMap.keySet()) { testStatsManager.collectAndAggregate(actualSnapshot, partitionId, unreachableStores); } assertTrue("Actual aggregated StatsSnapshot does not match with expected snapshot", preAggregatedSnapshot.equals(actualSnapshot)); assertEquals("Unreachable store count mismatch with expected value", 2, unreachableStores.size()); }
Source:
public static void setEventIndexName(String eventIndexName) { ElasticFlowRepository.eventIndexName = eventIndexName; }

Target:
public void setEventIndexName(String eventIndexName) { Objects.requireNonNull(eventIndexName); this.eventIndexName = eventIndexName; }
Source:
public void shouldWrapConnectorException() throws Exception { when(gerritConnector.listFiles()).thenThrow(new IOException("Connection refused")); catchException(fixture).listFiles(); assertThat(caughtException()).isInstanceOf(GerritException.class); assertThat(caughtException()).hasMessageContaining("Error listing files"); }

Target:
public void shouldWrapConnectorException() throws Exception { when(gerritConnector.listFiles()).thenThrow(new IOException("Connection refused")); catchException(fixture).listFiles(); assertThat(caughtException()) .isInstanceOf(GerritException.class) .hasMessageContaining("Error listing files"); }
Source:
public ListenableFuture<Optional<LabelMeta>> getLabelMeta(final LabelType type, final LabelId id) { return transform(labelClient.getLabelName(type, id), new AsyncFunction<Optional<String>, Optional<LabelMeta>>() { @Override public ListenableFuture<Optional<LabelMeta>> apply(final Optional<String> name) throws Exception { if (name.isPresent()) { return store.getMeta(id, type); } return immediateFailedFuture(new LabelException(id, type, "Could not find label meta information for id " + id + " and " + type)); } }); }

Target:
public ListenableFuture<Optional<LabelMeta>> getLabelMeta(final LabelType type, final LabelId id) { return store.getMeta(id, type); }