auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void assertRegexUrlPatternMap() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/app/{jobName}", 1); urlPatternMap.put("/app/list", 2); urlPatternMap.put("/app/{jobName}/disable", 3); urlPatternMap.put("/app/{jobName}/enable", 4); MappingContext<Integer> mappingContext = urlPatternMap.match("/app/myJob"); assertNotNull(mappingContext); assertEquals("/app/{jobName}", mappingContext.pattern()); assertEquals(Integer.valueOf(1), mappingContext.payload()); mappingContext = urlPatternMap.match("/app/list"); assertNotNull(mappingContext); assertEquals("/app/list", mappingContext.pattern()); assertEquals(Integer.valueOf(2), mappingContext.payload()); mappingContext = urlPatternMap.match("/job/list"); assertNull(mappingContext); }

Target:
public void assertRegexUrlPatternMap() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/app/{jobName}", 1); urlPatternMap.put("/app/list", 2); urlPatternMap.put("/app/{jobName}/disable", 3); urlPatternMap.put("/app/{jobName}/enable", 4); MappingContext<Integer> mappingContext = urlPatternMap.match("/app/myJob"); assertNotNull(mappingContext); assertThat(mappingContext.pattern(), is("/app/{jobName}")); assertThat(mappingContext.payload(), is(1)); mappingContext = urlPatternMap.match("/app/list"); assertNotNull(mappingContext); assertThat(mappingContext.pattern(), is("/app/list")); assertThat(mappingContext.payload(), is(2)); mappingContext = urlPatternMap.match("/job/list"); assertNull(mappingContext); }
Source:
private void verifyStateStore(final KafkaStreams streams, final Set<KeyValue<Long, Long>> expectedStoreContent) throws InterruptedException { final ReadOnlyKeyValueStore<Long, Long> store = IntegrationTestUtils .getStore(300000L, storeName, streams, QueryableStoreTypes.keyValueStore()); assertNotNull(store); final KeyValueIterator<Long, Long> it = store.all(); while (it.hasNext()) { assertTrue(expectedStoreContent.remove(it.next())); } assertTrue(expectedStoreContent.isEmpty()); }

Target:
private void verifyStateStore(final KafkaStreams streams, final Set<KeyValue<Long, Long>> expectedStoreContent) throws InterruptedException { final ReadOnlyKeyValueStore<Long, Long> store = IntegrationTestUtils .getStore(300_000L, storeName, streams, QueryableStoreTypes.keyValueStore()); assertNotNull(store); final KeyValueIterator<Long, Long> it = store.all(); while (it.hasNext()) { assertTrue(expectedStoreContent.remove(it.next())); } assertTrue(expectedStoreContent.isEmpty()); }
Source:
private void verifyCertificateChain(final List<X509Certificate> certificates) throws GeneralSecurityException, AuthenticationException { X509Certificate issuerCert = getSelfSignedCert(certificates); final TrustAnchor trustAnchor = new TrustAnchor(issuerCert, null); PKIXParameters pkixParameters = new PKIXParameters(Collections.singleton(trustAnchor)); pkixParameters.setRevocationEnabled(false); final CertPath certPath = CertificateFactory.getInstance("X.509") .generateCertPath(certificates); final CertPathValidator certPathValidator = CertPathValidator.getInstance("PKIX"); certPathValidator.validate(certPath, pkixParameters); }

Target:
private void verifyCertificateChain(final List<X509Certificate> certificates) throws GeneralSecurityException, AuthenticationException { final X509Certificate issuerCert = getSelfSignedCert(certificates); final TrustAnchor trustAnchor = new TrustAnchor(issuerCert, null); final PKIXParameters pkixParameters = new PKIXParameters(Collections.singleton(trustAnchor)); pkixParameters.setRevocationEnabled(false); final CertPath certPath = CertificateFactory.getInstance("X.509") .generateCertPath(certificates); final CertPathValidator certPathValidator = CertPathValidator.getInstance("PKIX"); certPathValidator.validate(certPath, pkixParameters); }
Source:
public ProfileGenericDataResponse getProfileGenericDataResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ProfileGenericDataAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ProfileGenericDataAsyncRequest for meter: {}.", request.getDeviceIdentification()); ProfileGenericDataResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeueProfileGenericDataResponse(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "retrieving the periodic meter reads"); response = this.monitoringMapper.map(meterResponseData.getMessageData(), ProfileGenericDataResponse.class); } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return response; }

Target:
public ProfileGenericDataResponse getProfileGenericDataResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ProfileGenericDataAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ProfileGenericDataAsyncRequest for meter: {}.", request.getDeviceIdentification()); ProfileGenericDataResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeueProfileGenericDataResponse(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "retrieving profile generic data"); response = this.monitoringMapper.map(meterResponseData.getMessageData(), ProfileGenericDataResponse.class); } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return response; }
Source:
public void generateProvisionTrue() throws Exception { configProperties.put("provision", "true"); InvocationContext context = new InvocationContext(mappingModels, configProperties); assertEquals(true, boschIOTSuiteGenerator.generate(modelProvider(), context) instanceof SingleGenerationResult); }

Target:
public void generateProvisionTrue() throws Exception { configProperties.put("provision", "true"); InvocationContext context = new InvocationContext(mappingModels, configProperties); SingleGenerationResult singleGenerationResult = (SingleGenerationResult) boschIOTSuiteGenerator.generate(modelProvider(), context); assertEquals("Provisioning_MySensor.postman.json", singleGenerationResult.getFileName()); }
Source:
public static String signOpenSSHCertificate( String name, String hostname, String principal ) throws IOException { EngineLocalConfig config = EngineLocalConfig.getInstance(); if ( !new OpenSslCAWrapper().signOpenSSHCertificate( new File(new File(config.getUsrDir(), "bin"), "pki-enroll-openssh-cert.sh"), name, hostname, principal ) ) { throw new RuntimeException("OpenSSH certificate enrollment failed"); } return new String(Files.readAllBytes( new File(new File(config.getPKIDir(), "certs"), String.format("%s-cert.pub", name)).toPath())); }

Target:
public static String signOpenSSHCertificate( String name, String hostname, String principal ) throws IOException { EngineLocalConfig config = EngineLocalConfig.getInstance(); if ( !new OpenSslCAWrapper().signOpenSSHCertificate( new File(new File(config.getUsrDir(), "bin"), "pki-enroll-openssh-cert.sh"), name, hostname, principal ) ) { throw new RuntimeException("OpenSSH certificate enrollment failed"); } return new String(Files.readAllBytes( Paths.get(config.getPKIDir().getPath(), "certs", String.format("%s-cert.pub", name)))); }
Source:
public void onMediaUploadProgress(final String localMediaId, final float progress) { if(!isAdded() || content == null || !mAztecReady) { return; } float maxProgressForLocalMediaId = mUploadingMediaProgressMax.get(localMediaId); if (progress > maxProgressForLocalMediaId) { synchronized (AztecEditorFragment.this) { maxProgressForLocalMediaId = progress; mUploadingMediaProgressMax.put(localMediaId, maxProgressForLocalMediaId); try { AztecText.AttributePredicate localMediaIdPredicate = ImagePredicate.getLocalMediaIdPredicate(localMediaId); content.setOverlayLevel(localMediaIdPredicate, 1, (int) (progress * 10000)); content.refreshText(); } catch (IndexOutOfBoundsException ex) { AppLog.d(AppLog.T.EDITOR, localMediaId + " - not found trying to update progress "); } } } }

Target:
public void onMediaUploadProgress(final String localMediaId, final float progress) { if(!isAdded() || content == null || !mAztecReady || TextUtils.isEmpty(localMediaId)) { return; } if (mUploadingMediaProgressMax.get(localMediaId) == null) { return; } float maxProgressForLocalMediaId = mUploadingMediaProgressMax.get(localMediaId); if (progress > maxProgressForLocalMediaId) { synchronized (AztecEditorFragment.this) { maxProgressForLocalMediaId = progress; mUploadingMediaProgressMax.put(localMediaId, maxProgressForLocalMediaId); try { AztecText.AttributePredicate localMediaIdPredicate = ImagePredicate.getLocalMediaIdPredicate(localMediaId); content.setOverlayLevel(localMediaIdPredicate, 1, (int) (progress * 10000)); content.refreshText(); } catch (IndexOutOfBoundsException ex) { AppLog.d(AppLog.T.EDITOR, localMediaId + " - not found trying to update progress "); } } } }
Source:
public UniformGranularitySpec( @JsonProperty("segmentGranularity") Granularity segmentGranularity, @JsonProperty("queryGranularity") QueryGranularity queryGranularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { this.segmentGranularity = segmentGranularity == null ? DEFAULT_SEGMENT_GRANULARITY : segmentGranularity; this.queryGranularity = queryGranularity == null ? DEFAULT_QUERY_GRANULARITY : queryGranularity; if (inputIntervals != null) { List<Interval> granularIntervals = Lists.newArrayList(); for (Interval inputInterval : inputIntervals) { for (Interval interval : segmentGranularity.getIterable(inputInterval)) { granularIntervals.add(trim(inputInterval, interval)); } } this.inputIntervals = ImmutableList.copyOf(inputIntervals); this.wrappedSpec = new ArbitraryGranularitySpec(queryGranularity, granularIntervals); } else { this.inputIntervals = null; this.wrappedSpec = null; } }

Target:
public UniformGranularitySpec( @JsonProperty("segmentGranularity") Granularity segmentGranularity, @JsonProperty("queryGranularity") QueryGranularity queryGranularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { this.segmentGranularity = segmentGranularity == null ? DEFAULT_SEGMENT_GRANULARITY : segmentGranularity; this.queryGranularity = queryGranularity == null ? DEFAULT_QUERY_GRANULARITY : queryGranularity; if (inputIntervals != null) { List<Interval> granularIntervals = Lists.newArrayList(); for (Interval inputInterval : inputIntervals) { Iterables.addAll(granularIntervals, this.segmentGranularity.getIterable(inputInterval)); } this.inputIntervals = ImmutableList.copyOf(inputIntervals); this.wrappedSpec = new ArbitraryGranularitySpec(queryGranularity, granularIntervals); } else { this.inputIntervals = null; this.wrappedSpec = null; } }
Source:
public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); toUpdate.setName(key.getName()); String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); } toUpdate.setServiceLevel(serviceLevel); activationKeyCurator.merge(toUpdate); return toUpdate; }

Target:
public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); toUpdate.setName(key.getName()); String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } activationKeyCurator.merge(toUpdate); return toUpdate; }
Source:
private INDArray asMatrix(BytePointer bytes, long length) throws IOException { PIXA pixa; pixa = pixaReadMemMultipageTiff(bytes, length); INDArray data; INDArray currentD; INDArrayIndex[] index = null; switch (this.multiPageMode) { case MINIBATCH: data = Nd4j.create(pixa.n(), 1, 1, pixa.pix(0).h(), pixa.pix(0).w()); break; case CHANNELS: data = Nd4j.create(1, pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w()); break; case FIRST: data = Nd4j.create(1, 1, 1, pixa.pix(0).h(), pixa.pix(0).w()); PIX pix = pixa.pix(0); currentD = asMatrix(convert(pix)); pixDestroy(pix); index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0), NDArrayIndex.point(0), NDArrayIndex.all(), NDArrayIndex.all()}; data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all())); return data; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } for (int i = 0; i < pixa.n(); i++) { PIX pix = pixa.pix(i); currentD = asMatrix(convert(pix)); pixDestroy(pix); switch (this.multiPageMode) { case MINIBATCH: index = new INDArrayIndex[]{NDArrayIndex.point(i),NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()}; break; case CHANNELS: index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i), NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()}; break; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); } return data; }

Target:
private INDArray asMatrix(BytePointer bytes, long length) throws IOException { PIXA pixa; pixa = pixaReadMemMultipageTiff(bytes, length); INDArray data; INDArray currentD; INDArrayIndex[] index = null; switch (this.multiPageMode) { case MINIBATCH: data = Nd4j.create(pixa.n(), 1, 1, pixa.pix(0).h(), pixa.pix(0).w()); break; case FIRST: data = Nd4j.create(1, 1, 1, pixa.pix(0).h(), pixa.pix(0).w()); PIX pix = pixa.pix(0); currentD = asMatrix(convert(pix)); pixDestroy(pix); index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0), NDArrayIndex.point(0), NDArrayIndex.all(), NDArrayIndex.all()}; data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all())); return data; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } for (int i = 0; i < pixa.n(); i++) { PIX pix = pixa.pix(i); currentD = asMatrix(convert(pix)); pixDestroy(pix); switch (this.multiPageMode) { case MINIBATCH: index = new INDArrayIndex[]{NDArrayIndex.point(i),NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()}; break; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); } return data; }
Source:
private void createSymlink(File downloadedOCBinary) { try { Files.deleteIfExists(OCBinaryFile.get().getFile().toPath()); Files.createSymbolicLink(OCBinaryFile.get().getFile().toPath(), Paths.get(downloadedOCBinary.getAbsolutePath())); } catch (IOException e) { throw new OpenShiftToolsException(NLS.bind("Could not symlink {0} to {1}:\n{3}", new Object[] { OCBinaryFile.get().getFile().getAbsolutePath(), downloadedOCBinary.getAbsolutePath(), e })); } }

Target:
private void createSymlink(File downloadedOCBinary) { try { Files.createSymbolicLink(OCBinaryFile.get().getFile().toPath(), Paths.get(downloadedOCBinary.getAbsolutePath())); } catch (IOException e) { throw new OpenShiftToolsException(NLS.bind("Could not symlink {0} to {1}:\n{2}", new Object[] { OCBinaryFile.get().getFile().getAbsolutePath(), downloadedOCBinary.getAbsolutePath(), e })); } }
Source:
public NotificationDto updateNotificationById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("notificationId") BigInteger notificationId, NotificationDto notificationDto) { try { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, getRemoteUser(req).getUserName()); Alert oldAlert = alertService.findAlertByPrimaryKey(alertId); if (oldAlert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldAlert.getOwner(), owner); for (Notification notification : oldAlert.getNotifications()) { if (notificationId.equals(notification.getId())) { copyProperties(notification, notificationDto); oldAlert.setModifiedBy(getRemoteUser(req)); Alert alert = alertService.updateAlert(oldAlert); int index = alert.getNotifications().indexOf(notification); return NotificationDto.transformToDto(alert.getNotifications().get(index)); } } throw new WebApplicationException("The notification does not exist.", Response.Status.NOT_FOUND); } catch (Exception e) { throw e; } }

Target:
public NotificationDto updateNotificationById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("notificationId") BigInteger notificationId, NotificationDto notificationDto) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, getRemoteUser(req).getUserName()); Alert oldAlert = alertService.findAlertByPrimaryKey(alertId); if (oldAlert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldAlert.getOwner(), owner); for (Notification notification : oldAlert.getNotifications()) { if (notificationId.equals(notification.getId())) { copyProperties(notification, notificationDto); oldAlert.setModifiedBy(getRemoteUser(req)); Alert alert = alertService.updateAlert(oldAlert); int index = alert.getNotifications().indexOf(notification); return NotificationDto.transformToDto(alert.getNotifications().get(index)); } } throw new WebApplicationException("The notification does not exist.", Response.Status.NOT_FOUND); }
Source:
public void insertPastState(long stateStartTime, long stateEndTime, int quark, ITmfStateValue value) throws TimeRangeException { fRwl.writeLock().lock(); fCurrentChunk.add(new HTInterval(stateStartTime, stateEndTime, quark, (TmfStateValue) value)); fRwl.writeLock().unlock(); if (fCurrentChunk.size() >= INTERVAL_CHUNK_SIZE) { try { intervalQueue.put(fCurrentChunk); fCurrentChunk = new ArrayList<>(INTERVAL_CHUNK_SIZE); } catch (InterruptedException e) { Activator.getDefault().logError("State system interrupted", e); } } }

Target:
public void insertPastState(long stateStartTime, long stateEndTime, int quark, ITmfStateValue value) throws TimeRangeException { fCurrentChunk.add(new HTInterval(stateStartTime, stateEndTime, quark, (TmfStateValue) value)); if (fCurrentChunk.size() >= INTERVAL_CHUNK_SIZE) { try { intervalQueue.put(fCurrentChunk); fCurrentChunk = new ArrayList<>(INTERVAL_CHUNK_SIZE); } catch (InterruptedException e) { Activator.getDefault().logError("State system interrupted", e); } } }
Source:
private static String toHtml(SpannableStringBuilder builder, AztecParser parser) { clearMetaSpans(builder); parser.syncVisualNewlinesOfBlockElements(builder); Format.postProcessSpannedText(builder, true); return EndOfBufferMarkerAdder.removeEndOfTextMarker(parser.toHtml(builder, false, false)); }

Target:
private static String toHtml(SpannableStringBuilder builder, AztecParser parser) { clearMetaSpans(builder); parser.syncVisualNewlinesOfBlockElements(builder); Format.postProcessSpannedText(builder, true); return EndOfBufferMarkerAdder.removeEndOfTextMarker(parser.toHtml(builder, false)); }
Source:
public void addChannel(Channel channel) { channelMap.put(channel.getChannelIdentifier(), channel); }

Target:
public boolean addChannel(Channel channel) { if (channelMap.containsKey(channel)){ return false; } else{ channelMap.put(channel.getChannelIdentifier(), channel); return true; } }
Source:
public void whenFlowIdIsPresentDoNotOverride() throws Exception { final EventType eventType = buildDefaultEventType(); final JSONObject event = buildBusinessEvent(); event.getJSONObject("metadata").put("flow_id", "something"); final BatchItem batch = createBatchItem(event); final String flowId = randomString(); FlowIdUtils.push(flowId); strategy.enrich(batch, eventType); assertThat(batch.getEvent().getJSONObject("metadata").getString("flow_id"), equalTo("something")); }

Target:
public void whenFlowIdIsPresentDoNotOverride() throws Exception { final EventType eventType = buildDefaultEventType(); final JSONObject event = buildBusinessEvent(); event.getJSONObject("metadata").put("flow_id", "something"); final BatchItem batch = createBatchItem(event); FlowIdUtils.push("something-else"); strategy.enrich(batch, eventType); assertThat(batch.getEvent().getJSONObject("metadata").getString("flow_id"), equalTo("something")); }
Source:
public void dummyCustomerApiTest() { Tenant tenant = new Tenant("testTenant", 2); Throttler timer = new ThrottleTimerImpl(100); B2BService service = new B2BService(timer); long counter = 0; for (int i = 0; i < 5; i++) { service.dummyCustomerApi(tenant); counter = CallsCount.getCount(tenant.getName()); } Assert.assertTrue("Counter limit must be reached", counter == 2); }

Target:
public void dummyCustomerApiTest() { Tenant tenant = new Tenant("testTenant", 2); Throttler timer = new ThrottleTimerImpl(100); B2BService service = new B2BService(timer); for (int i = 0; i < 5; i++) { service.dummyCustomerApi(tenant); } long counter = CallsCount.getCount(tenant.getName()); Assert.assertTrue("Counter limit must be reached", counter == 2); }
Source:
public void handleModifyEvent(CatalogModifyEvent event) throws CatalogException { if (event.getSource() instanceof PublishedInfo) { Date dateModified = new Date(); PublishedInfo info = (PublishedInfo) event.getSource(); info.getMetadata().put(PublishedInfo.TIME_MODIFIED, dateModified); updateModifyEventMetadata(event, PublishedInfo.TIME_MODIFIED, dateModified); } else if (event.getSource() instanceof StyleInfo) { StyleInfo info = (StyleInfo) event.getSource(); info.getMetadata().put(PublishedInfo.TIME_MODIFIED, new Date()); updateModifyEventMetadata( event, PublishedInfo.TIME_MODIFIED, info.getMetadata().get(PublishedInfo.TIME_MODIFIED, Date.class)); } else if (event.getSource() instanceof StoreInfo) { StoreInfo info = (StoreInfo) event.getSource(); info.getMetadata().put(PublishedInfo.TIME_MODIFIED, new Date()); updateModifyEventMetadata( event, PublishedInfo.TIME_MODIFIED, info.getMetadata().get(PublishedInfo.TIME_MODIFIED, Date.class)); } LOGGER.finest(event.toString()); }

Target:
public void handleModifyEvent(CatalogModifyEvent event) throws CatalogException { if (event.getSource() instanceof PublishedInfo || event.getSource() instanceof StyleInfo || event.getSource() instanceof PublishedInfo || event.getSource() instanceof StoreInfo || event.getSource() instanceof WorkspaceInfo) { CatalogInfo info = (CatalogInfo) event.getSource(); Date dateModified = new Date(); info.setDateModified(dateModified); } LOGGER.finest(event.toString() + " :handleModifyEvent"); }
Source:
public Location resolveCurrentLocation() throws LocationDefinitionErrorException { int numberOfTries = 0; do { URL whatIsMyCity; try { whatIsMyCity = new URL("<LINK_0>"); } catch (MalformedURLException e) { ++numberOfTries; continue; } try { BufferedReader in = new BufferedReader(new InputStreamReader( whatIsMyCity.openStream())); String currentInfo; StringBuilder responseStrBuilder = new StringBuilder(); while ((currentInfo = in.readLine()) != null) { responseStrBuilder.append(currentInfo); } JSONObject locationInfo = new JSONObject(responseStrBuilder.toString()); String[] coordinates = locationInfo .getString("loc").split(","); Location result = new Location( Double.parseDouble(coordinates[0]), Double.parseDouble(coordinates[1])); result.setName(locationInfo.getString("city")); return result; } catch (IOException | JSONException e) { ++numberOfTries; } } while (numberOfTries < TwitterStream.MAX_NUMBER_OF_TRIES); throw new LocationDefinitionErrorException(LOCATION_DEFINITION_ERROR); }

Target:
public Location resolveCurrentLocation() throws LocationDefinitionErrorException, MalformedURLException { int numberOfTries = 0; do { URL whatIsMyCity; whatIsMyCity = new URL("<LINK_0>"); try (BufferedReader in = new BufferedReader(new InputStreamReader( whatIsMyCity.openStream()))) { String currentInfo; StringBuilder responseStrBuilder = new StringBuilder(); while ((currentInfo = in.readLine()) != null) { responseStrBuilder.append(currentInfo); } JSONObject locationInfo = new JSONObject(responseStrBuilder.toString()); String[] coordinates = locationInfo .getString("loc").split(","); Location result = new Location( Double.parseDouble(coordinates[0]), Double.parseDouble(coordinates[1]), locationInfo.getString("city")); return result; } catch (IOException | JSONException e) { ++numberOfTries; } } while (numberOfTries < TwitterStream.MAX_NUMBER_OF_TRIES); throw new LocationDefinitionErrorException(LOCATION_DEFINITION_ERROR); }
Source:
private CheckResult checkResult(AsyncReporter<Span> asyncReporter) { ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<CheckResult> task = asyncReporter::check; Future<CheckResult> future = executor.submit(task); try { return future.get(1, TimeUnit.SECONDS); } catch (Exception ex) { if (log.isDebugEnabled()) { log.debug("An exception took place when trying to retrieve the check result. Will return null.", ex); } return null; } finally { future.cancel(true); executor.shutdown(); } }

Target:
private CheckResult checkResult(AsyncReporter<Span> asyncReporter) { ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<CheckResult> task = asyncReporter::check; Future<CheckResult> future = executor.submit(task); try { return future.get(1, TimeUnit.SECONDS); } catch (Exception ex) { log.warn( "An exception took place when trying to retrieve the check result. Will return null.", ex); return null; } finally { future.cancel(true); executor.shutdown(); } }
Source:
public void toJson() throws Exception { String jsonString = "{" + "\"action\":\"hangup\"" + "}"; assertEquals(jsonString, callModifier.toJson()); }

Target:
public void toJson() throws Exception { String jsonString = "{\"action\":\"hangup\"}"; assertEquals(jsonString, callModifier.toJson()); }
Source:
public void unbindConsumers(String inputChannelName) { this.binder.unbindProducers(inputChannelName); }

Target:
public void unbindConsumers(String inputChannelName) { this.binder.unbindConsumers (inputChannelName); }
Source:
public String getDescription() { if (open) { return DESCRIPTION_REOPENED; } else { return DESCRIPTION_CLOSED; } }

Target:
public String getDescription() { return isOpen ? DESCRIPTION_REOPENED : DESCRIPTION_CLOSED; }
Source:
public void onResume() { super.onResume(); if (!hasTabsChanged) { if (viewPager.getOffscreenPageLimit() != tabsList.size()) { viewPager.setOffscreenPageLimit(tabsList.size()); } } else { setupTabs(); } }

Target:
public void onResume() { super.onResume(); if (hasTabsChanged) setupTabs(); }
Source:
protected final void addConnections() { ((ServerWebSocketInitializer) getSocketInitailizerInstance()).setSslContext(sslCtx); boss = new NioEventLoopGroup(2, new RenamingThreadFactoryProxy("boss", Executors.defaultThreadFactory())); workers = new NioEventLoopGroup(NUMBER_EVENT_WORKERS, new RenamingThreadFactoryProxy("worker", Executors.defaultThreadFactory())); server.group(boss, workers); server.channel(NioServerSocketChannel.class); server.handler(new LoggingHandler(LogLevel.INFO)); server.option(ChannelOption.SO_SNDBUF, SIZE_OF_SEND_BUFFER); server.option(ChannelOption.SO_RCVBUF, SIZE_OF_RCV_BUFFER); server.childOption(ChannelOption.SO_RCVBUF, SIZE_OF_RCV_BUFFER); server.childOption(ChannelOption.SO_SNDBUF, SIZE_OF_SEND_BUFFER); server.option(ChannelOption.TCP_NODELAY, true); final ServerWebSocketInitializer socketInitializer = (ServerWebSocketInitializer) this.getSocketInitailizerInstance(); socketInitializer.initChannel(serverFactory); timeoutExecutor = new TimeoutExecutor(1, MAX_TIMEOUT_POOL_SIZE); timeoutChecker = new TimeoutChecker(); timeoutChecker.setTimeoutExecutor(timeoutExecutor); timeoutChecker.startChecking(serverFactory.getRpcClientRegistry()); if (this.isLocal()) { serverFactory.registerConnectionEventListener(localRpcEventLogger); } server.childHandler(serverFactory); server.localAddress(serverInfo.getPort()); }

Target:
protected final void addConnections() { ((ServerWebSocketInitializer) getSocketInitailizerInstance()).setSslContext(sslContext); boss = new NioEventLoopGroup(2, new RenamingThreadFactoryProxy("boss", Executors.defaultThreadFactory())); workers = new NioEventLoopGroup(NUMBER_EVENT_WORKERS, new RenamingThreadFactoryProxy("worker", Executors.defaultThreadFactory())); server.group(boss, workers); server.channel(NioServerSocketChannel.class); server.handler(new LoggingHandler(LogLevel.INFO)); server.option(ChannelOption.SO_SNDBUF, SIZE_OF_SEND_BUFFER); server.option(ChannelOption.SO_RCVBUF, SIZE_OF_RCV_BUFFER); server.childOption(ChannelOption.SO_SNDBUF, SIZE_OF_SEND_BUFFER); server.childOption(ChannelOption.SO_RCVBUF, SIZE_OF_RCV_BUFFER); server.option(ChannelOption.TCP_NODELAY, true); final ServerWebSocketInitializer socketInitializer = (ServerWebSocketInitializer) this.getSocketInitailizerInstance(); socketInitializer.initChannel(serverFactory); timeoutExecutor = new TimeoutExecutor(1, MAX_TIMEOUT_POOL_SIZE); timeoutChecker = new TimeoutChecker(); timeoutChecker.setTimeoutExecutor(timeoutExecutor); timeoutChecker.startChecking(serverFactory.getRpcClientRegistry()); if (this.isLocal()) { serverFactory.registerConnectionEventListener(localRpcEventLogger); } server.childHandler(serverFactory); server.localAddress(peerInfo.getPort()); }
Source:
public void onNext(final CompletedEvaluator completedEvaluator) { LOG.log(Level.INFO, "CompletedEvaluator: {0}", completedEvaluator); }

Target:
public void onNext(final CompletedEvaluator completedEvaluator) { LOG.log(Level.FINE, "CompletedEvaluator: {0}", completedEvaluator); }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } super.equals(obj); BrickProfileDetails brickDetails = (BrickProfileDetails) obj; if (brickDetails.getBrickId() == null) { return false; } if (!(ObjectUtils.objectsEqual(getBrickId(), brickDetails.getBrickId()))) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if(!super.equals(obj)) { return false; } BrickProfileDetails brickDetails = (BrickProfileDetails) obj; if (brickDetails.getBrickId() == null) { return false; } if (!(ObjectUtils.objectsEqual(getBrickId(), brickDetails.getBrickId()))) { return false; } return true; }
Source:
public Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable { return updateStoreStatistics(ctx, command); }

Target:
public Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable { boolean statisticsEnabled = getStatisticsEnabled(command); if (!statisticsEnabled || !ctx.isOriginLocal()) return invokeNext(ctx, command); long start = timeService.time(); return invokeNextAndFinally(ctx, command, (rCtx, rCommand, rv, t) -> { if (rv == null && command.isSuccessful()) { increaseRemoveMisses(); } else if (command.isSuccessful()) { long intervalMilliseconds = timeService.timeDuration(start, TimeUnit.MILLISECONDS); StripeB stripe = counters.stripeForCurrentThread(); counters.add(StripeB.storeTimesFieldUpdater, stripe, intervalMilliseconds); counters.increment(StripeB.storesFieldUpdater, stripe); } }); }
Source:
protected boolean loadFromSystemProperty(String propertyKey, String... expectedExtensions) { String configSystemProperty = System.getProperty(propertyKey); if (configSystemProperty == null) { LOGGER.finest("Could not find 'hazelcast.config' System property"); return false; } if (expectedExtensions != null && expectedExtensions.length > 0 && !isExpectedExtensionConfigured(configSystemProperty, expectedExtensions)) { return false; } LOGGER.info("Loading configuration " + configSystemProperty + " from System property 'hazelcast.config'"); if (configSystemProperty.startsWith("classpath:")) { loadSystemPropertyClassPathResource(configSystemProperty); } else { loadSystemPropertyFileResource(configSystemProperty); } return true; }

Target:
protected boolean loadFromSystemProperty(String propertyKey, String... expectedExtensions) { try { String configSystemProperty = System.getProperty(propertyKey); if (configSystemProperty == null) { LOGGER.finest(String.format("Could not find '%s' System property", propertyKey)); return false; } if (expectedExtensions != null && expectedExtensions.length > 0 && !isExpectedExtensionConfigured(configSystemProperty, expectedExtensions)) { return false; } LOGGER.info(String.format("Loading configuration '%s' from System property '%s'", configSystemProperty, propertyKey)); if (configSystemProperty.startsWith("classpath:")) { loadSystemPropertyClassPathResource(configSystemProperty); } else { loadSystemPropertyFileResource(configSystemProperty); } return true; } catch (RuntimeException e) { throw new HazelcastException(e); } }
Source:
public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { boolean hasComma = false; final int length = this.length(); writer.write('{'); if (length == 1) { final Entry<String,?> entry = this.entrySet().iterator().next(); final String key = entry.getKey(); writer.write(quote(key)); writer.write(':'); if (indentFactor > 0) { writer.write(' '); } try{ writeValue(writer, entry.getValue(), indentFactor, indent); } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } } else if (length != 0) { final int newIndent = indent + indentFactor; for (final Entry<String,?> entry : this.entrySet()) { if (hasComma) { writer.write(','); } if (indentFactor > 0) { writer.write('\n'); } indent(writer, newIndent); final String key = entry.getKey(); writer.write(quote(key)); writer.write(':'); if (indentFactor > 0) { writer.write(' '); } try { writeValue(writer, entry.getValue(), indentFactor, newIndent); } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } hasComma = true; } if (indentFactor > 0) { writer.write('\n'); } indent(writer, indent); } writer.write('}'); return writer; } catch (IOException exception) { throw new JSONException(exception); } }

Target:
public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { boolean needsComma = false; final int length = this.length(); writer.write('{'); if (length == 1) { final Entry<String,?> entry = this.entrySet().iterator().next(); final String key = entry.getKey(); writer.write(quote(key)); writer.write(':'); if (indentFactor > 0) { writer.write(' '); } try{ writeValue(writer, entry.getValue(), indentFactor, indent); } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } } else if (length != 0) { final int newIndent = indent + indentFactor; for (final Entry<String,?> entry : this.entrySet()) { if (needsComma) { writer.write(','); } if (indentFactor > 0) { writer.write('\n'); } indent(writer, newIndent); final String key = entry.getKey(); writer.write(quote(key)); writer.write(':'); if (indentFactor > 0) { writer.write(' '); } try { writeValue(writer, entry.getValue(), indentFactor, newIndent); } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } needsComma = true; } if (indentFactor > 0) { writer.write('\n'); } indent(writer, indent); } writer.write('}'); return writer; } catch (IOException exception) { throw new JSONException(exception); } }
Source:
public void checkAttributeValue(PerunSessionImpl perunSession, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { List<String> value = (List<String>) attribute.getValue(); for(String address : value) { if(!address.matches(IPv4_PATTERN) && !address.matches(IPv6_PATTERN) && !address.matches(IPv6_PATTERN_SHORT)) throw new WrongAttributeValueException(attribute, "IP address is not in the correct format."); } }

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { List<String> value = attribute.valueAsList(); for (String address : value) { if (!address.matches(IPv4_PATTERN) && !address.matches(IPv6_PATTERN) && !address.matches(IPv6_PATTERN_SHORT)) throw new WrongAttributeValueException(attribute, "IP address is not in the correct format."); } }
Source:
private void translateHeader(Entry<CharSequence, CharSequence> entry) throws Http2Exception { final CharSequence name = entry.getKey(); final CharSequence value = entry.getValue(); AsciiString translatedName = translations.get(name); if (translatedName != null) { output.add(translatedName, AsciiString.of(value)); } else if (!Http2Headers.PseudoHeaderName.isPseudoHeader(name)) { if (name.length() == 0 || name.charAt(0) == ':') { throw streamError(streamId, PROTOCOL_ERROR, "Invalid HTTP/2 header '%s' encountered in translation to HTTP/1.x", name); } if (COOKIE.equals(name)) { if (cookies == null) { cookies = InternalThreadLocalMap.get().stringBuilder(); } else if (cookies.length() > 0) { cookies.append("; "); } cookies.append(value); } else { output.add(name, value); } } }

Target:
private void translateHeader(Entry<CharSequence, CharSequence> entry) throws Http2Exception { }
Source:
public static void writeJobIdToFile(String hadoopJobIdFileName, String hadoopJobId) { if (hadoopJobId != null && hadoopJobIdFileName != null) { try { HadoopDruidIndexerConfig.JSON_MAPPER.writeValue( new OutputStreamWriter(new FileOutputStream(new File(hadoopJobIdFileName)), StandardCharsets.UTF_8), hadoopJobId ); log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName); } catch (IOException e) { log.warn(e, "Error writing job id [%s] to the file [%s]", hadoopJobId, hadoopJobIdFileName); } } else { log.info("Either job Id or File Name is null for the submitted job. Skipping writing the file [%s]", hadoopJobIdFileName); } }

Target:
public static void writeJobIdToFile(String hadoopJobIdFileName, String hadoopJobId) { if (hadoopJobId != null && hadoopJobIdFileName != null) { try { HadoopDruidIndexerConfig.JSON_MAPPER.writeValue( new OutputStreamWriter(new FileOutputStream(new File(hadoopJobIdFileName)), StandardCharsets.UTF_8), hadoopJobId ); log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName); } catch (IOException e) { log.warn(e, "Error writing job id [%s] to the file [%s]", hadoopJobId, hadoopJobIdFileName); } } else { log.info("Either job id or file name is null for the submitted job. Skipping writing the file [%s]", hadoopJobIdFileName); } }
Source:
public Iterable<InstanceInZone> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<InstanceInZone>() { @Override public boolean apply(InstanceInZone instance) { return contains(ids, instance.getInstance().getName()); } }); }

Target:
public Iterable<InstanceInZone> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<InstanceInZone>() { @Override public boolean apply(InstanceInZone instanceInZone) { return contains(ids, instanceInZone.getInstance().getName()); } }); }
Source:
public static Instance ofEndpoint(String endpoint, String name, String userName, String password, boolean verify) throws IOException { boolean possible_integ = true; if (endpoint == null) { endpoint = System.getenv(Util.ICP4D_DEPLOYMENT_URL); if (endpoint == null) { possible_integ = false; endpoint = System.getenv(Util.STREAMS_REST_URL); if (endpoint == null) { return null; } } } if (possible_integ && name == null) name = System.getenv(Util.STREAMS_INSTANCE_ID); StreamsConnection conn = null; Instance instance = null; if (name != null) { conn = createIntegratedConnection(endpoint, name, userName, password, verify); if (!verify) { conn.allowInsecureHosts(true); } instance = conn.getInstance(name); } else { conn = createStandaloneConnection(endpoint, userName, password, verify); if (!verify) { conn.allowInsecureHosts(true); } List<Instance> instances = conn.getInstances(); if (instances.size() != 1) { return null; } instance = instances.get(0); } return instance; }

Target:
public static Instance ofEndpoint(String endpoint, String name, String userName, String password, boolean verify) throws IOException { boolean possible_integ = true; if (endpoint == null) { endpoint = System.getenv(Util.ICP4D_DEPLOYMENT_URL); if (endpoint == null) { possible_integ = false; endpoint = System.getenv(Util.STREAMS_REST_URL); if (endpoint == null) { return null; } } } if (possible_integ && name == null) name = System.getenv(Util.STREAMS_INSTANCE_ID); StreamsConnection conn; Instance instance = null; if (name != null) { conn = createIntegratedConnection(endpoint, name, userName, password, verify); if (!verify) { conn.allowInsecureHosts(true); } instance = conn.getInstance(name); } else { conn = createStandaloneConnection(endpoint, userName, password, verify); if (!verify) { conn.allowInsecureHosts(true); } List<Instance> instances = conn.getInstances(); if (instances.size() != 1) { return null; } instance = instances.get(0); } return instance; }
Source:
public void init() { boolean disablePublish = Boolean.parseBoolean(properties.getProperty(DISABLE_PUBLISH_FILTERING_PROP, DISABLE_PUBLISH_FILTERING_ENV, "false")); boolean resetCache = Boolean.parseBoolean(properties.getProperty(RESET_PUBLISH_CACHE_PROP, RESET_PUBLISH_CACHE_ENV, "true")); if (!disablePublish) { if (resetCache) { msgLog.warnClearPublishCache(); publishCache.clear(); } msgLog.infoInitPublishCache(); initialCacheUpdate(); definitions.registerListener(events -> { events.stream().forEach(e -> { String tenantId = e.getTargetTenantId(); String triggerId = e.getTargetId(); TriggerKey triggerKey = new TriggerKey(tenantId, triggerId); Set<String> oldDataIds = dataIdsCache.get(triggerKey); removePublishCache(tenantId, triggerId, oldDataIds); if (e.getType().equals(TRIGGER_CONDITION_CHANGE)) { Set<String> newDataIds = e.getDataIds(); dataIdsCache.put(triggerKey, newDataIds); addPublishCache(tenantId, triggerId, newDataIds); } }); }, TRIGGER_CONDITION_CHANGE, TRIGGER_REMOVE); } else { msgLog.warnDisabledPublishCache(); } }

Target:
public void init() { boolean disablePublish = Boolean.parseBoolean(properties.getProperty(DISABLE_PUBLISH_FILTERING_PROP, DISABLE_PUBLISH_FILTERING_ENV, "false")); boolean resetCache = Boolean.parseBoolean(properties.getProperty(RESET_PUBLISH_CACHE_PROP, RESET_PUBLISH_CACHE_ENV, "true")); if (!disablePublish) { if (resetCache) { msgLog.warnClearPublishCache(); publishCache.clear(); publishDataIdsCache.clear(); } msgLog.infoInitPublishCache(); initialCacheUpdate(); definitions.registerListener(events -> { events.stream().forEach(e -> { String tenantId = e.getTargetTenantId(); String triggerId = e.getTargetId(); TriggerKey triggerKey = new TriggerKey(tenantId, triggerId); Set<String> oldDataIds = publishDataIdsCache.get(triggerKey); removePublishCache(tenantId, triggerId, oldDataIds); if (e.getType().equals(TRIGGER_CONDITION_CHANGE)) { Set<String> newDataIds = e.getDataIds(); publishDataIdsCache.put(triggerKey, newDataIds); addPublishCache(tenantId, triggerId, newDataIds); } }); }, TRIGGER_CONDITION_CHANGE, TRIGGER_REMOVE); } else { msgLog.warnDisabledPublishCache(); } }
Source:
public BasicReplicator(Replication replication) { this.replication = replication; this.state = State.PENDING; }

Target:
public BasicReplicator(Replication replication) { this(replication, NULL_ID); }
Source:
public String resolveServer(final int hash) { try { if (!initialized) { synchronized (this) { sender.get().sendRoutingTableRequestMsg(); this.wait(INITIALIZATION_TIMEOUT_MS); } } } catch (final InterruptedException e) { throw new RuntimeException("Failed to initialize routing table for resolving server", e); } final int blockId = hash % numTotalBlocks; return storeIdToEndpointId.get(blockIdToStoreId.get(blockId)); }

Target:
public String resolveServer(final int hash) { try { if (!initialized) { synchronized (this) { this.wait(INITIALIZATION_TIMEOUT_MS); } } } catch (final InterruptedException e) { throw new RuntimeException("Failed to initialize routing table for resolving server", e); } final int blockId = hash % numTotalBlocks; return storeIdToEndpointId.get(blockIdToStoreId.get(blockId)); }
Source:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, providerProxyFactory); if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (EngineException e) { AuditLogable loggable = new AuditLogableImpl(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }

Target:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, Injector.get(ProviderProxyFactory.class)); if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (EngineException e) { AuditLogable loggable = new AuditLogableImpl(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }
Source:
public synchronized List<AsyncTaskStatus> pollTasks(List<Guid> vdsmTaskIdList) { ArrayList<AsyncTaskStatus> returnValue = new ArrayList<>(); if (vdsmTaskIdList != null && vdsmTaskIdList.size() > 0) { for (Guid vdsmTaskId : vdsmTaskIdList) { if (_tasks.containsKey(vdsmTaskId)) { _tasks.get(vdsmTaskId).setLastStatusAccessTime(); returnValue.add(_tasks.get(vdsmTaskId).getLastTaskStatus()); } else { log.warn( "Polling tasks. Task ID '{}' doesn't exist in the manager -> assuming 'finished'.", vdsmTaskId); AsyncTaskStatus tempVar = new AsyncTaskStatus(); tempVar.setStatus(AsyncTaskStatusEnum.finished); tempVar.setResult(AsyncTaskResultEnum.success); returnValue.add(tempVar); } } } return returnValue; }

Target:
public synchronized List<AsyncTaskStatus> pollTasks(List<Guid> vdsmTaskIdList) { List<AsyncTaskStatus> returnValue = new ArrayList<>(); if (vdsmTaskIdList != null && vdsmTaskIdList.size() > 0) { for (Guid vdsmTaskId : vdsmTaskIdList) { if (_tasks.containsKey(vdsmTaskId)) { _tasks.get(vdsmTaskId).setLastStatusAccessTime(); returnValue.add(_tasks.get(vdsmTaskId).getLastTaskStatus()); } else { log.warn( "Polling tasks. Task ID '{}' doesn't exist in the manager -> assuming 'finished'.", vdsmTaskId); AsyncTaskStatus tempVar = new AsyncTaskStatus(); tempVar.setStatus(AsyncTaskStatusEnum.finished); tempVar.setResult(AsyncTaskResultEnum.success); returnValue.add(tempVar); } } } return returnValue; }