auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected FSDataOutputStream openStream(Path filepath, boolean append) throws IOException { FSDataOutputStream fsOutput; if (append) { <START> return openStreamForNonAppendFS(filepath); <END> } else { fsOutput = fs.create(filepath, (short)replication); fs.setPermission(filepath, FsPermission.createImmutable(filePermission)); } return fsOutput; }</code><technical_language>fsOutput = openStreamForNonAppendFS(filepath); consistent original one</technical_language>

Target:
protected FSDataOutputStream openStream(Path filepath, boolean append) throws IOException { FSDataOutputStream fsOutput; if (append) { fsOutput = openStreamInAppendMode(filepath); } else { fsOutput = fs.create(filepath, (short)replication); fs.setPermission(filepath, FsPermission.createImmutable(filePermission)); } return fsOutput; }
Source:
<code>protected ITmfTreeColumnDataProvider getColumnDataProvider() { return new ITmfTreeColumnDataProvider() { @Override public List<@Nullable TmfTreeColumnData> getColumnData() { return ImmutableList.of( <START> createTmfTreeColumnData(COLUMN_NAMES[0], Objects.requireNonNull(Comparator.comparing(SegmentStoreStatisticsEntry::getName))), <END> createTmfTreeColumnData(COLUMN_NAMES[1], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMin()))), createTmfTreeColumnData(COLUMN_NAMES[2], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMax()))), createTmfTreeColumnData(COLUMN_NAMES[3], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getMean()))), createTmfTreeColumnData(COLUMN_NAMES[4], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getStdDev()))), createTmfTreeColumnData(COLUMN_NAMES[5], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getNbElements()))), createTmfTreeColumnData(COLUMN_NAMES[6], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getTotal()))), new TmfTreeColumnData("")); } }; }</code><technical_language>requireNonNulls do work. annonate methods, return null</technical_language>

Target:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> ImmutableList.of( createTmfTreeColumnData(COLUMN_NAMES[0], Comparator.comparing(SegmentStoreStatisticsEntry::getName)), createTmfTreeColumnData(COLUMN_NAMES[1], Comparator.comparingLong(s -> s.getEntry().getMin())), createTmfTreeColumnData(COLUMN_NAMES[2], Comparator.comparingLong(s -> s.getEntry().getMax())), createTmfTreeColumnData(COLUMN_NAMES[3], Comparator.comparingDouble(s -> s.getEntry().getMean())), createTmfTreeColumnData(COLUMN_NAMES[4], Comparator.comparingDouble(s -> s.getEntry().getStdDev())), createTmfTreeColumnData(COLUMN_NAMES[5], Comparator.comparingLong(s -> s.getEntry().getNbElements())), createTmfTreeColumnData(COLUMN_NAMES[6], Comparator.comparingDouble(s -> s.getEntry().getTotal())), new TmfTreeColumnData("")); }
Source:
<code><START> public GraphResultSet execute(AbstractGraphStatement statement) { <END> if (!AbstractGraphStatement.checkStatement(statement)) { throw new InvalidQueryException("Invalid Graph Statement, you need to specify at least the keyspace containing the Graph data."); } return new GraphResultSet(session.execute(statement.configureAndGetWrappedStatement())); }</code><technical_language>I need interface AbstractGraphStatement need public this is a public method, weird classloading issues (BootstrapMethodError) if this a method reference in java 8</technical_language>

Target:
public GraphResultSet execute(AbstractGraphStatement statement) { return new GraphResultSet(session.execute(statement.configureAndGetWrappedStatement(getDefaultGraphOptions()))); }
Source:
<code>private void sendInfo(XMPPContact contact) { String sarosJid = contact.getSarosJid().map(JID::toString).orElse(null); if (sarosJid == null) return; IQ packet = InfoExchangeExtension.PROVIDER.createIQ(new InfoExchangeExtension(localInfo)); packet.setType(IQ.Type.SET); packet.setTo(sarosJid); try { transmitter.sendPacket(packet); } catch (IOException e) { <START> log.error("could not send version response to " + sarosJid, e); <END> } }</code><technical_language>error message is wrong</technical_language>

Target:
private void sendInfo(XMPPContact contact) { String sarosJid = contact.getSarosJid().map(JID::toString).orElse(null); if (sarosJid == null) return; IQ packet = InfoExchangeExtension.PROVIDER.createIQ(new InfoExchangeExtension(localInfo)); packet.setType(IQ.Type.SET); packet.setTo(sarosJid); try { transmitter.sendPacket(packet); } catch (IOException e) { log.error("could not send info packet to " + sarosJid, e); } }
Source:
<code>public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (!Projects.isBuildWithGradle(myProject)) { return null; } Module module = ModuleUtilCore.findModuleForFile(file, myProject); if (module == null) { return null; } AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(module); if(facet != null) { AppEngineConfigurationProperties state = facet.getConfiguration().getState(); if (state != null && !(new File(state.APPENGINE_SDKROOT).exists())) { <START> System.out.println("hello"); <END> return new DownloadSdkNotification(module); } } return null; }</code><technical_language>hello</technical_language>

Target:
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (!Projects.isBuildWithGradle(myProject)) { return null; } Module module = ModuleUtilCore.findModuleForFile(file, myProject); if (module == null) { return null; } AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(module); if(facet != null) { AppEngineConfigurationProperties state = facet.getConfiguration().getState(); if (state != null && !(new File(state.APPENGINE_SDKROOT).exists())) { return new DownloadSdkNotification(module); } } return null; }
Source:
<code>private String getVmIsBeingImportedMessage() { StringBuilder builder = new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED.name()); <START> builder.append(String.format("$VmName %1$s", getVmName())); <END> return builder.toString(); }</code><technical_language>NPE</technical_language>

Target:
private String getVmIsBeingImportedMessage() { StringBuilder builder = new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED.name()); if (getVmName() != null) { builder.append(String.format("$VmName %1$s", getVmName())); } return builder.toString(); }
Source:
<code><START> public void close() { <END> IOUtils.closeQuietly(inputStreamDataCache); }</code><technical_language>synchronized</technical_language>

Target:
public synchronized void close() { IOUtils.closeQuietly(streamCloser); }
Source:
<code>public void loadContent(Bounds bounds) { content.getChildren().clear(); HBox hbox = new HBox(); Range ranks = getRange(bounds); List<Annotation> annotations = graph.getAnnotationByRank(ranks).stream() <START> .sorted((a1, a2) -> (a1.getStart() < a2.getStart()) ? -1 : 1) <END> .collect(Collectors.toList()); annotations.forEach(a -> hbox.getChildren().add(new Gene(a))); content.getChildren().add(hbox); }</code><technical_language>pass check style</technical_language>

Target:
protected void loadContent(Bounds bounds) { content.getChildren().clear(); HBox hbox = new HBox(); Range ranks = getRange(bounds); List<Annotation> annotations = getSortedAnnotations(ranks); annotations.forEach(a -> hbox.getChildren().add(new Gene(a))); content.getChildren().add(hbox); }
Source:
<code>public ClusteredCacheQueryImpl(Query luceneQuery, SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?, ?> cache, KeyTransformationHandler keyTransformationHandler, Class<?>... classes) { super(luceneQuery, searchFactory, cache, keyTransformationHandler, classes); this.asyncExecutor = asyncExecutor; this.hSearchQuery = searchFactory.createHSQuery().luceneQuery(luceneQuery) .targetedEntities(Arrays.asList(classes)); <START> this.marshaller = ComponentRegistryUtils.getComponent(cache, <END> StreamingMarshaller.class); }</code><technical_language>related changes, this field is anymore</technical_language>

Target:
public ClusteredCacheQueryImpl(Query luceneQuery, SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?, ?> cache, KeyTransformationHandler keyTransformationHandler, Class<?>... classes) { super(luceneQuery, searchFactory, cache, keyTransformationHandler, classes); this.asyncExecutor = asyncExecutor; this.hSearchQuery = searchFactory.createHSQuery().luceneQuery(luceneQuery) .targetedEntities(Arrays.asList(classes)); }
Source:
<code>public void fallbackChunk_givenInInitParameter_passedOnToDeploymentConfiguration() throws ServletException { FallbackChunk fallbackChunk = new FallbackChunk(Collections.emptyList(), Collections.emptyList()); final Properties properties = new Properties(); properties.put(DeploymentConfigurationFactory.FALLBACK_CHUNK, fallbackChunk); VaadinService service = SpringInstantiatorTest.getService(context, properties, true); <START> Assert.assertEquals(fallbackChunk, <END> service.getDeploymentConfiguration().getInitParameters() .get(DeploymentConfigurationFactory.FALLBACK_CHUNK)); }</code><technical_language>assertSame is</technical_language>

Target:
public void fallbackChunk_givenInInitParameter_passedOnToDeploymentConfiguration() throws ServletException { FallbackChunk fallbackChunk = new FallbackChunk(Collections.emptyList(), Collections.emptyList()); final Properties properties = new Properties(); properties.put(DeploymentConfigurationFactory.FALLBACK_CHUNK, fallbackChunk); VaadinService service = SpringInstantiatorTest.getService(context, properties, true); Assert.assertSame(fallbackChunk, service.getDeploymentConfiguration().getInitParameters() .get(DeploymentConfigurationFactory.FALLBACK_CHUNK)); }
Source:
<code>public void testScheduleSplitsBatched() { StageExecutionPlan plan = createPlan(createFixedSplitSource(60, TestingSplit::createRemoteSplit)); NodeTaskMap nodeTaskMap = new NodeTaskMap(finalizerService); SqlStageExecution stage = createSqlStageExecution(plan, nodeTaskMap); StageScheduler scheduler = getSourcePartitionedScheduler(plan, stage, nodeManager, nodeTaskMap, 7); for (int i = 0; i <= (60 / 7); i++) { ScheduleResult scheduleResult = scheduler.schedule(); assertFalse(scheduleResult.isFinished()); <START> assertEquals(scheduleResult.getBlockedReason(), i == (60 / 7) ? Optional.of(NO_ACTIVE_DRIVER_GROUP) : Optional.empty()); <END> assertTrue(scheduleResult.getBlocked().isDone()); assertEquals(scheduleResult.getNewTasks().size(), i == 0 ? 3 : 0); assertEquals(stage.getAllTasks().size(), 3); assertPartitionedSplitCount(stage, min((i + 1) * 7, 60)); } assertCleanupScheduleResult(scheduler.schedule()); for (RemoteTask remoteTask : stage.getAllTasks()) { assertEquals(remoteTask.getPartitionedSplitCount(), 20); } stage.abort(); }</code><technical_language>I necessary introduce assertFinished(scheduledResult, scheduler). allow behaviors: * finished, blocked * initially: finished, blocked; 2nd invocation of schedule: finished, blocked ------------------------- (actually, this part ok.) In addition, I is here. i == 60/7, code is effectively doing: assertEquals(scheduleResult.getBlockedReason, Optional.of(NO_ACTIVE_DRIVER_GROUP)); assertTrue(scheduleResult.getBlocked().isDone()); I reasonable introduce assertBlocked(optionalReason)</technical_language>

Target:
public void testScheduleSplitsBatched() { StageExecutionPlan plan = createPlan(createFixedSplitSource(60, TestingSplit::createRemoteSplit)); NodeTaskMap nodeTaskMap = new NodeTaskMap(finalizerService); SqlStageExecution stage = createSqlStageExecution(plan, nodeTaskMap); StageScheduler scheduler = getSourcePartitionedScheduler(plan, stage, nodeManager, nodeTaskMap, 7); for (int i = 0; i <= (60 / 7); i++) { ScheduleResult scheduleResult = scheduler.schedule(); if (i == (60 / 7)) { assertEffectivelyFinished(scheduleResult, scheduler); } else { assertFalse(scheduleResult.isFinished()); } assertTrue(scheduleResult.getBlocked().isDone()); assertEquals(scheduleResult.getNewTasks().size(), i == 0 ? 3 : 0); assertEquals(stage.getAllTasks().size(), 3); assertPartitionedSplitCount(stage, min((i + 1) * 7, 60)); } for (RemoteTask remoteTask : stage.getAllTasks()) { assertEquals(remoteTask.getPartitionedSplitCount(), 20); } stage.abort(); }
Source:
<code>private void testDoubleCheckpointHandling(ProcessingMode processingMode) throws Exception { WindowGenerator windowGenerator = new WindowGenerator(new ScheduledThreadPoolExecutor(1, "WindowGenerator"), 1024); windowGenerator.setResetWindow(0L); windowGenerator.setFirstWindow(0L); windowGenerator.setWindowWidth(100); windowGenerator.setCheckpointCount(1, 0); GenericCheckpointOperator gco = new GenericCheckpointOperator(); DefaultAttributeMap dam = new DefaultAttributeMap(); dam.put(OperatorContext.APPLICATION_WINDOW_COUNT, 2); dam.put(OperatorContext.CHECKPOINT_WINDOW_COUNT, 2); final GenericNode in = new GenericNode(gco, new com.datatorrent.stram.engine.OperatorContext(0, dam, null)); in.setId(1); TestSink testSink = new TestSink(); in.connectInputPort("ip1", windowGenerator.acquireReservoir(String.valueOf(in.id), 1024)); in.connectOutputPort("output", testSink); windowGenerator.activate(null); final AtomicBoolean ab = new AtomicBoolean(false); Thread t = new Thread() { @Override public void run() { ab.set(true); in.activate(); in.run(); in.deactivate(); } }; t.start(); <START> Thread.sleep(3000); <END> t.stop(); windowGenerator.deactivate(); Assert.assertFalse(gco.checkpointTwice); }</code><technical_language>Wait 3 windows instead of fixed timeout</technical_language>

Target:
private void testDoubleCheckpointHandling(ProcessingMode processingMode) throws Exception { WindowGenerator windowGenerator = new WindowGenerator(new ScheduledThreadPoolExecutor(1, "WindowGenerator"), 1024); windowGenerator.setResetWindow(0L); windowGenerator.setFirstWindow(0L); windowGenerator.setWindowWidth(100); windowGenerator.setCheckpointCount(1, 0); GenericCheckpointOperator gco = new GenericCheckpointOperator(); DefaultAttributeMap dam = new DefaultAttributeMap(); dam.put(OperatorContext.APPLICATION_WINDOW_COUNT, 2); dam.put(OperatorContext.CHECKPOINT_WINDOW_COUNT, 2); dam.put(OperatorContext.PROCESSING_MODE, processingMode); final GenericNode in = new GenericNode(gco, new com.datatorrent.stram.engine.OperatorContext(0, dam, null)); in.setId(1); TestSink testSink = new TestSink(); in.connectInputPort("ip1", windowGenerator.acquireReservoir(String.valueOf(in.id), 1024)); in.connectOutputPort("output", testSink); windowGenerator.activate(null); final AtomicBoolean ab = new AtomicBoolean(false); Thread t = new Thread() { @Override public void run() { ab.set(true); in.activate(); in.run(); in.deactivate(); } }; t.start(); long startTime = System.currentTimeMillis(); long endTime = 0; while (gco.numWindows < 3 && ((endTime = System.currentTimeMillis()) - startTime) < 5000) { Thread.sleep(50); } in.shutdown(); t.join(); windowGenerator.deactivate(); Assert.assertFalse(gco.checkpointTwice); Assert.assertTrue("Timed out", (endTime - startTime) < 5000); }
Source:
<code>public void blockedLockRequestThrows503OnLeaderElection() throws InterruptedException { LockRefreshToken lock = CLUSTER.lock(CLIENT_1, BLOCKING_LOCK_REQUEST); assertThat(lock).isNotNull(); TestableTimelockServer leader = CLUSTER.currentLeader(); <START> Future<LockRefreshToken> lock2 = Executors.newSingleThreadExecutor() <END> .submit(() -> leader.lock(CLIENT_2, BLOCKING_LOCK_REQUEST)); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); CLUSTER.nonLeaders().forEach(TestableTimelockServer::kill); assertThatThrownBy(() -> leader.lock(CLIENT_3, BLOCKING_LOCK_REQUEST)) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); try { lock2.get(); fail(String.format("Lock client %s should have thrown an execution exception as leader is not available", CLIENT_2)); } catch (ExecutionException e) { assertThat(e.getCause()).satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); } }</code><technical_language>nit: CompletableFuture.supplyAsync</technical_language>

Target:
public void blockedLockRequestThrows503OnLeaderElection() throws InterruptedException { LockRefreshToken lock = CLUSTER.lock(CLIENT_1, BLOCKING_LOCK_REQUEST); assertThat(lock).isNotNull(); TestableTimelockServer leader = CLUSTER.currentLeader(); CompletableFuture<LockRefreshToken> lockRefreshTokenCompletableFuture = CompletableFuture.supplyAsync(() -> { try { return leader.lock(CLIENT_2, BLOCKING_LOCK_REQUEST); } catch (InterruptedException e) { return null; } }); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); CLUSTER.nonLeaders().forEach(TestableTimelockServer::kill); assertThatThrownBy(() -> leader.lock(CLIENT_3, BLOCKING_LOCK_REQUEST)) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); assertThat(catchThrowable(lockRefreshTokenCompletableFuture::get).getCause()) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); }
Source:
<code>public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { <START> assert (!PlatformUtil.isHeadless()); <END> login(monitor); synchronized (deployLock) { doDeployBDM(monitor); } }</code><technical_language>Becarefull assert. fail if jvm is launched specific argument (-ea). a Preconditions.checkState() instead</technical_language>

Target:
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Preconditions.checkState(!PlatformUtil.isHeadless()); login(monitor); synchronized (deployLock) { doDeployBDM(monitor); } }
Source:
<code>private OAuth2AuthorizationRequest getB2CAuthorizationRequest(@Nullable OAuth2AuthorizationRequest request, String userFlow) { Assert.hasText(userFlow, "User flow should contain text."); if (request == null) { return null; } cleanupSecurityContextAuthentication(); final Map<String, Object> additional = this.properties.getAdditional(); <START> this.properties.getAdditional().put("p", userFlow); <END> this.properties.getAdditional().put(PARAMETER_X_CLIENT_SKU, AAD_B2C_USER_AGENT); return OAuth2AuthorizationRequest.from(request).additionalParameters(additional).build(); }</code><technical_language>manipulate additional here</technical_language>

Target:
private OAuth2AuthorizationRequest getB2CAuthorizationRequest(@Nullable OAuth2AuthorizationRequest request, String userFlow) { Assert.hasText(userFlow, "User flow should contain text."); if (request == null) { return null; } cleanupSecurityContextAuthentication(); final Map<String, Object> additionalParameters = new HashMap<>(); Optional.ofNullable(this.properties) .map(AADB2CProperties::getAuthenticateAdditionalParameters) .ifPresent(additionalParameters::putAll); additionalParameters.put("p", userFlow); additionalParameters.put(PARAMETER_X_CLIENT_SKU, AAD_B2C_USER_AGENT); return OAuth2AuthorizationRequest.from(request).additionalParameters(additionalParameters).build(); }
Source:
<code>public List metacardValueToJsonValue(WorkspaceTransformer transformer, List metacardValue) { <START> return ((List<String>) metacardValue) <END> .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toList()); }</code><technical_language>guaranteed get a list of strings? A safer approach metacardValue.stream().filter(String.class::isInstance).map(String.class::cast)..</technical_language>

Target:
public Optional<List> metacardValueToJsonValue( WorkspaceTransformer transformer, List metacardValue) { return Optional.of( ((List<Object>) metacardValue) .stream() .filter(String.class::isInstance) .map(String.class::cast) .filter(StringUtils::isNotBlank) .collect(Collectors.toList())); }
Source:
<code>public void impl(@Nonnull CorfuRuntime runtime) throws Exception { <START> runtime.invalidateLayout(); <END> Layout layout = new Layout(runtime.getLayoutView().getLayout()); runtime.getLayoutManagementView().removeNode(layout, request.getEndpoint()); }</code><technical_language>orchestrator pass a connected client (i.e. a layout ready) creates a workflow, is this needed</technical_language>

Target:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { Layout layout = new Layout(runtime.getLayoutView().getLayout()); runtime.getLayoutManagementView().removeNode(layout, request.getEndpoint()); }
Source:
<code>public ScrollServiceImpl(List<ScrollDescriptor> scrollDescriptors) { descriptors = new HashMap<>(scrollDescriptors.size()); <START> scrollDescriptors.forEach(descriptor -> descriptors.put(descriptor.getName(), descriptor)); <END> scrollDescriptors.stream() .filter(ScrollDescriptor::isDefault) .forEach( descriptor -> descriptors.put(DocumentScrollRequest.Builder.DEFAULT_TYPE, descriptor)); }</code><technical_language>i wondering if (depending if in a race condition) replace ConcurrentHashMap</technical_language>

Target:
public ScrollServiceImpl(List<ScrollDescriptor> scrollDescriptors) { descriptors = new HashMap<>(scrollDescriptors.size()); scrollDescriptors.forEach(descriptor -> descriptors.put(getKey(descriptor), descriptor)); scrollDescriptors.stream() .filter(ScrollDescriptor::isDefault) .forEach(descriptor -> descriptors.put(getDefaultKey(descriptor), descriptor)); }
Source:
<code>private List<HasMetadata> unmarshalDefaultEnvObjects(WorkspaceConfigImpl workspaceConfig) throws DevfileException { String defaultEnvName = workspaceConfig.getDefaultEnv(); if (defaultEnvName == null) { return new ArrayList<>(); } EnvironmentImpl defaultEnv = workspaceConfig.getEnvironments().get(defaultEnvName); if (defaultEnv == null) { return new ArrayList<>(); } RecipeImpl envRecipe = defaultEnv.getRecipe(); if (!OpenShiftEnvironment.TYPE.equals(envRecipe.getType()) && !KubernetesEnvironment.TYPE.equals(envRecipe.getType())) { throw new DevfileException( String.format( <START> "Kubernetes tool can not be applied to workspace with recipe with not " <END> + "kubernetes nor openshift type but is has recipe with type '%s'", envRecipe.getType())); } return unmarshal(envRecipe.getContent()); }</code><technical_language>Kubernetes tool applied a workspace kubernetes openshift recipe type workspace %s a recipe of type %s sound IMHO. If want current wording -> cannot, is recipe -> recipe</technical_language>

Target:
private List<HasMetadata> unmarshalDefaultEnvObjects(WorkspaceConfigImpl workspaceConfig) throws DevfileException { String defaultEnvName = workspaceConfig.getDefaultEnv(); if (defaultEnvName == null) { return new ArrayList<>(); } EnvironmentImpl defaultEnv = workspaceConfig.getEnvironments().get(defaultEnvName); if (defaultEnv == null) { return new ArrayList<>(); } RecipeImpl envRecipe = defaultEnv.getRecipe(); if (!OpenShiftEnvironment.TYPE.equals(envRecipe.getType()) && !KubernetesEnvironment.TYPE.equals(envRecipe.getType())) { throw new DevfileException( format( "Kubernetes tool can only be applied to a workspace with either kubernetes or " + "openshift recipe type but workspace has a recipe of type '%s'", envRecipe.getType())); } return unmarshal(envRecipe.getContent()); }
Source:
<code>private PoolingHttpClientConnectionManager createInsecureTlsConnectionManager() { try { SSLContext sslContext = SSLContextBuilder .create() .loadTrustMaterial(new TrustSelfSignedStrategy()) .build(); HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder .<ConnectionSocketFactory>create().register("https", connectionFactory) .build(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager( socketFactoryRegistry); return cm; } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>want stack trace prints part of tha code flow. I suggest throw new RuntimeException(e) instead</technical_language>

Target:
private PoolingHttpClientConnectionManager createInsecureTlsConnectionManager() { try { SSLContext sslContext = SSLContextBuilder .create() .loadTrustMaterial(new TrustSelfSignedStrategy()) .build(); HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder .<ConnectionSocketFactory>create().register("https", connectionFactory) .build(); return new PoolingHttpClientConnectionManager(socketFactoryRegistry); } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { throw new RuntimeException(e); } }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult: " + requestCode + ", " + resultCode + ", " + data); super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { Bundle bundle = data.getExtras(); <START> String cookie = bundle.getString("cookie"); <END> Log.v(TAG, "cookie outside: " + cookie); _cookie = cookie; new ResourceAccessAsyncTask().execute(authorization_resource_url+"12345"); } }</code><technical_language>safer a constant for "cookie"</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult: " + requestCode + ", " + resultCode + ", " + data); super.onActivityResult(requestCode, resultCode, data); String AIS_WEBVIEW_COOKIE = getResources().getString(R.string.ais_webview_cookie); if (resultCode == RESULT_OK) { authorizationCookie = data.getExtras().getString(AIS_WEBVIEW_COOKIE); new ResourceAccessAsyncTask().execute(authorizationResourceUrl+"12345"); } }
Source:
<code>public boolean pollSocketsInfo() { if (!mDependencies.isTcpInfoParsingSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = mDependencies.connectToKernel(); mTcpStats.clear(); for (final int family : ADDRESS_FAMILIES) { mDependencies.sendPollingRequest(fd, mSockDiagMsg.get(family)); final ByteBuffer bytes = mDependencies.recvMesssage(fd); while (enoughBytesRemainForValidNlMsg(bytes)) { final StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + StructInetDiagMsg.STRUCT_SIZE - 7 * Integer.BYTES); final long cookie = bytes.getLong(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } <START> if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; <END> } } cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }</code><technical_language>this moved l.168</technical_language>

Target:
public boolean pollSocketsInfo() { if (!mDependencies.isTcpInfoParsingSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = mDependencies.connectToKernel(); final TcpStat stat = new TcpStat(); for (final int family : ADDRESS_FAMILIES) { mDependencies.sendPollingRequest(fd, mSockDiagMsg.get(family)); final ByteBuffer bytes = mDependencies.recvMesssage(fd); while (enoughBytesRemainForValidNlMsg(bytes)) { final StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsghdr=" + nlmsghdr); if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + IDIAG_COOKIE_OFFSET); final long cookie = bytes.getLong(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); stat.accumulate(calculateLatestPacketsStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } } } mSentSinceLastRecv = (stat.receivedCount == 0) ? (mSentSinceLastRecv + stat.sentCount) : 0; mLatestPacketFailRate = ((stat.sentCount != 0) ? ((stat.retransmitCount + stat.lostCount) * 100 / stat.sentCount) : 0); cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }
Source:
<code>private Map<String, BasicAuthenticatorUser> fetchUserMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchUserMapFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserMapFromDisk(prefix); } catch (Exception e2) { <START> LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); <END> } } } return null; } }</code><technical_language>Please add e e2 e2.addSuppressed(e)</technical_language>

Target:
private Map<String, BasicAuthenticatorUser> fetchUserMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchUserMapFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserMapFromDisk(prefix); } catch (Exception e2) { e2.addSuppressed(e); LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); } } } return null; } }
Source:
<code>protected void terminateMappedConfigurations(IResource resource) { ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { for (ILaunch <START> launche : <END> launches) { for (ILaunchConfiguration config : configs) { if(config.equals(launche.getLaunchConfiguration()) & launche.canTerminate()) { launche.terminate(); } } } } catch(CoreException e) {DebugPlugin.log(e);} }</code><technical_language>rename launch</technical_language>

Target:
protected void terminateMappedConfigurations(IResource resource) { ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { for (ILaunch launch : launches) { for (ILaunchConfiguration config : configs) { if(config.equals(launch.getLaunchConfiguration()) & launch.canTerminate()) { launch.terminate(); } } } } catch(CoreException e) {DebugPlugin.log(e);} }
Source:
<code>public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) { <START> throw new TajoRuntimeException(new UnsupportedException("getPartitionsByAlgebra")); <END> }</code><technical_language>UnsupportedException automatically generates error message including method class if is a default constructor. SO, new UnsupportedException()</technical_language>

Target:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { List<PartitionDescProto> list = null; try { String databaseName = request.getDatabaseName(); String tableName = request.getTableName(); TableDescProto tableDesc = getTable(databaseName, tableName); String filter = getFilter(databaseName, tableName, tableDesc.getPartition().getExpressionSchema().getFieldsList() , request.getAlgebra()); list = getPartitionsByFilterFromHiveMetaStore(databaseName, tableName, filter); } catch (Exception se) { throw new TajoInternalError(se); } return list; }
Source:
<code>public GitHubLastUpdateCache() { <START> this(new File(DRONE_TARGET_DIRECTORY + File.separator + "gh_cache" + File.separator)); <END> }</code><technical_language>DRONE_TARGET_DIRECTORY means update cache is stored in target directory, right? if is a good approach new run of test suite require a new request - I expected in ~/.arquillian/drone directory. other hand, I agree probability run out of limited number of request is low.... decided put target directory</technical_language>

Target:
public GitHubLastUpdateCache() { this(DEFAULT_CACHE_DIRECTORY); }
Source:
<code>public static DiscloseRequestMessageDTO createInstance(UserDTO actingUser, DiscloseRequestMessage messageEntity) { GoalConflictMessage targetGoalConflictMessage = messageEntity.getTargetGoalConflictMessage(); <START> return new DiscloseRequestMessageDTO(messageEntity.getID(), messageEntity.getCreationTime(), actingUser, <END> messageEntity.getNickname(), messageEntity.getMessage(), messageEntity.getStatus(), targetGoalConflictMessage.getOriginGoalConflictMessageID(), GoalConflictMessageDTO.createInstance(targetGoalConflictMessage, null)); }</code><technical_language>actingUser a parameter, while other subclasses of BuddyMessageDTO UserDTO.createInstanceIfNotNull(messageEntity.getUser()). please uniform? (See BuddyConnectRequestMessageDTO.createInstance, BuddyConnectResponseMessageDTO.createInstance, BuddyDisconnectMessageDTO.createInstance.) If user is deleted, actingUser null? message factory construct messages (by inbox request) related user deleted</technical_language>

Target:
public static DiscloseRequestMessageDTO createInstance(UserDTO actingUser, DiscloseRequestMessage messageEntity) { GoalConflictMessage targetGoalConflictMessage = messageEntity.getTargetGoalConflictMessage(); return new DiscloseRequestMessageDTO(messageEntity.getID(), messageEntity.getCreationTime(), UserDTO.createInstanceIfNotNull(messageEntity.getUser()), messageEntity.getNickname(), messageEntity.getMessage(), messageEntity.getStatus(), targetGoalConflictMessage.getOriginGoalConflictMessageID(), GoalConflictMessageDTO.createInstance(targetGoalConflictMessage, null)); }
Source:
<code>private ExpectedCondition<?> getDefaultCondition(By myBy) { ExpectedCondition<?> waitCondition = null; switch (loadingStrategy) { <START> case BY_PRESENCE: { <END> if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.presenceOfElementLocated(myBy); } break; } case BY_VISIBILITY: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.visibilityOfElementLocated(myBy); } break; } case BY_PRESENCE_VISIBILITY: if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy)); } break; } return waitCondition; }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Extract this nested code block a method. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
private ExpectedCondition<?> getDefaultCondition(By myBy) { ExpectedCondition<?> waitCondition = null; switch (loadingStrategy) { case BY_PRESENCE: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.presenceOfElementLocated(myBy); } break; } case BY_VISIBILITY: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.visibilityOfElementLocated(myBy); } break; } case BY_PRESENCE_OR_VISIBILITY: if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy)); } break; } return waitCondition; }
Source:
<code>public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { cursor.moveToPosition(-1); List<TruckCluster> markers = new ArrayList<>(); while (cursor.moveToNext()) { <START> Truck truck = new Truck.Builder() <END> .id(cursor.getString(ActiveTrucksQuery.INTERNAL_ID)) .name(cursor.getString(ActiveTrucksQuery.NAME)) .build(); LatLng location = new LatLng(cursor.getDouble(ActiveTrucksQuery.LATITUDE), cursor.getDouble(ActiveTrucksQuery.LONGITUDE)); markers.add(createTruckMarker(location)); } clusterManager.clearItems(); clusterManager.addItems(markers); }</code><technical_language>truck is unused</technical_language>

Target:
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { cursor.moveToPosition(-1); List<TruckCluster> markers = new ArrayList<>(); while (cursor.moveToNext()) { Truck truck = new Truck.Builder() .id(cursor.getString(ActiveTrucksQuery.INTERNAL_ID)) .name(cursor.getString(ActiveTrucksQuery.NAME)) .build(); LatLng location = new LatLng(cursor.getDouble(ActiveTrucksQuery.LATITUDE), cursor.getDouble(ActiveTrucksQuery.LONGITUDE)); markers.add(new TruckCluster(truck, location)); } if (clusterManager != null) { clusterManager.clearItems(); clusterManager.addItems(markers); } }
Source:
<code>public static void sleep(int timeInMillis) { try { if (timeInMillis > 0) { LOG.info("Sleep time set to:" + timeInMillis + " ms"); Thread.sleep(timeInMillis); } } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>I LOG.error</technical_language>

Target:
public static void sleep(int timeInMillis) { try { if (timeInMillis > 0) { LOG.info("Sleep time set to:" + timeInMillis + " ms"); Thread.sleep(timeInMillis); } } catch (InterruptedException e) { LOG.error("Exception while thread sleep", e); throw new RuntimeException(e); } }
Source:
<code>StateTransitionResult.Failure establishWebsocketConnection() throws InterruptedException { try { websocket = WebsocketImplProvider.getWebsocketImpl(OkHttpWebsocketImpl.class, connectionInternal, discoveredEndpoints); for (WebsocketRemoteConnectionEndpoint endpoint : discoveredEndpoints.getResult().discoveredRemoteConnectionEndpoints) { boolean connectionSuccessful = websocket.connect(endpoint); if (connectionSuccessful) { break; } } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't obtain the underlying websocket implementation: ", exception); return new StateTransitionResult.FailureCausedByException<Exception>(exception); } catch (SmackException | XMPPException | WebsocketException exception) { <START> Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't connect to any of the discovered endpoints: ", exception); <END> return new StateTransitionResult.FailureCausedByException<Exception>(exception); } return null; }</code><technical_language>perform exact code in catch blocks. is point in so, it? I want do is return if getWebsocketImpl() throws, collect exceptions thrown connect(), return unsuccessfully of connection endpoints fail</technical_language>

Target:
AbstractWebsocket establishWebsocketConnection() throws InterruptedException, WebsocketException { List<WebsocketRemoteConnectionEndpoint> endpoints = discoveredEndpoints.result.discoveredRemoteConnectionEndpoints; if (endpoints.isEmpty()) { throw new WebsocketException(new Throwable("No Endpoints discovered to establish connection")); } List<Throwable> connectionFailureList = new ArrayList<>(); AbstractWebsocket websocket; try { websocket = WebsocketImplProvider.getWebsocketImpl(OkHttpWebsocket.class, connectionInternal, discoveredEndpoints); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { throw new WebsocketException(exception); } for (WebsocketRemoteConnectionEndpoint endpoint : endpoints) { try { websocket.connect(endpoint); connectedEndpoint = endpoint; break; } catch (Throwable t) { connectionFailureList.add(t); if (connectionFailureList.size() == endpoints.size()) { WebsocketException websocketException = new WebsocketException(connectionFailureList); throw new WebsocketException(websocketException); } } } assert connectedEndpoint != null; return websocket; }
Source:
<code>default Spliterator<T> spliterator() { int characteristics = Spliterator.IMMUTABLE; if (isDistinct()) { characteristics |= Spliterator.DISTINCT; } if (isOrdered()) { characteristics |= (Spliterator.ORDERED | Spliterator.SORTED); } if (hasDefiniteSize()) { characteristics |= (Spliterator.SIZED | Spliterator.SUBSIZED); return Spliterators.spliterator(iterator(), length(), characteristics); <START> } <END> return Spliterators.spliteratorUnknownSize(iterator(), characteristics); }</code><technical_language>Please add else clear this if stay statement: java if (hasDefiniteSize()) { ... return ...; } else { return ...; }</technical_language>

Target:
default Spliterator<T> spliterator() { int characteristics = Spliterator.IMMUTABLE; if (isDistinct()) { characteristics |= Spliterator.DISTINCT; } if (isOrdered()) { characteristics |= (Spliterator.SORTED | Spliterator.ORDERED); } if (isSequential()) { characteristics |= Spliterator.ORDERED; } if (hasDefiniteSize()) { characteristics |= (Spliterator.SIZED | Spliterator.SUBSIZED); return Spliterators.spliterator(iterator(), length(), characteristics); } else { return Spliterators.spliteratorUnknownSize(iterator(), characteristics); } }
Source:
<code>private long getTime(final Operator operator) { final WorkerQueryPartition workerQueryPartition = (WorkerQueryPartition) operator.getQueryPartition(); final long workerStartTimeMillis = workerQueryPartition.getBeginMilliseconds(); final long threadStartTimeMillis = operator.getSubTreeTask().getBeginMilliseconds(); final long startupTimeMillis = threadStartTimeMillis - workerStartTimeMillis; <START> Preconditions.checkArgument(startupTimeMillis >= 0); <END> final long threadStartNanos = operator.getSubTreeTask().getBeginNanoseconds(); final long activeTimeNanos = System.nanoTime() - threadStartNanos; return TimeUnit.MILLISECONDS.toNanos(startupTimeMillis) + activeTimeNanos; }</code><technical_language>checkArgument wrong function -- checkState? Also, missing informative message in case check fails</technical_language>

Target:
private long getTime(final Operator operator) { final WorkerQueryPartition workerQueryPartition = (WorkerQueryPartition) operator.getQueryPartition(); final long workerStartTimeMillis = workerQueryPartition.getBeginMilliseconds(); final long threadStartTimeMillis = operator.getSubTreeTask().getBeginMilliseconds(); final long startupTimeMillis = threadStartTimeMillis - workerStartTimeMillis; Preconditions.checkArgument(startupTimeMillis >= 0, "Thread that works on fragment cannot run before query is initialized."); final long threadStartNanos = operator.getSubTreeTask().getBeginNanoseconds(); final long activeTimeNanos = System.nanoTime() - threadStartNanos; return TimeUnit.MILLISECONDS.toNanos(startupTimeMillis) + activeTimeNanos; }
Source:
<code>private static DatabaseType guessDialect(String name) { DatabaseType type = null; if (name != null) { <START> if (name.toLowerCase().contains("mysql")) { <END> type = DatabaseType.MYSQL; } else if (name.toLowerCase().contains("postgres")) { type = DatabaseType.POSTGRES; } else if (name.toLowerCase().contains("derby")) { type = DatabaseType.DERBY; } else if (name.toLowerCase().contains("hsql") || name.toLowerCase().contains("hypersonic")) { type = DatabaseType.HSQL; } else if (name.toLowerCase().contains("h2")) { type = DatabaseType.H2; } else if (name.toLowerCase().contains("sqlite")) { type = DatabaseType.SQLITE; } else if (name.toLowerCase().contains("db2")) { type = DatabaseType.DB2; } else if (name.toLowerCase().contains("informix")) { type = DatabaseType.INFORMIX; } else if (name.toLowerCase().contains("interbase")) { type = DatabaseType.INTERBASE; } else if (name.toLowerCase().contains("firebird")) { type = DatabaseType.FIREBIRD; } else if (name.toLowerCase().contains("sqlserver") || name.toLowerCase().contains("microsoft")) { type = DatabaseType.SQL_SERVER; } else if (name.toLowerCase().contains("access")) { type = DatabaseType.ACCESS; } else if (name.toLowerCase().contains("oracle")) { type = DatabaseType.ORACLE; } else if (name.toLowerCase().contains("adaptive")) { type = DatabaseType.SYBASE; } } return type; }</code><technical_language>convert this a switch statement strings</technical_language>

Target:
private static DatabaseType guessDialect(String name) { DatabaseType type = null; if (name == null) return null; name = name.toLowerCase(); if (name.contains("mysql")) { type = DatabaseType.MYSQL; } else if (name.contains("postgres")) { type = DatabaseType.POSTGRES; } else if (name.contains("derby")) { type = DatabaseType.DERBY; } else if (name.contains("hsql") || name.contains("hypersonic")) { type = DatabaseType.HSQL; } else if (name.contains("h2")) { type = DatabaseType.H2; } else if (name.contains("sqlite")) { type = DatabaseType.SQLITE; } else if (name.contains("db2")) { type = DatabaseType.DB2; } else if (name.contains("informix")) { type = DatabaseType.INFORMIX; } else if (name.contains("interbase")) { type = DatabaseType.INTERBASE; } else if (name.contains("firebird")) { type = DatabaseType.FIREBIRD; } else if (name.contains("sqlserver") || name.contains("microsoft")) { type = DatabaseType.SQL_SERVER; } else if (name.contains("access")) { type = DatabaseType.ACCESS; } else if (name.contains("oracle")) { type = DatabaseType.ORACLE; } else if (name.contains("adaptive")) { type = DatabaseType.SYBASE; } return type; }
Source:
<code>protected boolean canDoAction() { final boolean wrongInput = getParameters() == null || getMacPool() == null || <START> getMacPoolId() == null; <END> if (!super.canDoAction() || wrongInput) { return false; } final MacPool macPool = getParameters().getMacPool(); if (StringUtils.isEmpty(macPool.getName())) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_NAME); return false; } if (macPool.getRanges() == null || macPool.getRanges().isEmpty()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_RANGE); return false; } oldMacPool = macPoolDao.get(getMacPoolId()); if (oldMacPool == null) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_DOES_NOT_EXIST); return false; } return true; }</code><technical_language>in add command, need for this here.</technical_language>

Target:
protected boolean canDoAction() { final boolean wrongInput = getParameters() == null || getMacPool() == null || getMacPoolId() == null; if (!super.canDoAction() || wrongInput) { return false; } final MacPool macPool = getParameters().getMacPool(); if (StringUtils.isEmpty(macPool.getName())) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_NAME); return false; } if (macPool.getRanges() == null || macPool.getRanges().isEmpty()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_RANGE); return false; } oldMacPool = getMacPoolDAO().get(getMacPoolId()); if (oldMacPool == null) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_DOES_NOT_EXIST); return false; } return true; }
Source:
<code>@Override Bitmap decode(Uri uri, PicassoBitmapOptions options) throws IOException { <START> options.exifRotation = Utils.getContentProviderExifRotation(context.getContentResolver(), uri); <END> return super.decode(uri, options); }</code><technical_language>Inline Utils crap this class</technical_language>

Target:
@Override Bitmap decode(Uri uri, PicassoBitmapOptions options) throws IOException { if (options != null) { options.exifRotation = getContentProviderExifRotation(context.getContentResolver(), uri); } return super.decode(uri, options); }