auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void readAllItemsByPageWithCosmosPagedIterableHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedIterable<InternalObjectNode> cosmosPagedIterable = cosmosContainer.readAllItems(cosmosQueryRequestOptions, InternalObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedIterable = cosmosPagedIterable.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); logger.info("Cosmos Diagnostics : {}", cosmosDiagnostics); if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger itemCount = new AtomicInteger(); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedIterable.iterableByPage().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); int size = feedResponse.getResults().size(); itemCount.addAndGet(size); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); assertThat(itemCount.get()).isEqualTo(NUM_OF_ITEMS); }

Target:
public void readAllItemsByPageWithCosmosPagedIterableHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedIterable<ObjectNode> cosmosPagedIterable = cosmosContainer.readAllItems(cosmosQueryRequestOptions, ObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedIterable = cosmosPagedIterable.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedIterable.iterableByPage().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); }
Source:
public void testJWTAuthShouldPassWithToken() throws Exception { String url = getContextBaseUrl() + "/users"; String basicAuth = "Basic YWRtaW46cGFzc3dvcmQ="; String body = given().header(HttpHeaders.AUTHORIZATION, basicAuth) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(getContextBaseUrl() + "/login") .then() .statusCode(HttpStatus.OK.value()) .extract() .asString(); String tokenValue = getTokenValue(body); given().header(HttpHeaders.AUTHORIZATION, tokenValue) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.OK.value()) .body(notNullValue()); }

Target:
public void testJWTAuthShouldPassWithToken() throws Exception { String url = getContextBaseUrl() + "/users"; String basicAuth = "Basic YWRtaW46cGFzc3dvcmQ="; String body = given().header(HttpHeaders.AUTHORIZATION, basicAuth) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(getContextBaseUrl() + "/login") .then() .statusCode(HttpStatus.OK.value()) .extract() .asString(); TestSecurityContextHolder.clearContext(); SecurityContextHolder.clearContext(); given().header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.UNAUTHORIZED.value()) .body(notNullValue()); TestSecurityContextHolder.clearContext(); SecurityContextHolder.clearContext(); String tokenValue = getTokenValue(body); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(tokenValue)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.OK.value()) .body(notNullValue()); }
Source:
@Override public void cleanupCurrentSession() { cleanup(); }

Target:
@Override public void cleanupCurrentSession() { final IPentahoSession session = PentahoSessionHolder.getSession(); final List<String> key = Collections.unmodifiableList( Arrays.asList( SEGMENT, createKey( session.getName() ) ) ); final ICacheBackend backend = getBackend(); backend.purgeSegment( key, ( k, m ) -> true ); }
Source:
private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(filePath)) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); currentGlobalOffset += scanner.nextLine().length(); } } }

Target:
private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(filePath)) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); currentGlobalOffset += getLineLengthWithLineSeparator(scanner); } } }
Source:
public BuildImageCmdImpl withTag(String tag) { checkNotNull(tag, "Tag is null"); if (this.tags == null) { this.tags = new HashSet<>(4); } this.tags.add(tag); return this; }

Target:
public BuildImageCmdImpl withTag(String tag) { checkNotNull(tag, "Tag is null"); this.tag = tag; return this; }
Source:
public String docs() { List<ExceptionType> e = Arrays.asList(Exceptions.ExceptionType.values()); String Exceptions = "\nValid Exceptions: "; for (int i = 0; i < e.size(); i++) { String ExceptionType = e.get(i).getName(); if(i == e.size() - 1) { Exceptions = Exceptions + ExceptionType; } else { Exceptions = Exceptions + ExceptionType + ", \n"; } } return "nothing {exceptionType, msg} This function causes an exception to be thrown. If the exception type is null," + " it will be uncatchable. Otherwise, exceptionType may be any valid exception type." + Exceptions; }

Target:
public String docs() { List<ExceptionType> e = Arrays.asList(Exceptions.ExceptionType.values()); String exceptions = "\nValid Exceptions: "; for (int i = 0; i < e.size(); i++) { String exceptionType = e.get(i).getName(); if(i == e.size() - 1) { exceptions = exceptions + exceptionType; } else { exceptions = exceptions + exceptionType + ", "; } } return "nothing {exceptionType, msg} This function causes an exception to be thrown. If the exception type is null," + " it will be uncatchable. Otherwise, exceptionType may be any valid exception type." + exceptions; }
Source:
public boolean equals(Object other) { if (! (other instanceof MaskedPasswordAlgorithmSpec)) return false; MaskedPasswordAlgorithmSpec otherSpec = (MaskedPasswordAlgorithmSpec) other; return otherSpec == this || Arrays.equals(initialKeyMaterial, otherSpec.initialKeyMaterial) && iterationCount == otherSpec.iterationCount && Arrays.equals(salt, otherSpec.salt) && initializationVector == otherSpec.initializationVector; }

Target:
public boolean equals(Object other) { if (! (other instanceof MaskedPasswordAlgorithmSpec)) return false; MaskedPasswordAlgorithmSpec otherSpec = (MaskedPasswordAlgorithmSpec) other; return otherSpec == this || Arrays.equals(initialKeyMaterial, otherSpec.initialKeyMaterial) && iterationCount == otherSpec.iterationCount && Arrays.equals(salt, otherSpec.salt) && Arrays.equals(initializationVector, otherSpec.initializationVector); }
Source:
public PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions) { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); return new PagedFluxBase<>( () -> withContext(context -> this.suggestFirst(requestOptions, suggestRequest, context)), nextLink -> Mono.empty()); }

Target:
public PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions) { try { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); return new PagedFluxBase<>( () -> withContext(context -> this.suggestFirst(requestOptions, suggestRequest, context))); } catch (RuntimeException ex) { return new PagedFluxBase<>(() -> monoError(logger, ex)); } }
Source:
protected void receivePacket(DhcpPacket packet) { if (!isValidPacket(packet)) return; if (packet instanceof DhcpOfferPacket) { mOffer = packet.toDhcpResults(); if (mOffer != null) { Log.d(TAG, "Got pending lease: " + mOffer); transitionTo(mDhcpRequestingState); } } else if (packet instanceof DhcpAckPacket) { if (!isDhcpRapidCommitEnabled() || !packet.mRapidCommit) return; DhcpResults results = packet.toDhcpResults(); if (results != null) { confirmDhcpLease(packet, results); transitionTo(mConfiguringInterfaceState); } } }

Target:
protected void receivePacket(DhcpPacket packet) { if (!isValidPacket(packet)) return; if (packet instanceof DhcpOfferPacket) { mOffer = packet.toDhcpResults(); if (mOffer != null) { Log.d(TAG, "Got pending lease: " + mOffer); transitionTo(mDhcpRequestingState); } } else if (packet instanceof DhcpAckPacket) { if (!isDhcpRapidCommitEnabled() || !packet.mRapidCommit) return; final DhcpResults results = packet.toDhcpResults(); if (results != null) { confirmDhcpLease(packet, results); transitionTo(mConfiguringInterfaceState); } } }
Source:
public void waitWorkflowsReady() { ListWorkflowInstanceResponse[] wfr = assertTimeoutPreemptively(ofSeconds(60), () -> { ListWorkflowInstanceResponse wf = null; while (true) { sleep(500); ListWorkflowInstanceResponse[] instances = fromClient(workflowInstanceResource, true) .query("type", DEMO_WORKFLOW_TYPE) .query("maxResults", WORKFLOWS + 1) .query("businessKey", UNIQUE_KEY) .query("status", finished) .query("include", "").get(ListWorkflowInstanceResponse[].class); if (instances.length == WORKFLOWS) { return instances; } } }); assertThat(wfr.length, is(WORKFLOWS)); List<DateTime> startTimes = Stream.of(wfr).map(r -> r.started).sorted().collect(toList()); }

Target:
public void waitWorkflowsReady() { ListWorkflowInstanceResponse[] wfr = assertTimeoutPreemptively(ofSeconds(60), () -> { ListWorkflowInstanceResponse wf = null; while (true) { sleep(500); ListWorkflowInstanceResponse[] instances = fromClient(workflowInstanceResource, true) .query("type", DEMO_WORKFLOW_TYPE) .query("maxResults", WORKFLOWS + 1) .query("businessKey", UNIQUE_KEY) .query("status", finished) .query("include", "").get(ListWorkflowInstanceResponse[].class); if (instances.length == WORKFLOWS) { return instances; } } }); assertThat(wfr.length, is(WORKFLOWS)); }
Source:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { if (entityDescriptorParameter == null) { entityDescriptorParameter = new ElasticEntityDescriptorParameter("ed", NLS.get("ReindexJobFactory.descriptorParameter")); entityDescriptorParameter.markRequired(); } parameterCollector.accept(entityDescriptorParameter); }

Target:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { parameterCollector.accept(entityDescriptorParameter); }
Source:
public boolean step(IPointable result) throws SystemException { if (arrayArgsLength > 0) { while (indexArrayArgs < arrayArgsLength) { ap.getEntry(indexArrayArgs, tvp); abvs.reset(); try { ab.reset(abvs); ab.addItem(tvp); ab.finish(); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } result.set(abvs.getByteArray(), abvs.getStartOffset(), abvs.getLength()); indexArrayArgs++; return true; } } return false; }

Target:
public boolean step(IPointable result) { if (arOrObArgsLength > 0) { while (indexArrayArgs < arOrObArgsLength) { if (arg.getTag() == ValueTag.ARRAY_TAG) { ap.getEntry(indexArrayArgs, tvp); } else { tempTvp.getValue(sp); sp.getEntry(indexArrayArgs, tvp); } result.set(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength()); indexArrayArgs++; return true; } } return false; }
Source:
public boolean tryTransfer(AddressedTuple addressedTuple, Queue<AddressedTuple> pendingEmits) { if (isDebug) { LOG.info("TRANSFERRING tuple {}", addressedTuple); } JCQueue localQueue = getLocalQueue(addressedTuple); if (localQueue!=null) { return tryTransferLocal(addressedTuple, localQueue, pendingEmits); } else { if (remotesBatchSz >= producerBatchSz) { if ( !workerData.tryFlushRemotes() ) { if (pendingEmits != null) { pendingEmits.add(addressedTuple); } return false; } remotesBatchSz = 0; } if (workerData.tryTransferRemote(addressedTuple, pendingEmits, serializer)) { ++remotesBatchSz; if (remotesBatchSz >= producerBatchSz) { workerData.tryFlushRemotes(); remotesBatchSz = 0; } return true; } return false; } }

Target:
public boolean tryTransfer(AddressedTuple addressedTuple, Queue<AddressedTuple> pendingEmits) { if (isDebug) { LOG.info("TRANSFERRING tuple {}", addressedTuple); } JCQueue localQueue = getLocalQueue(addressedTuple); if (localQueue!=null) { return tryTransferLocal(addressedTuple, localQueue, pendingEmits); } return workerData.tryTransferRemote(addressedTuple, pendingEmits, serializer); }
Source:
public static Path createTempFile(String suffix) { try { Path path = Files.createTempFile("jadx-tmp-", System.nanoTime() + '-' + suffix); path.toFile().deleteOnExit(); return path; } catch (IOException e) { throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix); } }

Target:
public static Path createTempFile(String suffix) { try { Path path = Files.createTempFile("jadx-tmp-", suffix); path.toFile().deleteOnExit(); return path; } catch (IOException e) { throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix); } }
Source:
public static void handleApplicationInit(String applicationName) throws Exception { if (firstCall.compareAndSet(true, false)) { if (applicationName.equals(Base.ApplicationNames.OVIRT_ENGINE_AAA_EXTENSION_TOOL)) { if (System.getProperty("java.security.auth.login.config") == null) { InputStream stream = Utils.class.getResourceAsStream("/extensions-tester/jaas.conf"); File file = File.createTempFile("jaas", "conf"); Files.copy(stream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); System.setProperty("java.security.auth.login.config", file.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { throw new Exception(String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath())); } else { System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } }

Target:
public static synchronized void handleApplicationInit(String applicationName) throws Exception { if (applicationName.equals(Base.ApplicationNames.OVIRT_ENGINE_AAA_EXTENSION_TOOL)) { if (System.getProperty("java.security.auth.login.config") == null) { InputStream stream = Utils.class.getResourceAsStream("/extensions-tester/jaas.conf"); File file = File.createTempFile("jaas", "conf"); file.deleteOnExit(); Files.copy(stream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); System.setProperty("java.security.auth.login.config", file.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { throw new Exception(String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath())); } else { System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); }
Source:
public void testSigningOutWorks() { openSignOutDialog(); pressButton("Yes"); onView(withId(R.id.email)).check(matches(isDisplayed())); }

Target:
public void testSigningOutWorks() throws Exception { openSignOutDialog(); pressButton(R.string.yes); onView(withId(R.id.email)).check(matches(isDisplayed())); }
Source:
private Map<String, Object> createInfo() { if (FeatureSupported.isDomainXMLSupported(vm.getClusterCompatibilityVersion())) { String engineXml = generateDomainXml(); if (getParameters().getMemoryDumpImage() == null) { return Collections.singletonMap(VdsProperties.engineXml, engineXml); } else { Map<String, Object> createInfo = new HashMap<>(); createInfo.put(VdsProperties.engineXml, engineXml); DiskImage memoryDump = getParameters().getMemoryDumpImage(); Map<String, String> memoryDumpPDIV = PDIVMapBuilder.create().setPoolId(memoryDump.getStoragePoolId()) .setDomainId(memoryDump.getStorageIds().get(0)).setVolumeId(memoryDump.getId()) .setVolumeId(memoryDump.getImageId()).build(); DiskImage memoryConf = getParameters().getMemoryDumpImage(); Map<String, String> memoryConfPDIV = PDIVMapBuilder.create().setPoolId(memoryConf.getStoragePoolId()) .setDomainId(memoryConf.getStorageIds().get(0)).setVolumeId(memoryConf.getId()) .setVolumeId(memoryConf.getImageId()).build(); createInfo.put("memoryDumpVolume", memoryDumpPDIV); createInfo.put("memoryConfVolume", memoryConfPDIV); return createInfo; } } else { Map<String, Object> createInfo = new HashMap<>(); VmInfoBuilder builder = createBuilder(createInfo); buildVmData(builder); log.info("VM {}", createInfo); return createInfo; } }

Target:
private Map<String, Object> createInfo() { if (FeatureSupported.isDomainXMLSupported(vm.getClusterCompatibilityVersion())) { String engineXml = generateDomainXml(); if (getParameters().getMemoryDumpImage() == null) { return Collections.singletonMap(VdsProperties.engineXml, engineXml); } else { Map<String, Object> createInfo = new HashMap<>(4); createInfo.put(VdsProperties.engineXml, engineXml); DiskImage memoryDump = getParameters().getMemoryDumpImage(); Map<String, String> memoryDumpPDIV = PDIVMapBuilder.create() .setPoolId(memoryDump.getStoragePoolId()) .setDomainId(memoryDump.getStorageIds().get(0)) .setVolumeId(memoryDump.getId()) .setVolumeId(memoryDump.getImageId()).build(); DiskImage memoryConf = getParameters().getMemoryConfImage(); Map<String, String> memoryConfPDIV = PDIVMapBuilder.create() .setPoolId(memoryConf.getStoragePoolId()) .setDomainId(memoryConf.getStorageIds().get(0)) .setVolumeId(memoryConf.getId()) .setVolumeId(memoryConf.getImageId()).build(); createInfo.put("memoryDumpVolume", memoryDumpPDIV); createInfo.put("memoryConfVolume", memoryConfPDIV); return createInfo; } } else { Map<String, Object> createInfo = new HashMap<>(); VmInfoBuilder builder = createBuilder(createInfo); buildVmData(builder); log.info("VM {}", createInfo); return createInfo; } }
Source:
public void parserNoteText(String text){ this.mNoteText = text; this.setImportance(getTagValue("Importance")); this.setEstimation(getTagValue("Estimation")); this.setValue(getTagValue("Value")); this.setHowToDemo(getTagValue("HowToDemo")); this.setNotes(getTagValue("Notes")); }

Target:
public void parserNoteText(String text){ mNoteText = text; setImportance(getTagValue("Importance")); setEstimation(getTagValue("Estimation")); setValue(getTagValue("Value")); setHowToDemo(getTagValue("HowToDemo")); setNotes(getTagValue("Notes")); }
Source:
private Object[] getQueryTreeStrings() throws SemanticException { List<String> qstrs = new ArrayList<String>(); qstrs.add(select); qstrs.add(from); if (!StringUtils.isBlank(where)) { qstrs.add(where); } if (!StringUtils.isBlank(groupby)) { qstrs.add(groupby); } if (!StringUtils.isBlank(having)) { qstrs.add(having); } if (!StringUtils.isBlank(orderby)) { qstrs.add(orderby); } if (limit != null) { qstrs.add(String.valueOf(limit)); } return qstrs.toArray(new String[0]); }

Target:
private String[] getQueryTreeStrings() throws SemanticException { List<String> qstrs = new ArrayList<String>(); qstrs.add(select); qstrs.add(from); if (!StringUtils.isBlank(where)) { qstrs.add(where); } if (!StringUtils.isBlank(groupby)) { qstrs.add(groupby); } if (!StringUtils.isBlank(having)) { qstrs.add(having); } if (!StringUtils.isBlank(orderby)) { qstrs.add(orderby); } if (limit != null) { qstrs.add(String.valueOf(limit)); } return qstrs.toArray(new String[0]); }
Source:
public void testGetClusterStatus() throws IOException { AbstractBigtableConnection connectionMock; BigtableAdmin bigtableAdmin; connectionMock = mock(AbstractBigtableConnection.class); BigtableApi bigtableApi = mock(BigtableApi.class); Mockito.doReturn(bigtableApi).when(connectionMock).getBigtableApi(); bigtableAdmin = new BigtableAdmin(connectionMock); ClusterStatus status = bigtableAdmin.getClusterStatus(); assertNotNull(status); assertEquals("hbaseVersion", status.getHBaseVersion()); assertEquals("clusterid", status.getClusterId()); assertTrue(status.getServersName().isEmpty()); assertTrue(status.getDeadServerNames().isEmpty()); assertNull(status.getMaster()); assertTrue(status.getBackupMasterNames().isEmpty()); assertTrue(status.getRegionStatesInTransition().isEmpty()); assertEquals(0, status.getMasterCoprocessors().length); assertFalse(status.getBalancerOn()); assertEquals(-1, status.getMasterInfoPort()); }

Target:
public void testGetClusterStatus() throws IOException { AbstractBigtableConnection connectionMock = mock(AbstractBigtableConnection.class); BigtableApi bigtableApi = mock(BigtableApi.class); Mockito.doReturn(bigtableApi).when(connectionMock).getBigtableApi(); BigtableAdmin bigtableAdmin = new BigtableAdmin(connectionMock); ClusterStatus status = bigtableAdmin.getClusterStatus(); assertNotNull(status); assertEquals("hbaseVersion", status.getHBaseVersion()); assertEquals("clusterid", status.getClusterId()); assertTrue(status.getServersName().isEmpty()); assertTrue(status.getDeadServerNames().isEmpty()); assertNull(status.getMaster()); assertTrue(status.getBackupMasterNames().isEmpty()); assertTrue(status.getRegionStatesInTransition().isEmpty()); assertEquals(0, status.getMasterCoprocessors().length); assertFalse(status.getBalancerOn()); assertEquals(-1, status.getMasterInfoPort()); }
Source:
public List<AutoCloseable> start(Params params) { Configuration config = new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv"); String dir = config.getString("dir", ""); if (!config.getBoolean("enable", false) || dir.isEmpty()) { return Collections.emptyList(); } TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase()); TimeUnit durationUnit = TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase()); CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit) .convertRatesTo(rateUnit).build(new File(dir)); reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS); log.info("Reporting metrics as csv"); return Collections.singletonList((AutoCloseable) reporter); }

Target:
public List<AutoCloseable> start(Params params) { Configuration config = new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv"); String dir = config.getString("dir", ""); if (!config.getBoolean("enable", false) || dir.isEmpty()) { return Collections.emptyList(); } TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase()); TimeUnit durationUnit = TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase()); CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit) .convertRatesTo(rateUnit).build(new File(dir)); reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS); log.info("Reporting metrics as csv to directory {}", dir); return Collections.singletonList((AutoCloseable) reporter); }
Source:
private void produceValueRange(final int key, final int start, final int endExclusive) throws ExecutionException, InterruptedException { final Properties producerProps = new Properties(); producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.bootstrapServers()); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); IntegrationTestUtils.produceKeyValuesSynchronously( INPUT_TOPIC_NAME, IntStream.range(start, endExclusive) .mapToObj(i -> KeyValue.pair(key, i)) .collect(Collectors.toList()), producerProps, mockTime); }

Target:
private void produceValueRange(final int key, final int start, final int endExclusive) throws Exception { final Properties producerProps = new Properties(); producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.bootstrapServers()); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); IntegrationTestUtils.produceKeyValuesSynchronously( INPUT_TOPIC_NAME, IntStream.range(start, endExclusive) .mapToObj(i -> KeyValue.pair(key, i)) .collect(Collectors.toList()), producerProps, mockTime); }
Source:
public File export(final List<LocationDto> locations, final List<VariableDetails> units) { try { final File temporaryFolder = Files.createTempDir(); final String sanitizedFileName = "template_import_lots.xls"; final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + sanitizedFileName; return lotExcelTemplateGenerator.generateTemplateFile(fileNameFullPath, locations, units); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.exportAsXLS.lot.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }

Target:
public File export(final List<LocationDto> locations, final List<VariableDetails> units) { try { final File temporaryFolder = Files.createTempDir(); final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + LotExcelTemplateExportServiceImpl.FILE_NAME; return lotExcelTemplateGenerator.generateTemplateFile(fileNameFullPath, locations, units); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.exportAsXLS.lot.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }
Source:
private void put(byte b[], int length) { buffer.writeVLong(length); buffer.add(b, 0, length); estimatedSize += length + SERIALIZATION_OVERHEAD; }

Target:
private void put(byte b[], int length) { buffer.writeVLong(length); buffer.add(b, 0, length); }
Source:
public boolean equals(Object other) { if (!(other instanceof ChessCoordinates)) return false; ChessCoordinates otherCoordinates = (ChessCoordinates) other; return otherCoordinates.boardIndex == boardIndex && otherCoordinates.row == row && otherCoordinates.column == column; }

Target:
public boolean equals(Object other) { if (!(other instanceof ChessCoordinates)) return false; ChessCoordinates otherCoordinates = (ChessCoordinates) other; return Objects.equal(row, otherCoordinates.row) && Objects.equal(column, otherCoordinates.column) && Objects.equal(boardIndex, otherCoordinates.boardIndex); }
Source:
protected boolean isSplitable(JobContext context, Path filename) { try { FileSystem fs = filename.getFileSystem( context.getConfiguration() ); return fs.exists( filename.suffix( LzoIndex.LZO_INDEX_SUFFIX ) ); } catch (IOException e) { return false; } }

Target:
protected boolean isSplitable(JobContext context, Path filename) { try { FileSystem fs = filename.getFileSystem( context.getConfiguration() ); return fs.exists( filename.suffix( LzoIndex.LZO_INDEX_SUFFIX ) ); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
protected synchronized Map<String,SortedMap<TServerInstance,TabletServerStatus>> splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current) { if ((System.currentTimeMillis() - lastPoolRecheck) > poolRecheckMillis) { Map<String,SortedMap<TServerInstance,TabletServerStatus>> newPools = new HashMap<String,SortedMap<TServerInstance,TabletServerStatus>>(); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { String tableName = getPoolNameForHost(e.getKey().host()); if (!newPools.containsKey(tableName)) { newPools.put(tableName, new TreeMap<TServerInstance,TabletServerStatus>()); } newPools.get(tableName).put(e.getKey(), e.getValue()); } boolean error = false; for (SortedMap<TServerInstance,TabletServerStatus> s1 : newPools.values()) { for (SortedMap<TServerInstance,TabletServerStatus> s2 : newPools.values()) { if (s1 == s2) { continue; } if (!Collections.disjoint(s1.keySet(), s2.keySet())) { LOG.error("Pools are not disjoint: {}, there is a problem with your regular expressions. Putting all servers in default pool", newPools); error = true; } } } if (error) { newPools.clear(); newPools.put(DEFAULT_POOL, new TreeMap<TServerInstance,TabletServerStatus>()); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { newPools.get(DEFAULT_POOL).put(e.getKey(), e.getValue()); } } pools = newPools; this.lastPoolRecheck = System.currentTimeMillis(); } return pools; }

Target:
protected synchronized Map<String,SortedMap<TServerInstance,TabletServerStatus>> splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current) { if ((System.currentTimeMillis() - lastPoolRecheck) > poolRecheckMillis) { LOG.debug("Performing pool recheck - regrouping tablet servers based on regular expressions"); Map<String,SortedMap<TServerInstance,TabletServerStatus>> newPools = new HashMap<String,SortedMap<TServerInstance,TabletServerStatus>>(); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { List<String> poolNames = getPoolNamesForHost(e.getKey().host()); for (String pool : poolNames) { SortedMap<TServerInstance,TabletServerStatus> np = newPools.get(pool); if (null == np) { np = new TreeMap<TServerInstance,TabletServerStatus>(current.comparator()); newPools.put(pool, np); } np.put(e.getKey(), e.getValue()); } } pools = newPools; this.lastPoolRecheck = System.currentTimeMillis(); } return pools; }
Source:
public void cleanup() { org.jboss.reddeer.common.util.Display.syncExec(new Runnable() { @Override public void run() { for (Shell shell : org.jboss.reddeer.common.util.Display.getDisplay().getShells()) { if (shell.getText().equals(title)) { shell.dispose(); break; } } new WaitWhile(new ShellWithTextIsAvailable(title)); } }); }

Target:
public void cleanup() { org.jboss.reddeer.common.util.Display.syncExec(new Runnable() { @Override public void run() { for (Shell shell : org.jboss.reddeer.common.util.Display.getDisplay().getShells()) { if (shell.getText().equals(title)) { shell.dispose(); break; } } } }); new WaitWhile(new ShellWithTextIsAvailable(title)); }
Source:
public List<JobId> getJobsToRemove(final long time) { List<JobId> jobIdsList = executeReadOnlyTransaction(session -> { List<JobId> jobsToRemove = new ArrayList<JobId>(); Query query = session.createSQLQuery("select ID from JOB_DATA where " + "SCHEDULED_TIME_FOR_REMOVAL <> 0 and " + "SCHEDULED_TIME_FOR_REMOVAL < :timeLimit") .setParameter("timeLimit", time); Iterator jobIdIterator = query.list().iterator(); while (jobIdIterator.hasNext()) { jobsToRemove.add(JobIdImpl.makeJobId((jobIdIterator.next()).toString())); } return jobsToRemove; }); return jobIdsList; }

Target:
public List<JobId> getJobsToRemove(final long time) { return executeReadOnlyTransaction(session -> { Query query = session.createSQLQuery("select ID from JOB_DATA where " + "SCHEDULED_TIME_FOR_REMOVAL <> 0 and " + "SCHEDULED_TIME_FOR_REMOVAL < :timeLimit") .setParameter("timeLimit", time); return ((List<Long>) query.list()).stream() .map(Object::toString) .map(JobIdImpl::makeJobId) .collect(Collectors.toList()); }); }
Source:
public SslCertificateType getDefault() { return SslCertificateType.CLOUD_PROVIDER_OWNED; }

Target:
public SslCertificateType getDefault() { return SslCertificateType.NONE; }
Source:
public ClientOutputStream(Client c) { this.c = c; c.addCloseListener(new CloseListener() { @Override public void onClose(Client client) { isClosed = true; synchronized(this) { try { this.notifyAll(); } catch(Throwable t) { ExceptionUtils.handleException(t); } } } }); lastWriteFuture = c.lastWriteFuture(); }

Target:
public ClientOutputStream(Client c) { this.c = c; c.addCloseListener(new CloseListener() { @Override public void onClose(Client client) { isClosed = true; } }); lastWriteFuture = c.lastWriteFuture(); }
Source:
public void recreateInMemoryData(boolean isFirstEventArrived) { if (isFirstEventArrived) { this.isFirstEventArrived = true; for (Map.Entry<TimePeriod.Duration, IncrementalExecutor> durationIncrementalExecutorEntry : this.incrementalExecutorMap.entrySet()) { durationIncrementalExecutorEntry.getValue().setProcessingExecutor(true); } } synchronized (this) { this.recreateInMemoryData.recreateInMemoryData(); } }

Target:
public synchronized void recreateInMemoryData(boolean isFirstEventArrived) { if (isFirstEventArrived) { this.isFirstEventArrived = true; for (Map.Entry<TimePeriod.Duration, IncrementalExecutor> durationIncrementalExecutorEntry : this.incrementalExecutorMap.entrySet()) { durationIncrementalExecutorEntry.getValue().setProcessingExecutor(true); } } this.recreateInMemoryData.recreateInMemoryData(); }
Source:
public WriteInfo getPartitionWriteInfo(LocationHandle locationHandle, Optional<Partition> partition, String partitionName) { Path tempPath = new Path(locationHandle.getTmpPath(), randomUUID().toString().replaceAll("/", "_")); if (partition.isPresent()) { WriteMode writeMode = locationHandle.getWriteMode(); Path targetPath = new Path(partition.get().getStorage().getLocation()); Path writePath; switch (writeMode) { case STAGE_AND_MOVE_TO_TARGET_DIRECTORY: writePath = new Path(locationHandle.getWritePath(), partitionName); break; case DIRECT_TO_TARGET_EXISTING_DIRECTORY: writePath = targetPath; break; case DIRECT_TO_TARGET_NEW_DIRECTORY: default: throw new UnsupportedOperationException(format("inserting into existing partition is not supported for %s", writeMode)); } return new WriteInfo(targetPath, writePath, tempPath, writeMode); } else { return new WriteInfo( new Path(locationHandle.getTargetPath(), partitionName), new Path(locationHandle.getWritePath(), partitionName), tempPath, locationHandle.getWriteMode()); } }

Target:
public WriteInfo getPartitionWriteInfo(LocationHandle locationHandle, Optional<Partition> partition, String partitionName) { Optional<Path> tempPath = locationHandle.getTempPath().map(path -> new Path(path, randomUUID().toString().replaceAll("-", "_"))); if (partition.isPresent()) { WriteMode writeMode = locationHandle.getWriteMode(); Path targetPath = new Path(partition.get().getStorage().getLocation()); Path writePath; switch (writeMode) { case STAGE_AND_MOVE_TO_TARGET_DIRECTORY: writePath = new Path(locationHandle.getWritePath(), partitionName); break; case DIRECT_TO_TARGET_EXISTING_DIRECTORY: writePath = targetPath; break; case DIRECT_TO_TARGET_NEW_DIRECTORY: default: throw new UnsupportedOperationException(format("inserting into existing partition is not supported for %s", writeMode)); } return new WriteInfo(targetPath, writePath, tempPath, writeMode); } else { return new WriteInfo( new Path(locationHandle.getTargetPath(), partitionName), new Path(locationHandle.getWritePath(), partitionName), tempPath, locationHandle.getWriteMode()); } }
Source:
private String readRawString(int id) throws IOException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(getResources().openRawResource(id))); StringBuilder sb = new StringBuilder(); String s; while((s = reader.readLine()) != null) { sb.append(s).append('\n'); } return sb.toString(); } finally { if(reader != null) { try { reader.close(); } catch (IOException e) { Log.w(TAG, "readRawString() failed to close reader\n" + e.toString() + "\n" + e.getStackTrace().toString()); } } } }

Target:
private String readRawString(int id) throws IOException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(getResources().openRawResource(id))); StringBuilder sb = new StringBuilder(); String s; while((s = reader.readLine()) != null) { sb.append(s).append('\n'); } return sb.toString(); } finally { if(reader != null) { try { reader.close(); } catch (IOException e) { Log.w(TAG, "readRawString() failed to close reader", e); } } } }
Source:
public SpecialCuratedContentPageObject(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); }

Target:
public SpecialCuratedContentPageObject(WebDriver driver) { super(driver); }
Source:
public void testSwitchDeregAction(){ int tid = 10; long vswId=5; boolean before=false, after=true; PhysicalSwitch psw = new TestSwitch(1); final ArrayList <String>ctlList= new ArrayList <String>(); ctlList.add("tcp:127.0.0.1:6633"); OVXIPAddress ip = new OVXIPAddress("10.0.0.0", tid); psw.register(); OVXSwitch vsw = new OVXSingleSwitch(vswId, tid); try { OVXNetwork net = new OVXNetwork(tid,ctlList,ip,(short)24); net.register(); this.map.addSwitches(Collections.singletonList(psw), vsw); vsw.register(); vsw.map.addNetwork(net); vsw.register(); } catch (IndexOutOfBoundException e) { Assert.fail(); e.printStackTrace(); } before=psw.map.hasVirtualSwitch(psw, tid); Assert.assertTrue(before); psw.cleanUpTenant(tid, (short)0); vsw.tearDown(true); vsw.unregSwitch(true); after=psw.map.hasVirtualSwitch(psw, tid); Assert.assertFalse(after); }

Target:
public void testSwitchDeregAction(){ int tid = 10; long vswId=5; boolean before=false, after=true; PhysicalSwitch psw = new TestSwitch(1); final ArrayList <String>ctlList= new ArrayList <String>(); ctlList.add("tcp:127.0.0.1:6633"); OVXIPAddress ip = new OVXIPAddress("10.0.0.0", tid); psw.register(); OVXSwitch vsw = new OVXSingleSwitch(vswId, tid); try { OVXNetwork net = new OVXNetwork(tid,ctlList,ip,(short)24); net.register(); this.map.addSwitches(Collections.singletonList(psw), vsw); vsw.map.addNetwork(net); vsw.register(); } catch (IndexOutOfBoundException e) { Assert.fail("Exception: IndexOutOfBound"); } before=psw.map.hasVirtualSwitch(psw, tid); Assert.assertTrue(before); psw.cleanUpTenant(tid, (short)0); vsw.tearDown(true); vsw.unregSwitch(true); after=psw.map.hasVirtualSwitch(psw, tid); Assert.assertFalse(after); }
Source:
private static void assertFormValid() throws ValidationException { info("Check there are no validation errors..."); String failedFields = ""; if (Existence.existsImmediately(driver, pmPage.getRecipientErrorMessage())) { WebElement recipientError = pmPage.getRecipientErrorMessage(); failedFields += recipientError.getText(); } if (Existence.existsImmediately(driver, pmPage.getSubjectErrorMessage())) { WebElement subjectError = pmPage.getSubjectErrorMessage(); failedFields += subjectError.getText(); } if (Existence.existsImmediately(driver, pmPage.getBodyMsgErrorMessage())) { WebElement bodyMsgError = pmPage.getBodyMsgErrorMessage(); failedFields += bodyMsgError.getText(); } if (!failedFields.equals("")) { info("Validation failed!"); throw new ValidationException(failedFields); } info("Validation completed successfully! No errors found."); }

Target:
private static void assertFormValid() throws ValidationException { info("Check there are no validation errors..."); String failedFields = ""; if (Existence.existsImmediately(driver, pmPage.getRecipientErrorMessage())) { WebElement recipientError = pmPage.getRecipientErrorMessage(); failedFields += recipientError.getText(); } if (Existence.existsImmediately(driver, pmPage.getSubjectErrorMessage())) { WebElement subjectError = pmPage.getSubjectErrorMessage(); failedFields += subjectError.getText(); } if (Existence.existsImmediately(driver, pmPage.getBodyMsgErrorMessage())) { WebElement bodyMsgError = pmPage.getBodyMsgErrorMessage(); failedFields += bodyMsgError.getText(); } if (StringUtils.isNotBlank(failedFields)) { info("Validation failed!"); throw new ValidationException(failedFields); } info("Validation completed successfully! No errors found."); }
Source:
public TransactionInfo readObject(ObjectInput input) throws IOException, ClassNotFoundException { GlobalTransaction globalTransaction = (GlobalTransaction) input.readObject(); int topologyId = input.readInt(); WriteCommand[] modifications = MarshallUtil.unmarshallArray(input, WriteCommand[]::new); Set<Object> lockedKeys = (Set<Object>) MarshallUtil.unmarshallCollection(input, HashSet::new); return new TransactionInfo(globalTransaction, topologyId, modifications, lockedKeys); }

Target:
public TransactionInfo readObject(ObjectInput input) throws IOException, ClassNotFoundException { GlobalTransaction globalTransaction = (GlobalTransaction) input.readObject(); int topologyId = input.readInt(); WriteCommand[] modifications = MarshallUtil.unmarshallArray(input, WriteCommand[]::new); Set<Object> lockedKeys = MarshallUtil.unmarshallCollection(input, HashSet::new); return new TransactionInfo(globalTransaction, topologyId, modifications, lockedKeys); }
Source:
public PlanNodeCostEstimate visitTableScan(TableScanNode node, Void context) { return cpuCost(getStats(node).getOutputSizeInBytes()); }

Target:
public PlanNodeCostEstimate visitTableScan(TableScanNode node, Void context) { return cpuCost(getStats(node).getOutputSizeInBytes(node.getOutputSymbols())); }
Source:
public StageState transition(Stage stage, StageEvent stageEvent) { try { LOG.info(String.format("Stage completed - %s (total=%d, success=%d, killed=%d)", stage.getId().toString(), stage.getTotalScheduledObjectsCount(), stage.getSucceededObjectCount(), stage.killedObjectCount)); if (stage.killedObjectCount > 0 || stage.failedObjectCount > 0) { if (stage.failedObjectCount > 0) { stage.abort(StageState.FAILED); return StageState.FAILED; } else if (stage.killedObjectCount > 0) { stage.abort(StageState.KILLED); return StageState.KILLED; } else { TajoInternalError error = new TajoInternalError("Invalid State " + stage.getSynchronizedState() + " State"); LOG.error(error.getMessage(), error); stage.abort(StageState.ERROR, error); return StageState.ERROR; } } else { stage.complete(); return StageState.SUCCEEDED; } } catch (Throwable t) { LOG.error(t.getMessage(), t); stage.abort(StageState.ERROR, t); return StageState.ERROR; } }

Target:
public StageState transition(Stage stage, StageEvent stageEvent) { try { LOG.info(String.format("Stage completed - %s (total=%d, success=%d, killed=%d)", stage.getId().toString(), stage.getTotalScheduledObjectsCount(), stage.getSucceededObjectCount(), stage.killedObjectCount)); if (stage.killedObjectCount + stage.failedObjectCount > 0) { if (stage.failedObjectCount > 0) { stage.abort(StageState.FAILED); return StageState.FAILED; } else { stage.abort(StageState.KILLED); return StageState.KILLED; } } else { stage.complete(); return StageState.SUCCEEDED; } } catch (Throwable t) { LOG.error(t.getMessage(), t); stage.abort(StageState.ERROR, t); return StageState.ERROR; } }
Source:
public static McMMOPlayerProfileLoadEvent callPlayerProfileLoadEvent(Player player, PlayerProfile profile){ McMMOPlayerProfileLoadEvent e = new McMMOPlayerProfileLoadEvent(player, profile); mcMMO.p.getServer().getPluginManager().callEvent(e); return e; }

Target:
public static McMMOPlayerProfileLoadEvent callPlayerProfileLoadEvent(Player player, PlayerProfile profile){ McMMOPlayerProfileLoadEvent event = new McMMOPlayerProfileLoadEvent(player, profile); mcMMO.p.getServer().getPluginManager().callEvent(event); return event; }
Source:
private void preProcessModule(Module module) { if (this.plugins != null) { for (Plugin plugin : this.plugins.values()) { if (plugin.supports(module.getType())) { plugin.preProcessModule(module); } } } }

Target:
private void preProcessModule(Module module) { for (Plugin plugin : this.getSupportedPlugins(module)) { plugin.preProcessModule(module); } }
Source:
public boolean initGlusterHost(VDS vds) { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterHostUUID, new VdsIdVDSCommandParametersBase(vds.getId())); if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) { Guid addedServerUuid = Guid.createGuidFromString((String) returnValue.getReturnValue()); if (hostUuidExists(vds, addedServerUuid)) { setNonOperational(vds, NonOperationalReason.GLUSTER_HOST_UUID_ALREADY_EXISTS, null); return false; } saveGlusterHostUuid(vds, addedServerUuid); } else { setNonOperational(vds, NonOperationalReason.GLUSTER_HOST_UUID_NOT_FOUND, null); return false; } refreshGlusterStorageDevices(vds); boolean ret = initGlusterPeerProcess(vds); glusterServerDao.updatePeerStatus(vds.getId(), ret ? PeerStatus.CONNECTED : PeerStatus.DISCONNECTED); addGlusterWebhook(vds); return ret; }

Target:
public boolean initGlusterHost(VDS vds) { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterHostUUID, new VdsIdVDSCommandParametersBase(vds.getId())); if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) { Guid addedServerUuid = Guid.createGuidFromString((String) returnValue.getReturnValue()); if (hostUuidExists(vds, addedServerUuid)) { setNonOperational(vds, NonOperationalReason.GLUSTER_HOST_UUID_ALREADY_EXISTS, null); return false; } saveGlusterHostUuid(vds, addedServerUuid); } else { setNonOperational(vds, NonOperationalReason.GLUSTER_HOST_UUID_NOT_FOUND, null); return false; } refreshGlusterStorageDevices(vds); boolean ret = initGlusterPeerProcess(vds); glusterServerDao.updatePeerStatus(vds.getId(), ret ? PeerStatus.CONNECTED : PeerStatus.DISCONNECTED); if (ret) { addGlusterWebhook(vds); } return ret; }
Source:
public void run() { try ( Socket socket = new Socket( "127.0.0.1", port ) ) { socket.getOutputStream().write( sessionId.getBytes( US_ASCII ) ); byte[] data = new byte[128]; int readLength = socket.getInputStream().read( data ); String token = new String( data, 0, readLength, US_ASCII ); assertThat( token ).isEqualTo( ":maven-surefire-command:noop:" ); socket.getOutputStream().write( ":maven-surefire-event:bye:".getBytes( US_ASCII ) ); } catch ( IOException e ) { hasError.set( true ); e.printStackTrace(); throw new IllegalStateException( e ); } catch ( RuntimeException e ) { hasError.set( true ); e.printStackTrace(); throw e; } }

Target:
public void run() { try ( Socket socket = new Socket( InetAddress.getLocalHost().getHostAddress(), port ) ) { socket.getOutputStream().write( sessionId.getBytes( US_ASCII ) ); byte[] data = new byte[128]; int readLength = socket.getInputStream().read( data ); String token = new String( data, 0, readLength, US_ASCII ); assertThat( token ).isEqualTo( ":maven-surefire-command:noop:" ); socket.getOutputStream().write( ":maven-surefire-event:bye:".getBytes( US_ASCII ) ); } catch ( IOException e ) { hasError.set( true ); e.printStackTrace(); throw new IllegalStateException( e ); } catch ( RuntimeException e ) { hasError.set( true ); e.printStackTrace(); throw e; } }
Source:
private static ProfileCredentialsService getProfileCredentialService() { if (STS_SERVICE_CONSTRUCTOR == null) { try { STS_SERVICE_CONSTRUCTOR = (Constructor<ProfileCredentialsService>) Class.forName(CLASS_NAME).getConstructor(); } catch (ClassNotFoundException ex) { throw new AmazonClientException("To use assume role profiles the aws-java-sdk-sts module must be on the class path.", ex); } catch (NoSuchMethodException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } } try { return STS_SERVICE_CONSTRUCTOR.newInstance(); } catch (InstantiationException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } catch (IllegalAccessException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } catch (InvocationTargetException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } }

Target:
private static ProfileCredentialsService getProfileCredentialService() { if (STS_CREDENTIALS_SERVICE == null) { try { STS_CREDENTIALS_SERVICE = (ProfileCredentialsService) Class.forName(CLASS_NAME).newInstance(); } catch (ClassNotFoundException ex) { throw new AmazonClientException("To use assume role profiles the aws-java-sdk-sts module must be on the class path.", ex); } catch (InstantiationException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } catch (IllegalAccessException ex) { throw new AmazonClientException("Failed to instantiate " + CLASS_NAME, ex); } } return STS_CREDENTIALS_SERVICE; }
Source:
@Override RemoteViewsTarget getTarget() { return new RemoteViewsTarget(remoteViews, viewId); }

Target:
@Override RemoteViewsTarget getTarget() { if (target == null) { target = new RemoteViewsTarget(remoteViews, viewId); } return target; }