auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void removeTrigger(Trigger trigger) { if (null != rules.getFact(trigger)) { rules.removeFact(trigger); final String triggerId = trigger.getId(); rules.removeFacts(t -> { if (t instanceof Dampening) { return ((Dampening)t).getTriggerId().equals(triggerId); } else if (t instanceof Condition) { return ((Condition)t).getTriggerId().equals(triggerId); } return false; }); <START> } else { <END> log.debug("Trigger not found. Not removed from rulebase " + trigger.toString()); } }</code><technical_language>this need analogous addTrigger?: if (distributed) { - partitionManager.notifyTrigger(Operation.REMOVE, tenantId, triggerId); - }</technical_language>

Target:
private void removeTrigger(Trigger trigger) { if (null != rules.getFact(trigger)) { rules.removeFact(trigger); alertsEngineCache.remove(trigger.getTenantId(), trigger.getId()); final String triggerId = trigger.getId(); rules.removeFacts(t -> { if (t instanceof Dampening) { return ((Dampening)t).getTriggerId().equals(triggerId); } else if (t instanceof Condition) { return ((Condition)t).getTriggerId().equals(triggerId); } return false; }); } else { if (log.isDebugEnabled()) { log.debug("Trigger not found. Not removed from rulebase " + trigger.toString()); } } }
Source:
<code>private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) { if (hasNoParameters(paramsNode)) { <START> return findBestMethodUsingParamIndexes(methods, 0, null); <END> } AMethodWithItsArgs matchedMethod; if (paramsNode.isArray()) { matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode)); } else if (paramsNode.isObject()) { matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode)); } else { throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString()); } if(matchedMethod==null) { for (Method method : methods) { if(method.getParameterTypes().length!=1) { continue; } if(method.isVarArgs()) { matchedMethod = new AMethodWithItsArgs(method); if (paramsNode.isArray()) { ArrayNode arrayNode = ArrayNode.class.cast(paramsNode); for (int i = 0; i < paramsNode.size(); i++) { matchedMethod.arguments.add(arrayNode.get(i)); } } if (paramsNode.isObject()) { ObjectNode objectNode = ObjectNode.class.cast(paramsNode); Iterator<Map.Entry<String, JsonNode>> items = objectNode.fields(); while (items.hasNext()) { Map.Entry<String, JsonNode> item = items.next(); JsonNode name = JsonNodeFactory.instance.objectNode().put(item.getKey(),item.getKey()); matchedMethod.arguments.add(name.get(item.getKey())); matchedMethod.arguments.add(item.getValue()); } } break; } } } return matchedMethod; }</code><technical_language>this function need refactoring large</technical_language>

Target:
private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) { if (hasNoParameters(paramsNode)) { return findBestMethodUsingParamIndexes(methods, 0, null); } AMethodWithItsArgs matchedMethod; if (paramsNode.isArray()) { matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode)); } else if (paramsNode.isObject()) { matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode)); } else { throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString()); } if (matchedMethod == null) { matchedMethod = findBestMethodForVarargs(methods, paramsNode); } return matchedMethod; }
Source:
<code>public int hashCode() { <START> return (null != value) ? value.hashCode() : 0; <END> }</code><technical_language>this client side GWT compiled classes needs a sort of sanitized hashCode implementaiton utility class HashUtils. this @Override public int hashCode() { return HashUtil.combineHashCodes(super.hashCode(), executionSet.hashCode()); }</technical_language>

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(value)); }
Source:
<code>private void registerArgumentResolverMessageConverter(BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition( IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME)) { <START> BeanDefinitionBuilder resolverBuilder = BeanDefinitionBuilder <END> .genericBeanDefinition(ConfigurableCompositeMessageConverter.class); registry.registerBeanDefinition(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME, resolverBuilder.getBeanDefinition()); } }</code><technical_language>I agree previous postProcessorBuilder name good, Resolver. is MessageConverter</technical_language>

Target:
private void registerArgumentResolverMessageConverter(BeanDefinitionRegistry registry) { if (!registry.containsBeanDefinition( IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME)) { BeanDefinitionBuilder converterBuilder = BeanDefinitionBuilder .genericBeanDefinition(ConfigurableCompositeMessageConverter.class); registry.registerBeanDefinition(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME, converterBuilder.getBeanDefinition()); } }
Source:
<code>public Adapter getContentAdapter() { if <START> (adapter == null) { <END> adapter = new AdapterImpl() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: refreshChildren(); break; default: break; } } }; } return adapter; }</code><technical_language>null == adapter</technical_language>

Target:
public Adapter getContentAdapter() { if (null == adapter) { adapter = new AdapterImpl() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: refreshChildren(); break; default: break; } } }; } return adapter; }
Source:
<code>private <P> void updateWidgetsAndFireEvent(final boolean sync, final String property, final P oldValue, final P newValue, final Object excluding) { for (final Binding binding : bindings.get(property)) { final Object component = binding.getComponent(); final Converter converter = binding.getConverter(); if (component == excluding) continue; if (!sync && binding.propertyIsList() && component instanceof BindableListChangeHandler) continue; if (component instanceof TakesValue) { updateComponentValue(newValue, (TakesValue) component, converter); } else if (component instanceof HasText) { updateComponentValue(newValue, (HasText) component, converter); } else if (component instanceof IsElement || component instanceof org.jboss.errai.common.client.api.elemental2.IsElement || isElement(component)) { <START> final Element element = BoundUtil.asElement(getComponent(component)); <END> final ElementWrapperWidget<?> wrapper = ElementWrapperWidget.getWidget(element); if (wrapper instanceof TakesValue) { updateComponentValue(newValue, (TakesValue) wrapper, converter); } else if (wrapper instanceof HasText) { updateComponentValue(newValue, (HasText) wrapper, converter); } } } maybeFirePropertyChangeEvent(property, oldValue, newValue); }</code><technical_language>IMO getComponent(component) reads a bit confusingly. change method name getUIPart</technical_language>

Target:
private <P> void updateWidgetsAndFireEvent(final boolean sync, final String property, final P oldValue, final P newValue, final Object excluding) { for (final Binding binding : bindings.get(property)) { final Object component = binding.getComponent(); final Converter converter = binding.getConverter(); if (component == excluding) continue; if (!sync && binding.propertyIsList() && component instanceof BindableListChangeHandler) continue; if (component instanceof TakesValue) { updateComponentValue(newValue, (TakesValue) component, converter); } else if (component instanceof HasText) { updateComponentValue(newValue, (HasText) component, converter); } else if (component instanceof IsElement || component instanceof org.jboss.errai.common.client.api.elemental2.IsElement || isElement(component)) { final Element element = BoundUtil.asElement(getUIPart(component)); final ElementWrapperWidget<?> wrapper = ElementWrapperWidget.getWidget(element); if (wrapper instanceof TakesValue) { updateComponentValue(newValue, (TakesValue) wrapper, converter); } else if (wrapper instanceof HasText) { updateComponentValue(newValue, (HasText) wrapper, converter); } } } maybeFirePropertyChangeEvent(property, oldValue, newValue); }
Source:
<code>private static Map<TaskId, SortedSet<UUID>> tasksToCaughtUpClients(final Set<TaskId> statefulTasks, final Map<UUID, ClientState> clientStates, final long acceptableRecoveryLag) { final Map<TaskId, SortedSet<UUID>> taskToCaughtUpClients = new HashMap<>(); <START> for (final TaskId task : statefulTasks) { <END> final TreeSet<UUID> caughtUpClients = new TreeSet<>(); for (final Map.Entry<UUID, ClientState> clientEntry : clientStates.entrySet()) { final UUID client = clientEntry.getKey(); final long taskLag = clientEntry.getValue().lagFor(task); if (active(taskLag) || unbounded(acceptableRecoveryLag) || acceptable(acceptableRecoveryLag, taskLag)) { caughtUpClients.add(client); } } taskToCaughtUpClients.put(task, caughtUpClients); } return taskToCaughtUpClients; }</code><technical_language>Fair enough. I meant a cost saving thing, easier understand caught-up clients. If find this logic easier follow, for</technical_language>

Target:
private static Map<TaskId, SortedSet<UUID>> tasksToCaughtUpClients(final Set<TaskId> statefulTasks, final Map<UUID, ClientState> clientStates, final long acceptableRecoveryLag) { final Map<TaskId, SortedSet<UUID>> taskToCaughtUpClients = new HashMap<>(); for (final TaskId task : statefulTasks) { final TreeSet<UUID> caughtUpClients = new TreeSet<>(); for (final Map.Entry<UUID, ClientState> clientEntry : clientStates.entrySet()) { final UUID client = clientEntry.getKey(); final long taskLag = clientEntry.getValue().lagFor(task); if (activeRunning(taskLag) || unbounded(acceptableRecoveryLag) || acceptable(acceptableRecoveryLag, taskLag)) { caughtUpClients.add(client); } } taskToCaughtUpClients.put(task, caughtUpClients); } return taskToCaughtUpClients; }
Source:
<code>public void setViewer(SDView viewer) { fLock.lock(); try { fView = viewer; PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(this); fView.setSDFindProvider(this); fView.setSDPagingProvider(this); fView.setSDFilterProvider(this); resetLoader(); <START> IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); <END> if (activePage != null) { IEditorPart editor = activePage.getActiveEditor(); if (editor instanceof ITmfTraceEditor) { ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace(); if (trace != null) { traceSelected(new TmfTraceSelectedSignal(this, trace)); } } } } finally { fLock.unlock(); } }</code><technical_language>is ok, I realized do: editor = fView.getSite().getPage().getActiveEditor() here, if want code</technical_language>

Target:
public void setViewer(SDView viewer) { fLock.lock(); try { fView = viewer; PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(this); fView.setSDFindProvider(this); fView.setSDPagingProvider(this); fView.setSDFilterProvider(this); resetLoader(); IEditorPart editor = fView.getSite().getPage().getActiveEditor(); if (editor instanceof ITmfTraceEditor) { ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace(); if (trace != null) { traceSelected(new TmfTraceSelectedSignal(this, trace)); } } } finally { fLock.unlock(); } }
Source:
<code>public static void main(String[] args) { NGrinderControllerStarter server = new NGrinderControllerStarter(); JCommander commander = new JCommander(server); commander.setAcceptUnknownOptions(true); commander.setProgramName("ngrinder"); PortAvailabilityValidator validator = new PortAvailabilityValidator(); try { commander.parse(args); if (server.port == null) { server.port = 8080; } validator.validate("-p / --port", server.port); } catch (Exception e) { System.err.println(e.getMessage()); commander.usage(); System.exit(0); } System.setProperty("server.port", Integer.toString(server.port)); if (!server.contextPath.startsWith("/")) { server.contextPath = "/" + server.contextPath; } System.setProperty("server.contextPath", server.contextPath); if (server.help) { commander.usage(); System.exit(0); } if (server.home != null) { System.setProperty("ngrinder.home", server.home); } if (server.exHome != null) { System.setProperty("ngrinder.ex.home", server.exHome); } final List<String> unknownOptions = commander.getUnknownOptions(); final ClusterMode clusterMode = ClusterMode.valueOf(server.clusterMode); clusterMode.parseArgs(unknownOptions.toArray(new String[unknownOptions.size()])); <START> System.getProperties().putAll(server.params); <END> SpringApplication.run(NGrinderControllerStarter.class, args); cleanupPreviouslyUnpackedFolders(); }</code><technical_language>Is safe run cleanupPreviouslyUnpackedFolders Spring shutdown? I is a lot of case ngrinder is killed kill -9 this clean process executed</technical_language>

Target:
public static void main(String[] args) { NGrinderControllerStarter server = new NGrinderControllerStarter(); JCommander commander = new JCommander(server); commander.setAcceptUnknownOptions(true); commander.setProgramName("ngrinder"); PortAvailabilityValidator validator = new PortAvailabilityValidator(); try { commander.parse(args); if (server.port == null) { server.port = 8080; } validator.validate("-p / --port", server.port); } catch (Exception e) { System.err.println(e.getMessage()); commander.usage(); System.exit(0); } System.setProperty("server.port", Integer.toString(server.port)); if (!server.contextPath.startsWith("/")) { server.contextPath = "/" + server.contextPath; } System.setProperty("server.contextPath", server.contextPath); if (server.help) { commander.usage(); System.exit(0); } if (server.home != null) { System.setProperty("ngrinder.home", server.home); } if (server.exHome != null) { System.setProperty("ngrinder.ex.home", server.exHome); } final List<String> unknownOptions = commander.getUnknownOptions(); final ClusterMode clusterMode = ClusterMode.valueOf(server.clusterMode); clusterMode.parseArgs(unknownOptions.toArray(new String[unknownOptions.size()])); System.getProperties().putAll(server.params); cleanupPreviouslyUnpackedFolders(); SpringApplication.run(NGrinderControllerStarter.class, args); }
Source:
<code>private File determineSandboxDir(SarosIntellijExtension sarosExtension) { File sandboxBaseDir = sarosExtension.getSandboxBaseDir(); if (sandboxBaseDir == null) { sandboxBaseDir = project.getBuildDir(); } if (!sandboxBaseDir.exists()) { <START> sandboxBaseDir.mkdirs(); <END> } Integer sandboxCount = 1; File currentSandboxDir = determineSandboxDirCandidate(sandboxBaseDir, sandboxCount); while (isSandboxLocked(currentSandboxDir)) { sandboxCount++; currentSandboxDir = determineSandboxDirCandidate(sandboxBaseDir, sandboxCount); } return currentSandboxDir; }</code><technical_language>above. validate dir exists/whether creation successful</technical_language>

Target:
private File determineSandboxDir(SarosIntellijExtension sarosExtension) { File sandboxBaseDir = sarosExtension.getSandboxBaseDir(); if (sandboxBaseDir == null) { sandboxBaseDir = project.getBuildDir(); } if (!sandboxBaseDir.exists() && !sandboxBaseDir.mkdirs()) { throw new GradleException( "Unable to create the sandbox base directory: " + sandboxBaseDir.getAbsolutePath()); } Integer sandboxCount = 1; File currentSandboxDir = determineSandboxDirCandidate(sandboxBaseDir, sandboxCount); while (isSandboxLocked(currentSandboxDir)) { sandboxCount++; currentSandboxDir = determineSandboxDirCandidate(sandboxBaseDir, sandboxCount); } return currentSandboxDir; }
Source:
<code>public Iterable<VirtualGuest> listNodesByIds(final Iterable<String> ids) { return Iterables.filter(listNodes(), new Predicate<VirtualGuest>() { @Override public boolean apply(VirtualGuest server) { <START> return Iterables.contains(ids, server.getId()); <END> } }); }</code><technical_language>Statics</technical_language>

Target:
public Iterable<VirtualGuest> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<VirtualGuest>() { @Override public boolean apply(VirtualGuest server) { return contains(ids, server.getId()); } }); }
Source:
<code>public Array<T> reverse() { if (size() <= 1) { return this; } else { final Object[] arr = new Object[delegate.length]; for (int i = 0; i < delegate.length; i++) { arr[delegate.length - 1 - i] = delegate[i]; <START> } <END> return wrap(arr); } }</code><technical_language>simplify operations a bit (read delegate length, subtract 1 subtract i) this: java final int length = delegate.length; for (int i = 0, j = length - 1; i < length; i++, j--) { arr[j] = delegate[i]; }</technical_language>

Target:
public Array<T> reverse() { if (size() <= 1) { return this; } else { final int length = delegate.length; final Object[] arr = new Object[length]; for (int i = 0, j = length - 1; i < length; i++, j--) { arr[j] = delegate[i]; } return wrap(arr); } }
Source:
<code>public void restartGluster() { GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER, "restart"); <START> Frontend.getInstance().runMultipleAction(VdcActionType.ManageGlusterService, <END> new ArrayList<>(Arrays.asList(new VdcActionParametersBase[]{parameters})), new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { } }, null); }</code><technical_language>runAction() eased run this action time. avoid passing params list. HostListModel.selectAsSPM() for reference</technical_language>

Target:
public void restartGluster() { GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER, "restart"); Frontend.getInstance().runAction(VdcActionType.ManageGlusterService, parameters); }
Source:
<code>public void deleteByContentType(final ContentTypeIf type) throws DotDataException{ <START> final DotConnect dc = new DotConnect(); <END> dc.setSQL(sql.DELETE_RELATIONSHIP_BY_PARENT_OR_CHILD_INODE); dc.addParam(type.id()); dc.addParam(type.id()); dc.loadResults(); }</code><technical_language>do this in line new DotConnect().setSQL(sql.DELETE_RELATIONSHIP_BY_PARENT_OR_CHILD_INODE).addParam(type.id()).addParam(type.id()).loadResults();</technical_language>

Target:
public void deleteByContentType(final ContentTypeIf type) throws DotDataException{ new DotConnect() .setSQL(sql.DELETE_RELATIONSHIP_BY_PARENT_OR_CHILD_INODE) .addParam(type.id()) .addParam(type.id()) .loadResults(); }
Source:
<code>public final Subscription subscribe() { final MultipleAssignmentSubscription mad = new MultipleAssignmentSubscription(); subscribe(new CompletableSubscriber() { @Override public void onCompleted() { mad.unsubscribe(); } @Override public void onError(Throwable e) { ERROR_HANDLER.handleError(e); mad.unsubscribe(); Thread thread = Thread.currentThread(); <START> thread.getUncaughtExceptionHandler().uncaughtException(thread, e); <END> } @Override public void onSubscribe(Subscription d) { mad.set(d); } }); return mad; }</code><technical_language>inline Thread.currentThread() call below</technical_language>

Target:
public final Subscription subscribe() { final MultipleAssignmentSubscription mad = new MultipleAssignmentSubscription(); subscribe(new CompletableSubscriber() { @Override public void onCompleted() { mad.unsubscribe(); } @Override public void onError(Throwable e) { ERROR_HANDLER.handleError(e); mad.unsubscribe(); deliverUncaughtException(e); } @Override public void onSubscribe(Subscription d) { mad.set(d); } }); return mad; }
Source:
<code>private void send(final Message message) { sendLink.delivery(UUID.randomUUID().toString().replace("-", "").getBytes(UTF_8)); <START> final int payloadSize = EventDataUtil.getDataSerializedSize(message) + 512; END> final byte[] bytes = new byte[payloadSize]; final int encodedSize = message.encode(bytes, 0, payloadSize); receiveLink.flow(1); sendLink.send(bytes, 0, encodedSize); sendLink.advance(); }</code><technical_language>consider putting 512 AmqpConstants protocol-specifics in place</technical_language>

Target:
private void send(final Message message) { sendLink.delivery(UUID.randomUUID().toString().replace("-", "").getBytes(UTF_8)); final int payloadSize = EventDataUtil.getDataSerializedSize(message) + MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[payloadSize]; final int encodedSize = message.encode(bytes, 0, payloadSize); receiveLink.flow(1); sendLink.send(bytes, 0, encodedSize); sendLink.advance(); }
Source:
<code>public List<SegmentLoadInfo> fetchServerView(String dataSource, Interval interval, boolean incompleteOk) { try { StatusResponseHolder response = client.go( new Request( HttpMethod.GET, new URL( String.format( "%s/datasources/%s/intervals/%s/serverview?partial=%s", baseUrl(), dataSource, <START> URLEncoder.encode(interval.toString(), "UTF-8"), <END> incompleteOk ) ) ), RESPONSE_HANDLER ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while fetching serverView status[%s] content[%s]", response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<SegmentLoadInfo>>() { } ); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>convert / a _? URL Encoding it, work, replacing underscore simpler</technical_language>

Target:
public List<ImmutableSegmentLoadInfo> fetchServerView(String dataSource, Interval interval, boolean incompleteOk) { try { StatusResponseHolder response = client.go( new Request( HttpMethod.GET, new URL( String.format( "%s/datasources/%s/intervals/%s/serverview?partial=%s", baseUrl(), dataSource, interval.toString().replace("/", "_"), incompleteOk ) ) ), RESPONSE_HANDLER ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while fetching serverView status[%s] content[%s]", response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<ImmutableSegmentLoadInfo>>() { } ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public boolean isDistributable() { final Distributed annotation = getAnnotation(Distributed.class); if (annotation != null) { return annotation.value(); } <START> if (ReflectionUtils.is(getComponentClass(), HasDistributionAdvice.class)) { <END> return true; } return true; }</code><technical_language>This code sense. ReflectionUtils.is(xxx) return true, return true</technical_language>

Target:
public boolean isDistributable() { final Distributed annotation = getAnnotation(Distributed.class); if (annotation != null) { return annotation.value(); } return ReflectionUtils.is(getComponentClass(), HasDistributionAdvice.class); }
Source:
<code>protected void executeCommand() { <START> boolean success = true; <END> if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { throw new VdcBLLException(VdcBllErrors.forValue(result.getSecond())); } } if (success) { StorageServerConnections connection = getConnection(); connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(connection.getid()); } setSucceeded(success); }</code><technical_language>success is defined here..</technical_language>

Target:
protected void executeCommand() { if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { throw new VdcBLLException(VdcBllErrors.forValue(result.getSecond())); } } StorageServerConnections connection = getConnection(); connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(connection.getid()); setSucceeded(true); }
Source:
<code>private void checkConnection(Connection con, IInterfaceElement opposite, IInterfaceElement ownIE) { if(elementsToAdd.contains(opposite.getFBNetworkElement())){ moveConIntoSubApp(con); }else if (targetSubApp.equals(opposite.getFBNetworkElement())){ <START> moveInterFaceCrossingConIntoSubApp(con, <END> opposite, ownIE); } else { handleModifyConnection(con, ownIE); } }</code><technical_language>Interface is word, camel casing</technical_language>

Target:
private void checkConnection(Connection con, IInterfaceElement opposite, IInterfaceElement ownIE) { if(elementsToAdd.contains(opposite.getFBNetworkElement())){ moveConIntoSubApp(con); }else if (targetSubApp.equals(opposite.getFBNetworkElement())){ moveInterfaceCrossingConIntoSubApp(con, opposite, ownIE); } else { handleModifyConnection(con, ownIE); } }
Source:
<code>public static void createTables(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + PEOPLE_TABLE + " (" + "person_id INTEGER DEFAULT 0," <START> + "site_id TEXT," <END> + "local_blog_id INTEGER DEFAULT 0," + "user_name TEXT," + "first_name TEXT," + "last_name TEXT," + "display_name TEXT," + "avatar_url TEXT," + "role TEXT," + "PRIMARY KEY (person_id, local_blog_id)" + ");"); }</code><technical_language>I feel site_id more sense of is for network calls. If for network calls, "local". Local_id for blogs/sites a mixture of hosted wordpress.com sites, id provided a network response. this for wpcom sites only</technical_language>

Target:
public static void createTables(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + PEOPLE_TABLE + " (" + "person_id INTEGER DEFAULT 0," + "blog_id TEXT," + "local_blog_id INTEGER DEFAULT 0," + "user_name TEXT," + "first_name TEXT," + "last_name TEXT," + "display_name TEXT," + "avatar_url TEXT," + "role TEXT," + "PRIMARY KEY (person_id, local_blog_id)" + ");"); }
Source:
<code>public ITmfStateValue getValue(ITmfEvent event) { if (fStateValue != null) { return fStateValue; } if (fType.equals(TmfXmlStrings.TYPE_NULL)) { <START> return TmfStateValue.nullValue(); <END> } try { return checkNotNull(fXmlStateValue).getValue(event); } catch (AttributeNotFoundException e) { Activator.logError("Failed to get the state value", e); } throw new IllegalStateException("Failed to get the value for the segment field " + fName); }</code><technical_language>I set fStateValue nullValue in constructor in this case, this is pretty dead code</technical_language>

Target:
public ITmfStateValue getValue(ITmfEvent event) { if (fStateValue != null) { return fStateValue; } try { return checkNotNull(fXmlStateValue).getValue(event); } catch (AttributeNotFoundException e) { Activator.logError("Failed to get the state value", e); } throw new IllegalStateException("Failed to get the value for the segment field " + fName); }
Source:
<code>void handleActionResult(final VdcActionType actionType, final VdcActionParametersBase parameters, final VdcReturnValueBase result, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { logger.log(Level.FINER, "Retrieved action result from RunAction."); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, result, state); boolean success = false; if (!result.getCanDoAction()) { result.setCanDoActionMessages((ArrayList<String>) translateError(result)); callback.executed(f); } else if (showErrorDialog && result.getIsSyncronious() && !result.getSucceeded()) { runActionExecutionFailed(actionType, result.getFault()); callback.executed(f); success = true; } else { success = true; callback.executed(f); } if (showErrorDialog && (!success) && (getEventsHandler() != null) && (getEventsHandler().isRaiseErrorModalPanel(actionType, result.getFault()))) { if (result.getCanDoActionMessages().size() <= 1) { String errorMessage = !result.getCanDoAction() || !result.getCanDoActionMessages().isEmpty() ? getRunActionErrorMessage(result.getCanDoActionMessages()) : result.getFault().getMessage(); <START> <END> failureEventHandler(result.getDescription(), errorMessage); } else { failureEventHandler(result.getDescription(), result.getCanDoActionMessages()); } } }</code><technical_language>in scope of patch. But- error message localized</technical_language>

Target:
void handleActionResult(final VdcActionType actionType, final VdcActionParametersBase parameters, final VdcReturnValueBase result, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { logger.log(Level.FINER, "Retrieved action result from RunAction."); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, result, state); boolean failedOnCanDoAction = !result.getCanDoAction(); if (failedOnCanDoAction) { result.setCanDoActionMessages((ArrayList<String>) translateError(result)); } else if (showErrorDialog && result.getIsSyncronious() && !result.getSucceeded()) { runActionExecutionFailed(actionType, result.getFault()); } callback.executed(f); if (showErrorDialog && failedOnCanDoAction && (getEventsHandler() != null) && (getEventsHandler().isRaiseErrorModalPanel(actionType, result.getFault()))) { if (result.getCanDoActionMessages().isEmpty()) { failureEventHandler(result.getDescription(), "No Message"); } else { failureEventHandler(result.getDescription(), result.getCanDoActionMessages()); } } }
Source:
<code>public void scheduleInitial(SourceScheduler scheduler) <START> { <END> checkState(!initialScheduled); initialScheduled = true; int driverGroupsScheduledPerTask = 0; while (driverGroups.hasNext()) { for (int i = 0; i < allNodes.size() && driverGroups.hasNext(); i++) { int driverGroupId = driverGroups.nextInt(); checkState(!bucketNodeMap.getAssignedNode(driverGroupId).isPresent()); bucketNodeMap.assignOrChangeBucketToNode(driverGroupId, allNodes.get(i)); scheduler.startLifespan(Lifespan.driverGroup(driverGroupId), partitionHandles.get(driverGroupId)); } driverGroupsScheduledPerTask++; if (concurrentLifespansPerTask.isPresent() && driverGroupsScheduledPerTask == concurrentLifespansPerTask.getAsInt()) { break; } } if (!driverGroups.hasNext()) { scheduler.noMoreLifespans(); } }</code><technical_language>null check</technical_language>

Target:
public void scheduleInitial(SourceScheduler scheduler) { checkState(!initialScheduled); initialScheduled = true; int driverGroupsScheduledPerTask = 0; while (driverGroups.hasNext()) { for (int i = 0; i < allNodes.size() && driverGroups.hasNext(); i++) { int driverGroupId = driverGroups.nextInt(); checkState(!bucketNodeMap.getAssignedNode(driverGroupId).isPresent()); bucketNodeMap.assignBucketToNode(driverGroupId, allNodes.get(i)); scheduler.startLifespan(Lifespan.driverGroup(driverGroupId), partitionHandles.get(driverGroupId)); } driverGroupsScheduledPerTask++; if (concurrentLifespansPerTask.isPresent() && driverGroupsScheduledPerTask == concurrentLifespansPerTask.getAsInt()) { break; } } if (!driverGroups.hasNext()) { scheduler.noMoreLifespans(); } }
Source:
<code>private void updateCardsInList(List<Card> cards, Map<Long, String> updatedCardTags) { <START> List<Card> allCards = CardUtils.getAllCards(CardUtils.getNotes(cards)); <END> for (Card c : allCards) { Note note = c.note(); int pos = getPosition(getCards(), c.getId()); if (pos < 0 || pos >= getCards().size()) { continue; } if (updatedCardTags != null) { getCards().get(pos).put("tags", updatedCardTags.get(c.getNid())); } String sfld = note.getSFld(); getCards().get(pos).put("sfld", sfld); updateSearchItemQA(getCards().get(pos), c); String deckName; try { deckName = getCol().getDecks().get(c.getDid()).getString("name"); } catch (JSONException e) { throw new RuntimeException(e); } getCards().get(pos).put("deck", deckName); String flags = Integer.toString((c.getQueue() == -1 ? 1 : 0) + (note.hasTag("marked") ? 2 : 0)); getCards().get(pos).put("flags", flags); } updateList(); }</code><technical_language>This is necessary for suspend card task right? I pull this part function</technical_language>

Target:
private void updateCardsInList(List<Card> cards, Map<Long, String> updatedCardTags) { Map<Long, Integer> idToPos = getPositionMap(getCards()); for (Card c : cards) { Note note = c.note(); int pos = idToPos.containsKey(c.getId()) ? idToPos.get(c.getId()) : -1; if (pos < 0 || pos >= getCards().size()) { continue; } if (updatedCardTags != null) { getCards().get(pos).put("tags", updatedCardTags.get(c.getNid())); } String sfld = note.getSFld(); getCards().get(pos).put("sfld", sfld); updateSearchItemQA(getCards().get(pos), c); String deckName; try { deckName = getCol().getDecks().get(c.getDid()).getString("name"); } catch (JSONException e) { throw new RuntimeException(e); } getCards().get(pos).put("deck", deckName); String flags = Integer.toString((c.getQueue() == -1 ? 1 : 0) + (note.hasTag("marked") ? 2 : 0)); getCards().get(pos).put("flags", flags); } updateList(); }
Source:
<code>protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } _uid = UID.getAndIncrement(); if (LOG.isInfoEnabled()) { <START> LOG.info("ZkClient created with _uid {}, stacktrace {}", _uid, Thread.currentThread().getStackTrace()); <END> } _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); if (LOG.isInfoEnabled()) { LOG.info("ZkClient created with _uid {}, _asyncCallRetryThread id {}", _uid, _asyncCallRetryThread.getId()); } connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }</code><technical_language>This is testing code, please careful pollute log in production. I recording this info in related thread good enough support detecting leakage in test</technical_language>

Target:
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } _uid = UID.getAndIncrement(); _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); LOG.debug("ZkClient created with _uid {}, _asyncCallRetryThread id {}", _uid, _asyncCallRetryThread.getId()); connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }
Source:
<code>public void testBuildOneFile_Commit_FiresIndexChangedEvent() throws Exception { final String path = "a-file-path"; final FileMode mode = FileMode.REGULAR_FILE; final long lastModified = 1218123387057L; final int length = 1342; final DirCacheEntry entOrig; final DirCache dc = db.lockDirCache(); final String message = "received IndexChangedEvent"; IndexChangedListener listener = new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { <START> throw new RuntimeException(message); <END> } }; ListenerList l = db.getListenerList(); l.addIndexChangedListener(listener); final DirCacheBuilder b = dc.builder(); entOrig = new DirCacheEntry(path); entOrig.setFileMode(mode); entOrig.setLastModified(lastModified); entOrig.setLength(length); b.add(entOrig); try { b.commit(); } catch (RuntimeException e) { assertEquals(e.getMessage(), message); return; } fail("IndexChangedEvent wasn't sent"); }</code><technical_language>A bit ugly. Runtime exception occur for other reasons. Define exception type wait for flag</technical_language>

Target:
public void testBuildOneFile_Commit_FiresIndexChangedEvent() throws Exception { final class ReceivedEventMarkerException extends RuntimeException { private static final long serialVersionUID = 1L; } final String path = "a-file-path"; final FileMode mode = FileMode.REGULAR_FILE; final long lastModified = 1218123387057L; final int length = 1342; final DirCacheEntry entOrig; final DirCache dc = db.lockDirCache(); IndexChangedListener listener = new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { throw new ReceivedEventMarkerException(); } }; ListenerList l = db.getListenerList(); l.addIndexChangedListener(listener); final DirCacheBuilder b = dc.builder(); entOrig = new DirCacheEntry(path); entOrig.setFileMode(mode); entOrig.setLastModified(lastModified); entOrig.setLength(length); b.add(entOrig); try { b.commit(); } catch (ReceivedEventMarkerException e) { return; } fail("IndexChangedEvent wasn't sent"); }
Source:
<code>public CommandFactory build() { checkNotNull(actor, "`actor` must be defined"); if (zoneOffset == null) { <START> setZoneOffset(toZoneOffset(TimeZone.getDefault())); <END> } final CommandFactory result = new CommandFactory(this); return result; }</code><technical_language>Please getDefault()</technical_language>

Target:
public CommandFactory build() { checkNotNull(actor, "`actor` must be defined"); if (zoneOffset == null) { setZoneOffset(ZoneOffsets.getDefault()); } final CommandFactory result = new CommandFactory(this); return result; }
Source:
<code>public void testServiceFoundWithValidResponseNoGzip() throws Exception { when(mockRequest.headers(HttpHeaders.ACCEPT_ENCODING)).thenReturn(NO_GZIP); when(mockRequest.params(QUERY_PARAM)).thenReturn(RETURN_ID); String res = Boon.toJson(cqlTransformHandler.handle(mockRequest, mockResponse)); assertThat(res, is(SERVICE_SUCCESS)); assertThat(mockResponse.status(), is(HttpStatus.OK_200)); assertTrue( mockResponse.getHeaders().get(HttpHeaders.CONTENT_DISPOSITION).matches(ATTACHMENT_REGEX)); <START> assertNull(mockResponse.getHeaders().get(HttpHeaders.CONTENT_ENCODING)); <END> assertThat(mockResponse.type(), is(MIME_TYPE)); }</code><technical_language>Or, assertThat(mockResponse.getHeaders(), not(hasKey(HttpHeaders.CONTENT_ENCODING)))</technical_language>

Target:
public void testServiceFoundWithValidResponseNoGzip() throws Exception { when(mockRequest.headers(HttpHeaders.ACCEPT_ENCODING)).thenReturn(NO_GZIP); when(mockRequest.params(QUERY_PARAM)).thenReturn(RETURN_ID); String res = Boon.toJson(cqlTransformHandler.handle(mockRequest, mockResponse)); assertThat(res, is(SERVICE_SUCCESS)); assertThat(mockResponse.status(), is(HttpStatus.OK_200)); assertThat( mockResponse.getHeaders().get(HttpHeaders.CONTENT_DISPOSITION), matchesPattern(ATTACHMENT_REGEX)); assertNull(mockResponse.getHeaders().get(HttpHeaders.CONTENT_ENCODING)); assertThat(mockResponse.type(), is(MIME_TYPE)); }
Source:
<code>private boolean handleRenameForTableLevelReplication(Context withinContext, String oldName, String newName) { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, oldName)) { boolean oldTableInBootstrapList = withinContext.removeFromListOfTablesForBootstrap(oldName); if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { if (oldTableInBootstrapList) { return false; } else { scenario = Scenario.DROP; LOG.info("Table " + oldName + " will be dropped as the table is renamed to " + newName); return true; } } if (oldTableInBootstrapList) { withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table satisfies the policy"); return true; } else { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { LOG.info("Table " + newName + " is added for bootstrap " + " during rename from " + oldName); withinContext.addToListOfTablesForBootstrap(newName); return false; } <START> LOG.info("both old and new table not satisfies the policy"); <END> return false; } }</code><technical_language>log table names in log message</technical_language>

Target:
private boolean handleRenameForTableLevelReplication(Context withinContext, String oldName, String newName) { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, oldName)) { boolean oldTableInBootstrapList = withinContext.removeFromListOfTablesForBootstrap(oldName); if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { if (oldTableInBootstrapList) { return false; } else { scenario = Scenario.DROP; LOG.info("Table " + oldName + " will be dropped as the table is renamed to " + newName); return true; } } if (oldTableInBootstrapList) { withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table satisfies the policy"); return true; } else { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { LOG.info("Table " + newName + " is added for bootstrap " + " during rename from " + oldName); withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table does not satisfies the policy"); return false; } }
Source:
<code>private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); if (choices.size() == 0) { return 0; } while (choices.size() > 0) { int spaIndex = Compute.randomInt(choices.size()); SpecialAbility spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); } else { String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: <START> if(entity.getCrew() == null || entity.getCrew().getOptions() == null || entity.getCrew().getOptions(spa.getName()) == null) { <END> return 0; } entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (!spaValue.equals(Crew.SPECIAL_NONE)) { entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); } } } return 0; }</code><technical_language>suggestion if ((entity.getCrew() == null) || (entity.getCrew().getOptions() == null) || (entity.getCrew().getOptions(spa.getName()) == null)) {</technical_language>

Target:
private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); if (choices.size() == 0) { return 0; } while (choices.size() > 0) { int spaIndex = Compute.randomInt(choices.size()); SpecialAbility spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); } else { String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: if ((entity.getCrew() == null) || (entity.getCrew().getOptions() == null) || (entity.getCrew().getOptions(spa.getName()) == null)) { return 0; } entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (!spaValue.equals(Crew.SPECIAL_NONE)) { entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); } } } return 0; }
Source:
<code>public static void initializeEnvironment() throws IOException, ParseException { if (initialized) return; initialized = true; if (Strings.isNullOrEmpty(USERNAME) || Strings.isNullOrEmpty(PASSWORD)) { USERNAME = System.getenv("TMDB_USERNAME"); PASSWORD = System.getenv("TMDB_PASSWORD"); } if (Strings.isNullOrEmpty(API_KEY)) { API_KEY = System.getenv("TMDB_APIKEY"); } if (API_KEY == null) { System.err.println("Your Environment is not Set for Testing. Please Define the proper Environment variables and try again."); System.exit(0); } unauthenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); authenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); initializeTestingIntegrityData(); <START> initializeAccountData(); <END> initializeGuestData(); }</code><technical_language>If possible, tests share state hide bugs. is this account initialization running for test, if do related configured data</technical_language>

Target:
public static void initializeEnvironment() throws IOException, ParseException, InterruptedException { if (initialized) { return; } if (Strings.isNullOrEmpty(USERNAME) || Strings.isNullOrEmpty(PASSWORD)) { USERNAME = System.getenv("TMDB_USERNAME"); PASSWORD = System.getenv("TMDB_PASSWORD"); } if (Strings.isNullOrEmpty(API_KEY)) { API_KEY = System.getenv("TMDB_APIKEY"); } if (API_KEY == null) { System.err.println("Your Environment is not Set for Testing. Please Define the proper Environment variables and try again."); System.exit(0); } unauthenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); authenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); initializeData(); initialized = true; }
Source:
<code>private void checkAndHandleIfAllMBusChannelsAreAlreadyOccupied(final SmartMeter gatewayDevice) throws FunctionalException { final List<SmartMeter> mBusDevices = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gatewayDevice.getId()); if (mBusDevices != null && mBusDevices.size() >= MAXIMUM_NUMBER_OF_MBUS_CHANNELS) { throw new FunctionalException(FunctionalExceptionType.ALL_MBUS_CHANNELS_OCCUPIED, ComponentType.DOMAIN_SMART_METERING, new OsgpException(ComponentType.DOMAIN_SMART_METERING, <START> "All MBus channels are already occupied for gateway " <END> + gatewayDevice.getDeviceIdentification())); } }</code><technical_language>put a dash M-Bus (DSMR P2 refers M-Bus M-bus) for logged sentence</technical_language>

Target:
private void checkAndHandleIfAllMBusChannelsAreAlreadyOccupied(final SmartMeter gatewayDevice) throws FunctionalException { final List<SmartMeter> mBusDevices = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gatewayDevice.getId()); if (mBusDevices != null && mBusDevices.size() >= MAXIMUM_NUMBER_OF_MBUS_CHANNELS) { throw new FunctionalException(FunctionalExceptionType.ALL_MBUS_CHANNELS_OCCUPIED, ComponentType.DOMAIN_SMART_METERING, new OsgpException(ComponentType.DOMAIN_SMART_METERING, "All M-Bus channels are already occupied for gateway " + gatewayDevice.getDeviceIdentification())); } }
Source:
<code>public static String convertTemperature(String temperature) { String temp = ""; switch (temperature.length()) { case 1: <START> temp += temperature.substring(0, 1); <END> break; case 2: if (!temperature.substring(0, 1).equalsIgnoreCase("0")) { temp += "-"; } temp += temperature.substring(1, 2); break; default: temp += temperature.substring(1, 3); temp += "."; temp += temperature.substring(3); break; } return (temp); }</code><technical_language>=, +=</technical_language>

Target:
public static String convertTemperature(String temperature) { String temp = ""; switch (temperature.length()) { case 1: temp = temperature.substring(0, 1); break; case 2: if (!temperature.substring(0, 1).equalsIgnoreCase("0")) { temp = "-"; } temp += temperature.substring(1, 2); break; default: temp = temperature.substring(1, 3); temp += "."; temp += temperature.substring(3); break; } return (temp); }