auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void pollItems( final long timeout, final TimeUnit timeoutTimeUnit, final ImmutableMap<K, Callable<V>> itemsToPoll) <START> throws IllegalArgumentException, NullPointerException, IllegalStateException, <END> InterruptedException, CancellationException, ExecutionException, PollerException { Validate.isTrue( notNull(timeoutTimeUnit).toMillis(timeout) >= MINIMUM_TIMEOUT_MS, "timeout argument may not be less than %d ms", MINIMUM_TIMEOUT_MS); notNull(itemsToPoll); if (pollThreadPool.isShutdown() || pollTimeoutWatcherThreadPool.isShutdown()) { final String message = "Unable to poll because pollThreadPool or pollTimeoutWatcherThreadPool is shutdown"; throw new IllegalStateException(message); } if (!pollItemsLock.tryLock()) { final String message = "Unable to poll items. Multiple threads may not pollItems at the same time"; LOGGER.debug(message); throw new IllegalStateException(message); } try { doPollItems(timeout, timeoutTimeUnit, itemsToPoll); } finally { pollItemsLock.unlock(); } }</code><technical_language>runtime exceptions methods other places</technical_language>

Target:
protected void pollItems( final long timeout, final TimeUnit timeoutTimeUnit, final ImmutableMap<K, Callable<V>> itemsToPoll) throws InterruptedException, ExecutionException, PollerException { Validate.isTrue( notNull(timeoutTimeUnit).toMillis(timeout) >= MINIMUM_TIMEOUT_MS, "timeout argument may not be less than %d ms", MINIMUM_TIMEOUT_MS); notNull(itemsToPoll); if (pollThreadPool.isShutdown() || pollTimeoutWatcherThreadPool.isShutdown()) { final String message = "Unable to poll because pollThreadPool or pollTimeoutWatcherThreadPool is shutdown"; throw new IllegalStateException(message); } if (!pollItemsLock.tryLock()) { final String message = "Unable to poll items. Multiple threads may not pollItems at the same time"; LOGGER.debug(message); throw new IllegalStateException(message); } try { doPollItems(timeout, timeoutTimeUnit, itemsToPoll); } finally { pollItemsLock.unlock(); } }
Source:
<code>public CatalogProtos.PartitionDescProto getPartition(String databaseName, String tableName, String partitionName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException, UndefinedPartitionException { final int databaseId = getDatabaseId(databaseName); final int tableId = getTableId(databaseId, databaseName, tableName); ensurePartitionTable(tableName, tableId); Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; PartitionDescProto.Builder builder = null; try { String sql = "SELECT PATH, " + COL_PARTITIONS_PK + ", " + COL_PARTITION_BYTES + ", " + COL_PARTITION_FILES + " FROM " + TB_PARTTIONS + " WHERE " + COL_TABLES_PK + " = ? AND PARTITION_NAME = ? "; if (LOG.isDebugEnabled()) { LOG.debug(sql); } conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, tableId); pstmt.setString(2, partitionName); res = pstmt.executeQuery(); if (res.next()) { builder = PartitionDescProto.newBuilder(); builder.setId(res.getInt(COL_PARTITIONS_PK)); builder.setPath(res.getString("PATH")); builder.setPartitionName(partitionName); builder.setNumBytes(res.getLong(COL_PARTITION_BYTES)); <START> builder.setNumFiles(res.getLong(COL_PARTITION_FILES)); <END> setPartitionKeys(res.getInt(COL_PARTITIONS_PK), builder); } else { throw new UndefinedPartitionException(partitionName); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return builder.build(); }</code><technical_language>I number of files in a partition is required. example</technical_language>

Target:
public CatalogProtos.PartitionDescProto getPartition(String databaseName, String tableName, String partitionName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException, UndefinedPartitionException { final int databaseId = getDatabaseId(databaseName); final int tableId = getTableId(databaseId, databaseName, tableName); ensurePartitionTable(tableName, tableId); Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; PartitionDescProto.Builder builder = null; try { String sql = "SELECT PATH, " + COL_PARTITIONS_PK + ", " + COL_PARTITION_BYTES + " FROM " + TB_PARTTIONS + " WHERE " + COL_TABLES_PK + " = ? AND PARTITION_NAME = ? "; if (LOG.isDebugEnabled()) { LOG.debug(sql); } conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, tableId); pstmt.setString(2, partitionName); res = pstmt.executeQuery(); if (res.next()) { builder = PartitionDescProto.newBuilder(); builder.setId(res.getInt(COL_PARTITIONS_PK)); builder.setPath(res.getString("PATH")); builder.setPartitionName(partitionName); builder.setNumBytes(res.getLong(COL_PARTITION_BYTES)); setPartitionKeys(res.getInt(COL_PARTITIONS_PK), builder); } else { throw new UndefinedPartitionException(partitionName); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return builder.build(); }
Source:
<code><START> public void requiresNewSuspendsExisting() throws Exception { <END> Transaction existingTrans = mock(Transaction.class); Transaction newTrans = mock(Transaction.class); when(mgr.getTransaction()).thenReturn(existingTrans).thenReturn(newTrans); when(mgr.suspend()).thenReturn(existingTrans); TransactionSupport.executeInNewTransaction(tm); verify(mgr).suspend(); verify(mgr).begin(); verify(mgr).commit(); verify(mgr).resume(existingTrans); }</code><technical_language>inOrder verification useful here, chain of commands is correct</technical_language>

Target:
public void requiresNewSuspendsExisting() throws Exception { Transaction existingTrans = mock(Transaction.class); Transaction newTrans = mock(Transaction.class); when(mgr.getTransaction()).thenReturn(existingTrans).thenReturn(newTrans); when(mgr.suspend()).thenReturn(existingTrans); TransactionSupport.executeInNewTransaction(tm); InOrder inOrder = inOrder(mgr); inOrder.verify(mgr).suspend(); inOrder.verify(mgr).begin(); inOrder.verify(mgr).commit(); inOrder.verify(mgr).resume(existingTrans); }
Source:
<code>public JwtAuthenticator(final String signingSecret) { <START> this(signingSecret, signingSecret); <END> }</code><technical_language>feeling is output a warning recommend new constructor is safer 2 secrets. do think</technical_language>

Target:
public JwtAuthenticator(final String signingSecret) { this(signingSecret, signingSecret); warning(); }
Source:
<code>private void validateRequestParams(Map<String, String> requestParams) { String pipeLineName = requestParams.get(PIPELINE_NAME); String stageName = requestParams.get(STAGE_NAME); if (isEmpty(pipeLineName) || isEmpty(stageName)) { <START> throw new RuntimeException("Expected to provide both pipeline name and stage name"); <END> } String fromId = requestParams.get(FROM_ID); if (!isEmpty(fromId) && !isNumber(fromId)) { throw new RuntimeException("Invalid from-id"); } }</code><technical_language>messages more specific? like: Expected provide pipeline name stage name. pipeline name: "pipeline-1" stage name: "". helpful plugin authors</technical_language>

Target:
private void validateRequestParams(Map<String, String> requestParams) { String pipeLineName = requestParams.get(PIPELINE_NAME); String stageName = requestParams.get(STAGE_NAME); if ((isEmpty(pipeLineName) && !isEmpty(stageName)) || (!isEmpty(pipeLineName) && isEmpty(stageName))) { throw new RuntimeException(String.format("Expected to provide both pipeline name and stage name, but got Pipeline name as [%s] and stage name as [%s]", pipeLineName, stageName)); } String fromId = requestParams.get(FROM_ID); if (!isEmpty(fromId) && !isDigits(fromId)) { throw new RuntimeException("Invalid from-id"); } String toId = requestParams.get(TO_ID); if (!isEmpty(toId) && !isDigits(toId)) { throw new RuntimeException("Invalid to-id"); } }
Source:
<code>public static void updateRouteRegistry(RouteRegistry registry, Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses, Set<Class<?>> deletedClasses) { RouteConfiguration routeConf = RouteConfiguration.forRegistry(registry); Logger logger = LoggerFactory.getLogger(RouteUtil.class); <START> registry.update(() -> { <END> deletedClasses.stream() .filter(Component.class::isAssignableFrom) .forEach(clazz -> { Class<? extends Component> componentClass = (Class<? extends Component>) clazz; logger.debug("Removing route to {}", componentClass); routeConf.removeRoute(componentClass); }); Stream.concat(addedClasses.stream(), modifiedClasses.stream()) .distinct() .filter(Component.class::isAssignableFrom) .filter(clazz -> clazz.isAnnotationPresent(Route.class)) .forEach(clazz -> { Class<? extends Component> componentClass = (Class<? extends Component>) clazz; logger.debug( "Updating route to {}", componentClass .getAnnotation(Route.class).value(), clazz); routeConf.removeRoute(componentClass); routeConf.setAnnotatedRoute(componentClass); }); }); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce this lambda expression number of lines 24 20. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public static void updateRouteRegistry(RouteRegistry registry, Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses, Set<Class<?>> deletedClasses) { RouteConfiguration routeConf = RouteConfiguration.forRegistry(registry); Logger logger = LoggerFactory.getLogger(RouteUtil.class); registry.update(() -> { Stream.concat(deletedClasses.stream(), modifiedClasses.stream().filter( clazz -> !clazz.isAnnotationPresent(Route.class))) .filter(Component.class::isAssignableFrom) .forEach(clazz -> { Class<? extends Component> componentClass = (Class<? extends Component>) clazz; logger.debug("Removing route to {}", componentClass); routeConf.removeRoute(componentClass); }); Stream.concat(addedClasses.stream(), modifiedClasses.stream()) .distinct() .filter(Component.class::isAssignableFrom) .filter(clazz -> clazz.isAnnotationPresent(Route.class)) .forEach(clazz -> { Class<? extends Component> componentClass = (Class<? extends Component>) clazz; logger.debug( "Updating route to {}", componentClass .getAnnotation(Route.class).value(), clazz); routeConf.removeRoute(componentClass); routeConf.setAnnotatedRoute(componentClass); }); }); }
Source:
<code>@Override public boolean nextKeyValue() throws IOException { while (true) { String line; while (true) { if (!lineRecordReader.nextKeyValue()) { return false; } line = lineRecordReader.getCurrentValue().toString(); if (!line.startsWith("#")) { break; } } final VariantContext v; try { v = codec.decode(line); <START> } catch (Exception e) { <END> if (stringency == ValidationStringency.STRICT) { throw e; } else { if (stringency == ValidationStringency.LENIENT && logger.isWarnEnabled()) { logger.warn("Parsing line failed with {}. Skipping...", line, e); } continue; } } if (!overlaps(v)) { continue; } Integer chromIdx = contigDict.get(v.getContig()); if (chromIdx == null) chromIdx = (int) MurmurHash3.murmurhash3(v.getContig(), 0); key.set((long) chromIdx << 32 | (long) (v.getStart() - 1)); vc.set(v, header); return true; } }</code><technical_language>@fnothaft add more detail kinds of VCF failures recover ? Masking Exception thrown parsing coarse grained of a knob (we're remove instances of this pattern htsjdk). TribbleExceptions VCF parsing errors. a minimum, narrowing catch TribbleException better, coarse grained. If parsing errors manifesting in some other way, understand root if fix that</technical_language>

Target:
@Override public boolean nextKeyValue() throws IOException { while (true) { String line; while (true) { if (!lineRecordReader.nextKeyValue()) { return false; } line = lineRecordReader.getCurrentValue().toString(); if (!line.startsWith("#")) { break; } } final VariantContext v; try { v = codec.decode(line); } catch (TribbleException e) { if (stringency == ValidationStringency.STRICT) { if (logger.isErrorEnabled()) { logger.error("Parsing line failed with {}.", line, e); } throw e; } else { if (stringency == ValidationStringency.LENIENT && logger.isWarnEnabled()) { logger.warn("Parsing line failed with {}. Skipping...", line, e); } continue; } } if (!overlaps(v)) { continue; } Integer chromIdx = contigDict.get(v.getContig()); if (chromIdx == null) chromIdx = (int) MurmurHash3.murmurhash3(v.getContig(), 0); key.set((long) chromIdx << 32 | (long) (v.getStart() - 1)); vc.set(v, header); return true; } }
Source:
<code><START> public static final int compareTwoBinaryUnsigned(Binary first, Binary second) { <END> byte[] array1 = first.getBytes(); byte[] array2 = second.getBytes(); if ((array1 == null) && (array2 == null)) return 0; if (array1 == array2) return 0; int length1 = array1.length; int length2 = array2.length; int min_length = (length1 < length2) ? length1 : length2; for (int i = 0; i < min_length; i++) { int value1 = array1[i] & 0xFF; int value2 = array2[i] & 0xFF; if (value1 != value2) { return value1 - value2; } } if (length1 == length2) { return 0; } else { return length1 - length2; } }</code><technical_language>compareUnsigned? 'two' 'binary' needed in signature right</technical_language>

Target:
public static final int compareTwoBinaryUnsigned(Binary first, Binary second) { byte[] array1 = first.getBytes(); byte[] array2 = second.getBytes(); if ((array1 == null) && (array2 == null)) return 0; if (array1 == array2) return 0; int length1 = array1.length; int length2 = array2.length; int min_length = (length1 < length2) ? length1 : length2; for (int i = 0; i < min_length; i++) { int value1 = array1[i] & 0xFF; int value2 = array2[i] & 0xFF; if (value1 != value2) { return value1 - value2; } } return length1 - length2; }
Source:
<code><START> public int getCrc() { <END> return crc; }</code><technical_language>think, API point of view nicer OptionalInt need additional boolean flag</technical_language>

Target:
public OptionalInt getCrc() { return crc; }
Source:
<code><START> public static void reportPredictions(Data dataSet) { <END> for (int docid = 0; docid < dataSet.documents.size(); docid++) { NERDocument doc = dataSet.documents.get(docid); logger.info("\nGetting document " + doc.docname); ArrayList<LinkedVector> sentences = doc.sentences; for (int k = 0; k < sentences.size(); k++) { LinkedVector sentence = sentences.get(k); int N = sentence.size(); for (int i = 0; i < N; ++i) { NEWord word = (NEWord) sentence.get(i); logger.info(word.form + "\tL:" + word.neLabel + "\t1:" + word.neTypeLevel1 + "\t2:" + word.neTypeLevel2 + "\t(" + doc.docname + ")"); for (String h2 : word.gazetteers) logger.info(" " + h2); logger.info(""); } } } }</code><technical_language>name "reportPredictions()" void return type suggest STDOUT instead of logger in this method</technical_language>

Target:
public static void reportPredictions(Data dataSet) { for (int docid = 0; docid < dataSet.documents.size(); docid++) { NERDocument doc = dataSet.documents.get(docid); System.out.println("\nGetting document " + doc.docname); ArrayList<LinkedVector> sentences = doc.sentences; for (int k = 0; k < sentences.size(); k++) { LinkedVector sentence = sentences.get(k); int N = sentence.size(); for (int i = 0; i < N; ++i) { NEWord word = (NEWord) sentence.get(i); System.out.println(word.form + "\tL:" + word.neLabel + "\t1:" + word.neTypeLevel1 + "\t2:" + word.neTypeLevel2 + "\t(" + doc.docname + ")"); for (String h2 : word.gazetteers) System.out.print(" " + h2); System.out.println(); } } } }
Source:
<code>public Set<Order> getOrders() { if (orders == null) { <START> orders = new LinkedHashSet<Order>(); <END> } return orders; }</code><technical_language>Correct if wrong, assumption is returned collection is sorted based sortWeight of individual orders</technical_language>

Target:
public List<Order> getOrders() { if (orders == null) { orders = new ArrayList<Order>(); } return orders; }
Source:
<code>public ServiceDate getEnd() { <START> return end == UNBOUNDED_END ? null : end; <END> }</code><technical_language>more readable export symbolic constants class, instead of null. is fine. clearer for debugging logging</technical_language>

Target:
public ServiceDate getEnd() { return end; }
Source:
<code>public SingleMultimapAggregationState(Type keyType, Type valueType) { <START> this.keyType = keyType; <END> this.valueType = valueType; keyBlockBuilder = this.keyType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(keyType, EXPECTED_ENTRY_SIZE)); valueBlockBuilder = this.valueType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(valueType, EXPECTED_ENTRY_SIZE)); }</code><technical_language>ditto for requireNonNull</technical_language>

Target:
public SingleMultimapAggregationState(Type keyType, Type valueType) { this.keyType = requireNonNull(keyType); this.valueType = requireNonNull(valueType); keyBlockBuilder = keyType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(keyType, EXPECTED_ENTRY_SIZE)); valueBlockBuilder = valueType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(valueType, EXPECTED_ENTRY_SIZE)); }
Source:
<code>public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { <START> DimensionType type = DimensionManager.getProviderType(dim); if(MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.DimensionPreloadEvent(dim, type))) return; <END> } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; } MinecraftServer mcServer = overworld.getMinecraftServer(); ISaveHandler savehandler = overworld.getSaveHandler(); WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init())); world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }</code><technical_language>This is a Forge file, need patches small</technical_language>

Target:
public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } WorldServer alterantiveDimension = null; try { DimensionType type = DimensionManager.getProviderType(dim); if(dim != 0) { DimensionPreloadEvent adEvent = new DimensionPreloadEvent(dim, type); MinecraftForge.EVENT_BUS.post(adEvent); alterantiveDimension = adEvent.getAlternativeDimension(); } } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; } MinecraftServer mcServer = overworld.getMinecraftServer(); WorldServer world = (dim == 0 ? overworld : ( alterantiveDimension != null ? alterantiveDimension : ((WorldServer)(new WorldServerMulti(mcServer, overworld.getSaveHandler(), dim, overworld, mcServer.theProfiler).init())))); world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }
Source:
<code>@Test public void testFromBase64() { <START> tester.setFor(MySqlOperatorTable.FROM_BASE64); <END> SqlTester tester1 = mysqlTester(); tester1.checkString("from_base64('VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==')", "This is a test String.", "VARCHAR NOT NULL"); tester1.checkNull("from_base64(cast(null as varchar(1)))"); SqlTester tester2 = mysqlTester(SqlConformanceEnum.MYSQL_5); tester2.checkString("from_base64('VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==')", "This is a test String.", "VARCHAR NOT NULL"); tester2.checkNull("from_base64(cast(null as varchar(1)))"); }</code><technical_language>Is a test for from_base64 invalid base64 string (not empty incorrect)</technical_language>

Target:
@Test public void testFromBase64() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.FROM_BASE64); tester1.checkString("from_base64('VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL"); tester1.checkString("from_base64('VGhpcyBpcyBhIHRlc\t3QgU3RyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL"); tester1.checkString("from_base64('VGhpcyBpcyBhIHRlc\t3QgU3\nRyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL"); tester1.checkString("from_base64('VGhpcyB pcyBhIHRlc3Qg\tU3Ry\naW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL"); tester1.checkNull("from_base64('-1')"); tester1.checkNull("from_base64('-100')"); }
Source:
<code>public Response getDeviceOrganizationParent(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } String result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationParent(deviceId); if (result == null) { String msg = "Device with ID: " + deviceId + " not found."; log.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); <START> return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); <END> } }</code><technical_language>Please add message entity describing error</technical_language>

Target:
public Response getDeviceOrganizationParent(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } String result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationParent(deviceId); if (result == null) { String msg = "Device with ID: " + deviceId + " not found."; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device " + "Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }
Source:
<code>MappedStopTimes mapToStopTimes( JourneyPattern journeyPattern, Trip trip, List<TimetabledPassingTime> passingTimes ) { MappedStopTimes result = new MappedStopTimes(); for (int i = 0; i < passingTimes.size(); i++) { TimetabledPassingTime currentPassingTime = passingTimes.get(i); String pointInJourneyPattern = currentPassingTime.getPointInJourneyPatternRef().getValue().getRef(); StopPointInJourneyPattern stopPoint = findStopPoint(pointInJourneyPattern, journeyPattern); Stop stop = lookupStop(stopPoint, quayIdByStopPointRef, stopsById); if (stop == null) { <START> LOG.warn("Stop not found for {}. Trip will not be mapped.", stopPoint != null ? stopPoint.getId() : "null", trip.getId()); <END> return null; } StopTime stopTime = mapToStopTime(trip, stopPoint, stop, currentPassingTime, i); result.add(currentPassingTime.getId(), stopTime); } return result; }</code><technical_language>This log id of stopPoint, log missing stop id: stopPoint.getScheduledStopPointRef().getValue().getRef()? while it, Stop for is missing context of id, e.g.: Stop for stop-point in journey pattern {}</technical_language>

Target:
MappedStopTimes mapToStopTimes( JourneyPattern journeyPattern, Trip trip, List<TimetabledPassingTime> passingTimes ) { MappedStopTimes result = new MappedStopTimes(); for (int i = 0; i < passingTimes.size(); i++) { TimetabledPassingTime currentPassingTime = passingTimes.get(i); String pointInJourneyPattern = currentPassingTime.getPointInJourneyPatternRef().getValue().getRef(); StopPointInJourneyPattern stopPoint = findStopPoint(pointInJourneyPattern, journeyPattern); Stop stop = lookupStop(stopPoint, quayIdByStopPointRef, stopsById); if (stop == null) { LOG.warn("Stop with id not found for StopPoint in JourneyPattern {}. " + "Trip will not be mapped.", stopPoint != null && stopPoint.getScheduledStopPointRef() != null ? stopPoint.getScheduledStopPointRef().getValue().getRef() : "null" , stopPoint != null ? stopPoint.getId() : "null" , journeyPattern.getId() , trip.getId()); return null; } StopTime stopTime = mapToStopTime(trip, stopPoint, stop, currentPassingTime, i); result.add(currentPassingTime.getId(), stopTime); } return result; }
Source:
<code>public void write(String str, int off, int len) throws IOException { if (!transactionActive()) { <START> if (len > 8192) { <END> BufferedOutputStream bos = new BufferedOutputStream(outputStream); OutputStreamWriter writer = new OutputStreamWriter(bos, this.encoding); writer.write(str, off, len); writer.flush(); } else { byte[] bytes = str.substring(off, len).getBytes(encoding); outputStream.write(bytes); } return; } Buffer buffer = getCurrentBuffer(); buffer.append(str, off, len); }</code><technical_language>8192 is extracted a constant a meaningful name</technical_language>

Target:
public void write(String str, int off, int len) throws IOException { if (!transactionActive()) { byte[] bytes = str.substring(off, off + len).getBytes(encoding); int length = bytes.length; ByteBuffer bb = ByteBuffer.wrap(bytes); int bytesWritten = channel.write(bb); if(bytesWritten != length) { throw new IOException("Unable to write all data. Bytes to write: " + len + ". Bytes written: " + bytesWritten); } return; } StringBuilder buffer = getCurrentBuffer(); buffer.append(str, off, len); }
Source:
<code><START> public String toString() { <END> return "primary=[" + primaryMatcher.pattern() + "] secondary=[" + secondaryMatcher.pattern() + "]"; }</code><technical_language>String.format this read better</technical_language>

Target:
public String toString() { return String.format("primary=[%s] secondary=[%s]", primaryMatcher.pattern(), secondaryMatcher.pattern()); }
Source:
<code>public void testOpenNewApplicationWizardFromOpenShiftExplorerWithNoProjectsAndCancelNewProject() { LogView logView = new LogView(); logView.open(); logView.deleteLog(); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.reopen(); OpenShift3Connection connection = explorer.getOpenShift3Connection(); connection.select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_OS3_APPLICATION).select();; try { <START> new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); <END> } catch (WaitTimeoutExpiredException ex) { fail("Shell to create a new OpenShift application was supposed to be opened. But it's not."); } new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT); new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName); new CancelButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); checkErrorLog(); logView = new LogView(); logView.open(); logView.deleteLog(); }</code><technical_language>WaitUntil, is written now, fail time if Create Project wizard is opened top of New App wizard</technical_language>

Target:
public void testOpenNewApplicationWizardFromOpenShiftExplorerWithNoProjectsAndCancelNewProject() { clearLog(); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.reopen(); OpenShift3Connection connection = explorer.getOpenShift3Connection(); connection.select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_OS3_APPLICATION).select();; try { new WaitUntil(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); } catch (WaitTimeoutExpiredException ex) { fail("Shell to create a new OpenShift application was supposed to be opened. But it's not."); } new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT); new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName); new CancelButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); checkErrorLog(); clearLog(); }
Source:
<code>private long[] generateValuesLong(int bitWidth) { long[] values = new long[32]; for (int j = 0; j < values.length; j++) { values[j] = ((long)(Math.random() * (1l<<32)) * (long)(Math.random() * (1l<<32))) & <START> ((1l << bitWidth) - 1l); <END> } LOG.debug("Input: " + TestBitPacking.toString(values)); return values; }</code><technical_language>randomLong a bit mask</technical_language>

Target:
private long[] generateValuesLong(int bitWidth) { long[] values = new long[32]; Random random = new Random(0); for (int j = 0; j < values.length; j++) { values[j] = random.nextLong() & ((1l << bitWidth) - 1l); } LOG.debug("Input: " + TestBitPacking.toString(values)); return values; }
Source:
<code>public void onReceive(Context context, Intent intent) { Log.d(TAG, "Unpairing bluetooth devices"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) { @SuppressLint("WrongConstant") Set<BluetoothDevice> bondedBluetoothDevices = ((BluetoothManager) context.getSystemService("bluetooth")).getAdapter().getBondedDevices(); if (bondedBluetoothDevices.size() > 0) { unpairBluetoothDevices(bondedBluetoothDevices); setResultCode(!isFailed ? -1 : 0); } else { Log.d(TAG, "No paired devices found"); setResultCode(-1); setResultData("No paired devices found"); } } else { setResultCode(0); <START> setResultData("Unpair bluetooth works from Android 4.3 - API Level 18"); <END> } }</code><technical_language>..since Android 4.3</technical_language>

Target:
public void onReceive(Context context, Intent intent) { Log.d(TAG, "Unpairing bluetooth devices"); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter == null) { String message = "No Bluetooth adapter found"; Log.e(TAG, message); setResultCode(Activity.RESULT_CANCELED); setResultData(message); return; } Set<BluetoothDevice> bondedBluetoothDevices = bluetoothAdapter.getBondedDevices(); if (bondedBluetoothDevices.isEmpty()) { setResultCode(Activity.RESULT_OK); setResultData("No paired devices found"); return; } unpairBluetoothDevices(bondedBluetoothDevices); }
Source:
<code>public List<ExecutableFlow> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final List<ExecutableFlow> execFlows = new ArrayList<>(); do { final int id = rs.getInt(1); final int encodingType = rs.getInt(2); final byte[] data = rs.getBytes(3); if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); try { final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlowFromObject( GZIPUtils.transformBytesToObject(data, encType)); <START> Status status = Status.fromInteger(rs.getInt(4)); exFlow.setStatus(status); <END> execFlows.add(exFlow); } catch (final IOException e) { throw new SQLException("Error retrieving flow data " + id, e); } } } while (rs.next()); return execFlows; }</code><technical_language>This is bug prone. I 4 instances of calls. pass in status a parameter createExecutableFlowFromObject encapsulate logic within? This way, new future call remain consistent</technical_language>

Target:
public List<ExecutableFlow> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final List<ExecutableFlow> execFlows = new ArrayList<>(); do { final int id = rs.getInt(1); final int encodingType = rs.getInt(2); final byte[] data = rs.getBytes(3); if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); final Status status = Status.fromInteger(rs.getInt(4)); try { final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlow( GZIPUtils.transformBytesToObject(data, encType), status); execFlows.add(exFlow); } catch (final IOException e) { throw new SQLException("Error retrieving flow data " + id, e); } } } while (rs.next()); return execFlows; }
Source:
<code>public Connection shutdown() { log.info("Stopping PubSub connection"); <START> if (subscriber != null) subscriber.stopAsync().awaitTerminated(); <END> subscriber = null; return this; }</code><technical_language>a bit paranoid I "if" statements curly braces. add else do them? For more context, break this line if (subscriber != null) subscriber.stopAsync().awaitTerminated(); is fine, else add more code this block get unexpected behavior: if (subscriber != null) subscriber.stopAsync().awaitTerminated(); // some other code, controlled if-statement</technical_language>

Target:
public Connection shutdown() { log.info("Stopping PubSub connection"); if (subscriber != null) { log.debug("Waiting for subscriber to terminate"); subscriber.stopAsync().awaitTerminated(); } subscriber = null; return this; }
Source:
<code>private static String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim("sub", APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim("jti", UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim("iss", issuerIdentifier); jwtClaimsSetBuilder.claim("iat", currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim("exp", expireIn); } jwtClaimsSetBuilder.claim("subscribedAPIs", jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim("tierInfo", jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim("application", jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim("keytype", jwtTokenInfoDTO.getKeyType()); <START> jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_IP, jwtTokenInfoDTO.getPermittedIP()); <END> jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_REFERER, jwtTokenInfoDTO.getPermittedReferer()); return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }</code><technical_language>null check set</technical_language>

Target:
private static String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim("sub", APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim("jti", UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim("iss", issuerIdentifier); jwtClaimsSetBuilder.claim("iat", currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim("exp", expireIn); } jwtClaimsSetBuilder.claim("subscribedAPIs", jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim("tierInfo", jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim("application", jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim("keytype", jwtTokenInfoDTO.getKeyType()); if (jwtTokenInfoDTO.getPermittedIP() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_IP, jwtTokenInfoDTO.getPermittedIP()); } if (jwtTokenInfoDTO.getPermittedReferer() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_REFERER, jwtTokenInfoDTO.getPermittedReferer()); } return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }
Source:
<code>public void sweepDeletesTombstonesWhenWriteHasHigherTimestamp() { sweepQueue.enqueue(tombstoneToDefaultCell(TABLE_CONSERVATIVE, TS), TS); sweepQueue.enqueue(writeToDefaultCell(TABLE_CONSERVATIVE, TS2), TS2); assertTombstone(TABLE_CONSERVATIVE, TS + 1, TS); assertValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); <START> assertSentinel(TABLE_CONSERVATIVE, TS + 1); <END> assertValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); }</code><technical_language>I get do (there's sentinel). hoping for a more explicit 'not tombstone', this is fine</technical_language>

Target:
public void sweepDeletesTombstonesWhenWriteHasHigherTimestamp() { enqueueTombstone(TABLE_CONSERVATIVE, TS); enqueueWrite(TABLE_CONSERVATIVE, TS2); assertReadAtTimestampReturnsTombstoneAtTimestamp(TABLE_CONSERVATIVE, TS + 1, TS); assertReadAtTimestampReturnsValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertReadAtTimestampReturnsSentinel(TABLE_CONSERVATIVE, TS + 1); assertReadAtTimestampReturnsValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); }
Source:
<code>private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); if (branchName.length() == 0) { setErrorMessage(MessageFormat.format( <START> UIText.PushBranchPage_ChooseBranchNameError, <END> remoteConfig.getName())); return; } if (!Repository.isValidRefName(Constants.R_HEADS + branchName)) { setErrorMessage(UIText.PushBranchPage_InvalidBranchNameError); return; } if (isConfigureUpstreamSelected() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PushBranchPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }</code><technical_language>"Choose branch in remote 'origin' want push."</technical_language>

Target:
private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); String branchNameMessage = null; if (branchName.length() == 0) { branchNameMessage = MessageFormat.format( UIText.PullWizardPage_ChooseReference, remoteConfig.getName()); } else if (!Repository .isValidRefName(Constants.R_HEADS + branchName)) { branchNameMessage = UIText.PushBranchPage_InvalidBranchNameError; return; } if (branchNameMessage != null) { setErrorMessage(branchNameMessage); if (this.missingBranchDecorator == null) { this.missingBranchDecorator = new ControlDecoration(this.remoteBranchNameText, SWT.TOP | SWT.LEFT); this.missingBranchDecorator .setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_ERROR) .getImage()); } this.missingBranchDecorator .setDescriptionText(branchNameMessage); this.missingBranchDecorator.show(); return; } else if (this.missingBranchDecorator != null) { this.missingBranchDecorator.hide(); } if (overrideUpstreamConfiguration() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PullWizardPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }
Source:
<code>private boolean validateClusterExistsForArchitecture(ArchitectureType architecture, StoragePool dataCenter) { if <START> (!clusterArchitecturesInDataCenters.get(dataCenter.getId()).contains(architecture)) <END> { showErrorPopup(constants.noClusterSupportingArchitectureInDC()); return false; } return true; }</code><technical_language>this null (at in theory) is inited a callback. Please init handle here. - clusterArchitecturesInDataCenters.get(dataCenter.getId()) return null in some rare cases, please handle case</technical_language>

Target:
private boolean validateClusterExistsForArchitecture(ArchitectureType architecture, StoragePool dataCenter) { if (clusterArchitecturesInDataCenters == null || clusterArchitecturesInDataCenters.get(dataCenter.getId()) == null) { return true; } if (!clusterArchitecturesInDataCenters.get(dataCenter.getId()).contains(architecture)) { showErrorPopup(constants.noClusterSupportingArchitectureInDC()); return false; } return true; }
Source:
<code><START> public static Socket openCommandSession(final String ip, final int port, final String passwd) throws IOException { <END> Socket sk = new Socket(ip, port); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketCommand); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { throw new IOException(); } } return sk; }</code><technical_language>this is a public method, create a new 3-parameter version instead of modifying this one</technical_language>

Target:
public static Socket openCommandSession(final String ip, final int port, final String passwd) throws IOException { Socket sk = new Socket(ip, port); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketCommand); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { throw new IOException("Invalid gateway password"); } } return sk; }
Source:
<code>public String toString() { <START> StringBuilder stringBuilder = new StringBuilder(); <END> stringBuilder.append("[MessageInfo:") .append("Key-") .append(key) .append(",") .append("Size-") .append(size) .append(",") .append("ExpirationTimeInMs-") .append(expirationTimeInMs) .append(",") .append("IsDeleted-") .append(isDeleted) .append("]"); return stringBuilder.toString(); }</code><technical_language>do need add CRC here</technical_language>

Target:
public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("[MessageInfo:") .append("Key-") .append(key) .append(",") .append("Size-") .append(size) .append(",") .append("ExpirationTimeInMs-") .append(expirationTimeInMs) .append(",") .append("IsDeleted-") .append(isDeleted) .append(",") .append("Crc-") .append(crc) .append("]"); return stringBuilder.toString(); }
Source:
<code>public void testObjectInsideCommand() { Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(CustomPerson.class); Marshaller marshaller = MarshallerFactory.getMarshaller(extraClasses, MarshallingFormat.JSON, this.getClass().getClassLoader()); CustomPerson john = new CustomPerson("John", 20); InsertObjectCommand command = new InsertObjectCommand(john); String marshall = marshaller.marshall(command); <START> assertTrue("marshalled string should contain a customized value", marshall.contains("John is CustomPerson")); <END> InsertObjectCommand unmarshall = marshaller.unmarshall(marshall, InsertObjectCommand.class); CustomPerson result = (CustomPerson) unmarshall.getObject(); assertEquals(50, result.getAge()); }</code><technical_language>replacing this assertion Assertions.assertThat(marshall).contains("John is CustomPerson"); ? visible is actual content of marshall variable in case of error</technical_language>

Target:
public void testObjectInsideCommand() { Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(CustomPerson.class); Marshaller marshaller = MarshallerFactory.getMarshaller(extraClasses, MarshallingFormat.JSON, this.getClass().getClassLoader()); CustomPerson john = new CustomPerson("John", 20); InsertObjectCommand command = new InsertObjectCommand(john); String marshall = marshaller.marshall(command); Assertions.assertThat(marshall).contains("John is CustomPerson"); InsertObjectCommand unmarshall = marshaller.unmarshall(marshall, InsertObjectCommand.class); CustomPerson result = (CustomPerson) unmarshall.getObject(); assertEquals(50, result.getAge()); }
Source:
<code>public void createResults(PointType location) { ThingUID localWeatherThing = new ThingUID(THING_TYPE_WEATHER, LOCAL); <START> ThingUID bridgeUID = weatherUndergroundBridgeHandler.getThing().getUID(); <END> Map<String, Object> properties = new HashMap<>(3); properties.put(LOCATION, String.format("%s,%s", location.getLatitude(), location.getLongitude())); thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withLabel("Local Weather") .withProperties(properties).withBridge(bridgeUID).build()); }</code><technical_language>bridgeUID is property is interesting bridge handler here. I suggest giving this ThingUID in constructor</technical_language>

Target:
public void createResults(PointType location) { ThingUID localWeatherThing = new ThingUID(THING_TYPE_WEATHER, LOCAL); Map<String, Object> properties = new HashMap<>(3); properties.put(LOCATION, String.format("%s,%s", location.getLatitude(), location.getLongitude())); thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withLabel("Local Weather") .withProperties(properties).withBridge(bridgeUID).build()); }
Source:
<code>public void clickAndWaitToBecomeStale(Duration timeout) { WebElement webElement = resolve(); <START> webElement.submit(); <END> waitFor(webElement).withTimeout(timeout).until(Control::isStale); }</code><technical_language>I get - blows is used</technical_language>

Target:
public void clickAndWaitToBecomeStale(Duration timeout) { WebElement webElement = resolve(); webElement.click(); waitFor(webElement).withTimeout(timeout).until(Control::isStale); }