auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized void updateQuotaCache() { if (!isCacheUpdateNeeded()) { return; } log.debug("Updating Quota Cache..."); long timeStart = System.currentTimeMillis(); List<Quota> allQuotaIncludingConsumption = getQuotaDAO().getAllQuotaIncludingConsumption(); if (allQuotaIncludingConsumption.isEmpty()) { return; } lock.writeLock().lock(); try { for (Quota quota : allQuotaIncludingConsumption) { if (!storagePoolQuotaMap.containsKey(quota.getStoragePoolId())) { storagePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid,Quota>()); } storagePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota); } } finally { lock.writeLock().unlock(); } long timeEnd = System.currentTimeMillis(); log.debugFormat("Quota Cache updated. ({0} msec)", timeEnd-timeStart); }

Target:
public synchronized void updateQuotaCache() { if (!isCacheUpdateNeeded()) { return; } log.debug("Updating Quota Cache..."); long timeStart = System.currentTimeMillis(); List<Quota> allQuotaIncludingConsumption = getQuotaDAO().getAllQuotaIncludingConsumption(); if (allQuotaIncludingConsumption.isEmpty()) { return; } HashMap<Guid, Map<Guid, Quota>> newStoragePoolQuotaMap = new HashMap<Guid, Map<Guid, Quota>>(); for (Quota quota : allQuotaIncludingConsumption) { if (!newStoragePoolQuotaMap.containsKey(quota.getStoragePoolId())) { newStoragePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid,Quota>()); } newStoragePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota); } lock.writeLock().lock(); try { storagePoolQuotaMap = newStoragePoolQuotaMap; } finally { lock.writeLock().unlock(); } long timeEnd = System.currentTimeMillis(); log.debugFormat("Quota Cache updated. ({0} msec)", timeEnd-timeStart); }
Source:
private void createSampleBoard() { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); panelData.add(new PanelInfo(FIRST_SAMPLE_PANEL_NAME, FIRST_SAMPLE_FILTER)); panelData.add(new PanelInfo(SECOND_SAMPLE_PANEL_NAME, SECOND_SAMPLE_FILTER)); panelData.add(new PanelInfo(THIRD_SAMPLE_PANEL_NAME, THIRD_SAMPLE_FILTER)); createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD + " has been created and loaded.\n\n" + "It is saved under the name \"" + SAMPLE_BOARD + "\"."); }

Target:
private void createSampleBoard() { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); for (int i = 0; i < SAMPLE_PANEL_NAMES.size(); i++) { panelData.add(new PanelInfo(SAMPLE_PANEL_NAMES.get(i), SAMPLE_PANEL_FILTERS.get(i))); } createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD_DIALOG); }
Source:
public void delete( Context context, Request request, Response response ) throws ResourceException { String repoId = this.getRepositoryId( request ); try { getNexus().deleteRepository( repoId ); response.setStatus( Status.SUCCESS_NO_CONTENT ); } catch ( ConfigurationException e ) { getLogger().warn( e.getMessage() ); throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage(), e ); } catch ( NoSuchRepositoryAccessException e ) { getLogger().warn( "Repository access denied, id=" + repoId ); throw new ResourceException( Status.CLIENT_ERROR_FORBIDDEN, "Access Denied to Repository" ); } catch ( NoSuchRepositoryException e ) { getLogger().warn( "Repository not found, id=" + repoId ); throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, "Repository Not Found" ); } catch ( IOException e ) { getLogger().warn( "Got IO Exception!", e ); throw new ResourceException( Status.SERVER_ERROR_INTERNAL ); } catch ( AccessDeniedException e ) { getLogger().warn( "Not allowed to delete repository '" + repoId + "'", e ); throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Not allowed to delete repository '" + repoId + "'" ); } }

Target:
public void delete( Context context, Request request, Response response ) throws ResourceException { String repoId = this.getRepositoryId( request ); try { getNexus().deleteRepository( repoId ); response.setStatus( Status.SUCCESS_NO_CONTENT ); } catch ( RepositoryDependentException e ) { getLogger().info( e.getMessage() ); throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, e.getUIMessage(), e ); } catch ( ConfigurationException e ) { getLogger().warn( e.getMessage() ); throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage(), e ); } catch ( NoSuchRepositoryAccessException e ) { getLogger().warn( "Repository access denied, id=" + repoId ); throw new ResourceException( Status.CLIENT_ERROR_FORBIDDEN, "Access Denied to Repository" ); } catch ( NoSuchRepositoryException e ) { getLogger().warn( "Repository not found, id=" + repoId ); throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, "Repository Not Found" ); } catch ( IOException e ) { getLogger().warn( "Got IO Exception!", e ); throw new ResourceException( Status.SERVER_ERROR_INTERNAL ); } catch ( AccessDeniedException e ) { getLogger().warn( "Not allowed to delete repository '" + repoId + "'", e ); throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Not allowed to delete repository '" + repoId + "'" ); } }
Source:
public <S extends Message, T extends Message> void dispatch(SinkModule<S, T> module, String topic, T message) { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { LOG.trace("dispatch({}): sending message {}", topic, message); String messageId = UUID.randomUUID().toString(); byte[] messageInBytes = wrapMessageToProto(messageId, module.marshal(message)); final ProducerRecord<String,byte[]> record = new ProducerRecord<>(topic, messageId, messageInBytes); while(true) { try { final Future<RecordMetadata> future = producer.send(record); future.get(); break; } catch (InterruptedException e) { LOG.warn("Interrupted while sending message to topic {}.", topic, e); Thread.currentThread().interrupt(); break; } catch (ExecutionException e) { if (e.getCause() != null && e.getCause() instanceof TimeoutException) { LOG.warn("Timeout occured while sending message to topic {}, it will be attempted again.", topic, e); } else { LOG.error("Exception occured while sending message to topic ", e); break; } } } } }

Target:
public <S extends Message, T extends Message> void dispatch(SinkModule<S, T> module, String topic, T message) { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { LOG.trace("dispatch({}): sending message {}", topic, message); String messageId = UUID.randomUUID().toString(); byte[] messageInBytes = wrapMessageToProto(messageId, module.marshal(message)); final ProducerRecord<String,byte[]> record = new ProducerRecord<>(topic, messageId, messageInBytes); while(true) { try { final Future<RecordMetadata> future = producer.send(record); future.get(); break; } catch (InterruptedException e) { LOG.warn("Interrupted while sending message to topic {}.", topic, e); Thread.currentThread().interrupt(); break; } catch (ExecutionException e) { if (e.getCause() != null && e.getCause() instanceof TimeoutException) { LOG.warn("Timeout occured while sending message to topic {}, it will be attempted again.", topic); } else { LOG.error("Exception occured while sending message to topic ", e); break; } } } } }
Source:
private static int cnt(int max) { return Stream.range(2, max + 1) .flatMap(a -> Stream.range(2, max + 1) .map(b -> BigInteger.valueOf(a).pow(b))) .distinct() .length(); }

Target:
private static int cnt(int max) { return Stream.rangeClosed(2, max) .map(BigInteger::valueOf) .flatMap(a -> Stream.rangeClosed(2, max).map(a::pow)) .distinct() .length(); }
Source:
protected void initializeModelHandlers(final TagListModel model) { super.initializeModelHandlers(model); model.getResetRequestedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (model.getItems() == null) { return; } Iterator<TagModel> iterator = model.getItems().iterator(); if (iterator.hasNext()) { TagModel root = model.cloneTagModel(iterator.next()); updateDataProvider(Arrays.asList(root)); } } }); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("SelectedItems".equals(args.propertyName)) { if (getSelectionModel().getSelectedObject() != null) { TagActivatedEvent.fire(TagModelProvider.this, findRootNode(getSelectionModel().getSelectedObject())); } } } private TagModel findRootNode(TagModel tagModel) { if (tagModel.getParent() != null) { return findRootNode(tagModel.getParent()); } return tagModel; } }); }

Target:
protected void initializeModelHandlers(final TagListModel model) { super.initializeModelHandlers(model); model.getResetRequestedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (model.getItems() == null) { return; } Iterator<TagModel> iterator = model.getItems().iterator(); if (iterator.hasNext()) { TagModel root = model.cloneTagModel(iterator.next()); updateDataProvider(Arrays.asList(root)); } } }); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("SelectedItems".equals(args.propertyName)) { if (getSelectionModel().getSelectedObject() != null) { TagActivationChangedEvent.fire(TagModelProvider.this, findRootNode(getSelectionModel().getSelectedObject())); } } } private TagModel findRootNode(TagModel tagModel) { if (tagModel.getParent() != null) { return findRootNode(tagModel.getParent()); } return tagModel; } }); }
Source:
public SubmissionResult call() { logger.info("Submitting exercise {}", exercise.getName()); informObserver(0, "Submitting exercise to server"); URI submissionUrl = tmcServerCommunicationTaskFactory.getSkillifierUrl(exercise.getName() + "/submit?username=" + TmcSettingsHolder.get().getToken().get()); logger.info("submissionurl: {}", submissionUrl.toString()); String networkResult = ""; try { networkResult = tmcServerCommunicationTaskFactory.getSubmissionFetchTask(submissionUrl).call(); logger.info("network result: {}", networkResult); } catch (Exception e) { informObserver(1, "Error while waiting for response from server"); logger.warn("Error while updating adaptive submission status from server, continuing", e); } Gson gson = new GsonBuilder().create(); SubmissionResult result = gson.fromJson(networkResult, AdaptiveSubmissionResult.class).toSubmissionResult(); if (!"null".equals(result.getError())) { logger.warn("submission result error: " + result.getError()); } return result; }

Target:
public SubmissionResult call() { logger.info("Submitting exercise {}", exercise.getName()); informObserver(0, "Submitting exercise to server"); URI submissionUrl = tmcServerCommunicationTaskFactory.getSkillifierUrl(exercise.getName() + "/submit?username=" + TmcSettingsHolder.get().getToken().get()); logger.info("submissionurl: {}", submissionUrl.toString()); String networkResult = ""; try { networkResult = tmcServerCommunicationTaskFactory.getSubmissionFetchTask(submissionUrl).call(); logger.info("network result: {}", networkResult); } catch (Exception e) { informObserver(1, "Error while waiting for response from server"); logger.warn("Error while updating adaptive submission status from server.", e); } Gson gson = new GsonBuilder().create(); SubmissionResult result = gson.fromJson(networkResult, AdaptiveSubmissionResult.class).toSubmissionResult(); if (!"null".equals(result.getError())) { logger.warn("Submission result error: " + result.getError()); } return result; }
Source:
protected void createPreparedStatement(Connection db) throws SQLException { String quoteString = JdbcUtils.getIdentifierQuoteString(db); stmt = db.prepareStatement("SELECT * FROM " + quoteString + name + quoteString); }

Target:
protected void createPreparedStatement(Connection db) throws SQLException { String quoteString = JdbcUtils.getIdentifierQuoteString(db); stmt = db.prepareStatement("SELECT * FROM " + JdbcUtils.quoteString(name, quoteString)); }
Source:
public void testLargeGeometryToBingTiles() throws Exception { Path filePath = Paths.get(this.getClass().getClassLoader().getResource("large_polygon.txt").getPath()); List<String> lines = Files.lines(filePath).collect(Collectors.toList()); for (String line : lines) { String[] parts = line.split("\\|"); String wkt = parts[0]; int zoomLevel = Integer.parseInt(parts[1]); long tileCount = Long.parseLong(parts[2]); assertFunction("cardinality(geometry_to_bing_tiles(ST_GeometryFromText('" + wkt + "'), " + zoomLevel + "))", BIGINT, tileCount); } }

Target:
public void testLargeGeometryToBingTiles() throws Exception { Path filePath = Paths.get(this.getClass().getClassLoader().getResource("large_polygon.txt").getPath()); List<String> lines = Files.readAllLines(filePath); for (String line : lines) { String[] parts = line.split("\\|"); String wkt = parts[0]; int zoomLevel = Integer.parseInt(parts[1]); long tileCount = Long.parseLong(parts[2]); assertFunction("cardinality(geometry_to_bing_tiles(ST_GeometryFromText('" + wkt + "'), " + zoomLevel + "))", BIGINT, tileCount); } }
Source:
protected boolean checkExistingStorageDomain() { if (DbFacade.getInstance().getStorageDomainStaticDao().get(getStorageDomain().getId()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } Pair<StorageDomainStatic, Guid> domainFromIrs = (Pair<StorageDomainStatic, Guid>) runVdsCommand( VDSCommandType.HSMGetStorageDomainInfo, new HSMGetStorageDomainInfoVDSCommandParameters(getVdsId(), getStorageDomain().getId()) ).getReturnValue(); if (domainFromIrs == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } return concreteCheckExistingStorageDomain(domainFromIrs); }

Target:
protected boolean checkExistingStorageDomain() { if (DbFacade.getInstance().getStorageDomainStaticDao().get(getStorageDomain().getId()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } Pair<StorageDomainStatic, Guid> domainFromIrs = executeHSMGetStorageDomainInfo(new HSMGetStorageDomainInfoVDSCommandParameters(getVdsId(), getStorageDomain().getId()); if (domainFromIrs == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } return concreteCheckExistingStorageDomain(domainFromIrs); }
Source:
public static void setSerializationStrategy(SerializationStrategy serializationStrategy) { if (serializationStrategy == null) { throw new IllegalArgumentException("Serialization strategy can't be null"); } strategy = serializationStrategy; }

Target:
public static void setSerializationStrategy(SerializationStrategy serializationStrategy) { Assert.notNull(serializationStrategy, "Serialization strategy can't be null"); strategy = serializationStrategy; }
Source:
beginRecognizeReceipts(Flux<ByteBuffer> receipt, long length, RecognizeOptions recognizeOptions) { try { Objects.requireNonNull(receipt, "'receipt' is required and cannot be null."); recognizeOptions = getRecognizeOptionsProperties(recognizeOptions); final boolean isIncludeFieldElements = recognizeOptions.isIncludeFieldElements(); return new PollerFlux<>( recognizeOptions.getPollInterval(), streamActivationOperation( (contentType -> service.analyzeReceiptAsyncWithResponseAsync( contentType, receipt, length, isIncludeFieldElements).map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation())))), receipt, recognizeOptions.getContentType()), pollingOperation(service::getAnalyzeReceiptResultWithResponseAsync), (activationResponse, context) -> monoError(logger, new RuntimeException("Cancellation is not supported")), fetchingOperation(service::getAnalyzeReceiptResultWithResponseAsync) .andThen(after -> after.map(modelSimpleResponse -> { throwIfAnalyzeStatusInvalid(modelSimpleResponse.getValue()); return toRecognizedForm(modelSimpleResponse.getValue().getAnalyzeResult(), isIncludeFieldElements); }).onErrorMap(Utility::mapToHttpResponseExceptionIfExist))); } catch (RuntimeException ex) { return PollerFlux.error(ex); } }

Target:
beginRecognizeReceipts(Flux<ByteBuffer> receipt, long length, RecognizeOptions recognizeOptions) { return beginRecognizeReceipts(receipt, length, recognizeOptions, Context.NONE); }
Source:
public void setAnalysisCache(final AnalysisCache cache) { if (cache == null && isAnalysisCacheFunctional()) { analysisCache = new NoopAnalysisCache(); if (!isIgnoreIncrementalAnalysis() && LOG.isLoggable(Level.WARNING)) { final String version = PMDVersion.isUnknown() || PMDVersion.isSnapshot() ? "latest" : "pmd-" + PMDVersion.VERSION; LOG.warning("This analysis could be faster, please consider using Incremental Analysis: " + "<LINK_0>" + version + "/pmd_userdocs_getting_started.html#incremental-analysis"); } } else if (!isIgnoreIncrementalAnalysis()) { analysisCache = cache; } }

Target:
public void setAnalysisCache(final AnalysisCache cache) { this.analysisCache = cache == null ? new NoopAnalysisCache() : cache; }
Source:
public Response getPaymentEvents(@ApiParam(value = "accountId", hidden = true) @Auth Account account, @PathParam("paymentId") String paymentId) { logger.info("Payment events request - payment_id={}", paymentId); String url = account.getPaymentType().equals(DIRECT_DEBIT) ? connectorDDUrl : connectorUrl; UriBuilder builder = UriBuilder .fromPath(url) .path(format("/v1/api/accounts/%s/charges/%s/events", account.getAccountId(), paymentId)); Collections.<Pair<String, String>>emptyList().stream().forEach(pair -> { if (isNotBlank(pair.getRight())) { builder.queryParam(pair.getKey(), pair.getValue()); } }); Response connectorResponse = client .target(builder.toString()) .request() .get(); if (connectorResponse.getStatus() == SC_OK) { JsonNode payload = connectorResponse.readEntity(JsonNode.class); URI paymentEventsLink = publicApiUriGenerator.getPaymentEventsURI(baseUrl, payload.get("charge_id").asText()); URI paymentLink = publicApiUriGenerator.getPaymentURI(baseUrl, payload.get("charge_id").asText()); PaymentEvents response = PaymentEvents.createPaymentEventsResponse(payload, paymentLink.toString()) .withSelfLink(paymentEventsLink.toString()); logger.info("Payment events returned - [ ]", response); return Response.ok(response).build(); } throw new GetEventsException(connectorResponse); }

Target:
public Response getPaymentEvents(@ApiParam(value = "accountId", hidden = true) @Auth Account account, @PathParam("paymentId") String paymentId) { logger.info("Payment events request - payment_id={}", paymentId); Response connectorResponse = client .target(connectorUriGenerator.chargeEventsURI(account, paymentId)) .request() .get(); if (connectorResponse.getStatus() == SC_OK) { JsonNode payload = connectorResponse.readEntity(JsonNode.class); URI paymentEventsLink = publicApiUriGenerator.getPaymentEventsURI(payload.get("charge_id").asText()); URI paymentLink = publicApiUriGenerator.getPaymentURI(payload.get("charge_id").asText()); PaymentEvents response = PaymentEvents.createPaymentEventsResponse(payload, paymentLink.toString()) .withSelfLink(paymentEventsLink.toString()); logger.info("Payment events returned - [ ]", response); return Response.ok(response).build(); } throw new GetEventsException(connectorResponse); }
Source:
private String loadProjectStructureFromTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { final File outputFile = FileUtil.createTempFile("pants_depmap_run", ".out"); final GeneralCommandLine command = getCommand(outputFile, statusConsumer); statusConsumer.consume("Exporting Pants project into IDEA format..."); PantsMetrics.markExportStart(); final ProcessOutput processOutput = getProcessOutput(command); PantsMetrics.markExportEnd(); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade your pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", command.getCommandLineString("pants"), processOutput); } }

Target:
private String loadProjectStructureFromTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { final File outputFile = FileUtil.createTempFile("pants_depmap_run", ".out"); final GeneralCommandLine command = getCommand(outputFile, statusConsumer); statusConsumer.consume("Resolving dependencies..."); PantsMetrics.markExportStart(); final ProcessOutput processOutput = getProcessOutput(command); PantsMetrics.markExportEnd(); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade your pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", command.getCommandLineString("pants"), processOutput); } }
Source:
public boolean configureAndStart(MediaFormat format, TestSurface surface) { mSurface = surface; Log.i(TAG, "configure(" + format + ", " + mSurface.getSurface() + ")"); try{ mCodec.configure(format, mSurface.getSurface(), null , 0 ); } catch (Exception e){ Log.i(TAG, "Unsupported Codec"); return false; } Log.i(TAG, "start"); mCodec.start(); mInputBuffers = mCodec.getInputBuffers(); mOutputBuffers = mCodec.getOutputBuffers(); Log.i(TAG, "configured " + mInputBuffers.length + " input[" + mInputBuffers[0].capacity() + "] and " + mOutputBuffers.length + "output[" + (mOutputBuffers[0] == null ? null : mOutputBuffers[0].capacity()) + "]"); mQueuedEos = false; return true; }

Target:
public boolean configureAndStart(MediaFormat format, TestSurface surface) { mSurface = surface; Log.i(TAG, "configure(" + format + ", " + mSurface.getSurface() + ")"); try{ mCodec.configure(format, mSurface.getSurface(), null , 0 ); } catch (Exception e){ Log.i(TAG, "Unsupported Codec"); return false; } Log.i(TAG, "start"); mCodec.start(); mInputBuffers = mCodec.getInputBuffers(); mOutputBuffers = mCodec.getOutputBuffers(); Log.i(TAG, "configured " + mInputBuffers.length + " input[" + mInputBuffers[0].capacity() + "] and " + mOutputBuffers.length + "output[" + (mOutputBuffers[0] == null ? null : mOutputBuffers[0].capacity()) + "]"); mQueuedEos = false; mConfigured = true; return true; }
Source:
public static String getSamtoolsBin() { final String samtoolsPath = System.getenv(SAMTOOLS_BIN_PROPERTY); return samtoolsPath == null ? "/usr/local/bin/samtools" : samtoolsPath; }

Target:
public static String getSamtoolsBin() { final String samtoolsPath = System.getenv(SAMTOOLS_BINARY_ENV_VARIABLE); return samtoolsPath == null ? "/usr/local/bin/samtools" : samtoolsPath; }
Source:
@Override public void run() { try { Integer exitStatus = controller._exitStatus(workspace); long lastLocation = 0; FilePath lastLocationFile = controller.getLastLocationFile(workspace); if (lastLocationFile.exists()) { lastLocation = Long.parseLong(lastLocationFile.readToString()); } FilePath logFile = controller.getLogFile(workspace); long len = logFile.length(); if (len > lastLocation) { assert !logFile.isRemote(); try (FileChannel ch = FileChannel.open(Paths.get(logFile.getRemote()), StandardOpenOption.READ)) { InputStream locallyEncodedStream = Channels.newInputStream(ch.position(lastLocation)); InputStream utf8EncodedStream; Charset nativeEncoding = Charset.defaultCharset(); if (nativeEncoding.equals(StandardCharsets.UTF_8)) { utf8EncodedStream = locallyEncodedStream; } else { utf8EncodedStream = new ReaderInputStream(new InputStreamReader(locallyEncodedStream, nativeEncoding), StandardCharsets.UTF_8); } CountingInputStream cis = new CountingInputStream(utf8EncodedStream); handler.output(cis); lastLocationFile.write(Long.toString(lastLocation + cis.getByteCount()), null); } } if (exitStatus != null) { byte[] output; if (controller.getOutputFile(workspace).exists()) { output = controller._getOutput(workspace); } else { output = null; } handler.exited(exitStatus, output); controller.cleanup(workspace); } else { watchService().schedule(this, 100, TimeUnit.MILLISECONDS); } } catch (Exception x) { LOGGER.log(Level.WARNING, "giving up on watching " + controller.controlDir, x); } }

Target:
@Override public void run() { try { Integer exitStatus = controller.exitStatus(workspace, listener); long lastLocation = 0; FilePath lastLocationFile = controller.getLastLocationFile(workspace); if (lastLocationFile.exists()) { lastLocation = Long.parseLong(lastLocationFile.readToString()); } FilePath logFile = controller.getLogFile(workspace); long len = logFile.length(); if (len > lastLocation) { assert !logFile.isRemote(); try (FileChannel ch = FileChannel.open(Paths.get(logFile.getRemote()), StandardOpenOption.READ)) { InputStream locallyEncodedStream = Channels.newInputStream(ch.position(lastLocation)); InputStream utf8EncodedStream = cs == null ? locallyEncodedStream : new ReaderInputStream(new InputStreamReader(locallyEncodedStream, cs), StandardCharsets.UTF_8); CountingInputStream cis = new CountingInputStream(utf8EncodedStream); handler.output(cis); lastLocationFile.write(Long.toString(lastLocation + cis.getByteCount()), null); } } if (exitStatus != null) { byte[] output; if (controller.getOutputFile(workspace).exists()) { output = controller.getOutput(workspace); } else { output = null; } handler.exited(exitStatus, output); controller.cleanup(workspace); } else { watchService().schedule(this, 100, TimeUnit.MILLISECONDS); } } catch (Exception x) { LOGGER.log(Level.WARNING, "giving up on watching " + controller.controlDir, x); } }
Source:
private MessageActionDTO handleAction_Process(UserDTO actingUser, BuddyInfoChangeMessage messageEntity, MessageActionDTO requestPayload) { if (messageEntity.getRelatedUserAnonymizedID().isPresent()) { buddyService.updateBuddyInfo(actingUser.getID(), messageEntity.getRelatedUserAnonymizedID().get(), messageEntity.getNewNickname()); } messageEntity = updateMessageStatusAsProcessed(messageEntity); return MessageActionDTO.createInstanceActionDone(theDTOFactory.createInstance(actingUser, messageEntity)); }

Target:
private MessageActionDTO handleAction_Process(UserDTO actingUser, BuddyInfoChangeMessage messageEntity, MessageActionDTO requestPayload) { if (messageEntity.getRelatedUserAnonymizedID().isPresent()) { buddyService.updateBuddyUserInfo(actingUser.getID(), messageEntity.getRelatedUserAnonymizedID().get(), messageEntity.getNewNickname()); } messageEntity = updateMessageStatusAsProcessed(messageEntity); return MessageActionDTO.createInstanceActionDone(theDTOFactory.createInstance(actingUser, messageEntity)); }
Source:
public void onViewStateRestored(Bundle savedInstanceState) { String stopId = savedInstanceState.getString(MapParams.STOP_ID); if (stopId == null) { float mapZoom = savedInstanceState.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); if (mapZoom != MapParams.DEFAULT_ZOOM) { mFragment.getMapView().setZoom(mapZoom); } double lat = savedInstanceState.getDouble(MapParams.CENTER_LAT); double lon = savedInstanceState.getDouble(MapParams.CENTER_LON); if (lat != 0d && lon != 0d) { Location location = LocationUtils.makeLocation(lat, lon); mFragment.getMapView().setMapCenter(location, true, false); } } }

Target:
public void onViewStateRestored(Bundle savedInstanceState) { String stopId = savedInstanceState.getString(MapParams.STOP_ID); if (stopId == null) { float mapZoom = savedInstanceState.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); if (mapZoom != MapParams.DEFAULT_ZOOM) { mFragment.getMapView().setZoom(mapZoom); } double lat = savedInstanceState.getDouble(MapParams.CENTER_LAT); double lon = savedInstanceState.getDouble(MapParams.CENTER_LON); if (lat != 0.0d && lon != 0.0d) { Location location = LocationUtils.makeLocation(lat, lon); mFragment.getMapView().setMapCenter(location, false, false); } } }
Source:
public void shouldReturnNotEnrolledWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertEquals(false, ((ProgramEnrollment) object).isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, ((ProgramEnrollment) object).getEnrolledString()); verifyZeroInteractions(programEnrollmentService); }

Target:
public void shouldReturnNotEnrolledWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertTrue(object instanceof ProgramEnrollment); ProgramEnrollment actual = (ProgramEnrollment) object; assertFalse(actual.isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, actual.getEnrolledString()); assertNull(actual.getCurrentState()); verifyZeroInteractions(programEnrollmentService); }
Source:
public QueryWithParams(Query query, Object[] params) { this(query, params, null); }

Target:
QueryWithParams(Query query, Object[] params) { this(query, params, null); }
Source:
public InstanceProcess createProcess(Command command, String outputChannel) throws MachineException { final Integer pid = pidSequence.getAndIncrement(); final InstanceProcess process = dockerMachineFactory.createProcess(container, command.getName(), command.getCommandLine(), command.getType(), outputChannel, String.format(PID_FILE_TEMPLATE, pid), pid); machineProcesses.put(pid, process); return process; }

Target:
public InstanceProcess createProcess(Command command, String outputChannel) throws MachineException { final Integer pid = pidSequence.getAndIncrement(); final InstanceProcess process = dockerMachineFactory.createProcess(command, container, outputChannel, String.format(PID_FILE_TEMPLATE, pid), pid); machineProcesses.put(pid, process); return process; }
Source:
public Attribute mergeAttributeValue(PerunSession sess, Member member, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if (attribute.getType().equals(ArrayList.class.getName()) || attribute.getType().equals(BeansUtils.largeArrayListClassName)) { Attribute storedAttribute = null; try { storedAttribute = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, attribute.getName()); } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } convertEmptyAttrValueToNull(attribute); if(attribute.getValue() == null) return storedAttribute; if (storedAttribute != null) { ArrayList<String> updatedList = (ArrayList<String>) storedAttribute.getValue(); if (updatedList != null) { for (String value : ((ArrayList<String>) attribute.getValue())) { if (!updatedList.contains(value)) { updatedList.add(value); } } attribute.setValue(updatedList); } else { attribute.setValue(attribute.getValue()); } } getPerunBl().getAttributesManagerBl().setAttribute(sess, member, attribute); } else if (attribute.getType().equals(LinkedHashMap.class.getName())) { Attribute storedAttribute = null; try { storedAttribute = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, attribute.getName()); } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } if(attribute.getValue() == null) return storedAttribute; if (storedAttribute != null) { LinkedHashMap<String, String> updatedMap = (LinkedHashMap<String, String>) storedAttribute.getValue(); LinkedHashMap<String, String> receivedMap = (LinkedHashMap<String, String>) attribute.getValue(); if (updatedMap != null) { if (receivedMap != null) { updatedMap.putAll(receivedMap); attribute.setValue(updatedMap); } } else { attribute.setValue(receivedMap); } } getPerunBl().getAttributesManagerBl().setAttribute(sess, member, attribute); } else { getPerunBl().getAttributesManagerBl().setAttribute(sess, member, attribute); } return attribute; }

Target:
public Attribute mergeAttributeValue(PerunSession sess, Member member, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { return this.mergeAttributeValue(sess, attribute, member); }
Source:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { MatchResult matcher = this.redirectMatcher.matcher(request); if (!matcher.isMatch()) { filterChain.doFilter(request, response); return; } String registrationId = matcher.getVariables().get("registrationId"); RelyingPartyRegistration relyingParty = this.relyingPartyRegistrationRepository.findByRegistrationId(registrationId); if (relyingParty == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if (this.logger.isDebugEnabled()) { this.logger.debug(format("Creating SAML2 SP Authentication Request for IDP[%s]", relyingParty.getRegistrationId())); } Saml2AuthenticationRequestContext authnRequestCtx = createRedirectAuthenticationRequestContext(relyingParty, request); if (relyingParty.getIdpSsoConfiguration().getBinding() == Saml2MessageBinding.REDIRECT) { sendRedirect(response, authnRequestCtx); } else { sendPost(response, authnRequestCtx); } }

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { MatchResult matcher = this.redirectMatcher.matcher(request); if (!matcher.isMatch()) { filterChain.doFilter(request, response); return; } String registrationId = matcher.getVariables().get("registrationId"); RelyingPartyRegistration relyingParty = this.relyingPartyRegistrationRepository.findByRegistrationId(registrationId); if (relyingParty == null) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return; } if (this.logger.isDebugEnabled()) { this.logger.debug(format("Creating SAML2 SP Authentication Request for IDP[%s]", relyingParty.getRegistrationId())); } Saml2AuthenticationRequestContext authnRequestCtx = createRedirectAuthenticationRequestContext(relyingParty, request); if (relyingParty.getProviderDetails().getBinding() == Saml2MessageBinding.REDIRECT) { sendRedirect(response, authnRequestCtx); } else { sendPost(response, authnRequestCtx); } }
Source:
protected String[] getGDBCommandLineArray() { List<String> gdbCommandLine = new ArrayList<String>(); gdbCommandLine.add(getGDBPath().toOSString()); gdbCommandLine.add("--interpreter"); gdbCommandLine.add("mi2"); gdbCommandLine.add("--nx"); return gdbCommandLine.toArray(new String[gdbCommandLine.size()]); }

Target:
protected String[] getGDBCommandLineArray() { return new String[] { getGDBPath().toOSString(), "--interpreter", "mi2", "--nx" }; }
Source:
public void shouldReturnNotEnrolledWhenProgramEnrollmentNotFoundForLookupByMotechIdAndProgramName() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_MOTECH_ID, DEFAULT_MOTECH_ID); lookupFields.put(PROGRAM_NAME, PROGRAM_ANOTHER_NAME); when(programEnrollmentService.getProgramEnrollmentByPatientMotechId(eq(CONFIG_NAME), eq(DEFAULT_MOTECH_ID))) .thenReturn(prepareProgramEnrollments()); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, BY_MOTECH_ID_AND_PROGRAM_NAME, lookupFields); verify(programEnrollmentService).getProgramEnrollmentByPatientMotechId(eq(CONFIG_NAME), eq(DEFAULT_MOTECH_ID)); assertEquals(false, ((ProgramEnrollment) object).isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, ((ProgramEnrollment) object).getEnrolledString()); }

Target:
public void shouldReturnNotEnrolledWhenProgramEnrollmentNotFoundForLookupByMotechIdAndProgramName() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_MOTECH_ID, DEFAULT_MOTECH_ID); lookupFields.put(PROGRAM_NAME, PROGRAM_ANOTHER_NAME); when(programEnrollmentService.getProgramEnrollmentByPatientMotechId(eq(CONFIG_NAME), eq(DEFAULT_MOTECH_ID))) .thenReturn(prepareProgramEnrollments()); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, BY_MOTECH_ID_AND_PROGRAM_NAME, lookupFields); verify(programEnrollmentService).getProgramEnrollmentByPatientMotechId(eq(CONFIG_NAME), eq(DEFAULT_MOTECH_ID)); assertTrue(object instanceof ProgramEnrollment); ProgramEnrollment actual = (ProgramEnrollment) object; assertFalse(actual.isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, actual.getEnrolledString()); assertNull(actual.getCurrentState()); }
Source:
public void run() { LOG.trace("BacklogMetricEmitter running for entities"); executor = new ScheduledThreadPoolExecutor(10); List<Future> futures = new ArrayList<>(); try { for (Entity entity : entityBacklogs.keySet()) { futures.add(executor.submit(new BacklogCalcService(entity, entityBacklogs.get(entity)))); } waitForFuturesToComplete(futures); } finally { executor.shutdown(); } }

Target:
public void run() { LOG.debug("BacklogMetricEmitter running for entities"); executor = new ScheduledThreadPoolExecutor(10); List<Future> futures = new ArrayList<>(); try { for (Entity entity : entityBacklogs.keySet()) { futures.add(executor.submit(new BacklogCalcService(entity, entityBacklogs.get(entity)))); } waitForFuturesToComplete(futures); } finally { executor.shutdown(); } }
Source:
public void start(Job project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeServerName(); initializeTriggerOnEvents(); try { addThisTriggerAsListener(project); } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { updateTriggerConfigURL(); gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } GerritProjectList.removeTriggerFromProjectList(this); }

Target:
public void start(Job project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeServerName(); initializeTriggerOnEvents(); try { addThisTriggerAsListener(project); } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { logger.debug("Start project: {}; dynamic project list; setting latch to 1", project); projectListIsReady = new CountDownLatch(1); gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } else { logger.debug("Start project: {}; static project list; setting latch to 0", project); projectListIsReady = new CountDownLatch(0); } GerritProjectList.removeTriggerFromProjectList(this); }
Source:
public RealmResults<E> freeze() { if (!isValid()) { throw new IllegalStateException("Only valid, managed RealmLists can be frozen."); } BaseRealm frozenRealm = realm.freeze(); OsResults frozenResults = osResults.freeze(); if (className != null) { return new RealmResults<>(frozenRealm, frozenResults, className); } else { return new RealmResults<>(frozenRealm, frozenResults, classSpec); } }

Target:
public RealmResults<E> freeze() { if (!isValid()) { throw new IllegalStateException("Only valid, managed RealmResults can be frozen."); } BaseRealm frozenRealm = realm.freeze(); OsResults frozenResults = osResults.freeze(frozenRealm.sharedRealm); if (className != null) { return new RealmResults<>(frozenRealm, frozenResults, className); } else { return new RealmResults<>(frozenRealm, frozenResults, classSpec); } }
Source:
private String toJSONString() { JSONStringer js = new JSONStringer(); try { js.object(); js.key(JSON_TOKENCOUNT_KEY).value(m_tokenCount); js.key(JSON_TOKENPARTITION_KEY).object(); for (Map.Entry<Integer, Integer> entry : m_tokensMap.get().entrySet()) { js.key(entry.getKey().toString()).value(entry.getValue()); } js.endObject().endObject(); }catch (JSONException e) { throw new RuntimeException("Failed to serialized Hashinator Configuration to JSON.", e); } return js.toString(); }

Target:
private String toJSONString() { JSONStringer js = new JSONStringer(); try { js.object(); for (Map.Entry<Integer, Integer> entry : m_tokensMap.get().entrySet()) { js.key(entry.getKey().toString()).value(entry.getValue()); } js.endObject(); } catch (JSONException e) { throw new RuntimeException("Failed to serialize Hashinator Configuration to JSON.", e); } return js.toString(); }
Source:
public boolean match(int endFlag) { if (endFlag == '"') { quoting = !quoting; } if (!quoting) { boolean started = equalsIgnoreCase(codeReader.peek(startChars.length), startChars); if (started) { nesting++; } else { boolean ended = ArrayUtils.isEquals(codeReader.peek(endChars.length), endChars); if (ended) { nesting--; return nesting < 0; } } } return false; }

Target:
public boolean match(int endFlag) { boolean result = false; if (endFlag == '"') { quoting = !quoting; } if (!quoting) { if (equalsIgnoreCase(codeReader.peek(startChars.length), startChars)) { nesting++; } else if (equalsIgnoreCase(codeReader.peek(endChars.length), endChars)) { nesting--; result = nesting < 0; } } return result; }
Source:
public Result apply(AggregationNode aggregation, Captures captures, Context context) { Lookup lookup = context.getLookup(); PlanNodeIdAllocator idAllocator = context.getIdAllocator(); Session session = context.getSession(); Optional<PlanNode> rewrittenSource = recurseToPartial(lookup.resolve(aggregation.getSource()), lookup, idAllocator); if (!rewrittenSource.isPresent()) { return Result.empty(); } PlanNode source = rewrittenSource.get(); if (getTaskConcurrency(session) > 1) { source = ExchangeNode.partitionedExchange( idAllocator.getNextId(), ExchangeNode.Scope.LOCAL, source, new PartitioningScheme(Partitioning.create(FIXED_ARBITRARY_DISTRIBUTION, ImmutableList.of()), source.getOutputSymbols())); source = new AggregationNode( idAllocator.getNextId(), source, inputsAsOutputs(aggregation.getAggregations()), aggregation.getGroupingSets(), AggregationNode.Step.INTERMEDIATE, aggregation.getHashSymbol(), aggregation.getGroupIdSymbol()); source = ExchangeNode.gatheringExchange(idAllocator.getNextId(), ExchangeNode.Scope.LOCAL, source); } return Result.replace(aggregation.replaceChildren(ImmutableList.of(source))); }

Target:
public Result apply(AggregationNode aggregation, Captures captures, Context context) { Lookup lookup = context.getLookup(); PlanNodeIdAllocator idAllocator = context.getIdAllocator(); Session session = context.getSession(); Optional<PlanNode> rewrittenSource = recurseToPartial(lookup.resolve(aggregation.getSource()), lookup, idAllocator); if (!rewrittenSource.isPresent()) { return Result.empty(); } PlanNode source = rewrittenSource.get(); if (getTaskConcurrency(session) > 1) { source = ExchangeNode.partitionedExchange( idAllocator.getNextId(), ExchangeNode.Scope.LOCAL, source, new PartitioningScheme(Partitioning.create(FIXED_ARBITRARY_DISTRIBUTION, ImmutableList.of()), source.getOutputSymbols())); source = new AggregationNode( idAllocator.getNextId(), source, inputsAsOutputs(aggregation.getAggregations()), aggregation.getGroupingSets(), AggregationNode.Step.INTERMEDIATE, aggregation.getHashSymbol(), aggregation.getGroupIdSymbol()); source = ExchangeNode.gatheringExchange(idAllocator.getNextId(), ExchangeNode.Scope.LOCAL, source); } return Result.ofPlanNode(aggregation.replaceChildren(ImmutableList.of(source))); }
Source:
public void start(Stage primaryStage) throws Exception { Pane root = new Pane(); root.setPrefSize(800, 600); primaryStage.setResizable(false); primaryStage.setTitle("mmm))"); InputStream iStream = null; iStream = Files.newInputStream(Paths.get("res/images/pic.png")); Image img = new Image(iStream); iStream.close(); ImageView imgView = new ImageView(img); imgView.setFitWidth(800); imgView.setFitHeight(600); mainGameMenu = new GameMenu(); root.getChildren().addAll(imgView, mainGameMenu); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); }

Target:
public void start(Stage primaryStage) throws Exception { Pane root = new Pane(); root.setPrefSize(X_RESOLUTION, Y_RESOLUTION); primaryStage.setResizable(false); primaryStage.setTitle("mmm))"); InputStream iStream = null; iStream = Files.newInputStream(Paths.get("res/images/pic.png")); Image img = new Image(iStream); iStream.close(); ImageView imgView = new ImageView(img); imgView.setFitWidth(X_RESOLUTION); imgView.setFitHeight(Y_RESOLUTION); mainGameMenu = new GameMenu(); root.getChildren().addAll(imgView, mainGameMenu); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); }
Source:
public void onNext(final FailedContext failedContext) { LOG.log(Level.INFO, "FailedContext: {0}", failedContext); final String contextId = failedContext.getId(); handleFinishedContext(contextId, failedContext.getParentContext()); }

Target:
public void onNext(final FailedContext failedContext) { LOG.log(Level.INFO, "Handle FailedContext in the same way as ClosedContext. FailedContext: {0}", failedContext); final String contextId = failedContext.getId(); handleFinishedContext(contextId, failedContext.getParentContext()); }
Source:
private void updateMemberDomainsFormat(StorageFormatType targetFormat) { Guid spId = getStoragePool().getId(); StorageDomainStaticDAO sdStatDao = DbFacade.getInstance().getStorageDomainStaticDAO(); List<storage_domain_static> domains = sdStatDao.getAllForStoragePool(spId); for (storage_domain_static domain : domains) { StorageDomainType sdType = domain.getstorage_domain_type(); log.infoFormat("Updating storage domain {0} (type {1}) to format {2}", domain.getId(), sdType, targetFormat); if (sdType != StorageDomainType.Data && sdType != StorageDomainType.Master) { continue; } domain.setStorageFormat(targetFormat); sdStatDao.update(domain); } }

Target:
private void updateMemberDomainsFormat(StorageFormatType targetFormat) { Guid spId = getStoragePool().getId(); StorageDomainStaticDAO sdStatDao = DbFacade.getInstance().getStorageDomainStaticDAO(); List<storage_domain_static> domains = sdStatDao.getAllForStoragePool(spId); for (storage_domain_static domain : domains) { StorageDomainType sdType = domain.getstorage_domain_type(); if (sdType == StorageDomainType.Data || sdType == StorageDomainType.Master) { log.infoFormat("Updating storage domain {0} (type {1}) to format {2}", domain.getId(), sdType, targetFormat); domain.setStorageFormat(targetFormat); sdStatDao.update(domain); } } }
Source:
public void CreateVirtualMachineImageFromExistingVM() { String id = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/myVM", getSubscriptionId(), resourceGroupName); ImageProperties properties = ImageProperties.builder() .sourceVirtualMachine(ImageProperties.SourceVirtualMachine.create(id)) .build(); Image image = api().createOrUpdate(imageName, LOCATION, properties); assertTrue(stateReached("Succeeded"), "start operation did not complete in the configured timeout"); assertTrue(id.equals(image.properties().sourceVirtualMachine().id())); }

Target:
public void CreateVirtualMachineImageFromExistingVM() { String id = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/myVM", getSubscriptionId(), resourceGroupName); ImageProperties properties = ImageProperties.builder() .sourceVirtualMachine(ImageProperties.SourceVirtualMachine.create(id)) .build(); Image image = api().createOrUpdate(imageName, LOCATION, properties); assertTrue(waitUntilAvailable(imageName), "creation operation did not complete in the configured timeout"); assertTrue(id.equals(image.properties().sourceVirtualMachine().id())); }
Source:
public void testCreateAlias() throws Exception { methodWatcher.executeUpdate("create alias t2 for t1"); methodWatcher.executeUpdate("drop alias t2"); }

Target:
public void testCreateAlias() throws Exception { methodWatcher.executeUpdate("create alias t3 for t1"); ResultSet rs = methodWatcher.executeQuery("select c1 from t3"); rs.next(); assertEquals(1, rs.getInt("C1")); rs.close(); methodWatcher.executeUpdate("drop alias t3"); }