auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Object> getMovingAverages() { Map<String, Object> movingAverages = Maps.newHashMap(); Map<String, Object> oneMinute = Maps.newHashMap(); oneMinute.put(PROCESSED, processed.getOneMinuteRate()); oneMinute.put(PROCESSED_WITH_ERROR, processedWithError.getOneMinuteRate()); oneMinute.put(UNPARSEABLE, unparseable.getOneMinuteRate()); oneMinute.put(THROWN_AWAY, thrownAway.getOneMinuteRate()); Map<String, Object> fiveMinute = Maps.newHashMap(); fiveMinute.put(PROCESSED, processed.getFiveMinuteRate()); fiveMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFiveMinuteRate()); fiveMinute.put(UNPARSEABLE, unparseable.getFiveMinuteRate()); fiveMinute.put(THROWN_AWAY, thrownAway.getFiveMinuteRate()); Map<String, Object> fifteenMinute = Maps.newHashMap(); fifteenMinute.put(PROCESSED, processed.getFifteenMinuteRate()); fifteenMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFifteenMinuteRate()); fifteenMinute.put(UNPARSEABLE, unparseable.getFifteenMinuteRate()); fifteenMinute.put(THROWN_AWAY, thrownAway.getFifteenMinuteRate()); <START> movingAverages.put("1m", oneMinute); <END> movingAverages.put("5m", fiveMinute); movingAverages.put("15m", fifteenMinute); return movingAverages; }</code><technical_language>static final strings somewhere</technical_language>

Target:
public Map<String, Object> getMovingAverages() { Map<String, Object> movingAverages = Maps.newHashMap(); Map<String, Object> oneMinute = Maps.newHashMap(); oneMinute.put(PROCESSED, processed.getOneMinuteRate()); oneMinute.put(PROCESSED_WITH_ERROR, processedWithError.getOneMinuteRate()); oneMinute.put(UNPARSEABLE, unparseable.getOneMinuteRate()); oneMinute.put(THROWN_AWAY, thrownAway.getOneMinuteRate()); Map<String, Object> fiveMinute = Maps.newHashMap(); fiveMinute.put(PROCESSED, processed.getFiveMinuteRate()); fiveMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFiveMinuteRate()); fiveMinute.put(UNPARSEABLE, unparseable.getFiveMinuteRate()); fiveMinute.put(THROWN_AWAY, thrownAway.getFiveMinuteRate()); Map<String, Object> fifteenMinute = Maps.newHashMap(); fifteenMinute.put(PROCESSED, processed.getFifteenMinuteRate()); fifteenMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFifteenMinuteRate()); fifteenMinute.put(UNPARSEABLE, unparseable.getFifteenMinuteRate()); fifteenMinute.put(THROWN_AWAY, thrownAway.getFifteenMinuteRate()); movingAverages.put(ONE_MINUTE_NAME, oneMinute); movingAverages.put(FIVE_MINUTE_NAME, fiveMinute); movingAverages.put(FIFTEEN_MINUTE_NAME, fifteenMinute); return movingAverages; }
Source:
<code>private ServiceConfiguration buildServerPropertiesServiceConfiguration(Config config) { ServiceConfiguration serverProperties = new ServiceConfiguration(); serverProperties.setName(CONFIG_SERVER_PROPERTIES); Map<String, String> confMap = new HashMap<>(); if (config.contains(PARAM_ZOOKEEPER_CONNECT)) { String zookeeperConnect = config.getString(PARAM_ZOOKEEPER_CONNECT); confMap.put(PARAM_ZOOKEEPER_CONNECT, zookeeperConnect); } if (config.contains(PARAM_SECURITY_INTER_BROKER_PROTOCOL)) { String securityInterBrokerProtocol = config.getString(PARAM_SECURITY_INTER_BROKER_PROTOCOL); confMap.put(PARAM_SECURITY_INTER_BROKER_PROTOCOL, securityInterBrokerProtocol); } try { String json = objectMapper.writeValueAsString(confMap); serverProperties.setConfiguration(json); } catch (JsonProcessingException e) { throw new RuntimeException(e); <START> } <END> return serverProperties; }</code><technical_language>is goal write empty JSON</technical_language>

Target:
private ServiceConfiguration buildServerPropertiesServiceConfiguration(Config config) { ServiceConfiguration serverProperties = new ServiceConfiguration(); serverProperties.setName(CONFIG_SERVER_PROPERTIES); Map<String, String> confMap = new HashMap<>(); if (config.contains(PARAM_ZOOKEEPER_CONNECT)) { confMap.put(PARAM_ZOOKEEPER_CONNECT, config.getString(PARAM_ZOOKEEPER_CONNECT)); } if (config.contains(PARAM_SECURITY_INTER_BROKER_PROTOCOL)) { confMap.put(PARAM_SECURITY_INTER_BROKER_PROTOCOL, config.getString(PARAM_SECURITY_INTER_BROKER_PROTOCOL)); } try { String json = objectMapper.writeValueAsString(confMap); serverProperties.setConfiguration(json); } catch (JsonProcessingException e) { throw new RuntimeException(e); } return serverProperties; }
Source:
<code><START> public RX16Packet(XBee16BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { <END> super(XBeeAPIType.RX_16); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }</code><technical_language>Throw proper exception if is supported: - NullPointerException if sourceAddress == null. - signal strength passed constructor, guess is a positive (0, equivalent 0dBM, 100, equivalent -100dBm). this account IllegalArgumentException if rssi < 0 rssi > 100. - receiveOptions valid values</technical_language>

Target:
public RX16Packet(XBee16BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { super(APIFrameType.RX_16); if (sourceAddress == null) throw new NullPointerException("Source address cannot be null."); if (rssi < 0 || rssi > 100) throw new IllegalArgumentException("RSSI value must be between 0 and 100."); if (receiveOptions < 0 || receiveOptions > 255) throw new IllegalArgumentException("Receive options value must be between 0 and 255."); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }
Source:
<code>public Iterator<T> iterator() { <START> ensureOrder(); <END> return super.iterator(); }</code><technical_language>...and need call other method</technical_language>

Target:
public Iterator<T> iterator() { sort(); return super.iterator(); }
Source:
<code>public SCIMSearchResult<Group> searchWithPost(@RequestParam Map<String, String> requestParameters) { SCIMSearchResult<Group> scimSearchResult = scimGroupProvisioning.search(requestParameters.get("filter"), requestParameters.get("sortBy"), requestParameters.getOrDefault("sortOrder", "ascending"), <START> Integer.parseInt(requestParameters.getOrDefault("count", "100")), <END> Integer.parseInt(requestParameters.getOrDefault("startIndex", "1"))); return attributesRemovalHelper.removeSpecifiedAttributes(scimSearchResult, requestParameters); }</code><technical_language>magic number (100) now? Do want add a constant SCIMSearchResult some other class? I said, configurable anyway, I care. /cc @dacrome</technical_language>

Target:
public SCIMSearchResult<Group> searchWithPost(@RequestParam Map<String, String> requestParameters) { SCIMSearchResult<Group> scimSearchResult = scimGroupProvisioning.search(requestParameters.get("filter"), requestParameters.get("sortBy"), requestParameters.getOrDefault("sortOrder", "ascending"), Integer.parseInt(requestParameters.getOrDefault("count", "" + SCIMSearchResult.MAX_RESULTS)), Integer.parseInt(requestParameters.getOrDefault("startIndex", "1"))); return attributesRemovalHelper.removeSpecifiedAttributes(scimSearchResult, requestParameters); }
Source:
<code>public void run() { try { Thread.sleep(DELAY_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation", e); } for (int i = 0; i < numberOfKeys; i++) { Integer value = 0; <START> for (int j = 0; j < numberOfUpdates; j++) { <END> parameterWorker.push(startKey + i, delta); value = parameterWorker.pull(startKey + i); } LOG.log(Level.INFO, "Current value associated with key {0} is {1}", new Object[]{startKey + i, value}); } }</code><technical_language>want this a benchmark, more helpful if characteristic of this application is similar of typcial ML apps. I change iteration order: numberOfUpdates first, numberOfKeys second</technical_language>

Target:
public void run() { try { Thread.sleep(DELAY_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation", e); } for (int i = 0; i < numberOfUpdates; i++) { for (int j = 0; j < numberOfKeys; j++) { parameterWorker.push(startKey + j, delta); final Integer value = parameterWorker.pull(startKey + j); LOG.log(Level.INFO, "Current value associated with key {0} is {1}", new Object[]{startKey + j, value}); } } }
Source:
<code>public EmbeddableForeignKeyResultImpl( List<SqlSelection> sqlSelections, NavigablePath navigablePath, EmbeddableValuedModelPart embeddableValuedModelPart, String resultVariable, DomainResultCreationState creationState) { super( embeddableValuedModelPart.getEmbeddableTypeDescriptor(), navigablePath ); this.resultVariable = resultVariable; <START> AtomicInteger atomicInteger = new AtomicInteger( 0 ); <END> fetches = new ArrayList<>(); embeddableValuedModelPart.visitFetchables( fetchable -> { generateFetches( sqlSelections, navigablePath, creationState, atomicInteger, fetchable ); }, null ); }</code><technical_language>save some CPU cycles default constructor instead. Super minor</technical_language>

Target:
public EmbeddableForeignKeyResultImpl( List<SqlSelection> sqlSelections, NavigablePath navigablePath, EmbeddableValuedModelPart embeddableValuedModelPart, String resultVariable, DomainResultCreationState creationState) { super( embeddableValuedModelPart.getEmbeddableTypeDescriptor(), navigablePath ); this.resultVariable = resultVariable; fetches = new ArrayList<>(); MutableInteger index = new MutableInteger( 0 ); embeddableValuedModelPart.visitFetchables( fetchable -> { generateFetches( sqlSelections, navigablePath, creationState, index, fetchable ); }, null ); }
Source:
<code>private ExecutorManager createMultiExecutorManagerInstance( ExecutorLoader loader) throws ExecutorManagerException { Props props = new Props(); props.put(ExecutorManager.AZKABAN_USE_MULTIPLE_EXECUTORS, "true"); props.put(ExecutorManager.AZKABAN_QUEUEPROCESSING_ENABLED, "false"); loader.addExecutor("localhost", 12345); loader.addExecutor("localhost", 12346); return new ExecutorManager(props, loader, new AlerterHolder(props), <START> new CommonMetrics(new MetricsManager(new MetricRegistry()))); <END> }</code><technical_language>a mock work here? for other tests</technical_language>

Target:
private ExecutorManager createMultiExecutorManagerInstance( ExecutorLoader loader) throws ExecutorManagerException { Props props = new Props(); props.put(ExecutorManager.AZKABAN_USE_MULTIPLE_EXECUTORS, "true"); props.put(ExecutorManager.AZKABAN_QUEUEPROCESSING_ENABLED, "false"); loader.addExecutor("localhost", 12345); loader.addExecutor("localhost", 12346); return new ExecutorManager(props, loader, new AlerterHolder(props), new CommonMetrics(new MetricRegistry())); }
Source:
<code>public LeasedConnection connect(URI uri, Properties properties) throws ConnectionException { Connection connection = ConnectionFactory.connect(uri, properties); <START> LeasedConnection leasedConnection = BasicLeasedConnection.create(connection, createTimeBudget(properties)); <END> return leasedConnection; }</code><technical_language>TimeBudget created call ConnectionFactory.connect(), timing lease, budget is supposed cover connection. Ideally a of passing TimeBudget ConnectionFactory.connect(), is call, manage TimeBudget</technical_language>

Target:
public LeasedConnection connect(URI uri, Properties properties) throws ConnectionException { TimeBudget timeBudget = createTimeBudget(properties); Connection connection = ConnectionFactory.connect(uri, properties); LeasedConnection leasedConnection = BasicLeasedConnection.create(connection, timeBudget); return leasedConnection; }
Source:
<code>public void checkUnpermittedUserLogins(Attribute loginAttribute) throws InternalErrorException, WrongAttributeValueException { if(loginAttribute == null) return; if (perunNamespaces == null) { <START> perunNamespaces = BeansUtils.getAllPropertiesFromCustomConfiguration("perun-namespaces.properties"); <END> } String unpermittedNames; if ((unpermittedNames = perunNamespaces.get(loginAttribute.getFriendlyName() + ":reservedNames")) != null) { List<String> unpermittedNamesList = Arrays.asList(unpermittedNames.split("\\s*,\\s*")); if (unpermittedNamesList.contains(loginAttribute.getValue())) throw new WrongAttributeValueException(loginAttribute, "This login is not permitted."); } else { if (unpermittedNamesForUserLogins.contains(loginAttribute.getValue())) throw new WrongAttributeValueException(loginAttribute, "This login is not permitted."); } }</code><technical_language>If file exception is thrown (when file exists, correct status), Internal Error Exception is thrown fail. In this case need set perunNamespaces map empty continue</technical_language>

Target:
public void checkUnpermittedUserLogins(Attribute loginAttribute) throws InternalErrorException, WrongAttributeValueException { if(loginAttribute == null) return; checkPerunNamespacesMap(); String unpermittedNames = perunNamespaces.get(loginAttribute.getFriendlyName() + ":reservedNames"); if (unpermittedNames != null) { List<String> unpermittedNamesList = Arrays.asList(unpermittedNames.split("\\s*,\\s*")); if (unpermittedNamesList.contains(loginAttribute.getValue())) throw new WrongAttributeValueException(loginAttribute, "This login is not permitted."); } else { if (unpermittedNamesForUserLogins.contains(loginAttribute.getValue())) throw new WrongAttributeValueException(loginAttribute, "This login is not permitted."); } }
Source:
<code>public void testClearOptions() { VariantContextWriterBuilder vcwb = new VariantContextWriterBuilder().clearOptions(); vcwb = vcwb.setOption(Options.INDEX_ON_THE_FLY); final VariantContextWriterBuilder builder = new VariantContextWriterBuilder().clearOptions(); <START> VariantContextWriter writer = builder.setOutputFile(vcf).build(); <END> writer.close(); }</code><technical_language>need assert INDEX_ON_THE_FLY is set this point</technical_language>

Target:
public void testClearOptions() { VariantContextWriterBuilder vcwb = new VariantContextWriterBuilder(); vcwb.clearOptions().setOption(Options.INDEX_ON_THE_FLY); final VariantContextWriterBuilder builder = new VariantContextWriterBuilder().clearOptions(); Assert.assertTrue(builder.options.isEmpty()); }
Source:
<code>public void visitLocal(int opcode, int offset, int length, int idx, Type type, int value) { int localOffset = (opcode == ByteOps.ISTORE) ? (offset + length) : offset; LocalVariableList.Item local = localVariables.pcAndIndexToLocal(localOffset, idx); Type localType; if (local != null) { localType = local.getType(); if (localType.getBasicFrameType() != type.getBasicFrameType()) { local = null; localType = <START> null; <END> } } else { localType = type; } switch (opcode) { case ByteOps.ILOAD: case ByteOps.RET: { machine.localArg(frame, idx); machine.localInfo(local != null); machine.auxType(type); break; } case ByteOps.ISTORE: { LocalItem item = (local == null) ? null : local.getLocalItem(); machine.popArgs(frame, type); machine.auxType(type); machine.localTarget(idx, localType, item); break; } case ByteOps.IINC: { LocalItem item = (local == null) ? null : local.getLocalItem(); machine.localArg(frame, idx); machine.localTarget(idx, localType, item); machine.auxType(type); machine.auxIntArg(value); machine.auxCstArg(CstInteger.make(value)); break; } default: { visitInvalid(opcode, offset, length); return; } } machine.run(frame, offset, opcode); }</code><technical_language>type</technical_language>

Target:
public void visitLocal(int opcode, int offset, int length, int idx, Type type, int value) { int localOffset = (opcode == ByteOps.ISTORE) ? (offset + length) : offset; LocalVariableList.Item local = localVariables.pcAndIndexToLocal(localOffset, idx); Type localType; if (local != null) { localType = local.getType(); if (localType.getBasicFrameType() != type.getBasicFrameType()) { local = null; localType = type; } } else { localType = type; } switch (opcode) { case ByteOps.ILOAD: case ByteOps.RET: { machine.localArg(frame, idx); machine.localInfo(local != null); machine.auxType(type); break; } case ByteOps.ISTORE: { LocalItem item = (local == null) ? null : local.getLocalItem(); machine.popArgs(frame, type); machine.auxType(type); machine.localTarget(idx, localType, item); break; } case ByteOps.IINC: { LocalItem item = (local == null) ? null : local.getLocalItem(); machine.localArg(frame, idx); machine.localTarget(idx, localType, item); machine.auxType(type); machine.auxIntArg(value); machine.auxCstArg(CstInteger.make(value)); break; } default: { visitInvalid(opcode, offset, length); return; } } machine.run(frame, offset, opcode); }
Source:
<code>public boolean sizeIsZero() { <START> return somestring.length == 0; <END> }</code><technical_language>@amihaiemil length()</technical_language>

Target:
public boolean sizeIsZero() { return somestring.length() == 0; }
Source:
<code>public static boolean isText(File file) throws IOException { try (FileInputStream rafile = new FileInputStream(file)) { int count = 0; <START> while (count++ < MAX_NB_BINARY_BYTES) { <END> int val = rafile.read(); if (val == 0) { return false; } } } return true; }</code><technical_language>this min size MAX_NB... avoid io, check if val == -1, return true;</technical_language>

Target:
public static boolean isText(File file) throws IOException { try (FileInputStream rafile = new FileInputStream(file)) { int count = 0; int val = rafile.read(); while ((count < MAX_NB_BINARY_BYTES) && (val >= 0)) { if (val == 0) { return false; } count++; val = rafile.read(); } } return true; }
Source:
<code>private String contentType() { <START> return String.format("%s; charset=%s", mimeType, charset); <END> }</code><technical_language>checking MimeBodyPart is implemented, sense tweak this to: java return String.format("%s; charset=%s", mimeType, MimeUtility.quote(charset, HeaderTokenizer.MIME));</technical_language>

Target:
private String contentType() { return String.format("%s; charset=%s", mimeType, MimeUtility.quote(charset, HeaderTokenizer.MIME)); }
Source:
<code>private ValuesWriter getDoubleValuesWriter(ColumnDescriptor path) { if (this.parquetProperties.isByteStreamSplitEnabled()) { <START> return new ByteStreamSplitValuesWriter.DoubleByteStreamSplitValuesWriter(parquetProperties.getInitialSlabSize(), parquetProperties.getPageSizeThreshold(), parquetProperties.getAllocator()); <END> } ValuesWriter fallbackWriter = new PlainValuesWriter(parquetProperties.getInitialSlabSize(), parquetProperties.getPageSizeThreshold(), parquetProperties.getAllocator()); return DefaultValuesWriterFactory.dictWriterWithFallBack(path, parquetProperties, getEncodingForDictionaryPage(), getEncodingForDataPage(), fallbackWriter); }</code><technical_language>This able dictionary encoding fallback of byte stream split. I think, dictionary perform in case of data is repetitive. this for FP values in real data scenarios, though. do think</technical_language>

Target:
private ValuesWriter getDoubleValuesWriter(ColumnDescriptor path) { ValuesWriter fallbackWriter = null; if (this.parquetProperties.isByteStreamSplitEnabled()) { fallbackWriter = new ByteStreamSplitValuesWriter.DoubleByteStreamSplitValuesWriter(parquetProperties.getInitialSlabSize(), parquetProperties.getPageSizeThreshold(), parquetProperties.getAllocator()); } else { fallbackWriter = new PlainValuesWriter(parquetProperties.getInitialSlabSize(), parquetProperties.getPageSizeThreshold(), parquetProperties.getAllocator()); } return DefaultValuesWriterFactory.dictWriterWithFallBack(path, parquetProperties, getEncodingForDictionaryPage(), getEncodingForDataPage(), fallbackWriter); }
Source:
<code>public void addPending(PendingResource resource) { synchronized (this) { if (pendingResources.containsKey(resource)) { PendingResource old = pendingResources.get(resource); log.warn("Clearing stale pending resource (host: {}, vm: {})", old, old.getHost(), old.getVm()); removeFromSetMap(resourcesByVm, old.getVm(), old); removeFromSetMap(resourcesByHost, old.getHost(), old); } log.debug("Adding pending resource (host: {}, vm: {})", resource, resource.getHost(), resource.getVm()); <START> resourcesByVm.putIfAbsent(resource.getVm(), new HashSet<>()); resourcesByHost.putIfAbsent(resource.getHost(), new HashSet<>()); <END> addToSetMap(resourcesByVm, resource.getVm(), resource); addToSetMap(resourcesByHost, resource.getHost(), resource); pendingResources.put(resource, resource); } }</code><technical_language>I if this is place now.. addToSetMap do this internally</technical_language>

Target:
public void addPending(PendingResource resource) { synchronized (this) { if (pendingResources.containsKey(resource)) { PendingResource old = pendingResources.get(resource); log.warn("Clearing stale pending resource (host: {}, vm: {})", old, old.getHost(), old.getVm()); removeFromSetMap(resourcesByVm, old.getVm(), old); removeFromSetMap(resourcesByHost, old.getHost(), old); } log.debug("Adding pending resource (host: {}, vm: {})", resource, resource.getHost(), resource.getVm()); addToSetMap(resourcesByVm, resource.getVm(), resource); addToSetMap(resourcesByHost, resource.getHost(), resource); pendingResources.put(resource, resource); } }
Source:
<code><START> public static SingleThreadEventLoop.IoHandlerFactory newFactory(final SelectorProvider selectorProvider, <END> final SelectStrategyFactory selectStrategyFactory) { ObjectUtil.checkNotNull(selectorProvider, "selectorProvider"); ObjectUtil.checkNotNull(selectStrategyFactory, "selectStrategyFactory"); return new SingleThreadEventLoop.IoHandlerFactory() { @Override public SingleThreadEventLoop.IoHandler newHandler() { return new NioHandler(selectorProvider, selectStrategyFactory.newSelectStrategy()); } }; }</code><technical_language>final purpose (say compiling Java < 8)</technical_language>

Target:
public static IoHandlerFactory newFactory(final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory) { ObjectUtil.checkNotNull(selectorProvider, "selectorProvider"); ObjectUtil.checkNotNull(selectStrategyFactory, "selectStrategyFactory"); return new IoHandlerFactory() { @Override public IoHandler newHandler() { return new NioHandler(selectorProvider, selectStrategyFactory.newSelectStrategy()); } }; }
Source:
<code>public int getAverageHeadwayForStop (String stop_id, LocalDate date, LocalTime from, LocalTime to) { <START> List<Trip> tripsForStop = feed.getStopTimesForStop(stop_id).stream() <END> .map(t -> feed.trips.get(t.b.a)) .filter(trip -> feed.services.get(trip.service_id).activeOn(date)) .collect(Collectors.toList()); return getStopHeadwayForTrips(stop_id, tripsForStop, from, to); }</code><technical_language>this code before, call getTripsForDate (unless intending from/to omitted). I this form better, trips a date a filter</technical_language>

Target:
public int getAverageHeadwayForStop (String stop_id, LocalDate date, LocalTime from, LocalTime to) { List<Trip> tripsForStop = getTripsForDate(stop_id, date); return getStopHeadwayForTrips(stop_id, tripsForStop, from, to); }
Source:
<code>public GenericRecord next() { try { return reader.read(null, in); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>Add message new RuntimeException</technical_language>

Target:
public GenericRecord next() { try { return reader.read( null, in); } catch (IOException e) { throw new RuntimeException("Failed to read more records", e); } }
Source:
<code>public void concurrentModificationRealmObjects() { final Realm realm = looperThread.realm; Dog dog1 = new Dog(); dog1.setName("Dog 1"); Dog dog2 = new Dog(); dog2.setName("Dog 2"); realm.beginTransaction(); dog1 = realm.copyToRealm(dog1); dog2 = realm.copyToRealm(dog2); realm.commitTransaction(); final WeakReference<RealmObjectProxy> weakReference1 = new WeakReference<RealmObjectProxy>((RealmObjectProxy)dog1); final WeakReference<RealmObjectProxy> weakReference2 = new WeakReference<RealmObjectProxy>((RealmObjectProxy)dog2); looperThread.realm.handlerController.realmObjects.put(weakReference1, Boolean.TRUE); final CountDownLatch dogAddFromBg = new CountDownLatch(1); Iterator<Map.Entry<WeakReference<RealmObjectProxy>, Object>> iterator = looperThread.realm.handlerController.realmObjects.entrySet().iterator(); AtomicBoolean fireOnce = new AtomicBoolean(true); while (iterator.hasNext()) { Dog next = (Dog) iterator.next().getKey().get(); if (fireOnce.compareAndSet(true, false)) { new Thread() { @Override public void run() { looperThread.realm.handlerController.realmObjects.put(weakReference2, Boolean.TRUE); dogAddFromBg.countDown(); } }.start(); TestHelper.awaitOrFail(dogAddFromBg); } <START> assertEquals("Dog 1", next.getName()); <END> } looperThread.testComplete(); }</code><technical_language>need verify is 1 object in iteration? e.g assertFalse(iterator.hasNext)</technical_language>

Target:
public void concurrentModificationRealmObjects() { RealmConfiguration config = configFactory.createConfiguration(); final Realm realm = Realm.getInstance(config); Dog dog1 = new Dog(); dog1.setName("Dog 1"); Dog dog2 = new Dog(); dog2.setName("Dog 2"); realm.beginTransaction(); dog1 = realm.copyToRealm(dog1); dog2 = realm.copyToRealm(dog2); realm.commitTransaction(); final WeakReference<RealmObjectProxy> weakReference1 = new WeakReference<RealmObjectProxy>((RealmObjectProxy)dog1); final WeakReference<RealmObjectProxy> weakReference2 = new WeakReference<RealmObjectProxy>((RealmObjectProxy)dog2); realm.handlerController.realmObjects.put(weakReference1, Boolean.TRUE); final CountDownLatch dogAddFromBg = new CountDownLatch(1); Iterator<Map.Entry<WeakReference<RealmObjectProxy>, Object>> iterator = realm.handlerController.realmObjects.entrySet().iterator(); AtomicBoolean fireOnce = new AtomicBoolean(true); while (iterator.hasNext()) { Dog next = (Dog) iterator.next().getKey().get(); if (fireOnce.compareAndSet(true, false)) { new Thread() { @Override public void run() { realm.handlerController.realmObjects.put(weakReference2, Boolean.TRUE); dogAddFromBg.countDown(); } }.start(); TestHelper.awaitOrFail(dogAddFromBg); } assertEquals("Dog 1", next.getName()); assertFalse(iterator.hasNext()); } realm.close(); }
Source:
<code>public void testGetAllAttachableDisksByPoolWithNoPermissionsFilterDisabled() { List<Disk> result = <START> dao.getAllAttachableDisksByPoolId(null, PRIVILEGED_USER_ID, false); <END> assertFullGetAllAttachableDisksByPoolId(result); }</code><technical_language>test UNPRIVILEGED_USER_ID more effective</technical_language>

Target:
public void testGetAllAttachableDisksByPoolWithNoPermissionsFilterDisabled() { List<Disk> result = dao.getAllAttachableDisksByPoolId(null, UNPRIVILEGED_USER_ID, false); assertFullGetAllAttachableDisksByPoolId(result); }
Source:
<code>public Expr visitTimestampLiteral(Object ctx, Stack<Expr> stack, TimestampLiteral expr) throws TajoException { StringBuilder sb = new StringBuilder(); if (!isHiveCatalog) { DateValue dateValue = expr.getDate(); TimeValue timeValue = expr.getTime(); int dates = ExprAnnotator.dateToIntArray(dateValue.getYears(), dateValue.getMonths(), dateValue.getDays()); int times = ExprAnnotator.timeToIntArray(timeValue.getHours(), timeValue.getMinutes(), timeValue.getSeconds(), timeValue.getSecondsFraction()); long julianTimestamp; if (timeValue.hasSecondsFraction()) { julianTimestamp = DateTimeUtil.toJulianTimestamp(dates[0], dates[1], dates[2], times[0], times[1], times[2], times[3] * 1000); } else { julianTimestamp = DateTimeUtil.toJulianTimestamp(dates[0], dates[1], dates[2], times[0], times[1], times[2], 0); } TimeMeta tm = new TimeMeta(); DateTimeUtil.toJulianTimeMeta(julianTimestamp, tm); TimeZone tz = TimeZone.getDefault(); DateTimeUtil.toUTCTimezone(tm, tz); sb.append("?").append(" )"); <START> parameters.add(new Pair(Type.TIMESTAMP, new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm)))); <END> } else { sb.append("\"").append(expr.toString()).append("\""); } queries.push(sb.toString()); return expr; }</code><technical_language>This code change timestamp a julian time. check if is valid? need partitioned table compatible Apache Hive. Hive a julian time</technical_language>

Target:
public Expr visitTimestampLiteral(Object ctx, Stack<Expr> stack, TimestampLiteral expr) throws TajoException { StringBuilder sb = new StringBuilder(); if (!isHiveCatalog) { DateValue dateValue = expr.getDate(); TimeValue timeValue = expr.getTime(); int dates = ExprAnnotator.dateToIntArray(dateValue.getYears(), dateValue.getMonths(), dateValue.getDays()); int times = ExprAnnotator.timeToIntArray(timeValue.getHours(), timeValue.getMinutes(), timeValue.getSeconds(), timeValue.getSecondsFraction()); long julianTimestamp; if (timeValue.hasSecondsFraction()) { julianTimestamp = DateTimeUtil.toJulianTimestamp(dates[0], dates[1], dates[2], times[0], times[1], times[2], times[3] * 1000); } else { julianTimestamp = DateTimeUtil.toJulianTimestamp(dates[0], dates[1], dates[2], times[0], times[1], times[2], 0); } TimeMeta tm = new TimeMeta(); DateTimeUtil.toJulianTimeMeta(julianTimestamp, tm); TimeZone tz = TimeZone.getDefault(); DateTimeUtil.toUTCTimezone(tm, tz); sb.append("?").append(" )"); Timestamp timestamp = new Timestamp(DateTimeUtil.julianTimeToJavaTime(DateTimeUtil.toJulianTimestamp(tm))); parameters.add(new Pair(Type.TIMESTAMP, timestamp)); } else { sb.append("\"").append(expr.toString()).append("\""); } queries.push(sb.toString()); return expr; }
Source:
<code><START> public void stopTimer() { <END> if (timerChronometer != null) { timerChronometer.stop(); isStarted = false; } }</code><technical_language>public</technical_language>

Target:
private void stopTimer() { if (timerChronometer != null) { timerChronometer.stop(); isStarted = false; } }
Source:
<code>public boolean visit(Node node, Visitor visitor, Printer printer) { if (node instanceof ColsNode) { ColsNode cols = (ColsNode) node; printer.println().print("<div <START> class=\"cols\">").indent(2); <END> boolean open = false; for (Node n : cols.getChildren()) { if (n instanceof HeaderNode) { if (open) { printer.print("</div>"); } printer.println().print("<div class=\"col-3\">"); open = true; } n.accept(visitor); } if (open) { printer.print("</div>"); } printer.indent(-2).println().print("</div>").println(); return true; } return false; }</code><technical_language>Well, bypass Soy. If a page is rendered Soy, extraneous whitespace stripped out. this is consistent that. leave in if want, I Gitiles is optimizing for readable source</technical_language>

Target:
public boolean visit(Node node, Visitor visitor, Printer printer) { if (node instanceof ColsNode) { ColsNode cols = (ColsNode) node; printer.println().print("<div class=\"cols\">").indent(2); boolean open = false; for (Node n : cols.getChildren()) { if (n instanceof HeaderNode || n instanceof DivNode) { if (open) { printer.print("</div>"); } printer.println().print("<div class=\"col-3\">"); open = true; } n.accept(visitor); } if (open) { printer.print("</div>"); } printer.indent(-2).println().print("</div>").println(); return true; } return false; }
Source:
<code>public static long currentTimeMillis(){ <START> return (long) (System.currentTimeMillis() * TIME_MULTIPLIER); <END> }</code><technical_language>confirm, if TIME_MULTIPLIER is 2, this speed time 2 (like expect), jump 44ish years future, System.currentTimeMillis is posix time. if this matters for this</technical_language>

Target:
public static long currentTimeMillis(){ if (TIME_MULTIPLIER == DEFAULT_TIME_MULTIPLIER){ return System.currentTimeMillis(); } else { return (long) ( RECORDED_TIME + (System.currentTimeMillis() - RECORDED_TIME) * TIME_MULTIPLIER ); } }
Source:
<code>public PlanNodeCostEstimate visitAggregation(AggregationNode node, Void context) { PlanNodeStatsEstimate aggregationStats = getStats(node); PlanNodeStatsEstimate sourceStats = getStats(node.getSource()); <START> return new PlanNodeCostEstimate(sourceStats.getOutputSizeInBytes(), aggregationStats.getOutputSizeInBytes(), 0); <END> }</code><technical_language>cpuCost(...).memoryCost(...) is easier read</technical_language>

Target:
public PlanNodeCostEstimate visitAggregation(AggregationNode node, Void context) { PlanNodeStatsEstimate aggregationStats = getStats(node); PlanNodeStatsEstimate sourceStats = getStats(node.getSource()); double cpuCost = sourceStats.getOutputSizeInBytes(node.getSource().getOutputSymbols()); double memoryCost = aggregationStats.getOutputSizeInBytes(node.getOutputSymbols()); return new PlanNodeCostEstimate(cpuCost, memoryCost, 0); }
Source:
<code><START> private static boolean isBlockUnsafe(final World world, final int x, final int y, final int z) { <END> return isBlockDamaging(world, x, y, z) || isBlockAboveAir(world, x, y, z); }</code><technical_language>LocationUtil static methods public</technical_language>

Target:
public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z) { return isBlockDamaging(world, x, y, z) || isBlockAboveAir(world, x, y, z); }
Source:
<code>private static String getIdAttribute(View element) { int id = element.getId(); <START> if (id == View.NO_ID) { <END> return null; } return ResourceIdUtil.getIdStringQuietly(element.getResources(), id); }</code><technical_language>getIdStringQuietly() handles 'id == NO_ID' case</technical_language>

Target:
private static String getIdAttribute(View element) { int id = element.getId(); if (id == View.NO_ID) { return null; } return ResourcesUtil.getIdStringQuietly(element, element.getResources(), id); }
Source:
<code>protected Optional<DataSource> getJNDIDataSource(Optional<String> name) { if(jndiCtx==null) return Optional.absent(); if(name.isPresent()) { try { Optional<DataSource> ds = Optional.of((DataSource)jndiCtx.lookup(name.get())); if(LOGGER.isLoggable(Level.INFO)) { <START> LOGGER.log(Level.INFO, "JDBCLoaer using JNDI DataSource {0}", name.get()); <END> } config.setDatasourceId(name.get()); return ds; } catch (NamingException ex) { if(LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Could not resolve JNDI name "+name.get()+" for JDBCLoader Database", ex); } return Optional.absent(); } } else { if(LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("No JNDI name given for JDBCLoader DB."); } return Optional.absent(); } }</code><technical_language>@NielsCharlier a typo here: I "JDBCLoader"</technical_language>

Target:
protected Optional<DataSource> getJNDIDataSource(Optional<String> name) { if(jndiCtx==null) return Optional.absent(); if(name.isPresent()) { try { Optional<DataSource> ds = Optional.of((DataSource)jndiCtx.lookup(name.get())); if(LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, "JDBCLoader using JNDI DataSource {0}", name.get()); } config.setDatasourceId(name.get()); return ds; } catch (NamingException ex) { if(LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Could not resolve JNDI name "+name.get()+" for JDBCLoader Database", ex); } return Optional.absent(); } } else { if(LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("No JNDI name given for JDBCLoader DB."); } return Optional.absent(); } }
Source:
<code>public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); <START> label.setText("&Script name:"); <END> fileText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); label = new Label(container, SWT.NULL); label = new Label(container, SWT.NULL); label.setText("&Directory:"); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); Button button = new Button(container, SWT.PUSH); button.setText("Browse"); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleBrowse(); } }); initialize(); dialogChanged(); setControl(container); }</code><technical_language>externalize</technical_language>

Target:
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText(Messages.getString("StapNewWizardPage.ScriptName")); fileText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); label = new Label(container, SWT.NULL); label = new Label(container, SWT.NULL); label.setText(Messages.getString("StapNewWizardPage.Directory")); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); Button button = new Button(container, SWT.PUSH); button.setText(Messages.getString("StapNewWizardPage.Browse")); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleBrowse(); } }); initialize(); dialogChanged(); setControl(container); }
Source:
<code>public ResultSet refresh() throws CouchbaseLiteException { if (_query == null) throw new IllegalStateException("_query variable is null"); try { <START> C4QueryEnumerator newEnum = _c4enum.refresh(); <END> return newEnum != null ? new ResultSet(_query, newEnum, _columnNames) : null; } catch (LiteCoreException e) { throw LiteCoreBridge.convertException(e); } }</code><technical_language>This requires database lock</technical_language>

Target:
public ResultSet refresh() throws CouchbaseLiteException { if (_query == null) throw new IllegalStateException("_query variable is null"); synchronized (getDatabase().getLock()) { try { C4QueryEnumerator newEnum = _c4enum.refresh(); return newEnum != null ? new ResultSet(_query, newEnum, _columnNames) : null; } catch (LiteCoreException e) { throw LiteCoreBridge.convertException(e); } } }
Source:
<code>private List<VariantEntity> updateVariantEntitiesSampleNames(List<VariantEntity> variantEntities, Table<String, String, Map<String, String>> studyFileIdsToPositionSamples) { <START> variantEntities = variantEntities.stream().map( <END> variantEntity -> updateVariantEntitySampleNames(variantEntity, studyFileIdsToPositionSamples) ).collect(Collectors.toList()); return variantEntities; }</code><technical_language>flow more clear if this returned assigning a input argument</technical_language>

Target:
private List<VariantEntity> updateVariantEntitiesSampleNames(List<VariantEntity> variantEntities, Table<String, String, Map<String, String>> studyFileIdsToPositionSamples) { return variantEntities.stream().map( variantEntity -> updateVariantEntitySampleNames(variantEntity, studyFileIdsToPositionSamples) ).collect(Collectors.toList()); }
Source:
<code>private String normalizeHostName(String hostname) { checkNotNull(hostname, "hostname"); if (hostname.isEmpty() || hostname.charAt(0) == '.') { throw new IllegalArgumentException("Hostname '" + hostname + "'not valid"); } hostname = ImmutableDomainWildcardMapping.normalize(checkNotNull(hostname, "hostname")); if (hostname.charAt(0) == '*') { <START> return hostname.substring(1); <END> } return hostname; }</code><technical_language>check charAt(1) is a . ? (and is length 2)</technical_language>

Target:
private String normalizeHostName(String hostname) { checkNotNull(hostname, "hostname"); if (hostname.isEmpty() || hostname.charAt(0) == '.') { throw new IllegalArgumentException("Hostname '" + hostname + "' not valid"); } hostname = ImmutableDomainWildcardMapping.normalize(checkNotNull(hostname, "hostname")); if (hostname.charAt(0) == '*') { if (hostname.length() < 3 || hostname.charAt(1) != '.') { throw new IllegalArgumentException("Wildcard Hostname '" + hostname + "'not valid"); } return hostname.substring(1); } return hostname; }
Source:
<code>public String getPreview() { StringBuilder bld= new StringBuilder(); bld.append("\n"); if (isEnabled(CleanUpConstants.USE_UNBOXING)) { <START> bld.append("int i = integerObject;\n"); <END> bld.append("char c = cObject;\n"); } else { bld.append("int i = integerObject.intValue();\n"); bld.append("char c = cObject.charValue();\n"); } return bld.toString(); }</code><technical_language>This needs context need a method takes Integer object a Character object</technical_language>

Target:
public String getPreview() { StringBuilder bld= new StringBuilder(); bld.append("\n"); bld.append("Integer integerObject = Integer.MAX_VALUE;\n"); bld.append("Character cObject = Character.MAX_VALUE;\n"); bld.append("\n"); if (isEnabled(CleanUpConstants.USE_UNBOXING)) { bld.append("int i = integerObject;\n"); bld.append("char c = cObject;\n"); } else { bld.append("int i = integerObject.intValue();\n"); bld.append("char c = cObject.charValue();\n"); } return bld.toString(); }
Source:
<code>private void moveCursorTo( long pageId, int offsetInPage ) throws IOException { if ( isEOF( pageId, offsetInPage ) ) { throw newEOFException( String.format( "EOF at { pageId: %d, offsetInPage: %d } %s", pageId, offsetInPage, describeCurrentPosition() ) ); } <START> if ( cursor.getCurrentPageId() != pageId && !cursor.next( pageId ) ) <END> { throw newEOFException( String.format( "Page cache EOF for { pageId: %d, offsetInPage: %d }", pageId, offsetInPage ) ); } }</code><technical_language>cursor.next( pageId ) this current page id check</technical_language>

Target:
private void moveCursorTo( long pageId, int offsetInPage ) throws IOException { if ( isEOF( pageId, offsetInPage ) ) { throw newCursorMoveEOFException( pageId, offsetInPage ); } if ( !cursor.next( pageId ) ) { throw newCursorMoveEOFException( pageId, offsetInPage ); } }
Source:
<code>public void collect(int doc) throws IOException { final Map<String, Object> hit = newHashMapWithExpectedSize(fields.size()); for (String field : fields) { Object docValues = this.docValues.get(field); if (docValues instanceof BinaryDocValues) { <START> hit.put(field, ((BinaryDocValues) docValues).get(doc).utf8ToString()); <END> } else if (docValues instanceof NumericDocValues) { hit.put(field, ((NumericDocValues) docValues).get(doc)); } else { throw new UnsupportedOperationException("Unhandled docValues for field: " + field + " -> " + docValues); } } checkState(!hit.isEmpty(), "No values loaded from document for fields: %s", fields); hits.add(hit); }</code><technical_language>OrderedBytes' byte array soup UTF-8 decodeable</technical_language>

Target:
public void collect(int doc) throws IOException { final Map<String, Object> hit = newHashMapWithExpectedSize(fields.size()); for (String field : fields) { Object docValues = this.docValues.get(field); if (docValues instanceof BinaryDocValues) { hit.put(field, ((BinaryDocValues) docValues).get(doc).utf8ToString()); } else if (docValues instanceof NumericDocValues) { hit.put(field, ((NumericDocValues) docValues).get(doc)); } else { throw new UnsupportedOperationException("Unhandled docValues for field: " + field + " -> " + docValues); } } if (!hit.keySet().containsAll(fields)) { throw new IllegalStateException(String.format("Missing fields on partially loaded document: %s", Sets.difference(fields, hit.keySet()))); } hits.add(hit); }
Source:
<code>private SweepOutcome grabLocksAndRun(SingleLockService locks) throws InterruptedException { try { locks.lockOrRefresh(); <START> if (locks.haveLocks()) { <END> return runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); return SweepOutcome.UNABLE_TO_ACQUIRE_LOCKS; } } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); log.error("Sweep failed", e); return SweepOutcome.ERROR; } }</code><technical_language>if parsing this right, if I 3 nodes 10 threads, thread 1s node compete for thread 1 lock on, right</technical_language>

Target:
private SweepOutcome grabLocksAndRun(SingleLockService locks) throws InterruptedException { try { locks.lockOrRefresh(); if (locks.haveLocks()) { return runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); closeTableLockIfHeld(); return SweepOutcome.UNABLE_TO_ACQUIRE_LOCKS; } } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); log.error("Sweep failed", e); return SweepOutcome.ERROR; } }
Source:
<code>protected void processParagraphChilds( final ParagraphRenderBox box ) { rawResult = box.getRawValue(); paragraphBounds.setRect( box.getX(), box.getY(), box.getWidth(), box.getHeight() ); overflowX = box.isBoxOverflowX(); overflowY = box.isBoxOverflowY(); final long contentAreaX1 = box.getContentAreaX1(); contentAreaX2 = box.getContentAreaX2(); RenderBox lineBox = (RenderBox) box.getFirstChild(); while ( lineBox != null ) { manualBreak = false; processTextLine( lineBox, contentAreaX1, contentAreaX2 ); if ( manualBreak ) { addLinebreak(); } else if ( lineBox.getNext() != null ) { if ( lineBox.getStaticBoxLayoutProperties().isPreserveSpace() == false ) { addSoftBreak(); } else { <START> RenderableText renderableText = (RenderableText) lineBox.getFirstChild(); <END> int wordSize = renderableText.getGlyphs().getSize(); int currentOffset = renderableText.getOffset(); int currentLength = renderableText.getLength(); if ( wordSize == currentOffset + currentLength ) { addSoftBreak(); } else { addEmptyBreak(); } } } lineBox = (RenderBox) lineBox.getNext(); } }</code><technical_language>assume child a renderable text element. a renderbox, image for instance. more defensive here. In case more child elements, ask yourself: Do want test child of line determine type of space child? recursively search linebox for deepest child base decision that. if child is box, search recursively box, if child is text, assume soft break, else logic below</technical_language>

Target:
protected void processParagraphChilds( final ParagraphRenderBox box ) { rawResult = box.getRawValue(); paragraphBounds.setRect( box.getX(), box.getY(), box.getWidth(), box.getHeight() ); overflowX = box.isBoxOverflowX(); overflowY = box.isBoxOverflowY(); final long contentAreaX1 = box.getContentAreaX1(); contentAreaX2 = box.getContentAreaX2(); RenderBox lineBox = (RenderBox) box.getFirstChild(); while ( lineBox != null ) { manualBreak = false; processTextLine( lineBox, contentAreaX1, contentAreaX2 ); if ( manualBreak ) { addLinebreak(); } else if ( lineBox.getNext() != null ) { if ( lineBox.getStaticBoxLayoutProperties().isPreserveSpace() == false ) { addSoftBreak(); } else { RenderNode deepestLastChild = getDeepestLastChild( lineBox ); if ( deepestLastChild != null && deepestLastChild instanceof RenderableText ) { RenderableText renderableText = (RenderableText) deepestLastChild; int wordSize = renderableText.getGlyphs().getSize(); int currentOffset = renderableText.getOffset(); int currentLength = renderableText.getLength(); if ( wordSize == currentOffset + currentLength ) { addSoftBreak(); } else { addEmptyBreak(); } } else { addSoftBreak(); } } } lineBox = (RenderBox) lineBox.getNext(); } }