auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); Group parentGroup = new Group(); background = new SingleSprite("background"); parentGroup.addActor(background.look); penActorSprite = new SingleSprite("penActor"); parentGroup.addActor(penActorSprite.look); project.getDefaultScene().addSprite(penActorSprite); embroideryActorSprite = new SingleSprite("embroideryActor"); parentGroup.addActor(embroideryActorSprite.look); project.getDefaultScene().addSprite(embroideryActorSprite); realSprite = new SingleSprite("testSprite"); parentGroup.addActor(realSprite.look); project.getDefaultScene().addSprite(realSprite); ProjectManager.getInstance().setProject(project); }

Target:
public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); background = new SingleSprite("background"); penActorSprite = new SingleSprite("penActor"); embroideryActorSprite = new SingleSprite("embroideryActor"); realSprite = new SingleSprite("testSprite"); project.getDefaultScene().addSprite(penActorSprite); project.getDefaultScene().addSprite(embroideryActorSprite); project.getDefaultScene().addSprite(realSprite); Group parentGroup = new Group(); parentGroup.addActor(background.look); parentGroup.addActor(penActorSprite.look); parentGroup.addActor(embroideryActorSprite.look); parentGroup.addActor(realSprite.look); ProjectManager.getInstance().setProject(project); }
Source:
public Void call() throws IOException { Engine e = Engine.current(); if (e == null) { return null; } try { Engine.class.getMethod("setNoReconnect", boolean.class); } catch (NoSuchMethodException ex) { return null; } e.setNoReconnect(true); LOGGER.log(Level.INFO, "Disabled slave engine reconnects."); return null; }

Target:
public Void call() throws IOException { Engine e = Engine.current(); if (e == null) { return null; } e.setNoReconnect(true); LOGGER.log(Level.INFO, "Disabled slave engine reconnects."); return null; }
Source:
private InputStream getFileInputStream(File file) throws AudioException { if (file == null) { throw new IllegalArgumentException("file must not be null"); } if (file.exists()) { this.length = file.length(); try { return new FileInputStream(file); } catch (FileNotFoundException e) { throw new AudioException("Cannot open temporary audio file '" + file.getName() + "."); } } else { throw new AudioException("Temporary file '" + file.getName() + "' not found!"); } }

Target:
private InputStream getFileInputStream(File file) throws AudioException { if (file == null) { throw new IllegalArgumentException("file must not be null"); } if (file.exists()) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { throw new AudioException("Cannot open temporary audio file '" + file.getName() + "."); } } else { throw new AudioException("Temporary file '" + file.getName() + "' not found!"); } }
Source:
public void extractFulltextTest() throws Exception { try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { BufferedWriter writeFile = new BufferedWriter(new FileWriter(file)); writeFile.write(testText); writeFile.close(); } String filePath = file.getAbsolutePath().toString(); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryChecksum))) .thenReturn("1234"); when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(filePath); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("plain/text"); binary = mock(BinaryObject.class); parent = mock(FileObject.class); when(repository.getBinary(any(PID.class))).thenReturn(binary); when(binary.getParent()).thenReturn(parent); processor.process(exchange); ArgumentCaptor<InputStream> requestCaptor = ArgumentCaptor.forClass(InputStream.class); verify(parent).addDerivative(eq(slug), requestCaptor.capture(), eq(fileName), eq("plain/text"), eq(PcdmUse.ExtractedText)); InputStream request = requestCaptor.getValue(); String extractedText = new BufferedReader(new InputStreamReader(request)) .lines().collect(Collectors.joining("\n")); assertEquals(testText, extractedText); }

Target:
public void extractFulltextTest() throws Exception { try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write(testText); } String filePath = file.getAbsolutePath().toString(); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryChecksum))) .thenReturn("1234"); when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(filePath); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("plain/text"); binary = mock(BinaryObject.class); parent = mock(FileObject.class); when(repository.getBinary(any(PID.class))).thenReturn(binary); when(binary.getParent()).thenReturn(parent); processor.process(exchange); ArgumentCaptor<InputStream> requestCaptor = ArgumentCaptor.forClass(InputStream.class); verify(parent).addDerivative(eq(slug), requestCaptor.capture(), eq(fileName), eq("plain/text"), eq(PcdmUse.ExtractedText)); InputStream request = requestCaptor.getValue(); String extractedText = new BufferedReader(new InputStreamReader(request)) .lines().collect(Collectors.joining("\n")); assertEquals(testText, extractedText); }
Source:
public boolean onTune(Uri channelUri) { synchronized (sLock) { if (sRating != null) { notifyContentBlocked(sRating); } if (sTuneCallback != null) { sTuneCallback.post(); sTuneCallback = null; } if (sRating == null) { notifyContentAllowed(); } } notifyVideoAvailable(); notifyTracksChanged(mTracks); notifyTrackSelected(TvTrackInfo.TYPE_AUDIO, sEngAudioTrack.getId()); notifyTrackSelected(TvTrackInfo.TYPE_SUBTITLE, null); if (sOverlayViewSizeChangedCallback != null) { notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, sDummyVideoTrack.getId()); } notifyTimeShiftStatusChanged(TvInputManager.TIME_SHIFT_STATUS_AVAILABLE); mRecordStartTimeMs = mCurrentPositionMs = mLastCurrentPositionUpdateTimeMs = System.currentTimeMillis(); mPausedTimeMs = 0; mHandler.sendEmptyMessageDelayed(MSG_SEEK, SEEK_DELAY_MS); mSpeed = 1; return true; }

Target:
public boolean onTune(Uri channelUri) { synchronized (sLock) { if (sRating != null) { notifyContentBlocked(sRating); } if (sTuneCallback != null) { sTuneCallback.post(); sTuneCallback = null; } if (sRating == null) { notifyContentAllowed(); } } notifyVideoAvailable(); notifyTracksChanged(mTracks); notifyTrackSelected(TvTrackInfo.TYPE_AUDIO, sEngAudioTrack.getId()); notifyTrackSelected(TvTrackInfo.TYPE_SUBTITLE, null); notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, sDummyVideoTrack.getId()); notifyTimeShiftStatusChanged(TvInputManager.TIME_SHIFT_STATUS_AVAILABLE); mRecordStartTimeMs = mCurrentPositionMs = mLastCurrentPositionUpdateTimeMs = System.currentTimeMillis(); mPausedTimeMs = 0; mHandler.sendEmptyMessageDelayed(MSG_SEEK, SEEK_DELAY_MS); mSpeed = 1; return true; }
Source:
public void jsr107LoaderGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheLoader<Object, Object> mock = mock(CacheLoader.class); RecordingFactory<CacheLoader<Object, Object>> factory = factoryOf(mock); configuration.setReadThrough(true).setCacheLoaderFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>any()); }

Target:
public void jsr107LoaderGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheLoader<Object, Object> mock = mock(CacheLoader.class); RecordingFactory<CacheLoader<Object, Object>> factory = factoryOf(mock); configuration.setReadThrough(true).setCacheLoaderFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>isNotNull()); }
Source:
public void ping(){ if(selectedEndpoint != null) { boolean status = pingService.ping(selectedEndpoint.getServiceUrl()); Date timestamp = new Date(); EndpointManagerCache.getInstance().addOrUpdateEndPoint(selectedEndpoint.getServiceUrl(), timestamp, status); } }

Target:
public void ping() { if (selectedEndpoint != null) { boolean status = pingService.ping(selectedEndpoint.getServiceUrl()); EndpointManagerCache.getInstance().addOrUpdateEndpoint(selectedEndpoint.getServiceUrl(), new Date(), status); } }
Source:
protected void applyChanges(IndexFamily to, IndexFamily from) throws IOException { to.setName(from.getName()); to.setFake(from.hasFakeSequence()); to.setUniqueDualIndex(from.isUniqueDualIndex()); to.setArchived(from.getArchived()); }

Target:
protected void applyChanges(IndexFamily to, IndexFamily from) throws IOException { to.setName(from.getName()); to.setUniqueDualIndex(from.isUniqueDualIndex()); to.setArchived(from.getArchived()); }
Source:
public void validate(Map<String, String> attributes) throws ValidationException { String namespace = attributes.get(WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE); if (!isNullOrEmpty(namespace)) { if (namespace.length() > METADATA_NAME_MAX_LENGTH) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: must be no more than 63 characters"); } if (!METADATA_NAME_PATTERN.matcher(namespace).matches()) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: a DNS-1123 label must consist of lower case alphanumeric" + " characters or '-', and must start and end with an" + " alphanumeric character (e.g. 'my-name', or '123-abc', regex used for" + " validation is '" + METADATA_NAME_REGEX + "')"); } if (!EnvironmentContext.getCurrent().getSubject().isAnonymous()) { namespaceFactoryProvider.get().checkIfNamespaceIsAllowed(namespace); } } }

Target:
public void validate(Map<String, String> attributes) throws ValidationException { String namespace = attributes.get(WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE); if (!isNullOrEmpty(namespace)) { if (namespace.length() > METADATA_NAME_MAX_LENGTH) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: must be no more than 63 characters"); } if (!METADATA_NAME_PATTERN.matcher(namespace).matches()) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: a DNS-1123 label must consist of lower case alphanumeric" + " characters or '-', and must start and end with an" + " alphanumeric character (e.g. 'my-name', or '123-abc', regex used for" + " validation is '" + METADATA_NAME_REGEX + "')"); } namespaceFactoryProvider.get().checkIfNamespaceIsAllowed(namespace); } }
Source:
public void map(String key, WebPage page, Context context) throws IOException, InterruptedException { ParseStatus pstatus = page.getParseStatus(); if (pstatus == null || !ParseStatusUtils.isSuccess(pstatus) || pstatus.getMinorCode() == ParseStatusCodes.SUCCESS_REDIRECT) { return; } Utf8 mark = Mark.UPDATEDB_MARK.checkMark(page); if (mark == null) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping " + TableUtil.unreverseUrl(key) + "; not updated on db yet"); } return; } if (deduplicate) { Duplicate duplicate = duplicateStore.get( new String(page.getSignature().array())); if (!indexUtil.isOriginal(TableUtil.unreverseUrl(key), duplicate.getUrls())) { return; } else { StringBuilder duplicates = new StringBuilder(""); for (CharSequence url : duplicate.getUrls()) { String duplicateKey = TableUtil.reverseUrl(url.toString()); if (!key.equals(duplicateKey)) { duplicates.append(url); duplicates.append(Nutch.DUPLICATE_URLS_SPLITTER); writers.delete(duplicateKey); } } page.getMetadata().put(Nutch.DUPLICATE_URLS_KEY, ByteBuffer.wrap(duplicates.toString().getBytes())); } } NutchDocument doc = indexUtil.index(key, page); if (doc == null) { return; } if (mark != null) { Mark.INDEX_MARK.putMark(page, Mark.UPDATEDB_MARK.checkMark(page)); store.put(key, page); } context.write(key, doc); context.getCounter("IndexerJob", "DocumentCount").increment(1); }

Target:
public void map(String key, WebPage page, Context context) throws IOException, InterruptedException { ParseStatus pstatus = page.getParseStatus(); if (pstatus == null || !ParseStatusUtils.isSuccess(pstatus) || pstatus.getMinorCode() == ParseStatusCodes.SUCCESS_REDIRECT) { return; } Utf8 mark = Mark.UPDATEDB_MARK.checkMark(page); String url = TableUtil.unreverseUrl(key); if (mark == null) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping " + url + "; not updated on db yet"); } return; } if (deduplicate) { Duplicate duplicate = duplicateStore.get( new String(page.getSignature().array())); if (duplicate != null) { if (duplicate.getOriginal() != null && !duplicate.getOriginal().toString().equals(url)) { return; } else { StringBuilder duplicates = new StringBuilder(""); for (CharSequence duplicateUrl : duplicate.getUrls()) { String duplicateKey = TableUtil.reverseUrl(duplicateUrl.toString()); if (!key.equals(duplicateKey)) { duplicates.append(duplicateUrl); duplicates.append(Nutch.DUPLICATE_URLS_SPLITTER); writers.delete(duplicateKey); } } page.getMetadata().put(Nutch.DUPLICATE_URLS_KEY, ByteBuffer.wrap(duplicates.toString().getBytes())); } } } NutchDocument doc = indexUtil.index(key, page); if (doc == null) { return; } if (mark != null) { Mark.INDEX_MARK.putMark(page, Mark.UPDATEDB_MARK.checkMark(page)); store.put(key, page); } context.write(key, doc); context.getCounter("IndexerJob", "DocumentCount").increment(1); }
Source:
public void testSlice() throws Exception { Block block1 = readFile("test_dictionaries/string-dictionary.orc", VarcharType.VARCHAR); Block block2 = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VarcharType.VARCHAR); compare(VarcharType.VARCHAR, block1, block2); }

Target:
public void testSlice() throws Exception { Block expected = readFile("test_dictionaries/string-dictionary.orc", VARCHAR); Block actual = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VARCHAR); assertEqualBlocks(VARCHAR, expected, actual); }
Source:
public static Query buildQuery(EntityProjection entityProjection, RequestScope scope) { SQLSchema schema = new SQLSchema(entityProjection.getType(), scope.getDictionary()); AggregationDataStoreHelper agHelper = new AggregationDataStoreHelper(schema, entityProjection); FilterExpression filterExpression = entityProjection.getFilterExpression(); FilterExpression whereFilter = agHelper.getWhereFilter(filterExpression); FilterExpression havingFilter = agHelper.getHavingFilter(filterExpression); Sorting sorting = entityProjection.getSorting(); Pagination pagination = entityProjection.getPagination(); Set<Dimension> dimensions = new LinkedHashSet<>(); Set<TimeDimension> timeDimensions = new LinkedHashSet<>(); agHelper.populateDimensionList(dimensions, timeDimensions); Set<Metric> metrics = new LinkedHashSet<>(); agHelper.populateMetricList(metrics); Map<Metric, ? extends Class<? extends Aggregation>> metricClassMap = agHelper.getMetricMap(metrics); return Query.builder() .schema(schema) .metrics(metricClassMap) .groupDimensions(dimensions) .timeDimensions(timeDimensions) .whereFilter(whereFilter) .havingFilter(havingFilter) .sorting(sorting) .pagination(pagination) .scope(scope) .build(); }

Target:
public static Query buildQuery(EntityProjection entityProjection, RequestScope scope) { Schema schema = new Schema(entityProjection.getType(), scope.getDictionary()); AggregationDataStoreHelper agHelper = new AggregationDataStoreHelper(schema, entityProjection); return agHelper.getQuery(); }
Source:
public SpongeBlockStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); String args; if (statId.equals("stat.mineBlock.")) { args = Block.getBlockFromItem(item).getLocalizedName(); } else { args = new ItemStack(item).getDisplayName(); } translation = new SpongeTranslation(statId.substring(0, statId.length() - 1), args); }

Target:
public SpongeBlockStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); }
Source:
@Override public double score(Iterator<LabelPair<Double>> iter) { PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(new Comparator<Pair<Double, Double>>() { @Override public int compare(Pair<Double, Double> o1, Pair<Double, Double> o2) { if (o1.getKey() < o2.getKey()) return -1; if (o1.getKey() > o2.getKey()) return 1; return 0; } }); long pos = 0; long neg = 0; while (iter.hasNext()) { LabelPair<Double> e = iter.next(); Double prediction = e.getPrediction(); Double truth = e.getTruth(); queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } return calculateROCAUC(queue, pos, neg, positiveClsLb); }

Target:
@Override public double score(Iterator<LabelPair<Double>> iter) { PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey)); long pos = 0; long neg = 0; while (iter.hasNext()) { LabelPair<Double> e = iter.next(); Double prediction = e.getPrediction(); Double truth = e.getTruth(); queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } return calculateROCAUC(queue, pos, neg, positiveClsLb); }
Source:
public void update() { if (!getWorld().isRemote) { ticksExisted++; int currentInput = getWorld().getStrongPower(pos); if (previousInput == 0 && currentInput != 0) { initiateTeleport(); } previousInput = currentInput; if (ticksExisted % 100 == 0) { ItemStack focusStack = getStackInSlot(0); if (!focusStack.isEmpty()) { ItemTelepositionFocus focus = (ItemTelepositionFocus) focusStack.getItem(); Binding binding = focus.getBinding(focusStack); if (binding == null) return; SubCommandTeleposer.teleposerSet.add(this); } else SubCommandTeleposer.teleposerSet.remove(this); } } }

Target:
public void update() { if (!getWorld().isRemote) { int currentInput = getWorld().getStrongPower(pos); if (previousInput == 0 && currentInput != 0) { initiateTeleport(); } previousInput = currentInput; if (world.getTotalWorldTime() % 100 == 0) { ItemStack focusStack = getStackInSlot(0); if (!focusStack.isEmpty()) { if (((ItemTelepositionFocus) focusStack.getItem()).getBinding(focusStack) != null) SubCommandTeleposer.teleposerSet.add(this); else SubCommandTeleposer.teleposerSet.remove(this); } else SubCommandTeleposer.teleposerSet.remove(this); } } }
Source:
public void testEmbeddedLuceneQueryExecution() throws Exception { QueryFactory queryFactory = Search.getQueryFactory(cache); Query cacheQuery = queryFactory.create(String.format("From %s where name = 'John1'", UserHS.class.getName())); final int loops = 100000; final long startTs = System.nanoTime(); for (int i = 0; i < loops; i++) { List<User> list = cacheQuery.list(); assertEquals(1, list.size()); assertEquals("John1", list.get(0).getName()); } final long duration = (System.nanoTime() - startTs) / loops; System.out.printf("Embedded HS execution took %d us per query\n", TimeUnit.NANOSECONDS.toMicros(duration)); }

Target:
public void testEmbeddedLuceneQueryExecution() throws Exception { final int loops = 100000; final long startTs = System.nanoTime(); for (int i = 0; i < loops; i++) { QueryFactory queryFactory = Search.getQueryFactory(cache); Query cacheQuery = queryFactory.create(String.format("From %s where name = 'John1'", UserHS.class.getName())); List<User> list = cacheQuery.list(); assertEquals(1, list.size()); assertEquals("John1", list.get(0).getName()); } final long duration = (System.nanoTime() - startTs) / loops; System.out.printf("Embedded HS execution took %d us per query\n", TimeUnit.NANOSECONDS.toMicros(duration)); }
Source:
private Map<Set<ServerIdentity>, ModelNode> resolveCoreServiceOperations(ModelNode operation, PathAddress address, ModelNode domain, ModelNode host) { if (MANAGEMENT.equals(address.getElement(0).getValue()) && address.size() >= 2) { ModelNode op = operation.clone(); switch (address.getElement(1).getKey()) { case ACCESS: case AUDIT: op.get(OP_ADDR).set(address.toModelNode()); if (address.size() >= 3) { PathAddress newAddr = PathAddress.EMPTY_ADDRESS; for (PathElement element : address) { if (LOGGER.equals(element.getKey())) { return Collections.emptyMap(); } else { PathElement myElement = element; if (SERVER_LOGGER.equals(myElement.getKey())) { myElement = PathElement.pathElement(LOGGER, element.getValue()); } newAddr = newAddr.append(myElement); } } op.get(OP_ADDR).set(newAddr.toModelNode()); } return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); case SERVICE: if (CONFIGURATION_CHANGES.equals(address.getElement(1).getValue())) { if ("list-changes".equals(operation.get(OP).asString())) { return Collections.emptyMap(); } op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SECURITY_REALM: op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); default: return Collections.emptyMap(); } } return Collections.emptyMap(); }

Target:
private Map<Set<ServerIdentity>, ModelNode> resolveCoreServiceOperations(ModelNode operation, PathAddress address, ModelNode domain, ModelNode host) { if (MANAGEMENT.equals(address.getElement(0).getValue()) && address.size() >= 2) { ModelNode op = operation.clone(); switch (address.getElement(1).getKey()) { case ACCESS: if (AUDIT.equals(address.getElement(1).getValue())) { op.get(OP_ADDR).set(address.toModelNode()); if (address.size() >= 3) { PathAddress newAddr = PathAddress.EMPTY_ADDRESS; for (PathElement element : address) { if (LOGGER.equals(element.getKey())) { return Collections.emptyMap(); } else { PathElement myElement = element; if (SERVER_LOGGER.equals(myElement.getKey())) { myElement = PathElement.pathElement(LOGGER, element.getValue()); } newAddr = newAddr.append(myElement); } } op.get(OP_ADDR).set(newAddr.toModelNode()); } return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SERVICE: if (CONFIGURATION_CHANGES.equals(address.getElement(1).getValue())) { if ("list-changes".equals(operation.get(OP).asString())) { return Collections.emptyMap(); } op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SECURITY_REALM: op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); default: return Collections.emptyMap(); } } return Collections.emptyMap(); }
Source:
public void sendMailShouldEnqueueEmailWithRootStateAndDelayWhenSpecified() throws Exception { MailImpl mail = new MailImpl(); mail.setSender(mailAddress); mail.setRecipients(ImmutableList.of(mailAddress)); mail.setMessage(MimeMessageBuilder.defaultMimeMessage()); testee.sendMail(mail, 5, TimeUnit.MINUTES); ArgumentCaptor<Mail> mailArgumentCaptor = ArgumentCaptor.forClass(Mail.class); ArgumentCaptor<Long> delayArgumentCaptor = ArgumentCaptor.forClass(Long.class); ArgumentCaptor<TimeUnit> timeUnitArgumentCaptor = ArgumentCaptor.forClass(TimeUnit.class); verify(spoolMailQueue).enQueue(mailArgumentCaptor.capture(), delayArgumentCaptor.capture(), timeUnitArgumentCaptor.capture()); verifyNoMoreInteractions(spoolMailQueue); assertThat(mailArgumentCaptor.getValue().getState()).isEqualTo(Mail.DEFAULT); assertThat(delayArgumentCaptor.getValue()).isEqualTo(5L); assertThat(timeUnitArgumentCaptor.getValue()).isEqualTo(TimeUnit.MINUTES); }

Target:
public void sendMailShouldEnqueueEmailWithRootStateAndDelayWhenSpecified() throws Exception { MailImpl mail = new MailImpl(); mail.setSender(mailAddress); mail.setRecipients(ImmutableList.of(mailAddress)); mail.setMessage(MimeMessageBuilder.defaultMimeMessage()); testee.sendMail(mail, 5, TimeUnit.MINUTES); ArgumentCaptor<Mail> mailArgumentCaptor = ArgumentCaptor.forClass(Mail.class); ArgumentCaptor<Long> delayArgumentCaptor = ArgumentCaptor.forClass(Long.class); ArgumentCaptor<TimeUnit> timeUnitArgumentCaptor = ArgumentCaptor.forClass(TimeUnit.class); verify(spoolMailQueue).enQueue(mailArgumentCaptor.capture(), delayArgumentCaptor.capture(), timeUnitArgumentCaptor.capture()); verifyNoMoreInteractions(spoolMailQueue); softly.assertThat(mailArgumentCaptor.getValue().getState()).isEqualTo(Mail.DEFAULT); softly.assertThat(delayArgumentCaptor.getValue()).isEqualTo(5L); softly.assertThat(timeUnitArgumentCaptor.getValue()).isEqualTo(TimeUnit.MINUTES); }
Source:
void closeAttemptExceptionWillBeThrownDownTheCallStack() { FailingAutoClosableExtenstionContext failingExtensionContext = mock(FailingAutoClosableExtenstionContext.class); doCallRealMethod().when(failingExtensionContext).close(); JupiterEngineExecutionContext newContext = originalContext.extend().withExtensionContext( failingExtensionContext).build(); assertThrows(Exception.class, newContext::close); }

Target:
void closeAttemptExceptionWillBeThrownDownTheCallStack() throws Exception { ExtensionContext failingExtensionContext = mock(ExtensionContext.class, withSettings().extraInterfaces(AutoCloseable.class)); Exception expectedException = new Exception("test message"); doThrow(expectedException).when(((AutoCloseable) failingExtensionContext)).close(); JupiterEngineExecutionContext newContext = originalContext.extend() .withExtensionContext(failingExtensionContext) .build(); try { newContext.close(); fail("`close()` method did not raised an exception"); } catch (Exception actual) { assertSame(expectedException, actual); assertEquals("test message", actual.getMessage()); } }
Source:
public void postStart() { for (Map.Entry<ScopedState, Object> e : getStateCache().getAdvancedCache().entrySet()) { if (CACHE_SCOPE.equals(e.getKey().getScope())) localCreateCache(e.getKey().getName(), (CacheState) e.getValue()); } stateCacheListener = new GlobalConfigurationStateListener(this); getStateCache().addListener(stateCacheListener, new ScopeFilter(CACHE_SCOPE)); if (globalConfiguration.globalState().enabled()) { try (FileInputStream fis = new FileInputStream(getPersistentFile())) { ConfigurationBuilderHolder holder = parserRegistry.parse(fis); for (Map.Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { String name = entry.getKey(); Configuration configuration = entry.getValue().build(); createCache(name, configuration, EnumSet.of(CacheContainerAdmin.AdminFlag.PERSISTENT)); } } catch (FileNotFoundException e) { } catch (IOException e) { throw new CacheConfigurationException(e); } } }

Target:
public void postStart() { for (Map.Entry<ScopedState, Object> e : getStateCache().entrySet()) { if (CACHE_SCOPE.equals(e.getKey().getScope())) localCreateCache(e.getKey().getName(), (CacheState) e.getValue()); } GlobalConfigurationStateListener stateCacheListener = new GlobalConfigurationStateListener(this); getStateCache().addListener(stateCacheListener, new ScopeFilter(CACHE_SCOPE)); if (globalConfiguration.globalState().enabled()) { try (FileInputStream fis = new FileInputStream(getPersistentFile())) { ConfigurationBuilderHolder holder = parserRegistry.parse(fis); for (Map.Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { String name = entry.getKey(); Configuration configuration = entry.getValue().build(); createCache(name, configuration, EnumSet.of(CacheContainerAdmin.AdminFlag.PERSISTENT)); } } catch (FileNotFoundException e) { } catch (IOException e) { throw new CacheConfigurationException(e); } } }
Source:
private void addVariableToGroup() { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); if (selection.size() == 1) { final Object selectedNode = selection.getFirstElement(); if (selectedNode instanceof IPath) { final IPath currentGroup = (IPath) selectedNode; if (currentGroup != null) getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, currentGroup); } else if (selectedNode instanceof Variable) { final Variable currentVariable = (Variable) selectedNode; getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, currentVariable.getPath()); } } else { getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, new Path(VariablesTreeContentProvider.NAME_DEFAULT_VARIABLES_GROUP)); } }

Target:
private void addVariableToGroup() { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); if (selection.size() == 1) { final Object selectedNode = selection.getFirstElement(); if (selectedNode instanceof IPath) { final IPath currentGroup = (IPath) selectedNode; getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, currentGroup); } else if (selectedNode instanceof Variable) { final Variable currentVariable = (Variable) selectedNode; getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, currentVariable.getPath()); } } else { getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, Path.ROOT); } }
Source:
private void requestLocationUpdates() { mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Set<String> mProviders = GeoUtils.evaluateProviders(mLocationManager); for (String provider : mProviders) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { if (location == null) { Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider); this.location = toGeoPointData(lastKnownLocation); Log.i("HereFunctionHandler", "last known location: " + this.location.getDisplayText()); } mLocationManager.requestLocationUpdates(provider, 0, 0, this, Looper.getMainLooper()); } } locationUpdatesRequested = true; }

Target:
public void requestLocationUpdates() { mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Set<String> mProviders = GeoUtils.evaluateProviders(mLocationManager); for (String provider : mProviders) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { if (location == null) { Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider); if (lastKnownLocation != null) { this.location = toGeoPointData(lastKnownLocation); Log.i("HereFunctionHandler", "last known location: " + this.location.getDisplayText()); } } mLocationManager.requestLocationUpdates(provider, 0, 0, this, Looper.getMainLooper()); } } locationUpdatesRequested = true; locationUpdatesHaveBeenRequested = true; }
Source:
public void smallDataWithValidChecksum_timesOutInCreateRepeatedly() throws Exception { InputStream inputStream = mock(ByteArrayInputStream.class); doAnswer((Answer<Integer>) invocation -> { ++nRetries; throw new SocketTimeoutException(); }).when(inputStream).read(any(), anyInt(), anyInt()); when(reconnector.connect(any(), any())).thenReturn(connection); when(connection.getInputStream()).thenReturn(inputStream); when(connection.getHeaderField("Accept-Ranges")).thenReturn("bytes"); thrown.expect(SocketTimeoutException.class); try { streamFactory.create(connection, AURL, GOOD_CHECKSUM, reconnector); } catch (Exception e) { assertThat(nRetries).isGreaterThan(3); throw e; } }

Target:
public void smallDataWithValidChecksum_timesOutInCreateRepeatedly() throws Exception { InputStream inputStream = mock(ByteArrayInputStream.class); doAnswer((Answer<Integer>) invocation -> { ++nRetries; throw new SocketTimeoutException(); }).when(inputStream).read(any(), anyInt(), anyInt()); when(reconnector.connect(any(), any())).thenReturn(connection); when(connection.getInputStream()).thenReturn(inputStream); when(connection.getHeaderField("Accept-Ranges")).thenReturn("bytes"); thrown.expect(SocketTimeoutException.class); Field field = RetryingInputStream.class.getDeclaredField("MAX_RESUMES"); field.setAccessible(true); int maxResumes = (int) field.get(null); try { streamFactory.create(connection, AURL, GOOD_CHECKSUM, reconnector); } catch (Exception e) { assertThat(nRetries).isGreaterThan(maxResumes); throw e; } }
Source:
public Object getValueAndReset() { Map<String, Object> ret = new ConcurrentHashMap<>(); for (Map.Entry<String, ReducedMetric> e : value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; }

Target:
public Object getValueAndReset() { Map<String, Object> ret = new HashMap<>(); for (Map.Entry<String, ReducedMetric> e : value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; }
Source:
public void testMappingOfConsolidatedForm() { ObjectMapper mapper = new ObjectMapper(); try { TrialData data = mapper.readValue( "{\"trialSettings\":{\"userInput\":{}},\"environments\":{\"environments\":[{\"managementDetailValues\":{\"8170\":null,\"8192\":\"2\",\"8194\":\"1\"},\"" + "trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"4\",\"8194\":\"3\"},\"trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"" + "6\",\"8194\":\"5\"},\"trialDetailValues\":{}}],\"noOfEnvironments\":\"3\"},\"basicDetails\":{\"basicDetails\":{\"8007\":\"test\",\"8050\":\"" + "07/10/2014\",\"8060\":\"\"},\"folderId\":1,\"folderName\":\"Program Trials\",\"folderNameLabel\":\"Program Trials\",\"userID\":-1,\"userName\":\"Daniel Villafuerte\"}}", TrialData.class); Assert.assertNotNull(data); } catch (IOException e) { Assert.fail(e.getMessage()); } }

Target:
public void testMappingOfConsolidatedForm() { ObjectMapper mapper = new ObjectMapper(); try { TrialData data = mapper.readValue( "{\"trialSettings\":{\"userInput\":{}},\"environments\":{\"environments\":[{\"managementDetailValues\":{\"8170\":null,\"8192\":\"2\",\"8194\":\"1\"},\"" + "trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"4\",\"8194\":\"3\"},\"trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"" + "6\",\"8194\":\"5\"},\"trialDetailValues\":{}}],\"noOfEnvironments\":\"3\"},\"basicDetails\":{\"folderId\":1,\"folderName\":\"Program Trials\",\"folderNameLabel\":\"Program Trials\",\"userID\":-1,\"userName\":\"Daniel Villafuerte\"}}", TrialData.class); Assert.assertNotNull(data); } catch (IOException e) { Assert.fail(e.getMessage()); } }
Source:
public HdfsStorageService(OrcDataEnvironment environment, Path baseLocation) { this.fileSystem = requireNonNull(environment, "requireNonNull is null").getFileSystem(); Path baseDataDir = requireNonNull(baseLocation, "baseLocation is null"); this.baseStorageDir = new Path(baseDataDir, "storage"); this.baseQuarantineDir = new Path(baseDataDir, "quarantine"); }

Target:
public HdfsStorageService(OrcDataEnvironment environment, Path baseLocation) { requireNonNull(baseLocation, "baseLocation is null"); this.baseStorageDir = new Path(baseLocation, "storage"); this.baseQuarantineDir = new Path(baseLocation, "quarantine"); this.environment = requireNonNull(environment, "environment is null"); }
Source:
private static StateItem createState(LinuxStyle style) { int rgbInt = (int) style.toMap().getOrDefault(ITimeEventStyle.FILL_COLOR(), 0); RGB color = new RGB(rgbInt >> 24 & 0xff, rgbInt >> 16 & 0xff, rgbInt >> 8 & 0xff); return new StateItem(color, style.getLabel()); }

Target:
private static StateItem createState(LinuxStyle style) { int rgbInt = (int) style.toMap().getOrDefault(ITimeEventStyleStrings.fillColor(), 0); RGB color = new RGB(rgbInt >> 24 & 0xff, rgbInt >> 16 & 0xff, rgbInt >> 8 & 0xff); return new StateItem(color, style.getLabel()); }
Source:
public void testDeploymentDoesntFailBecauseOfNPE() throws Exception { try { deployer.deploy("test_jar"); } catch (Exception e) { if (e instanceof DeploymentException) { StringWriter out = new StringWriter(); e.printStackTrace(new PrintWriter(out)); String stackTrace = out.getBuffer().toString(); if (stackTrace.contains("Caused by: java.lang.NullPointerException")) { throw e; } } else { throw e; } } }

Target:
public void testDeploymentDoesntFailBecauseOfNPE() throws Exception { try { deployer.deploy("test_jar"); Assert.fail("Expected DeploymentException not thrown"); } catch (Exception e) { Assert.assertTrue(e instanceof DeploymentException); Assert.assertTrue(e.getMessage().contains(JSFLogger.ROOT_LOGGER.invalidDefaultJSFImpl("idontexist").getMessage())); } }
Source:
public String skipString() throws IOException { return tokenizer.readString(); }

Target:
public void skipString() throws IOException { readString(); }
Source:
public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { this.intervalFunction = (x) -> waitDuration.toMillis(); } return this; }

Target:
public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { this.intervalFunction = (x) -> waitDuration.toMillis(); } else { throw new IllegalArgumentException("waitDurationInOpenState must be a positive value"); } return this; }
Source:
public void redraw (int x, int y, int width, int height, boolean all) { if (display.inPaint) { display.asyncExec(() -> redraw(x, y, width, height, all)); return; } checkWidget (); NSRect rect = new NSRect(); rect.x = x; rect.y = y; rect.width = width; rect.height = height; view.setNeedsDisplayInRect(rect); }

Target:
public void redraw(int x, int y, int width, int height, boolean all) { checkWidget(); if (display.inPaint) { display.asyncExec(() -> { if (!isDisposed()) setNeedsDisplayInRect(x, y, width, height); }); return; } setNeedsDisplayInRect(x, y, width, height); }
Source:
boolean hasDoNotSetOnAnyLevel( List<ExecutableElement> methodElements, TypeElement daoLevelInterface) { boolean hasDoNotSetStatement = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, false) || insertHasDoNotSet(v, false) || setEntityHasDoNotSet(v, false) || queryHasDoNotSet(v, false)); boolean hasDoNotSetStatementSetExplicitly = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, true) || insertHasDoNotSet(v, true) || setEntityHasDoNotSet(v, true) || queryHasDoNotSet(v, true)); boolean hasSetToNullStatementSetExplicitlyForAll = methodElements .stream() .filter(this::isOperationWithNullSavingStrategy) .allMatch( v -> updateHasSetToNullExplicitly(v) || insertHasSetToNullExplicitly(v) || setEntitySetToNullExplicitly(v) || queryHasSetToNullExplicitly(v)); if (hasDaoLevelSetToNullStatement(daoLevelInterface) && hasDoNotSetStatementSetExplicitly) { return true; } else if (hasDaoLevelDoNotSetStatement(daoLevelInterface) && !hasSetToNullStatementSetExplicitlyForAll) { return true; } else { return hasDaoLevelUnset(daoLevelInterface) && hasDoNotSetStatement; } }

Target:
public boolean hasDoNotSetOnAnyLevel( List<ExecutableElement> methodElements, TypeElement daoLevelInterface) { boolean anyMethodHasOrDefaultsToDoNotSet = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, false) || insertHasDoNotSet(v, false) || setEntityHasDoNotSet(v, false) || queryHasDoNotSet(v, false)); boolean anyMethodHasDoNotSetExplicitly = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, true) || insertHasDoNotSet(v, true) || setEntityHasDoNotSet(v, true) || queryHasDoNotSet(v, true)); boolean allMethodsHaveSetToNull = methodElements .stream() .filter(this::isOperationWithNullSavingStrategy) .allMatch( v -> updateHasSetToNullExplicitly(v) || insertHasSetToNullExplicitly(v) || setEntitySetToNullExplicitly(v) || queryHasSetToNullExplicitly(v)); if (daoHasSetToNull(daoLevelInterface) && anyMethodHasDoNotSetExplicitly) { return true; } else if (daoHasDoNotSet(daoLevelInterface) && !allMethodsHaveSetToNull) { return true; } else { return daoIsNotAnnotated(daoLevelInterface) && anyMethodHasOrDefaultsToDoNotSet; } }
Source:
public void updateTokenRanges(Set<Range<LightweightOppToken>> newRanges) { Preconditions.checkArgument(!newRanges.isEmpty(), "Set of ranges must not be empty!"); if (!Sets.symmetricDifference(ranges, newRanges).isEmpty()) { ranges = newRanges; statsPerTable.clear(); } }

Target:
public void updateTokenRanges(Set<Range<LightweightOppToken>> newRanges) { Preconditions.checkArgument(!newRanges.isEmpty(), "Set of ranges must not be empty!"); if (!newRanges.equals(ranges)) { ranges = newRanges; statsPerTable.clear(); } }
Source:
public Requirements(List<Requirement<?>> requirements, Class<?> clazz, String configID) { super(); if (requirements == null){ throw new IllegalArgumentException("The requirements list was null"); } if (clazz == null) { throw new IllegalArgumentException("The class containing requirements is null"); } this.requirements = requirements; sortRequirements(this.requirements); this.clazz = clazz; this.configID = configID; }

Target:
public Requirements(List<Requirement<?>> requirements, Class<?> clazz, String configID) { super(); if (requirements == null){ throw new IllegalArgumentException("The requirements list was null"); } if (clazz == null) { throw new IllegalArgumentException("The class containing requirements is null"); } requirements.sort(new PriorityComparator()); this.requirements = requirements; this.clazz = clazz; this.configID = configID; }
Source:
public Action getAction(AbstractBuild<?,?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException{ EnvVars env = getEnvironment(build, listener); String resolvedPropertiesFile = env.expand(propertiesFile); String[] allFiles = Util.tokenize(resolvedPropertiesFile, ","); List<ParameterValue> values = new ArrayList<ParameterValue>(); for(String file:allFiles) { FilePath f = build.getWorkspace().child(file); if (!f.exists()) { listener.getLogger().println("[parameterizedtrigger] Properties file " + file + " did not exist."); if(getFailTriggerOnMissing() == true) { listener.getLogger().println("Not triggering due to missing file"); throw new DontTriggerException(); } continue; } String s = f.readToString(); s = env.expand(s); Properties p = new Properties(); p.load(new InputStreamReader(new StringInputStream(s), Charset.defaultCharset())); for (Map.Entry<Object, Object> entry : p.entrySet()) { values.add(new StringParameterValue(entry.getKey().toString(), entry.getValue().toString())); } } return values.size() == 0 ? null :new ParametersAction(values); }

Target:
public Action getAction(AbstractBuild<?,?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException{ EnvVars env = getEnvironment(build, listener); String resolvedPropertiesFile = env.expand(propertiesFile); String[] allFiles = Util.tokenize(resolvedPropertiesFile, ","); List<ParameterValue> values = new ArrayList<ParameterValue>(); for(String file:allFiles) { FilePath f = build.getWorkspace().child(file); if (!f.exists()) { listener.getLogger().println("[parameterizedtrigger] Properties file " + file + " did not exist."); if(getFailTriggerOnMissing() == true) { listener.getLogger().println("Not triggering due to missing file"); throw new DontTriggerException(); } continue; } String s = f.readToString(); s = env.expand(s); Properties p = new Properties(); p.load(new InputStreamReader(new StringInputStream(s), Charsets.UTF_8)); for (Map.Entry<Object, Object> entry : p.entrySet()) { values.add(new StringParameterValue(entry.getKey().toString(), entry.getValue().toString())); } } return values.size() == 0 ? null :new ParametersAction(values); }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); domains = getStorageDomainsByConnId(getConnection().getid()); if (!domains.isEmpty()) { for (StorageDomain domain : domains) { locks.put(domain.getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } } if (getConnection().getstorage_type().isFileDomain()) { locks.put(getConnection().getconnection(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } else { locks.put(getConnection().getconnection() + ";" + getConnection().getiqn() + ";" + getConnection().getport() + ";" + getConnection().getuser_name(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } locks.put(getConnection().getid(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); return locks; }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); domains = getStorageDomainsByConnId(getConnection().getid()); if (!domains.isEmpty()) { for (StorageDomain domain : domains) { locks.put(domain.getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } } if (getConnection().getstorage_type().isFileDomain()) { locks.put(getConnection().getconnection(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } else { locks.put(getConnection().getconnection() + ";" + getConnection().getiqn() + ";" + getConnection().getport() + ";" + getConnection().getuser_name(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); if(getLuns()!=null) { for(LUNs lun : getLuns()) { Guid diskId = lun.getDiskId(); Guid storageDomainId = lun.getStorageDomainId(); if(diskId != null) { locks.put(diskId.toString(),LockMessagesMatchUtil.makeLockingPair(LockingGroup.DISK, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } if(storageDomainId != null) { locks.put(storageDomainId.toString(),LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } } } } locks.put(getConnection().getid(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE_CONNECTION, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); return locks; }
Source:
public void close() { try { if (!mClosed) { stopLocalOnlyHotspot(); } mCloseGuard.close(); } catch (Exception e) { Log.e(TAG, "Failed to stop Local Only Hotspot."); } finally { mClosed = true; } }

Target:
public void close() { try { synchronized (mLock) { if (!mClosed) { mClosed = true; stopLocalOnlyHotspot(); mCloseGuard.close(); } } } catch (Exception e) { Log.e(TAG, "Failed to stop Local Only Hotspot."); } }
Source:
private void assertCSPAlertAttributes(Alert alert, String key, int expectedRisk) { assertThat(alert.getRisk(), is(expectedRisk)); assertThat(alert.getName(), is(getLocalisedString(key + "name"))); assertThat(alert.getDescription(), is(getLocalisedString(key + "desc"))); assertThat(alert.getReference(), is(getLocalisedString(key + "refs"))); assertThat(alert.getSolution(), is(getLocalisedString("soln"))); assertThat(alert.getConfidence(), is(Alert.CONFIDENCE_MEDIUM)); assertThat(alert.getCweId(), is(16)); assertThat(alert.getWascId(), is(15)); assertThat(alert.getUri(), is(URI)); }

Target:
private static void assertCSPAlertAttributes(Alert alert, String key, int expectedRisk) { assertThat(alert.getRisk(), is(expectedRisk)); assertThat(alert.getName(), is(getLocalisedString(key + "name"))); assertThat(alert.getDescription(), is(getLocalisedString(key + "desc"))); assertThat(alert.getReference(), is(getLocalisedString(key + "refs"))); assertThat(alert.getSolution(), is(getLocalisedString("soln"))); assertThat(alert.getConfidence(), is(Alert.CONFIDENCE_MEDIUM)); assertThat(alert.getCweId(), is(16)); assertThat(alert.getWascId(), is(15)); assertThat(alert.getUri(), is(URI)); }