auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void start() { super.start(); try { connection = datasourceJNDILocation != null ? DatabaseBinaryStore.connect(datasourceJNDILocation) : DatabaseBinaryStore.connect(driverClass, connectionURL, username, password); if (!tableExists()) { createTable(); } } catch (BinaryStoreException e) { throw new RuntimeException(e); } }

Target:
public void start() { super.start(); try { Connection connection = datasourceJNDILocation != null ? DatabaseBinaryStore.connect(datasourceJNDILocation) : DatabaseBinaryStore.connect(driverClass, connectionURL, username, password); DatabaseMetaData metaData = connection.getMetaData(); database = new Database(connection); if (!database.tableExists()) { database.createTable(); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void testForceDeleteJobFromJobQueue() throws InterruptedException { String jobQueueName = TestHelper.getTestMethodName(); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "10")); JobConfig.Builder jobBuilder2 = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "100000")).setTimeout(100000); JobQueue.Builder jobQueue = TaskTestUtil.buildJobQueue(jobQueueName); jobQueue.enqueueJob("job1", jobBuilder); jobQueue.enqueueJob("job2", jobBuilder2); _driver.start(jobQueue.build()); _driver.pollForJobState(jobQueueName, TaskUtil.getNamespacedJobName(jobQueueName, "job2"), TaskState.IN_PROGRESS); try { _driver.deleteJob(jobQueueName, "job2"); } catch (IllegalStateException e) { } _driver.deleteJob(jobQueueName, "job2", true); Assert.assertNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); }

Target:
public void testForceDeleteJobFromJobQueue() throws InterruptedException { String jobQueueName = TestHelper.getTestMethodName(); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "10")); JobConfig.Builder jobBuilder2 = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "100000")).setTimeout(100000); JobQueue.Builder jobQueue = TaskTestUtil.buildJobQueue(jobQueueName); jobQueue.enqueueJob("job1", jobBuilder); jobQueue.enqueueJob("job2", jobBuilder2); _driver.start(jobQueue.build()); _driver.pollForJobState(jobQueueName, TaskUtil.getNamespacedJobName(jobQueueName, "job2"), TaskState.IN_PROGRESS); try { _driver.deleteJob(jobQueueName, "job2"); Assert.fail("Regular, non-force deleteJob should fail since the workflow is in progress!"); } catch (IllegalStateException e) { } Assert.assertNotNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert .assertNotNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNotNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); _driver.deleteJob(jobQueueName, "job2", true); Assert.assertNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); }
Source:
public ChannelFuture goAway(final ChannelHandlerContext ctx, final int lastStreamId, final long errorCode, final ByteBuf debugData, ChannelPromise promise) { promise = promise.unvoid(); final Http2Connection connection = connection(); try { if (!connection.goAwaySent(lastStreamId, errorCode, debugData)) { debugData.release(); promise.trySuccess(); return promise; } } catch (Throwable cause) { debugData.release(); promise.tryFailure(cause); return promise; } ctx.fireUserEventTriggered(new Http2GoAwaySentEvent(lastStreamId, errorCode)); debugData.retain(); ChannelFuture future = frameWriter().writeGoAway(ctx, lastStreamId, errorCode, debugData, promise); if (future.isDone()) { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } }); } return future; }

Target:
public ChannelFuture goAway(final ChannelHandlerContext ctx, final int lastStreamId, final long errorCode, final ByteBuf debugData, ChannelPromise promise) { promise = promise.unvoid(); final Http2Connection connection = connection(); try { if (!connection.goAwaySent(lastStreamId, errorCode, debugData)) { debugData.release(); promise.trySuccess(); return promise; } } catch (Throwable cause) { debugData.release(); promise.tryFailure(cause); return promise; } ctx.fireUserEventTriggered(new Http2GoAwayWriteEvent(lastStreamId, errorCode)); debugData.retain(); ChannelFuture future = frameWriter().writeGoAway(ctx, lastStreamId, errorCode, debugData, promise); if (future.isDone()) { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } }); } return future; }
Source:
private LocalCheckpointTracker createLocalCheckpointTracker( BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) throws IOException { final long maxSeqNo; final long localCheckpoint; final SequenceNumbers.CommitInfo seqNoStats = SequenceNumbers.loadSeqNoInfoFromLuceneCommit(store.readLastCommittedSegmentsInfo().userData.entrySet()); maxSeqNo = seqNoStats.maxSeqNo; localCheckpoint = seqNoStats.localCheckpoint; logger.trace("recovered maximum sequence number and local checkpoint [{}]", maxSeqNo, localCheckpoint); return localCheckpointTrackerSupplier.apply(maxSeqNo, localCheckpoint); }

Target:
private LocalCheckpointTracker createLocalCheckpointTracker( BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) throws IOException { final long maxSeqNo; final long localCheckpoint; final SequenceNumbers.CommitInfo seqNoStats = SequenceNumbers.loadSeqNoInfoFromLuceneCommit(store.readLastCommittedSegmentsInfo().userData.entrySet()); maxSeqNo = seqNoStats.maxSeqNo; localCheckpoint = seqNoStats.localCheckpoint; if (logger.isTraceEnabled()) { logger.trace("recovered maximum sequence number and local checkpoint [{}]", maxSeqNo, localCheckpoint); } return localCheckpointTrackerSupplier.apply(maxSeqNo, localCheckpoint); }
Source:
private static boolean checkSecurityTokenCompatibility(PGPSecretKey key, OperationLog log, int indent) { final PGPPublicKey publicKey = key.getPublicKey(); ASN1ObjectIdentifier curve; switch (publicKey.getAlgorithm()) { case PublicKeyAlgorithmTags.RSA_ENCRYPT: case PublicKeyAlgorithmTags.RSA_SIGN: case PublicKeyAlgorithmTags.RSA_GENERAL: if (publicKey.getBitStrength() < 2048) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_SIZE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDH: curve = ((ECDHPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDSA: curve = ((ECDSAPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; default: log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_ALGO, indent + 1); return false; } if (isDivertToCard(key) || isDummy(key)) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_STRIPPED, indent + 1); return false; } return true; }

Target:
private static boolean checkSecurityTokenCompatibility(PGPSecretKey key, OperationLog log, int indent) { final PGPPublicKey publicKey = key.getPublicKey(); ASN1ObjectIdentifier curve; switch (publicKey.getAlgorithm()) { case PublicKeyAlgorithmTags.RSA_ENCRYPT: case PublicKeyAlgorithmTags.RSA_SIGN: case PublicKeyAlgorithmTags.RSA_GENERAL: if (publicKey.getBitStrength() < 2048) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_RSA_KEY_SIZE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDH: curve = ((ECDHPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDSA: curve = ((ECDSAPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; default: log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_ALGO, indent + 1); return false; } if (isDivertToCard(key) || isDummy(key)) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_STRIPPED, indent + 1); return false; } return true; }
Source:
private synchronized void onReceiverCompleted(final String receiverId) { stateMachine.checkState(CAN_SEND); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.RECEIVING, PushShuffleReceiverState.COMPLETED); numCompletedReceivers++; LOG.log(Level.FINE, "A receiver " + receiverId + " was completed to receive data."); if (numCompletedReceivers == totalNumReceivers) { numCompletedReceivers = 0; stateMachine.checkAndSetState(CAN_SEND, RECEIVERS_COMPLETED); LOG.log(Level.INFO, "All receivers were completed to receive data."); if (pushShuffleListener != null) { pushShuffleListener.onIterationCompleted(++numCompletedIterations); } if (shutdown) { shutdownAllSendersAndReceivers(); } else { broadcastToReceivers(PushShuffleCode.RECEIVER_CAN_RECEIVE); } } }

Target:
private synchronized void onReceiverCompleted(final String receiverId) { stateMachine.checkState(CAN_SEND); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.RECEIVING, PushShuffleReceiverState.COMPLETED); numCompletedReceivers++; LOG.log(Level.FINE, "A receiver " + receiverId + " was completed to receive data."); if (numCompletedReceivers == totalNumReceivers) { numCompletedReceivers = 0; stateMachine.checkAndSetState(CAN_SEND, RECEIVERS_COMPLETED); LOG.log(Level.INFO, "All receivers were completed to receive data."); pushShuffleListener.onIterationCompleted(++numCompletedIterations); if (shutdown) { shutdownAllSendersAndReceivers(); } else { broadcastToReceivers(PushShuffleCode.RECEIVER_CAN_RECEIVE); } } }
Source:
synchronized void updateLease(Lease newLease) { this.lease = newLease; }

Target:
synchronized void updateLease(Lease newLease) { Preconditions.checkArgument(newLease.leaseOwnerId().equals(lease.leaseOwnerId()), "Lock leases can only be refreshed by lease owners"); if (this.lease.expiry().isBefore(newLease.expiry())) { this.lease = newLease; } }
Source:
RouterNetworkComponentsFactory(NetworkMetrics networkMetrics, NetworkConfig networkConfig, SSLFactory sslFactory, int maxConnectionsPerPortPlainText, int maxConnectionsPerPortSsl, Time time) { if (networkMetrics == null || networkConfig == null) { throw new IllegalArgumentException("Invalid inputs passed in, NetworkMetrics: " + networkMetrics + " " + "NetworkConfig: " + networkConfig); } this.networkMetrics = networkMetrics; this.networkConfig = networkConfig; this.sslFactory = sslFactory; this.maxConnectionsPerPortPlainText = maxConnectionsPerPortPlainText; this.maxConnectionsPerPortSsl = maxConnectionsPerPortSsl; this.time = time; }

Target:
RouterNetworkComponentsFactory(NetworkMetrics networkMetrics, NetworkConfig networkConfig, SSLFactory sslFactory, int maxConnectionsPerPortPlainText, int maxConnectionsPerPortSsl, Time time) { this.networkMetrics = networkMetrics; this.networkConfig = networkConfig; this.sslFactory = sslFactory; this.maxConnectionsPerPortPlainText = maxConnectionsPerPortPlainText; this.maxConnectionsPerPortSsl = maxConnectionsPerPortSsl; this.time = time; }
Source:
public void testProcessWithMissingRequiredVariable() throws Exception { KieBase kbase = createKnowledgeBase("variable-tags/approval-with-required-variable-tags.bpmn2"); KieSession ksession = createKnowledgeSession(kbase); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.startProcess("approvals")); ksession.dispose(); }

Target:
public void testProcessWithMissingRequiredVariable() throws Exception { ksession = createSessionAndRegisterWorkItemHandler("variable-tags/approval-with-required-variable-tags.bpmn2"); assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.startProcess("approvals")); }
Source:
public ChainrEntry( int index, Object chainrEntryObj ) { if ( ! (chainrEntryObj instanceof Map ) ) { throw new SpecException( "JOLT Chainr expects a JSON array of objects - Malformed spec at index:" + index ); } @SuppressWarnings( "unchecked" ) Map<String,Object> chainrEntryMap = (Map<String, Object>) chainrEntryObj; this.index = index; String opString = extractString( index, ChainrEntry.OPERATION_KEY, chainrEntryMap ); if ( opString == null ) { throw new SpecException( "JOLT Chainr spec index:" + index + " should define an 'operation' that is a transform or transform factory." ); } if ( STOCK_TRANSFORMS.containsKey( opString ) ) { operationString = opString; operationClassName = STOCK_TRANSFORMS.get( opString ); } else { operationString = null; operationClassName = opString; } transformClass = getTransformComponentClass(); spec = chainrEntryMap.get( ChainrEntry.SPEC_KEY ); isSpecDriven = SpecTransform.class.isAssignableFrom( transformClass ); if ( isSpecDriven && ! chainrEntryMap.containsKey( SPEC_KEY ) ) { throw new SpecException( "JOLT Chainr - operation:" + operationString + " implemented by className:" + transformClass.getCanonicalName() + " requires a spec." ); } }

Target:
public ChainrEntry( int index, Object chainrEntryObj ) { if ( ! (chainrEntryObj instanceof Map ) ) { throw new SpecException( "JOLT ChainrEntry expects a JSON map - Malformed spec at index:" + index ); } @SuppressWarnings( "unchecked" ) Map<String,Object> chainrEntryMap = (Map<String, Object>) chainrEntryObj; this.index = index; String opString = extractString( index, ChainrEntry.OPERATION_KEY, chainrEntryMap ); if ( opString == null ) { throw new SpecException( "JOLT Chainr spec index:" + index + " should define an 'operation' that is a transform or transform factory." ); } if ( STOCK_TRANSFORMS.containsKey( opString ) ) { operationClassName = STOCK_TRANSFORMS.get( opString ); } else { operationClassName = opString; } transformClass = getTransformComponentClass(); spec = chainrEntryMap.get( ChainrEntry.SPEC_KEY ); isSpecDriven = SpecTransform.class.isAssignableFrom( transformClass ); if ( isSpecDriven && ! chainrEntryMap.containsKey( SPEC_KEY ) ) { throw new SpecException( "JOLT Chainr - Transform className:" + transformClass.getCanonicalName() + " requires a spec." ); } }
Source:
private ArgumentMatcher<RefundGatewayRequest> aRefundRequestWith(ChargeEntity capturedCharge, long amountInPence) { return (RefundGatewayRequest object) -> object.getGatewayAccount().equals(capturedCharge.getGatewayAccount()) && object.getTransactionId().equals(capturedCharge.getGatewayTransactionId()) && object.getAmount().equals(String.valueOf(amountInPence)); }

Target:
private ArgumentMatcher<RefundGatewayRequest> aRefundRequestWith(ChargeEntity capturedCharge, long amountInPence) { return (RefundGatewayRequest refundGatewayRequest) -> refundGatewayRequest.getGatewayAccount().equals(capturedCharge.getGatewayAccount()) && refundGatewayRequest.getTransactionId().equals(capturedCharge.getGatewayTransactionId()) && refundGatewayRequest.getAmount().equals(String.valueOf(amountInPence)); }
Source:
public void addTask(Runnable task) { taskQueue.add(task); if (parked) { parked = false; LockSupport.unpark(thread); } }

Target:
public void addTask(Runnable task) { taskQueue.add(task); if (parked) { parked = false; LockSupport.unpark(thread); } else if (wakupNeighborWorker.parked) { wakupNeighborWorker.parked = false; LockSupport.unpark(wakupNeighborWorker.thread); } }
Source:
public void logHtmlWriterFreestyleBenchmark(JenkinsState state, Blackhole blackhole) throws Exception { AnnotatedLargeText logText = state.freestyleBuild.getLogText(); long r = logText.writeHtmlTo(0, new BlackholeWriter(blackhole)); blackhole.consume(r); }

Target:
public void logHtmlWriterFreestyleBenchmark(JenkinsState state, Blackhole blackhole) throws Exception { AnnotatedLargeText logText = state.freestyleBuild.getLogText(); long r = logText.writeHtmlTo(0, state.blackholeWriter); blackhole.consume(r); }
Source:
public void testCreateTableAsync() throws Exception{ CreateTableRequest request = CreateTableRequest.of(TABLE_ID); when(mockAdminClient.createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID))) .thenReturn(immediateFuture(createTableData())); ApiFuture<Table> response = clientWrapper.createTableAsync(request); assertEquals(Table.fromProto(createTableData()), response.get()); verify(mockAdminClient).createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID)); }

Target:
public void testCreateTableAsync() throws Exception{ CreateTableRequest request = CreateTableRequest.of(TABLE_ID); when(mockAdminClient.createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID))) .thenReturn(immediateFuture(createTableData())); Future<Table> response = clientWrapper.createTableAsync(request); assertEquals(Table.fromProto(createTableData()), response.get()); verify(mockAdminClient).createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID)); }
Source:
public Mutable clear() { _uri = null; _scheme = null; _host = null; _port = -1; _path = null; _param = null; _query = null; _decodedPath = null; _user = null; return this; }

Target:
public Mutable clear() { _scheme = null; _user = null; _host = null; _port = -1; _path = null; _param = null; _query = null; _fragment = null; _uri = null; _decodedPath = null; return this; }
Source:
private List<DeveloperEntity> getEntitiesByCertificationBodyId(final List<Long> certificationBodyIds) { String hql = "SELECT DISTINCT dev " + "FROM CertifiedProductEntity cp " + "JOIN FETCH cp.productVersion pv " + "JOIN FETCH pv.product prod " + "JOIN FETCH prod.developer dev " + "WHERE cp.certificationBody.id IN :certificationBodyIds"; return entityManager.createQuery(hql, DeveloperEntity.class) .setParameter("certificationBodyIds", certificationBodyIds) .getResultList(); }

Target:
private List<DeveloperEntity> getEntitiesByCertificationBodyId(final List<Long> certificationBodyIds) { String hql = "SELECT DISTINCT dev " + "FROM CertifiedProductEntity cp " + "JOIN FETCH cp.productVersion pv " + "JOIN FETCH pv.product prod " + "JOIN FETCH prod.developer dev " + "WHERE cp.certificationBody.id IN (:certificationBodyIds)"; return entityManager.createQuery(hql, DeveloperEntity.class) .setParameter("certificationBodyIds", certificationBodyIds) .getResultList(); }
Source:
public void processElement(DoFn<T, KV<T, Integer>>.ProcessContext c) throws Exception { c.output( KV.of(c.element(), 42)); }

Target:
public void processElement(DoFn<T, KV<T, Integer>>.ProcessContext c) throws Exception { c.output( KV.of(c.element(), DUMMY_VALUE)); }
Source:
String read(HttpServletRequest servletRequest, String key) { HttpHeaders headers = new HttpHeaders(); String token = servletRequest.getHeader(TOKEN_HEADER); if (!StringUtils.hasLength(token)) { throw new IllegalArgumentException( "Missing required header: " + TOKEN_HEADER); } headers.add(VAULT_TOKEN, token); System.out.println("Namespace : " + this.namespace); if (this.namespace != null && !this.namespace.isEmpty()) { headers.add(VAULT_NAMESPACE, this.namespace); } return this.accessStrategy.getData(headers, this.backend, key); }

Target:
String read(HttpServletRequest servletRequest, String key) { HttpHeaders headers = new HttpHeaders(); String token = servletRequest.getHeader(TOKEN_HEADER); if (!StringUtils.hasLength(token)) { throw new IllegalArgumentException( "Missing required header: " + TOKEN_HEADER); } headers.add(VAULT_TOKEN, token); if (this.namespace != null && !this.namespace.isEmpty()) { headers.add(VAULT_NAMESPACE, this.namespace); } return this.accessStrategy.getData(headers, this.backend, key); }
Source:
public String rotate(String data, int shiftKey){ String cipherText = ""; for(int i = 0;i < data.length(); i++){ if(data.charAt(i) >= 'A' && data.charAt(i) <= 'Z'){ char replacementCharacter = (char) (data.charAt(i) + shiftKey); if(replacementCharacter > 'Z'){ replacementCharacter = (char)(64 + (replacementCharacter % 90)); } cipherText += replacementCharacter; } else if(data.charAt(i) >= 'a' && data.charAt(i) <= 'z'){ char replacementCharacter = (char) (data.charAt(i) + shiftKey); if(replacementCharacter > 'z'){ replacementCharacter = (char)(96 + (replacementCharacter % 122)); } cipherText += replacementCharacter; } else cipherText += data.charAt(i); } return cipherText; }

Target:
public String rotate(String data, int shiftKey) { StringBuilder dataStringBuilder = new StringBuilder(); for (char c : data.toCharArray()) { if (Character.isUpperCase(c)) { dataStringBuilder.append(replacementCharacter(c, 'A', 'Z', shiftKey)); } else if (Character.isLowerCase(c)) { dataStringBuilder.append(replacementCharacter(c, 'a', 'z', shiftKey)); } else { dataStringBuilder.append(c); } } return dataStringBuilder.toString(); }
Source:
private Set<AttributeDefinition> findAttributeDefinitionsForDependencies(PerunSession sess, List<String> dependenciesNames) throws InternalErrorException { Set<AttributeDefinition> strongDepSet = new HashSet<>(); for (String s : dependenciesNames) { if (!s.endsWith("*")) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, s); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("For attribute dependency name can't be found attributeDefinition.", s); } } else { List<String> allVariantOfDependence = getAllSimilarAttributeNames(sess, s.substring(0, s.length() - 2)); for (String variant : allVariantOfDependence) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, variant); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("For attribute dependency name can't be found attributeDefinition.", variant); } } } } return strongDepSet; }

Target:
private Set<AttributeDefinition> findAttributeDefinitionsForDependencies(PerunSession sess, List<String> dependenciesNames) throws InternalErrorException { Set<AttributeDefinition> strongDepSet = new HashSet<>(); for (String s : dependenciesNames) { if (!s.endsWith("*")) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, s); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("AttributeDefinition can't be found for dependency {}", s); } } else { List<String> allVariantOfDependence = getAllSimilarAttributeNames(sess, s.substring(0, s.length() - 2)); for (String variant : allVariantOfDependence) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, variant); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("For attribute dependency name can't be found attributeDefinition.", variant); } } } } return strongDepSet; }
Source:
private void showAddViaUrlDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.add_podcast_by_url); View content = View.inflate(getContext(), R.layout.edit_text_dialog, null); alertViewBinding = EditTextDialogBinding.bind(content); alertViewBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : ""; if (clipboardContent.trim().startsWith("http")) { alertViewBinding.urlEditText.setText(clipboardContent.trim()); } builder.setView(content); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(alertViewBinding.urlEditText.getText().toString())); builder.setNegativeButton(R.string.cancel_label, null); builder.show(); }

Target:
private void showAddViaUrlDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.add_podcast_by_url); View content = View.inflate(getContext(), R.layout.edit_text_dialog, null); EditTextDialogBinding alertViewBinding = EditTextDialogBinding.bind(content); alertViewBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : ""; if (clipboardContent.trim().startsWith("http")) { alertViewBinding.urlEditText.setText(clipboardContent.trim()); } builder.setView(alertViewBinding.getRoot()); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(alertViewBinding.urlEditText.getText().toString())); builder.setNegativeButton(R.string.cancel_label, null); builder.show(); }
Source:
private void storeContentResource(String rootId, ContentResource resource, ZipOutputStream out) throws Exception { String filename = resource.getId().substring(rootId.length(),resource.getId().length()); if(filename != null && filename.length()>0) { String filenameArr[] = filename.split(Entity.SEPARATOR); if (filenameArr.length > 1) { ContentCollectionEdit collectionEdit = (ContentCollectionEdit) ContentHostingService.getCollection(rootId+filenameArr[0]+Entity.SEPARATOR); ResourcePropertiesEdit props = collectionEdit.getPropertiesEdit(); String displayName = props.getProperty(ResourcePropertiesEdit.PROP_DISPLAY_NAME); try { String uniqueId = UserDirectoryService.getUser(filenameArr[0]).getDisplayId(); filename = displayName +"("+uniqueId+")"+ Entity.SEPARATOR + filenameArr[1]; }catch(UserNotDefinedException e) { LOG.warn("Not able to find user for id:"+filenameArr[0]); } } else { ContentCollectionEdit collectionEdit = (ContentCollectionEdit) ContentHostingService.getCollection(rootId); ResourcePropertiesEdit props = collectionEdit.getPropertiesEdit(); String displayName = props.getProperty(ResourcePropertiesEdit.PROP_DISPLAY_NAME); try { String uniqueId = UserDirectoryService.getUser(extractName(rootId)).getDisplayId(); filename = displayName + "(" + uniqueId + ")" + Entity.SEPARATOR + filenameArr[0]; }catch(UserNotDefinedException e) { LOG.warn("Not able to find user for id:"+extractName(rootId)); } } } ZipEntry zipEntry = new ZipEntry(filename); zipEntry.setSize(resource.getContentLength()); out.putNextEntry(zipEntry); InputStream contentStream = null; try { contentStream = resource.streamContent(); IOUtils.copy(contentStream, out); } finally { if (contentStream != null) { contentStream.close(); } } }

Target:
private void storeContentResource(String rootId, ContentResource resource, ZipOutputStream out) throws Exception { String filename = resource.getId().substring(rootId.length(),resource.getId().length()); if(ContentHostingService.isInDropbox(rootId) && ServerConfigurationService.getBoolean("dropbox.zip.haveDisplayname", true)) { try { filename = getContainingFolderDisplayName(rootId, filename); } catch(TypeException e){ LOG.warn("Unexpected error occurred when trying to create Zip archive:" + extractName(rootId), e.getCause()); return; } catch(IdUnusedException e ){ LOG.warn("Unexpected error occurred when trying to create Zip archive:" + extractName(rootId), e.getCause()); return; } catch(PermissionException e){ LOG.warn("Unexpected error occurred when trying to create Zip archive:" + extractName(rootId), e.getCause()); return; } catch (Exception e) { LOG.warn("Unexpected error occurred when trying to create Zip archive:" + extractName(rootId), e.getCause()); return; } } ZipEntry zipEntry = new ZipEntry(filename); zipEntry.setSize(resource.getContentLength()); out.putNextEntry(zipEntry); InputStream contentStream = null; try { contentStream = resource.streamContent(); IOUtils.copy(contentStream, out); } finally { if (contentStream != null) { contentStream.close(); } } }
Source:
public final void initialize(final URL location, final ResourceBundle resources) { final int initialCapacity = 10; this.notifications = new PriorityQueue<>(initialCapacity, (n1, n2) -> n1.getPriority() - n2.getPriority()); hide(); listen(NOTIFY, (controller, args) -> { assert (args.length == 1 && args[0] instanceof Notification); Notification notification = (Notification) args[0]; notifications.add(notification); if (!displaying) { displayNext(); } }); }

Target:
public final void initialize(final URL location, final ResourceBundle resources) { final int initialCapacity = 10; this.notifications = new PriorityQueue<>(initialCapacity, ( notification1, notification2) -> { if (notification1.getPriority() == notification2.getPriority()) { return Boolean.compare(notification1.equals(notification2), true); } else { return notification1.getPriority() - notification2.getPriority(); } }); hide(); listen(NOTIFY, (controller, args) -> { assert args.length == 1 && args[0] instanceof AbstractNotification; AbstractNotification notification = (AbstractNotification) args[0]; if (!notifications.contains(notification)) { notifications.add(notification); } if (!displaying) { displayNext(); } }); }
Source:
public void testTransformNativeRserveSingleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); }

Target:
public void testTransformNativeRserveSingleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); Assert.assertEquals("transformed DDF newDdf4 should have newcol added", "newcol", newDdf4.getColumnName(8)); Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); }
Source:
private double countCurrentNumberOfCrossings(final GraphInfoHolder currentGraph) { double totalCrossings = 0; Deque<GraphInfoHolder> countCrossingsIn = new ArrayDeque<>(); countCrossingsIn.push(currentGraph); while (!countCrossingsIn.isEmpty()) { GraphInfoHolder gD = countCrossingsIn.pop(); double modelOrderInfluence = 0; if (currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY) != OrderingStrategy.NONE) { modelOrderInfluence += currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_NODE_INFLUENCE) * countModelOrderNodeChanges(gD.currentNodeOrder(), currentGraph.lGraph().getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY)); modelOrderInfluence += currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_PORT_INFLUENCE) * countModelOrderPortChanges(gD.currentNodeOrder()); } totalCrossings += gD.crossCounter().countAllCrossings(gD.currentNodeOrder()) + modelOrderInfluence; for (LGraph childLGraph : gD.childGraphs()) { GraphInfoHolder child = graphInfoHolders.get(childLGraph.id); if (!child.dontSweepInto()) { totalCrossings += countCurrentNumberOfCrossings(child); } } } return totalCrossings; }

Target:
private double countCurrentNumberOfCrossings(final GraphInfoHolder currentGraph) { double totalCrossings = 0; Deque<GraphInfoHolder> countCrossingsIn = new ArrayDeque<>(); countCrossingsIn.push(currentGraph); while (!countCrossingsIn.isEmpty()) { GraphInfoHolder gD = countCrossingsIn.pop(); double modelOrderInfluence = 0; OrderingStrategy modelOrderStrategy = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY); double crossingCounterNodeInfluence = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_NODE_INFLUENCE); double crossingCounterPortInfluence = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_PORT_INFLUENCE); if (modelOrderStrategy != OrderingStrategy.NONE) { modelOrderInfluence += crossingCounterNodeInfluence * countModelOrderNodeChanges(gD.currentNodeOrder(), modelOrderStrategy); modelOrderInfluence += crossingCounterPortInfluence * countModelOrderPortChanges(gD.currentNodeOrder()); } totalCrossings += gD.crossCounter().countAllCrossings(gD.currentNodeOrder()) + modelOrderInfluence; for (LGraph childLGraph : gD.childGraphs()) { GraphInfoHolder child = graphInfoHolders.get(childLGraph.id); if (!child.dontSweepInto()) { totalCrossings += countCurrentNumberOfCrossings(child); } } } return totalCrossings; }
Source:
public void testLoadDataObjectsWithNonNullWorkspaceProject() { assertTrue(dataObjectsService.loadDataObjects(workspaceProject).isEmpty()); }

Target:
public void testLoadDataObjectsWithNonNullWorkspaceProject() { assertThat(dataObjectsService.loadDataObjects(workspaceProject)).isEmpty(); }
Source:
public AffinityLabelListModel(VdcQueryType queryType) { this.queryType = queryType; setTitle(ConstantsManager.getInstance().getConstants().affinityLabelsTitle()); setHelpTag(HelpTag.affinity_groups); setHashName("affinity_labels"); setNewCommand(new UICommand("New", this)); setEditCommand(new UICommand("Edit", this)); setRemoveCommand(new UICommand("Remove", this)); entitiesNameMap.setEntity(new HashMap<>()); updateActionAvailability(); loadEntitiesNameMap(); getItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); getSelectedItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); getEntityChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); }

Target:
public AffinityLabelListModel(VdcQueryType queryType) { this.queryType = queryType; setTitle(ConstantsManager.getInstance().getConstants().affinityLabelsTitle()); setHelpTag(HelpTag.affinity_groups); setHashName("affinity_labels"); setNewCommand(new UICommand("New", this)); setEditCommand(new UICommand("Edit", this)); setRemoveCommand(new UICommand("Remove", this)); entitiesNameMap.setEntity(new HashMap<>()); updateActionAvailability(); loadEntitiesNameMap(); getItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); getSelectedItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); }
Source:
public void testLineColumnAfterCopyConstructor() throws IOException { final String charsetName = StandardCharsets.ISO_8859_1.name(); final FileText fileText = new FileText(new File(getPath("InputFileTextImportControl.xml")), charsetName); final FileText copy = new FileText(fileText); assertNull("LineBreaks not null", Whitebox.getInternalState(copy, "lineBreaks")); final LineColumn lineColumn = copy.lineColumn(100); assertEquals("Invalid line", 3, lineColumn.getLine()); if (fileText.getFullText().chars().anyMatch(character -> character == '\r')) { assertEquals("Invalid column", 44, lineColumn.getColumn()); } else { assertEquals("Invalid column", 46, lineColumn.getColumn()); } }

Target:
public void testLineColumnAfterCopyConstructor() throws IOException { final Charset charset = StandardCharsets.ISO_8859_1; final String filepath = getPath("InputFileTextImportControl.xml"); final FileText fileText = new FileText(new File(filepath), charset.name()); final FileText copy = new FileText(fileText); assertNull("LineBreaks not null", Whitebox.getInternalState(copy, "lineBreaks")); final LineColumn lineColumn = copy.lineColumn(100); assertEquals("Invalid line", 3, lineColumn.getLine()); if (CheckUtil.CRLF.equals(CheckUtil.getLineSeparatorForFile(filepath, charset))) { assertEquals("Invalid column", 44, lineColumn.getColumn()); } else { assertEquals("Invalid column", 46, lineColumn.getColumn()); } }
Source:
@Override protected final FilePath write(FileCredentials credentials, FilePath dir) throws IOException, InterruptedException { FilePath secret = dir.child(credentials.getFileName()); copy(secret, credentials); if (secret.isDirectory()) { secret.chmod(0700); } else { secret.chmod(0400); } return secret; }

Target:
@Override protected final FilePath write(FileCredentials credentials, FilePath dir) throws IOException, InterruptedException { FilePath secret = dir.child(credentials.getFileName()); secret.copyFrom(credentials.getContent()); secret.chmod(0400); return secret; }
Source:
public void update(InventoryScreen inventoryScreen, SolApplication solApplication) { Hero hero = solApplication.getGame().getHero(); SolItem selectedItem = inventoryScreen.getSelectedItem(); boolean itemPurchasable = (selectedItem != null && hero.getMoney() >= selectedItem.getPrice() && hero.getItemContainer().canAdd(selectedItem)); inventoryScreen.getInteractButton().setEnabled(itemPurchasable); inventoryScreen.setInteractText("Buy"); }

Target:
public void update(InventoryScreen inventoryScreen, SolApplication solApplication) { Hero hero = solApplication.getGame().getHero(); SolItem selectedItem = inventoryScreen.getSelectedItem(); boolean itemPurchasable = (selectedItem != null && hero.getMoney() >= selectedItem.getPrice() && hero.getItemContainer().canAdd(selectedItem)); inventoryScreen.getInteractButton().setEnabled(itemPurchasable); }
Source:
public static void cleanup() throws DotDataException, DotSecurityException, AlreadyExistException { if (null != schemeStepActionResult1 && null != schemeStepActionResult1.getScheme()) { final WorkflowScheme wfScheme = schemeStepActionResult1.getScheme(); wfScheme.setArchived(true); workflowAPI.saveScheme(wfScheme, user); try { Future<WorkflowScheme> result = workflowAPI.deleteScheme(wfScheme, user); result.get(); }catch (InterruptedException | ExecutionException e){ assertTrue(e.getMessage(),false); } } if (null != schemeStepActionResult2 && null != schemeStepActionResult2.getScheme()) { final WorkflowScheme wfScheme2 = schemeStepActionResult2.getScheme(); wfScheme2.setArchived(true); workflowAPI.saveScheme(wfScheme2, user); try { Future<WorkflowScheme> result = workflowAPI.deleteScheme(wfScheme2, user); result.get(); }catch (InterruptedException | ExecutionException e){ assertTrue(e.getMessage(),false); } } }

Target:
public static void cleanup() throws DotDataException, DotSecurityException, AlreadyExistException { if (null != schemeStepActionResult1 && null != schemeStepActionResult1.getScheme()) { final WorkflowScheme wfScheme = schemeStepActionResult1.getScheme(); workflowAPI.archive(wfScheme, user); workflowAPI.deleteScheme(wfScheme, user); } if (null != schemeStepActionResult2 && null != schemeStepActionResult2.getScheme()) { final WorkflowScheme wfScheme2 = schemeStepActionResult2.getScheme(); workflowAPI.archive(wfScheme2, user); workflowAPI.deleteScheme(wfScheme2, user); } }
Source:
protected double invertPosition(double value) { return -1 * value + 1; }

Target:
protected static double invertPosition(double value) { return 1 - value; }
Source:
private void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, VMSnapshotVO vmSnapshotVo) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId()); if (serviceOfferingVO.isDynamic()) { List<VMSnapshotDetailsVO> vmSnapshotDetails = _vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId()); for (VMSnapshotDetailsVO detail : vmSnapshotDetails) { UserVmDetailVO userVmDetail = _userVmDetailsDao.findDetail(userVm.getId(), detail.getName()); if (userVmDetail != null) { userVmDetail.setValue(detail.getValue()); _userVmDetailsDao.update(userVmDetail.getId(), userVmDetail); } else { _userVmDetailsDao.addDetail(userVm.getId(), detail.getName(), detail.getValue(), detail.isDisplay()); } } } }

Target:
protected void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, VMSnapshotVO vmSnapshotVo) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId()); if (serviceOfferingVO.isDynamic()) { List<VMSnapshotDetailsVO> vmSnapshotDetails = _vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId()); List<UserVmDetailVO> userVmDetails = new ArrayList<UserVmDetailVO>(); for (VMSnapshotDetailsVO detail : vmSnapshotDetails) { userVmDetails.add(new UserVmDetailVO(userVm.getId(), detail.getName(), detail.getValue(), detail.isDisplay())); } _userVmDetailsDao.saveDetails(userVmDetails); } }
Source:
public String call() throws IOException { HttpURLConnection.setFollowRedirects(false); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); int statusCode = connection.getResponseCode(); if (statusCode != 200) { throw new IOException("Got status code: " + statusCode + " while downloading schema"); } InputStream urlStream = connection.getInputStream(); try { return Util.readAsUTF8(urlStream); } finally { urlStream.close(); } }

Target:
public String call() throws IOException { HttpURLConnection connection = (HttpURLConnection)url.openConnection(); int statusCode = connection.getResponseCode(); if (statusCode != 200) { throw new IOException("Got status code: " + statusCode + " while downloading " + "schema with url: " + url.toString()); } InputStream urlStream = connection.getInputStream(); try { return Util.readAsUTF8(urlStream); } finally { urlStream.close(); } }
Source:
public void testSplitBrainProtectionNotChecked_whenIsNotEnabled() { String disabledSBPName = "disabled-quorum"; SplitBrainProtectionConfig disabledSBPConfig = new SplitBrainProtectionConfig() .setName(disabledSBPName) .setMinimumClusterSize(3); MapConfig mapConfig = new MapConfig(randomMapName()) .setSplitBrainProtectionName(disabledSBPName); Config config = new Config() .addSplitBrainProtectionConfig(disabledSBPConfig) .addMapConfig(mapConfig); HazelcastInstance instance = createHazelcastInstance(config); SplitBrainProtectionService quorumService = instance.getSplitBrainProtectionService(); quorumService.ensureNoSplitBrain(disabledSBPName, disabledSBPConfig.getProtectOn()); instance.getMap(mapConfig.getName()).put("key", "value"); }

Target:
public void testSplitBrainProtectionNotChecked_whenIsNotEnabled() { String disabledSBPName = "disabled-quorum"; SplitBrainProtectionConfig disabledSBPConfig = new SplitBrainProtectionConfig() .setName(disabledSBPName) .setMinimumClusterSize(3); MapConfig mapConfig = new MapConfig(randomMapName()) .setSplitBrainProtectionName(disabledSBPName); Config config = new Config() .addSplitBrainProtectionConfig(disabledSBPConfig) .addMapConfig(mapConfig); HazelcastInstance instance = createHazelcastInstance(config); instance.getSplitBrainProtectionService().ensureNoSplitBrain(disabledSBPName, disabledSBPConfig.getProtectOn()); instance.getMap(mapConfig.getName()).put("key", "value"); }
Source:
private void updateExportDialogAutoScaleSettings(boolean value) { IDialogSettings settings = getExportDialogSettings(); settings.put(AbstractExportRepresentationsAsImagesDialog.AUTO_SCALE_SETTING_PROPERTY, value); if (value) { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 100); } else { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 0); } }

Target:
private void updateExportDialogAutoScaleSettings(boolean value) { IDialogSettings settings = getExportDialogSettings(); settings.put(AbstractExportRepresentationsAsImagesDialog.AUTO_SCALE_SETTING_PROPERTY, value); if (value) { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 10); } else { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 0); } }
Source:
public DateUiColumn(final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final DatePickerSingletonDOMElementFactory factory) { super(headerMetaData, new CellRenderer<Date, DatePicker, DatePickerDOMElement>(factory) { @Override protected void doRenderCellContent(final Text t, final Date value, final GridBodyCellRenderContext context) { t.setText(format(value)); } }, width, isResizable, isVisible, access, factory); }

Target:
public DateUiColumn( final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final DatePickerSingletonDOMElementFactory factory ) { super( headerMetaData, makeColumnRenderer(factory), width, isResizable, isVisible, access, factory ); }
Source:
private File newFile(int index) { createDirectoryIfDoesNotExist(); File fresh = new File(diagnostics.directory, format(fileName, index)); logger.info("Current diagnostics log file is " + fresh.getAbsolutePath()); return fresh; }

Target:
private File newFile(int index) { createDirectoryIfDoesNotExist(); logger.info("Diagnostics log directory is [" + diagnostics.directory + "]"); return new File(diagnostics.directory, format(fileName, index)); }
Source:
public Enumerable<Object[]> scan(DataContext root) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); final Access stateAccess = AuthorizationUtils.authorizeAllResourceActions( authenticationResult, Collections.singletonList(new ResourceAction(new Resource("STATE", ResourceType.STATE), Action.READ)), authorizerMapper ); if (!stateAccess.isAllowed()) { throw new ForbiddenException("Insufficient permission to view servers :" + stateAccess); } final List<Object[]> rows = new ArrayList<>(); final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final int serverSegmentsTableSize = SERVER_SEGMENTS_SIGNATURE.getRowOrder().size(); for (ImmutableDruidServer druidServer : druidServers) { final Iterable<DataSegment> authorizedServerSegments = AuthorizationUtils.filterAuthorizedResources( authenticationResult, druidServer.getLazyAllSegments(), SEGMENT_RA_GENERATOR, authorizerMapper ); for (DataSegment segment : authorizedServerSegments) { Object[] row = new Object[serverSegmentsTableSize]; row[0] = druidServer.getHost(); row[1] = segment.getId(); rows.add(row); } } return Linq4j.asEnumerable(rows); }

Target:
public Enumerable<Object[]> scan(DataContext root) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); checkStateReadAccessForServers(authenticationResult, authorizerMapper); final List<Object[]> rows = new ArrayList<>(); final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final int serverSegmentsTableSize = SERVER_SEGMENTS_SIGNATURE.getRowOrder().size(); for (ImmutableDruidServer druidServer : druidServers) { final Iterable<DataSegment> authorizedServerSegments = AuthorizationUtils.filterAuthorizedResources( authenticationResult, druidServer.getLazyAllSegments(), SEGMENT_RA_GENERATOR, authorizerMapper ); for (DataSegment segment : authorizedServerSegments) { Object[] row = new Object[serverSegmentsTableSize]; row[0] = druidServer.getHost(); row[1] = segment.getId(); rows.add(row); } } return Linq4j.asEnumerable(rows); }