auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public void onJobFinished(GridJobWorker worker) { if (log.isDebugEnabled()) log.debug("Received onJobFinished() callback: " + worker); GridJobSessionImpl ses = worker.getSession(); if (ses.isFullSupport() && ctx.session().removeSession(ses.getId())) { ses.onClosed(); ctx.checkpoint().onSessionEnd(ses, true); } if (worker.endTime() < Long.MAX_VALUE) ctx.timeout().removeTimeoutObject(worker); release(worker.getDeployment()); finishedJobs.add(worker.getJobId()); if (!worker.isInternal()) { finishedJobsCnt.increment(); finishedJobsMetric.increment(); long execTime = worker.getExecuteTime(); finishedJobsTime.add(execTime); totalExecutionTimeMetric.add(execTime); maxFinishedJobsTime.setIfGreater(execTime); if (jobAlwaysActivate) { if (metricsUpdateFreq > -1L) updateJobMetrics(); if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); } else { if (!rwLock.tryReadLock()) { if (log.isDebugEnabled()) log.debug("Skipping collision handling on job finish (node is stopping)."); return; } if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); try { handleCollisions(); } finally { rwLock.readUnlock(); } } <START> if (ctx.performanceStatistics().enabled()) { <END> ctx.performanceStatistics().job(ses.getId(), worker.getQueuedTime(), worker.getStartTime(), worker.getExecuteTime(), worker.isTimedOut()); } } }</code><technical_language>do this if (!worker.isInternal()) {</technical_language>

Target:
@Override public void onJobFinished(GridJobWorker worker) { if (log.isDebugEnabled()) log.debug("Received onJobFinished() callback: " + worker); GridJobSessionImpl ses = worker.getSession(); if (ses.isFullSupport() && ctx.session().removeSession(ses.getId())) { ses.onClosed(); ctx.checkpoint().onSessionEnd(ses, true); } if (worker.endTime() < Long.MAX_VALUE) ctx.timeout().removeTimeoutObject(worker); release(worker.getDeployment()); finishedJobs.add(worker.getJobId()); if (!worker.isInternal()) { finishedJobsCnt.increment(); finishedJobsMetric.increment(); long execTime = worker.getExecuteTime(); finishedJobsTime.add(execTime); totalExecutionTimeMetric.add(execTime); maxFinishedJobsTime.setIfGreater(execTime); if (jobAlwaysActivate) { if (metricsUpdateFreq > -1L) updateJobMetrics(); if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); } else { if (!rwLock.tryReadLock()) { if (log.isDebugEnabled()) log.debug("Skipping collision handling on job finish (node is stopping)."); return; } if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); try { handleCollisions(); } finally { rwLock.readUnlock(); } } } if (ctx.performanceStatistics().enabled()) { ctx.performanceStatistics().job(ses.getId(), worker.getQueuedTime(), worker.getStartTime(), worker.getExecuteTime(), worker.isTimedOut()); } }
Source:
<code>public void testCompareToLargeScale3() { final ITmfTimestamp ts0a = TmfTimestamp.create(1, Integer.MAX_VALUE); final ITmfTimestamp ts0b = TmfTimestamp.create(2, Integer.MAX_VALUE); <START> assertEquals("CompareTo", 1, ts0b.compareTo(ts0a)); <END> assertEquals("CompareTo", -1, ts0a.compareTo(ts0b)); }</code><technical_language>0 <0</technical_language>

Target:
public void testCompareToLargeScale3() { final ITmfTimestamp ts0a = TmfTimestamp.create(1, Integer.MAX_VALUE); final ITmfTimestamp ts0b = TmfTimestamp.create(2, Integer.MAX_VALUE); assertTrue("CompareTo", ts0b.compareTo(ts0a) > 0); assertTrue("CompareTo", ts0a.compareTo(ts0b) < 0); }
Source:
<code>public Notifier notifier() { String notifier = (String) optionSet.valueOf(NOTIFIER); <START> if ("ConsoleNotifier".equals(notifier)) { <END> return new ConsoleNotifier(verboseLoggingEnabled()); } if ("Slf4jNotifier".equals(notifier)) { return new Slf4jNotifier(verboseLoggingEnabled()); } else { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class<?> cls = loader.loadClass(notifier); return (Notifier)cls.newInstance(); } catch (Exception e) { return throwUnchecked(e, null); } } }</code><technical_language>I ConsoleNotifier.class.getSimpleName() avoid changes in future</technical_language>

Target:
public Notifier notifier() { String notifier = (String) optionSet.valueOf(NOTIFIER); if (ConsoleNotifier.class.getSimpleName().equals(notifier)) { return new ConsoleNotifier(verboseLoggingEnabled()); } if (Slf4jNotifier.class.getSimpleName().equals(notifier)) { return new Slf4jNotifier(verboseLoggingEnabled()); } else { try { @SuppressWarnings("unchecked") Class<Notifier> notifierClass = (Class<Notifier>)ClassUtils.getClass(notifier); return ConstructorUtils.invokeConstructor(notifierClass); } catch (Exception e) { throw new IllegalArgumentException("Cannot load notifier by its name: " + notifier, e); } } }
Source:
<code>public void grant(String roleName, String principalName) { <START> Set<String> roleSet = getClusterRoleMap().computeIfAbsent(principalName, n -> { return new HashSet<>(); }); <END> roleSet.add(roleName); clusterRoleMap.put(principalName, roleSet); }</code><technical_language>replace { return new HashSet<>(); } new HashSet<>()</technical_language>

Target:
public void grant(String roleName, String principalName) { Set<String> roleSet = getClusterRoleMap().computeIfAbsent(principalName, n -> new HashSet<>() ); roleSet.add(roleName); clusterRoleMap.put(principalName, roleSet); }
Source:
<code>public ChannelHandlerContext lastContext() { synchronized (handlers) { <START> if (handlers.isEmpty()) { <END> return null; } return handlers.get(handlers.size() - 1); } }</code><technical_language>simplify conditional operator</technical_language>

Target:
public ChannelHandlerContext lastContext() { synchronized (handlers) { return handlers.isEmpty() ? null : handlers.get(handlers.size() - 1); } }
Source:
<code>protected boolean matchesSafely(View target) { if (!(target instanceof ImageView)) { return false; } ImageView imageView = (ImageView) target; if (expectedId < 0) { return imageView.getDrawable() == null; } Resources resources = target.getContext().getResources(); Drawable expectedDrawable = resources.getDrawable(expectedId); resourceName = resources.getResourceEntryName(expectedId); if (expectedDrawable == null) { return false; } Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); <START> Bitmap otherBitmap = ((BitmapDrawable) expectedDrawable).getBitmap(); <END> return bitmap.sameAs(otherBitmap); }</code><technical_language>Give this a more meaningful name, expectedBitmap</technical_language>

Target:
protected boolean matchesSafely(View target) { if (!(target instanceof ImageView)) { return false; } ImageView imageView = (ImageView) target; if (expectedId < 0) { return imageView.getDrawable() == null; } Resources resources = target.getContext().getResources(); Drawable expectedDrawable = getDrawable(resources, expectedId, target.getContext().getTheme()); resourceName = resources.getResourceEntryName(expectedId); if (expectedDrawable == null) { return false; } Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); Bitmap expectedBitmap = ((BitmapDrawable) expectedDrawable).getBitmap(); return bitmap.sameAs(expectedBitmap); }
Source:
<code>private void checkResponseStatus(HttpResponse response) { StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); if (statusLine.getStatusCode() >= 400) { String error; try { BufferedInputStream bis = new BufferedInputStream( response.getEntity().getContent()); <START> ByteArrayOutputStream buf = new ByteArrayOutputStream(); int result = bis.read(); while (result != -1) { buf.write((byte) result); result = bis.read(); } <END> error = buf.toString(); } catch (IOException e) { error = statusLine.getReasonPhrase(); } throw new RuntimeException("Status: " + status + " " + error); } assertEquals(200, status); }</code><technical_language>This replaced like: ByteBuffer buf = IO.readWholeStream(bis, 1024);</technical_language>

Target:
private void checkResponseStatus(HttpResponse response) { StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); if (statusLine.getStatusCode() >= 400) { String error; try { ByteBuffer buf = IO.readWholeStream(new BufferedInputStream( response.getEntity().getContent()), 1024); error = new String(buf.array(), UTF_8); } catch (IOException e) { error = statusLine.getReasonPhrase(); } throw new RuntimeException("Status: " + status + " " + error); } assertEquals(200, status); }
Source:
<code>private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("orders", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), <START> Optional.of(TestingHandle.INSTANCE)), <END> ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }</code><technical_language>If want IndexSourceNode.tableLayout consistent IndexSourceNode.tableHandle.layout, Optional.empty() :)</technical_language>

Target:
private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("orders", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), Optional.empty()), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }
Source:
<code>public void expectNone(long withinMillis) throws InterruptedException { received.expectNone(withinMillis, "Did not expect an element but got "); <START> } <END></code><technical_language>for consistency add overload takes time message</technical_language>

Target:
public void expectNone(long withinMillis) throws InterruptedException { expectNone(withinMillis, "Did not expect an element but got "); }
Source:
<code>public boolean hasVolumeOnServer(Guid vdsId) { if (getGlusterBrickDao().getGlusterVolumeBricksByServerId(vdsId).size() > 0) { return true; } else { return false; <START> } <END> }</code><technical_language>this is a matter of style, written this: return getGlusterBrickDao().getGlusterVolumeBricksByServerId(vdsId).size() > 0</technical_language>

Target:
public boolean hasVolumeOnServer(Guid vdsId) { return (getGlusterBrickDao().getGlusterVolumeBricksByServerId(vdsId).size() > 0); }
Source:
<code>private void listenForMessages() { this.queueId = ensureQueueExists( amazonSQS, queueARN, topicARN, subscription.getSqsMessageRetentionPeriodSeconds() ); subscribeToTopic(amazonSNS, topicARN, queueARN); while (true) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(queueId) .withMaxNumberOfMessages(AWS_MAX_NUMBER_OF_MESSAGES) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) ); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages"); continue; <START> } <END> receiveMessageResult.getMessages().forEach(message -> { handleMessage(message); registry.counter(getProcessedMetricId(subscriptionName())).increment(); }); } }</code><technical_language>Is a reason checks done in constructor vs. nested a while (true)</technical_language>

Target:
private void listenForMessages() { while (isEnabled.get()) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(queueId) .withMaxNumberOfMessages(AWS_MAX_NUMBER_OF_MESSAGES) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) ); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages for queue: {}", queueARN); continue; } receiveMessageResult.getMessages().forEach(message -> { handleMessage(message); }); } }
Source:
<code>private static String findSqlOnClasspath(ClassLoader classLoader, String path) { try { <START> return CACHE.get(path, () -> readResource(classLoader, path)); <END> } catch (ExecutionException e) { throw Throwables.propagate(e); } }</code><technical_language>CACHE.getUnchecked instead if rethrow</technical_language>

Target:
private static String findSqlOnClasspath(ClassLoader classLoader, String path) { try { return CACHE.get(new AbstractMap.SimpleEntry<>(classLoader, path), () -> readResource(classLoader, path)); } catch (UncheckedExecutionException | ExecutionException e) { throw Throwables.propagate(e.getCause()); } }
Source:
<code>void peekBatchMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> iterableMessages = receiver.peekBatchAt(maxMessages, fromSequenceNumber); <START> Assertions.assertEquals(maxMessages, iterableMessages.stream().collect(Collectors.toList()).size()); <END> }</code><technical_language>asserting messages start sequence number</technical_language>

Target:
void peekBatchMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> iterableMessages = receiver.peekBatchAt(maxMessages, fromSequenceNumber); final List<ServiceBusReceivedMessage> asList = iterableMessages.stream().collect(Collectors.toList()); assertEquals(maxMessages, asList.size()); final ServiceBusReceivedMessage receivedMessage = asList.get(0); assertNotNull(receivedMessage); assertTrue(receivedMessage.getSequenceNumber() >= fromSequenceNumber); }
Source:
<code>public String createBuildInfoJSonFileAndGetItsPath() throws IOException { if (serverConfig == null) { return null; } try { File buildInfoJsonTempFile = File.createTempFile(BuildInfoFields.GENERATED_BUILD_INFO, ".json"); clientConf.info.setGeneratedBuildInfoFilePath(buildInfoJsonTempFile.getAbsolutePath()); return buildInfoJsonTempFile.getCanonicalPath(); } catch (IOException e) { log.error("Error occurred while writing build info properties to a temp file. Build info " + <START> "collection is disabled.", e); <END> throw e; } }</code><technical_language>This message incorrect. I be: **Error occurred while writing build info JSON a temp file.**</technical_language>

Target:
public String createBuildInfoJSonFileAndGetItsPath() throws IOException { if (serverConfig == null) { return null; } try { File buildInfoJsonTempFile = File.createTempFile(BuildInfoFields.GENERATED_BUILD_INFO, ".json"); clientConf.info.setGeneratedBuildInfoFilePath(buildInfoJsonTempFile.getAbsolutePath()); return buildInfoJsonTempFile.getCanonicalPath(); } catch (IOException e) { log.error("Error occurred while creating temp build info JSON file.", e); throw e; } }
Source:
<code>@Override protected Map<TypeElement, InjectionTarget> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, InjectionTarget> targetClassMap = new LinkedHashMap<>(); Set<TypeMirror> erasedTargetTypes = new LinkedHashSet<>(); parseInjectExtraAnnotatedElements(env, targetClassMap, erasedTargetTypes); for (Map.Entry<TypeElement, InjectionTarget> entry : targetClassMap.entrySet()) { TypeElement typeElement = entry.getKey(); InjectionTarget injectionTarget = entry.getValue(); String parentClassFqcn = findParentFqcn(typeElement, erasedTargetTypes); if (parentClassFqcn != null) { injectionTarget.setParentTarget(parentClassFqcn); } else { <START> findInjectionTargetForSuperTypeWithInjectExtra(typeElement, injectionTarget); <END> } } return targetClassMap; }</code><technical_language>ancestors besides parent</technical_language>

Target:
@Override protected Map<TypeElement, InjectionTarget> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, InjectionTarget> targetClassMap = new LinkedHashMap<>(); Set<TypeMirror> erasedTargetTypes = new LinkedHashSet<>(); parseInjectExtraAnnotatedElements(env, targetClassMap, erasedTargetTypes, false); for (Map.Entry<TypeElement, InjectionTarget> entry : targetClassMap.entrySet()) { TypeElement typeElement = entry.getKey(); InjectionTarget injectionTarget = entry.getValue(); String parentClassFqcn = findParentFqcn(typeElement, erasedTargetTypes); if (parentClassFqcn != null) { injectionTarget.setParentTarget(parentClassFqcn); } else { findParentInjectionTarget(typeElement, injectionTarget); } } return targetClassMap; }
Source:
<code>public void invoke(final Object event, boolean isLocalNodePrimaryOwner, final boolean unKeyed) { if (unKeyed || shouldInvoke(event, isLocalNodePrimaryOwner)) { Runnable r = new Runnable() { @Override public void run() { ClassLoader contextClassLoader = null; Transaction transaction = suspendIfNeeded(); if (classLoader != null && classLoader.get() != null) { contextClassLoader = setContextClassLoader(classLoader.get()); } try { <START> if (!unKeyed && converter != null && event instanceof EventImpl) { <END> EventImpl eventImpl = (EventImpl)event; eventImpl.setValue(converter.convert(eventImpl.getKey(), eventImpl.getValue(), eventImpl.getMetadata())); } method.invoke(target, event); } catch (InvocationTargetException exception) { Throwable cause = getRealException(exception); if (sync) { throw getLog().exceptionInvokingListener( cause.getClass().getName(), method, target, cause); } else { getLog().unableToInvokeListenerMethod(method, target, cause); } } catch (IllegalAccessException exception) { getLog().unableToInvokeListenerMethod(method, target, exception); removeListener(target); } finally { if (classLoader != null && classLoader.get() != null) { setContextClassLoader(contextClassLoader); } resumeIfNeeded(transaction); } } }; if (sync) syncProcessor.execute(r); else asyncProcessor.execute(r); } }</code><technical_language>Wondering if throw exception if is a converter a filter set event class is EventImpl</technical_language>

Target:
public void invoke(final Object event, boolean isLocalNodePrimaryOwner, final boolean unKeyed) { if (unKeyed || shouldInvoke(event, isLocalNodePrimaryOwner)) { Runnable r = new Runnable() { @Override public void run() { ClassLoader contextClassLoader = null; Transaction transaction = suspendIfNeeded(); if (classLoader != null && classLoader.get() != null) { contextClassLoader = setContextClassLoader(classLoader.get()); } try { if (!unKeyed && converter != null) { if (event instanceof EventImpl) { EventImpl eventImpl = (EventImpl)event; eventImpl.setValue(converter.convert(eventImpl.getKey(), eventImpl.getValue(), eventImpl.getMetadata())); } else { throw new IllegalArgumentException("Provided event should be EventImpl when a converter is" + "being used!"); } } method.invoke(target, event); } catch (InvocationTargetException exception) { Throwable cause = getRealException(exception); if (sync) { throw getLog().exceptionInvokingListener( cause.getClass().getName(), method, target, cause); } else { getLog().unableToInvokeListenerMethod(method, target, cause); } } catch (IllegalAccessException exception) { getLog().unableToInvokeListenerMethod(method, target, exception); removeListener(target); } finally { if (classLoader != null && classLoader.get() != null) { setContextClassLoader(contextClassLoader); } resumeIfNeeded(transaction); } } }; if (sync) syncProcessor.execute(r); else asyncProcessor.execute(r); } }
Source:
<code>public String getName() { <START> return "ATLAS_DUMP_TASK"; <END> }</code><technical_language>Name stage type is for tasks generally</technical_language>

Target:
public String getName() { return "ATLAS_DUMP"; }
Source:
<code>private void checkConstraints(JsonDoc doc, Path currentValuePath, JsonNode currentValue) { LOGGER.debug("checking field constraints"); FieldCursor cursor = md.getFieldCursor(); Path skip=null; while (cursor.next()) { currentFieldNode = cursor.getCurrentNode(); currentFieldPath = cursor.getCurrentPath(); if(skip==null) { if(currentFieldNode instanceof ResolvedReferenceField) skip=currentFieldNode.getFullPath(); } else { <START> if(!currentFieldPath.prefix(skip.numSegments()).equals(skip)) <END> skip=null; } if(skip==null) { LOGGER.debug("checking field {}", currentFieldPath); Error.push(currentFieldPath.toString()); try { List<FieldConstraint> constraints = null; if (currentFieldNode instanceof Field) { constraints = ((Field) currentFieldNode).getConstraints(); } else if (currentFieldNode instanceof SimpleArrayElement) { constraints = ((SimpleArrayElement) currentFieldNode).getConstraints(); } if (constraints != null && !constraints.isEmpty()) { checkFieldConstraints(doc, constraints, currentValuePath, currentValue); } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(CrudConstants.ERR_CRUD, e.getMessage()); } finally { Error.pop(); } } } }</code><technical_language>if next field is a ResolvedReferenceField</technical_language>

Target:
private void checkConstraints(JsonDoc doc, Path currentValuePath, JsonNode currentValue) { LOGGER.debug("checking field constraints"); FieldCursor cursor = md.getFieldCursor(); Path skip=null; while (cursor.next()) { currentFieldNode = cursor.getCurrentNode(); currentFieldPath = cursor.getCurrentPath(); if(skip!=null) { if(!currentFieldPath.prefix(skip.numSegments()).equals(skip)) skip=null; } if(skip==null) { if(currentFieldNode instanceof ResolvedReferenceField) skip=currentFieldNode.getFullPath(); } if(skip==null) { LOGGER.debug("checking field {}", currentFieldPath); Error.push(currentFieldPath.toString()); try { List<FieldConstraint> constraints = null; if (currentFieldNode instanceof Field) { constraints = ((Field) currentFieldNode).getConstraints(); } else if (currentFieldNode instanceof SimpleArrayElement) { constraints = ((SimpleArrayElement) currentFieldNode).getConstraints(); } if (constraints != null && !constraints.isEmpty()) { checkFieldConstraints(doc, constraints, currentValuePath, currentValue); } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(CrudConstants.ERR_CRUD, e.getMessage()); } finally { Error.pop(); } } } }
Source:
<code>public boolean isEmpty() { <START> return !startPosition.isValid() && !endPosition.isValid(); <END> }</code><technical_language>I expect a Selection 1,1 1,1 empty. More general a Selection 1,1 0,0 valid in this class</technical_language>

Target:
public boolean isEmpty() { return this == EMPTY_SELECTION; }
Source:
<code>public static void <START> setLogger(Logger <END> logger) { sLogger = logger; }</code><technical_language>Synchronize this too</technical_language>

Target:
public static synchronized void setLogger(Logger logger) { sLogger = logger; }
Source:
<code>public void TestSuppressTransientExceptions() throws IOException { Configuration conf = new HdfsConfiguration(); HdfsStorageFactory.reset(); HdfsStorageFactory.setConfiguration(conf); HopsTransactionalRequestHandler txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { throw new RuntimeException("Test"); } @Override public Object performTask() throws IOException { return null; } @Override public void acquireLock(TransactionLocks locks) throws IOException { } }; try { txHandler.handle(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; <START> } <END> txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { } @Override public Object performTask() throws IOException { throw new RuntimeException("Test"); } @Override public void acquireLock(TransactionLocks locks) throws IOException { } }; try { txHandler.handle(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; } txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { } @Override public Object performTask() throws IOException { return null; } @Override public void acquireLock(TransactionLocks locks) throws IOException { throw new RuntimeException("Test"); } }; try { txHandler.handle(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; } }</code><technical_language>expecting get exception? If fail if excpetion is thrown</technical_language>

Target:
public void TestSuppressTransientExceptions() throws IOException { Configuration conf = new HdfsConfiguration(); HdfsStorageFactory.reset(); HdfsStorageFactory.setConfiguration(conf); HopsTransactionalRequestHandler txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { throw new RuntimeException("Test"); } @Override public Object performTask() throws IOException { return null; } @Override public void acquireLock(TransactionLocks locks) throws IOException { } }; try { txHandler.handle(); fail(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; } txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { } @Override public Object performTask() throws IOException { throw new RuntimeException("Test"); } @Override public void acquireLock(TransactionLocks locks) throws IOException { } }; try { txHandler.handle(); fail(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; } txHandler = new HopsTransactionalRequestHandler(HDFSOperationType.TEST) { @Override public void setUp() throws IOException { } @Override public Object performTask() throws IOException { return null; } @Override public void acquireLock(TransactionLocks locks) throws IOException { throw new RuntimeException("Test"); } }; try { txHandler.handle(); fail(); } catch (RuntimeException e) { assert e.getMessage().compareToIgnoreCase("Test") == 0; } }
Source:
<code>public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, <START> ExecutionType priority) { <END> synchronized (TmfEventRequest.class) { fRequestId = fRequestNumber++; } fDataType = dataType; fIndex = index; fNbRequested = nbRequested; fExecType = priority; fRange = range; fNbRead = 0; fRequestRunning = false; fRequestCompleted = false; fRequestFailed = false; fRequestCanceled = false; if (TmfCoreTracer.isRequestTraced()) { String type = getClass().getName(); type = type.substring(type.lastIndexOf('.') + 1); @SuppressWarnings("nls") String message = "CREATED " + (getExecType() == ExecutionType.BACKGROUND ? "(BG)" : "(FG)") + " Type=" + type + " Index=" + getIndex() + " NbReq=" + getNbRequested() + " Range=" + getRange() + " DataType=" + getDataType().getSimpleName(); TmfCoreTracer.traceRequest(fRequestId, message); } }</code><technical_language>call this(...) dependency level of 0</technical_language>

Target:
public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, ExecutionType priority) { this(dataType, range, index, nbRequested, priority, 0); }
Source:
<code>private void mockJobSubjectEntityDao(Guid jobId) { when(jobSubjectEntityDao.getJobSubjectEntityByJobId(eq(jobId))) .thenReturn(JOB_SUBJECT_ENTITIES_MAP); <START> when(jobSubjectEntityDao.getJobIdByEntityId(any(Guid.class))).thenReturn(Collections.<Guid>singletonList(jobId)); <END> }</code><technical_language>I drop <Guid> parameter inferred in this case</technical_language>

Target:
private void mockJobSubjectEntityDao(Guid jobId) { when(jobSubjectEntityDao.getJobSubjectEntityByJobId(eq(jobId))) .thenReturn(JOB_SUBJECT_ENTITIES_MAP); when(jobSubjectEntityDao.getJobIdByEntityId(any(Guid.class))).thenReturn(Collections.singletonList(jobId)); }
Source:
<code>protected List<Disk> manualAggregateSnapshots() { List<Disk> <START> Param = <END> new ArrayList<>(); DiskImage diskWithSnaps = diskWithSnapshots; diskWithSnaps.getSnapshots().addAll(snapshotsList); Param.add(diskWithSnapshots); return Param; }</code><technical_language>I a more informative name, if decide this - please switch param</technical_language>

Target:
protected List<DiskImage> manualAggregateSnapshots() { List<DiskImage> diskImageWithAggregatedSnapshots = new ArrayList<>(); DiskImage diskWithSnaps = diskWithSnapshots; diskWithSnaps.getSnapshots().addAll(snapshotsList); diskImageWithAggregatedSnapshots.add(diskWithSnapshots); return diskImageWithAggregatedSnapshots; }
Source:
<code>private void invokeBeforeServerStop() { <START> Arrays.stream(testClass.getMethods()) <END> .filter(field -> field.getAnnotation(BeforeServerStop.class) != null) .forEach(method -> { try { method.invoke(testInstance); } catch (Exception e) { throw new RuntimeException(e); } }); }</code><technical_language>static import</technical_language>

Target:
private void invokeBeforeServerStop() { stream(testClass.getMethods()) .filter(field -> field.getAnnotation(BeforeServerStop.class) != null) .forEach(this::invokeTestInstanceMethod); }
Source:
<code>AllProjectsNameOnInitProvider(Section.Factory sections) { String n = sections.get("gerrit", null).get("allProjects"); <START> if (n == null || n.isEmpty()) { n = AllProjectsNameProvider.DEFAULT; } name = n; <END> }</code><technical_language>name = Objects.firstNonNull( Strings.emptyToNull(n), AllProjectsNameProvider.DEFAULT);</technical_language>

Target:
AllProjectsNameOnInitProvider(Section.Factory sections) { String n = sections.get("gerrit", null).get("allProjects"); name = Objects.firstNonNull( Strings.emptyToNull(n), AllProjectsNameProvider.DEFAULT); }
Source:
<code><START> protected IStateHistoryBackend getBackend() { <END> return fBackend; }</code><technical_language>protected @NonNull IStateHistoryBackend... screw Sonar lol</technical_language>

Target:
protected @NonNull IStateHistoryBackend getBackend() { return fPartialBackend; }
Source:
<code>public static String getParameter(String key) { try { return getConfig().getString(key); } catch (NoSuchElementException e) { <START> logger.catching(e); <END> throw new NoSuchElementException("No configuration found in kitodo_config.properties for key " + key + "!"); } }</code><technical_language>Logger rethrow in black? IS necessary</technical_language>

Target:
public static String getParameter(String key) { try { return getConfig().getString(key); } catch (NoSuchElementException e) { try { FIELD_DETAIL_MESSAGE.set(e, "No configuration found in kitodo_config.properties for key " + key + "!"); } catch (IllegalAccessException e1) { throw new UndeclaredThrowableException(e1); } throw e; } }
Source:
<code>public AndroidSentryClientFactory(Context ctx) { Log.d(TAG, "Construction of Android Sentry from Android Context."); <START> this.ctx = ctx; <END> }</code><technical_language>This change is a bit risky, is produce a memory leak if application is creating a AndroidSentryClientFactory Activity ctx. Sentry hold a reference Activity resource tied eligible for garbage collection (e.g. view hierarchy, massive in terms of memory occupation). I previous method of hold of a Context wrong, I suggested a for a developer feed consciously a Context Sentry</technical_language>

Target:
public AndroidSentryClientFactory(Context ctx) { Log.d(TAG, "Construction of Android Sentry from Android Context."); this.ctx = ctx.getApplicationContext(); if (this.ctx == null) { this.ctx = ctx; } }
Source:
<code>public final void onMessage(final SocketSession conn, final Request req) { if (req.getRequestType() == Request.MessageType.DATA_REQUEST) { DataRequestHandler.handleRequest(req, conn, super.getConnectionToId().get(conn).getKey(), getConnectionManager()); } else if (req.getRequestType() == Request.MessageType.DATA_INSERT) { DataInsertHandler.handleData(req, conn); } else if (req.getRequestType() == Request.MessageType.DATA_UPDATE) { DataUpdateHandler.handleData(req, conn); } else if (req.getRequestType() == Request.MessageType.TIME) { final Request rsp = TimeManager.decodeRequest(req); if (rsp != null) { send(conn, rsp); } } <START> LOG.info("Finished looking at query"); <END> }</code><technical_language>print out request type here</technical_language>

Target:
public final void onMessage(final SocketSession conn, final Request req) { if (req.getRequestType() == Request.MessageType.DATA_REQUEST) { DataRequestHandler.handleRequest(req, conn, super.getConnectionToId().get(conn).getKey(), getConnectionManager()); } else if (req.getRequestType() == Request.MessageType.DATA_INSERT) { DataInsertHandler.handleData(req, conn); } else if (req.getRequestType() == Request.MessageType.DATA_UPDATE) { DataUpdateHandler.handleData(req, conn); } else if (req.getRequestType() == Request.MessageType.TIME) { final Request rsp = TimeManager.decodeRequest(req); if (rsp != null) { send(conn, rsp); } } LOG.info("Finished looking at query {}", req); }
Source:
<code>private void printTableScanInfo(TableScanNode node, int indent) { TableHandle table = node.getTable(); if (node.getLayout().isPresent()) { ConnectorTableLayoutHandle layout = node.getLayout().get().getConnectorHandle(); if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout); } } <START> TupleDomain<ColumnHandle> predicate = node.getLayoutConstraint(); <END> if (predicate.isNone()) { print(indent + 2, ":: NONE"); } else { for (Map.Entry<Symbol, ColumnHandle> assignment : node.getAssignments().entrySet()) { ColumnHandle column = assignment.getValue(); print(indent + 2, "%s := %s", assignment.getKey(), column); printConstraint(indent + 3, column, predicate); } if (!predicate.isAll()) { Set<ColumnHandle> outputs = ImmutableSet.copyOf(node.getAssignments().values()); predicate.getDomains().get() .entrySet().stream() .filter(entry -> !outputs.contains(entry.getKey())) .forEach(entry -> { ColumnHandle column = entry.getKey(); print(indent + 2, "%s", column); printConstraint(indent + 3, column, predicate); }); } } }</code><technical_language>TableScanNode::getCurrentConstraint() here</technical_language>

Target:
private void printTableScanInfo(TableScanNode node, int indent) { TableHandle table = node.getTable(); if (node.getLayout().isPresent()) { ConnectorTableLayoutHandle layout = node.getLayout().get().getConnectorHandle(); if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout); } } TupleDomain<ColumnHandle> predicate = node.getCurrentConstraint(); if (predicate.isNone()) { print(indent + 2, ":: NONE"); } else { for (Map.Entry<Symbol, ColumnHandle> assignment : node.getAssignments().entrySet()) { ColumnHandle column = assignment.getValue(); print(indent + 2, "%s := %s", assignment.getKey(), column); printConstraint(indent + 3, column, predicate); } if (!predicate.isAll()) { Set<ColumnHandle> outputs = ImmutableSet.copyOf(node.getAssignments().values()); predicate.getDomains().get() .entrySet().stream() .filter(entry -> !outputs.contains(entry.getKey())) .forEach(entry -> { ColumnHandle column = entry.getKey(); print(indent + 2, "%s", column); printConstraint(indent + 3, column, predicate); }); } } }
Source:
<code>private static Object prioritizeObjectValue(Object value1, Object value2) { boolean value1Null = value1 == null; <START> if (!value1Null && !(value1 instanceof Data)) { <END> return value1; } boolean value2Null = value2 == null; if (!value2Null && !(value2 instanceof Data)) { return value2; } if (!value1Null) { return value1; } if (!value2Null) { return value2; } return null; }</code><technical_language>Minor: of booleans is inverted simpler if boolean valueXNotNull instead</technical_language>

Target:
private static Object prioritizeObjectValue(Object value1, Object value2) { boolean value1NotNull = value1 != null; if (value1NotNull && !(value1 instanceof Data)) { return value1; } boolean value2NotNull = value2 != null; if (value2NotNull && !(value2 instanceof Data)) { return value2; } if (value1NotNull) { return value1; } if (value2NotNull) { return value2; } return null; }
Source:
<code>public DBObject fetch(DBRef dbRef) { <START> return ReflectiveDBRefResolver.fetch(MongoClientVersion.isMongo3Driver() ? mongoDbFactory.getDb() : null, dbRef); <END> }</code><technical_language>test case simple if handed factory fetch method? ReflectiveDbRefResolver isMongo3Driver() anyway, lookup DB guard? a simple unit test for ReflectiveDbRefResolver.fetch(MongoDbFactory, DBRef) then, i</technical_language>

Target:
public DBObject fetch(DBRef dbRef) { return ReflectiveDBRefResolver.fetch(mongoDbFactory, dbRef); }
Source:
<code>protected void logError( Request request, Throwable error, long latencyNanos, Node node, int maxQueryLength, boolean showValues, int maxValues, int maxValueLength, boolean showStackTraces) { StringBuilder builder = formatter.logBuilder(logPrefix, node); formatter.appendErrorDescription(builder); formatter.appendLatency(latencyNanos, builder); formatter.appendRequest( request, maxQueryLength, showValues, maxValues, maxValueLength, builder); if (showStackTraces) { LOG.error(builder.toString(), error); } else { <START> LOG.error("{} {}", builder.toString(), error.toString()); <END> } }</code><technical_language>Nit: nice some kind of obvious indicator/separator demarcating builder message error string kinda awkward currently: Error (2 ms) [0 values] SELECT release_version system.local com.datastax.oss.driver.api.core.servererrors.ServerError: test</technical_language>

Target:
protected void logError( Request request, Throwable error, long latencyNanos, Node node, int maxQueryLength, boolean showValues, int maxValues, int maxValueLength, boolean showStackTraces) { StringBuilder builder = formatter.logBuilder(logPrefix, node); formatter.appendErrorDescription(builder); formatter.appendLatency(latencyNanos, builder); formatter.appendRequest( request, maxQueryLength, showValues, maxValues, maxValueLength, builder); if (showStackTraces) { LOG.error(builder.toString(), error); } else { LOG.error("{} [{}]", builder.toString(), error.toString()); } }
Source:
<code>public void checkStoppingByApi() throws Exception { Workspace workspace = workspaceServiceClient.getByName( testWorkspace.getName(), testUser.getName(), testUser.getAuthToken()); <START> assertEquals(workspace.getStatus(), WorkspaceStatus.STOPPED); <END> }</code><technical_language>you, please, explain expecting STOPPED status of workspace here</technical_language>

Target:
public void checkStoppingByApi() throws Exception { Workspace workspace = workspaceServiceClient.getByName( testWorkspace.getName(), testUser.getName()); assertEquals(workspace.getStatus(), STOPPED); }
Source:
<code>public void writePacketData(RailcraftOutputStream data) throws IOException { for (StandardTank tank : tanks) { data.writeFluidStack(tank.getFluid()); <START> data.writeInt(tank.getCapacity()); <END> } }</code><technical_language>client this</technical_language>

Target:
public void writePacketData(RailcraftOutputStream data) throws IOException { for (StandardTank tank : tanks) { data.writeFluidStack(tank.getFluid()); } }
Source:
<code>public PreparedOperation<PutResult> prepare() { <START> Checks.checkNotNull(mapFunc, "Please specify map function"); <END> return new PreparedPutObject<>( storIOSQLiteDb, putResolver, object, mapFunc ); }</code><technical_language>Static import</technical_language>

Target:
public PreparedOperation<PutResult> prepare() { checkNotNull(mapFunc, "Please specify map function"); return new PreparedPutObject<>( storIOSQLiteDb, putResolver, object, mapFunc ); }
Source:
<code>public String render(@RequestParam(value = "reportId", required = true) int reportId, WebRequest request, HttpServletResponse response) throws IOException { String message = null; int timesheetId; String temp = request.getParameter("timesheetId"); if (!StringUtils.isEmpty(temp) && StringUtils.isNumeric(temp)) { timesheetId = Integer.parseInt(temp); } else { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The timesheet id ('" + temp + "') must be " + "defined and be numeric."); return null; } JasperReportService jasperService = Context.getService(JasperReportService.class); JasperReport report = jasperService.getJasperReport(reportId); if (report == null) { <START> message = "Could not find report '" + reportId + "'"; <END> return "redirect:" + JasperReportConstants.REPORT_ERROR_PAGE + "?reportId="+reportId+"&message="+message; } report.setName("Cashier Shift Report - " + temp); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("timesheetId", timesheetId); try { ReportGenerator.generate(report, params, false, true); } catch (IOException e) { message = "Error generating cashier shift report for " + "timesheet '" + temp + "'"; return "redirect:" + JasperReportConstants.REPORT_ERROR_PAGE + "?reportId="+reportId+"&message="+message; } return "redirect:" + CashierWebConstants.REPORT_DOWNLOAD_URL + "?reportName=" + report.getName().replaceAll("\\W", "") + ".pdf"; }</code><technical_language>Change this error message to: "No Jasper Report ID of '{ID}' found."</technical_language>

Target:
public String render(@RequestParam(value = "reportId", required = true) int reportId, WebRequest request, HttpServletResponse response) throws IOException { String message = null; int timesheetId; String temp = request.getParameter("timesheetId"); if (!StringUtils.isEmpty(temp) && StringUtils.isNumeric(temp)) { timesheetId = Integer.parseInt(temp); } else { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The timesheet id ('" + temp + "') must be " + "defined and be numeric."); return null; } JasperReportService jasperService = Context.getService(JasperReportService.class); JasperReport report = jasperService.getJasperReport(reportId); if (report == null) { message = "No Jasper Report with an ID of" +reportId+ "could be found."; return "redirect:" + JasperReportConstants.REPORT_ERROR_PAGE + "?reportId="+reportId+"&message="+message; } report.setName("Cashier Shift Report - " + temp); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("timesheetId", timesheetId); try { ReportGenerator.generate(report, params, false, true); } catch (IOException e) { message = "Error generating cashier shift report for " + "timesheet " + temp + ". The Following Error Occurred " + ""+e.getMessage()+""; return "redirect:" + JasperReportConstants.REPORT_ERROR_PAGE + "?reportId="+reportId+"&message="+message; } return "redirect:" + CashierWebConstants.REPORT_DOWNLOAD_URL + "?reportName=" + report.getName().replaceAll("\\W", "") + ".pdf"; }
Source:
<code>void onCancelClicked() { new AlertDialog.Builder(getContext()) .setMessage(R.string.compilation_download_cancel_confirm) <START> .setPositiveButton(android.R.string.yes, <END> new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (callback != null) { callback.onCancel(); } } }) .setNegativeButton(android.R.string.no, null) .show(); }</code><technical_language>Remove</technical_language>

Target:
void onCancelClicked() { new AlertDialog.Builder(getContext()) .setMessage(R.string.compilation_download_cancel_confirm) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (callback != null) { callback.onCancel(); } } }) .setNegativeButton(R.string.no, null) .show(); }
Source:
<code>public boolean haveTriggersFired() { ModelNode causes = get(DEPLOYMENTCONFIG_CAUSES); <START> if (causes == null || causes.getType() != ModelType.LIST) <END> return false; return causes.asList().size() > 0; }</code><technical_language>underlying impl is DMR returns null; returns something. 'null' is ModelType.UNDEFINED is</technical_language>

Target:
public boolean haveTriggersFired() { ModelNode causes = get(DEPLOYMENTCONFIG_CAUSES); if (causes.getType() == ModelType.UNDEFINED || causes.getType() != ModelType.LIST) return false; return causes.asList().size() > 0; }
Source:
<code>public void nextPage() { int curPage = model.getPage(); if (curPage == model.getMaxPage()) return; <START> model.setPage(model.getPage() + 1); <END> model.setFetchData(null, model.getCurrentStartCursor(), false); this.fetch(false); }</code><technical_language>model.setPage(curPage + 1);</technical_language>

Target:
public void nextPage() { int curPage = model.getPage(); if (curPage == model.getMaxPage()) return; model.setPage(curPage + 1); model.setFetchData(null, model.getCurrentStartCursor(), false); this.fetch(false); }
Source:
<code>public static void replyError(HttpServletRequest req, HttpServletResponse res, int statusCode, String msg, CacheControl c, @Nullable Throwable err) throws IOException { res.setStatus(statusCode); configureCaching(req, res, null, c); replyText(req, res, msg); if (err != null) { <START> req.setAttribute(RequestUtil.ATTRIBUTE_ERROR_TRACE, err); <END> } }</code><technical_language>Please fix. style Dave proposes helps readability code reducing risk of typing errors</technical_language>

Target:
public static void replyError(HttpServletRequest req, HttpServletResponse res, int statusCode, String msg, CacheControl c, @Nullable Throwable err) throws IOException { res.setStatus(statusCode); configureCaching(req, res, null, c); replyText(req, res, msg); if (err != null) { RequestUtil.setErrorTraceAttribute(req, err); } }
Source:
<code>public GroupAddRequest(User sender, Group group, User newUser) { super(); mSender = sender; mGroup = group; <START> mUser = newUser; <END> }</code><technical_language>add null checks</technical_language>

Target:
public GroupAddRequest(User sender, Group group, User newUser) { super(); Objects.requireNonNull(sender); Objects.requireNonNull(group); Objects.requireNonNull(newUser); mSender = sender; mGroup = group; mUser = newUser; }
Source:
<code>private List<GlusterBrickEntity> getBricks(Guid volumeId, String dirPrefix, int n) { List<GlusterBrickEntity> bricks = new ArrayList<GlusterBrickEntity>(); GlusterBrickEntity brick; for (Integer i = 0; i < n; i++) { brick = new GlusterBrickEntity(volumeId, new VdsStatic(serverName, "127.0.0.1", "0934390834", 20, new Guid(), serverId, serverName, true, VDSType.oVirtNode, <START> "", "", "", "", "", ""), <END> "/tmp/" + dirPrefix + i.toString(), GlusterStatus.UP); bricks.add(brick); } return bricks; }</code><technical_language>This is example fact if additional CTOR, need change lots of places do do host bios info</technical_language>

Target:
private List<GlusterBrickEntity> getBricks(Guid volumeId, String dirPrefix, int n) { List<GlusterBrickEntity> bricks = new ArrayList<GlusterBrickEntity>(); GlusterBrickEntity brick; for (Integer i = 0; i < n; i++) { brick = new GlusterBrickEntity(volumeId, new VdsStatic(serverName, "127.0.0.1", "0934390834", 20, new Guid(), serverId, serverName, true, VDSType.oVirtNode), "/tmp/" + dirPrefix + i.toString(), GlusterStatus.UP); bricks.add(brick); } return bricks; }