auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); <START> final EntityQuery<I> entityQuery = EntityQueries.from(filters, columnCache()); <END> final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }</code><technical_language>Similar JDBC library, hide entity column cache public API. EntityQueries.from(...) is a good example of external API</technical_language>

Target:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, recordStorage()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }
Source:
<code>public FastTextExecutorService() { <START> this.executorService = Executors.newFixedThreadPool(8); <END> }</code><technical_language>I guess this configurable</technical_language>

Target:
private FastTextExecutorService() { this.executorService = Executors.newFixedThreadPool(Configuration.getThreadPoolSize()); }
Source:
<code>public void testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport() throws RecoverableException, WriteException, JsonProcessingException { this.content.setLastFetched(DateTime.parse("2016-08-28T00:00:00Z")); ResourceUpdatedMessage updatedMessage = createUpdatedMessage(); when(resourceRef.getId()).thenReturn(Id.valueOf(1)); when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content)))); when(writer.writeContent(content)).thenReturn(successfulWriteResult); when(metricsTimer.time()).thenReturn(timerContext); <START> when(objectMapper.writeValueAsString(any(Content.class))).thenReturn("{ \"test\":\"test\"}"); <END> bootstrapWorker.process(updatedMessage); verify(telescopeClient, times(1)).createEvent(any(Event.class)); verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture()); Event event = columbusTelescopeEventCaptor.getValue(); assertThat(event.getEntityState().get().getRaw().get(), is("{ \"test\":\"test\"}")); assertThat(event.getEntityState().get().getRawMime().get(), is(MimeType.APPLICATION_JSON.toString())); assertThat(event.getEntityState().get().getAtlasId().get(), is("c")); }</code><technical_language>Magic string copy-pasted. Extract variable</technical_language>

Target:
public void testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport() throws RecoverableException, WriteException, JsonProcessingException { this.content.setLastFetched(DateTime.parse("2016-08-28T00:00:00Z")); ResourceUpdatedMessage updatedMessage = createUpdatedMessage(); when(resourceRef.getId()).thenReturn(Id.valueOf(1)); when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content)))); when(writer.writeContent(content)).thenReturn(successfulWriteResult); when(metricsTimer.time()).thenReturn(timerContext); when(objectMapper.writeValueAsString(any(Content.class))).thenReturn(TEST_RAW_STRING); bootstrapWorker.process(updatedMessage); verify(telescopeClient, times(1)).createEvent(any(Event.class)); verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture()); Event event = columbusTelescopeEventCaptor.getValue(); assertThat(event.getEntityState().get().getRaw().get(), is(TEST_RAW_STRING)); assertThat(event.getEntityState().get().getRawMime().get(), is(MimeType.APPLICATION_JSON.toString())); assertThat(event.getEntityState().get().getAtlasId().get(), is("c")); }
Source:
<code>public void GIVEN_component_not_in_config_WHEN_adding_duplicate_ioc_THEN_no_conflict_returned() { DuplicateChecker<Ioc> checker = new IocDuplicateChecker(); configIocs.add(ioc1); allComps.add(mockComp(COMP_NAME_1, Collections.emptyList(), Arrays.asList(ioc1))); baseConfig = mockConfig(BASE_CONFIG_NAME, configBlocks, configComps, configIocs); checker.setBase(baseConfig, allComps); Map<String, Set<String>> result = checker.checkItemsOnAddItem(mockIoc(IOC_NAME_1, COMP_NAME_1), COMP_NAME_1); assertTrue(result.isEmpty()); <START> } <END></code><technical_language>this is missing tests check for duplicate IOCs load</technical_language>

Target:
public void GIVEN_component_not_in_config_WHEN_adding_duplicate_ioc_THEN_no_conflict_returned() { configIocs.add(ioc1); allComps.add(mockComp(COMP_NAME_1, Collections.emptyList(), Arrays.asList(ioc1))); baseConfig = mockConfig(BASE_CONFIG_NAME, configBlocks, configComps, configIocs); iocDuplicateChecker.setBase(baseConfig, allComps); Map<String, Set<String>> result = iocDuplicateChecker.checkItemsOnAddItem(mockIoc(IOC_NAME_1, COMP_NAME_1), COMP_NAME_1); assertTrue(result.isEmpty()); }
Source:
<code><START> public void setDIOValue(IOLine ioLine, IOValue ioValue) throws InvalidOperatingModeException, XBeeException { <END> if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (ioValue == null) throw new NullPointerException("IO value cannot be null."); String atCommand = ioLine.getATCommand(); byte[] valueByte = new byte[]{(byte)ioValue.getID()}; ATCommandResponse response = sendATCommand(new ATCommand(atCommand, valueByte)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }</code><technical_language>This need revisited throw proper exceptions</technical_language>

Target:
public void setDIOValue(IOLine ioLine, IOValue ioValue) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (ioValue == null) throw new NullPointerException("IO value cannot be null."); String atCommand = ioLine.getConfigurationATCommand(); byte[] valueByte = new byte[]{(byte)ioValue.getID()}; ATCommandResponse response = sendATCommand(new ATCommand(atCommand, valueByte)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }
Source:
<code>private JToolBar getToolBar() { if (mainToolBar == null) { mainToolBar = new JToolBar(); mainToolBar.setLayout(new java.awt.GridBagLayout()); mainToolBar.setEnabled(true); mainToolBar.setFloatable(false); mainToolBar.setRollover(true); mainToolBar.setPreferredSize(new java.awt.Dimension(800,30)); mainToolBar.setName("Callback Toolbar"); mainToolBar.add(getClearButton(), newGBC(0)); <START> mainToolBar.add(new JPanel(), newPlaceholderGBC(1)); <END> mainToolBar.add(getOptionsButton(), newOptionsGBC(2)); } return mainToolBar; }</code><technical_language>Box.createHorizontalGlue() instead of panel</technical_language>

Target:
private JToolBar getToolBar() { if (mainToolBar == null) { mainToolBar = new JToolBar(); mainToolBar.setEnabled(true); mainToolBar.setFloatable(false); mainToolBar.setRollover(true); mainToolBar.setName("Callback Toolbar"); mainToolBar.add(getClearButton()); mainToolBar.add(Box.createHorizontalGlue()); mainToolBar.add(getOptionsButton()); } return mainToolBar; }
Source:
<code>public Future<Channel> acquire(Promise<Channel> promise) { http2ClientMetrics.http2NewStreamCount.inc(); if (closed.get()) { return promise.setFailure(new IOException("Channel pool is closed!")); } <START> List<MultiplexedChannelRecord> multiplexedChannelRecords = new ArrayList<>(parentConnections); for (int i = 0; i < multiplexedChannelRecords.size(); i++) { int randomIndex = random.nextInt(multiplexedChannelRecords.size()); MultiplexedChannelRecord multiplexedChannelRecord = multiplexedChannelRecords.get(randomIndex); if (acquireStreamOnInitializedConnection(multiplexedChannelRecord, promise)) { return promise; } log.warn("Stream slip acquire on {}", inetSocketAddress); http2ClientMetrics.http2StreamSlipAcquireCount.inc(); <END> } acquireStreamOnNewConnection(promise); return promise; }</code><technical_language>nit: Collections.shuffle(multiplexedChannelRecords, random, for loop</technical_language>

Target:
public Future<Channel> acquire(Promise<Channel> promise) { http2ClientMetrics.http2NewStreamCount.inc(); if (closed.get()) { return promise.setFailure(new IOException("Channel pool is closed!")); } if (parentConnections.size() >= http2ClientConfig.http2MinConnectionPerPort) { List<MultiplexedChannelRecord> multiplexedChannelRecords = new ArrayList<>(parentConnections); Collections.shuffle(multiplexedChannelRecords); for (MultiplexedChannelRecord multiplexedChannelRecord : multiplexedChannelRecords) { if (acquireStreamOnInitializedConnection(multiplexedChannelRecord, promise)) { return promise; } log.warn("Stream slip acquire on {}", inetSocketAddress); http2ClientMetrics.http2StreamSlipAcquireCount.inc(); } } acquireStreamOnNewConnection(promise); return promise; }
Source:
<code>public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); <START> table.setSortDirection(getSortDirection()); <END> TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortColumn(fColumn); ViewerCompoundComparator comparator = fComparators.get(fColumn.getText()); if (fDirection == SWT.DOWN) { fTableViewer.setComparator(comparator); } else { fTableViewer.setComparator(new InvertSorter(comparator)); } refreshContentProvider(); }</code><technical_language>this code wrong. flipSortDirection effect time. I setSortDirection called flipSortDirection. fixed in another patch this one</technical_language>

Target:
public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortDirection(fDirection); table.setSortColumn(fColumn); ViewerCompoundComparator comparator = fComparators.get(fColumn.getText()); if (fDirection == SWT.DOWN) { fTableViewer.setComparator(comparator); } else { fTableViewer.setComparator(new InvertSorter(comparator)); } sortOrderChanged(); }
Source:
<code>public DeserializationResult getNextRecord(T target) throws IOException { <START> if (nonSpanningWrapper.canReadLength()) { <END> return nonSpanningWrapper.getNextRecord( target, recordLength -> spanningWrapper.transferFrom(nonSpanningWrapper, recordLength)); } else if (nonSpanningWrapper.hasRemaining()) { nonSpanningWrapper.transferTo(spanningWrapper.lengthBuffer); return PARTIAL_RECORD; } else if (spanningWrapper.hasFullRecord()) { target.read(spanningWrapper.getInputView()); spanningWrapper.transferLeftOverTo(nonSpanningWrapper); return nonSpanningWrapper.hasRemaining() ? INTERMEDIATE_RECORD_FROM_BUFFER : LAST_RECORD_FROM_BUFFER; } else { return PARTIAL_RECORD; } }</code><technical_language>nonSpanningWrapper.canReadLength() -> !nonSpanningWrapper.hasCompleteLength()? nonSpanningWrapper.canReadLength() -> nonSpanningWrapper.hasCompleteLength()</technical_language>

Target:
public DeserializationResult getNextRecord(T target) throws IOException { if (nonSpanningWrapper.hasCompleteLength()) { return readNonSpanningRecord(target); } else if (nonSpanningWrapper.hasRemaining()) { nonSpanningWrapper.transferTo(spanningWrapper.lengthBuffer); return PARTIAL_RECORD; } else if (spanningWrapper.hasFullRecord()) { target.read(spanningWrapper.getInputView()); spanningWrapper.transferLeftOverTo(nonSpanningWrapper); return nonSpanningWrapper.hasRemaining() ? INTERMEDIATE_RECORD_FROM_BUFFER : LAST_RECORD_FROM_BUFFER; } else { return PARTIAL_RECORD; } }
Source:
<code>public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); initStreamLogDirectory(); verifyLogs(); long startingAddress = dataStore.getStartingAddress(); <START> long firstSegment = startingAddress / RECORDS_PER_LOG_FILE; <END> long lastSegment = dataStore.getTailSegment(); logMetadata = initializeLogMetadata(firstSegment, lastSegment, startingAddress); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }</code><technical_language>a helper method get a segment number for address</technical_language>

Target:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); initStreamLogDirectory(); verifyLogs(); logMetadata = initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }
Source:
<code>private String getMethodName(String httpMethod) { if (httpMethod.equals("POST")) { return "add"; } if (httpMethod.equals("PUT")) { return "update"; } if (httpMethod.equals("GET")) { return "get"; } if (httpMethod.equals("DELETE")) { return "remove"; <START> } <END> return ""; }</code><technical_language>Consider a "switch" statement</technical_language>

Target:
private String getMethodName(String httpMethod) { switch (httpMethod) { case "POST": return "add"; case "PUT": return "update"; case "GET": return "get"; case "DELETE": return "remove"; default: return ""; } }
Source:
<code>private HttpMessage createHttpMessage(String cspHeaderName, String cspPolicy) { HttpMessage msg = new HttpMessage(); <START> String header = !cspHeaderName.isEmpty() ? cspHeaderName : "Content-Security-Policy"; <END> try { msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody("<html></html>"); msg.setResponseHeader( "HTTP/1.1 200 OK\r\n" + "Server: Apache-Coyote/1.1\r\n" + header + ":" + cspPolicy + "\r\n" + "Content-Type: text/html;charset=ISO-8859-1\r\n" + "Content-Length: " + msg.getResponseBody().length() + "\r\n"); } catch (HttpMalformedHeaderException e) { } return msg; }</code><technical_language>HTTP_HEADER_CSP</technical_language>

Target:
private HttpMessage createHttpMessage(String cspHeaderName, String cspPolicy) { HttpMessage msg = new HttpMessage(); String header = !cspHeaderName.isEmpty() ? cspHeaderName : HTTP_HEADER_CSP; try { msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody("<html></html>"); msg.setResponseHeader( "HTTP/1.1 200 OK\r\n" + "Server: Apache-Coyote/1.1\r\n" + header + ":" + cspPolicy + "\r\n" + "Content-Type: text/html;charset=ISO-8859-1\r\n" + "Content-Length: " + msg.getResponseBody().length() + "\r\n"); } catch (HttpMalformedHeaderException e) { throw new RuntimeException(e); } return msg; }
Source:
<code>public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); <START> if (words.length < 2 || words.length > 3) { <END> return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!Base64.isArrayByteBase64(words[1].getBytes())) { return false; } return true; }</code><technical_language>3 if split 3</technical_language>

Target:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length < 2 || words.length > 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes())) { return false; } return true; }
Source:
<code>public void determineProfileTest() { assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); filter.setDataProfile("summarystation"); assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(filter)); <START> filter.setDataProfile("periodofrecord"); <END> assertEquals(Profile.PERIOD_OF_RECORD, controller.determineProfile(filter)); }</code><technical_language>This stayed camel case</technical_language>

Target:
public void determineProfileTest() { assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); filter.setDataProfile("summarystation"); assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(filter)); filter.setDataProfile("periodOfRecord"); assertEquals(Profile.PERIOD_OF_RECORD, controller.determineProfile(filter)); }
Source:
<code>private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); <START> if (eventSpanContext != null) { <END> Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPresent()) { eventData.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); tracerProvider.endSpan(eventSpanContext, Signal.complete()); eventData.addContext(SPAN_CONTEXT_KEY, eventSpanContext); } } } return eventData; }</code><technical_language>Is a scenario tracing is enabled eventSpanContext is null? incorrectly written tracer</technical_language>

Target:
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPresent()) { eventData.getProperties().put(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); tracerProvider.endSpan(eventSpanContext, Signal.complete()); eventData.addContext(SPAN_CONTEXT_KEY, eventSpanContext); } } return eventData; }
Source:
<code>public static int[] convertRGBAFunctiontoIntTable(String rgba) { int[] extract = new int[3]; <START> int start = 0; <END> int end = 0; start = rgba.indexOf("(", 0) + 1; end = rgba.indexOf(",", 0); int red = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int green = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int blue = Integer.parseInt(rgba.substring(start, end)); extract[0] = red; extract[1] = green; extract[2] = blue; return extract; }</code><technical_language>need initialize 0 assignment is right after</technical_language>

Target:
public static int[] convertRGBAFunctiontoIntTable(String rgba) { int[] extract = new int[3]; int start = rgba.indexOf("(", 0) + 1; int end = rgba.indexOf(",", 0); int red = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int green = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int blue = Integer.parseInt(rgba.substring(start, end)); extract[0] = red; extract[1] = green; extract[2] = blue; return extract; }
Source:
<code>public boolean onMapClick(@NonNull LatLng point) { List<Feature> renderedStationFeatures = mapboxMap.queryRenderedFeatures( mapboxMap.getProjection().toScreenLocation(point), LAYER_ID); if (!renderedStationFeatures.isEmpty()) { Point pointOfSelectedStation = (Point) renderedStationFeatures.get(0).geometry(); if (pointOfSelectedStation != null) { String selectedBoltFeatureName = renderedStationFeatures.get(0).getStringProperty(STATION_NAME_PROPERTY); List<Feature> featureList = featureCollection.features(); for (int i = 0; i < featureList.size(); i++) { if (featureList.get(i).getStringProperty(STATION_NAME_PROPERTY).equals(selectedBoltFeatureName)) { makeMapboxMatrixApiCall(i); } <START> } <END> } } return true; }</code><technical_language>This assign feature reused later, geometry</technical_language>

Target:
public boolean onMapClick(@NonNull LatLng point) { List<Feature> renderedStationFeatures = mapboxMap.queryRenderedFeatures( mapboxMap.getProjection().toScreenLocation(point), LAYER_ID); if (!renderedStationFeatures.isEmpty()) { Feature featureOfSelectedStation = renderedStationFeatures.get(0); if (featureOfSelectedStation != null) { String selectedBoltFeatureName = featureOfSelectedStation.getStringProperty(STATION_NAME_PROPERTY); List<Feature> featureList = featureCollection.features(); if (featureList != null) { for (int i = 0; i < featureList.size(); i++) { if (featureList.get(i).getStringProperty(STATION_NAME_PROPERTY).equals(selectedBoltFeatureName)) { makeMapboxMatrixApiCall(i); } } } } } return true; }
Source:
<code>public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); <START> } <END> setVdsExceptionAndLog(e); } catch (Exception e) { log.error("Exception", e); setVdsExceptionAndLog(e); } return getVDSReturnValue(); }</code><technical_language>VDSNetworkException is instance of RuntimeException, examined settle for: log stacktrace message is logged entire block like: setVdsRuntimeError(e); log.error("Error: {}", e.getMessage()); if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); }</technical_language>

Target:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { setVdsRuntimeError(e); log.error("Error: {}", e.getMessage()); if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); } } catch (Exception e) { log.error("Error: {}", e.getMessage()); log.error("Exception", e); setVdsRuntimeError(e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); } return getVDSReturnValue(); }
Source:
<code>public <T, ID> List<T> findByIds(Iterable<ID> ids, Class<T> domainType, String containerName) { Assert.notNull(ids, "Id list should not be null"); Assert.notNull(domainType, "domainType should not be null."); Assert.hasText(containerName, "container should not be null, empty or only whitespaces"); <START> final List<Object> idList = new ArrayList<>(); <END> for (ID id : ids) { if (id instanceof String) { idList.add(id); } else if (id instanceof Integer) { idList.add(Integer.toString((Integer) id)); } else if (id instanceof Long) { idList.add(Long.toString((Long) id)); } else { throw new IllegalQueryException("Type of id field must be String or Integer or Long"); } } final DocumentQuery query = new DocumentQuery(Criteria.getInstance(CriteriaType.IN, "id", Collections.singletonList(idList), Part.IgnoreCaseType.NEVER)); return find(query, domainType, containerName); }</code><technical_language>I need this change for ReactiveCosmosTemplate well</technical_language>

Target:
public <T, ID> List<T> findByIds(Iterable<ID> ids, Class<T> domainType, String containerName) { Assert.notNull(ids, "Id list should not be null"); Assert.notNull(domainType, "domainType should not be null."); Assert.hasText(containerName, "container should not be null, empty or only whitespaces"); final List<Object> idList = new ArrayList<>(); for (ID id : ids) { idList.add(CosmosUtils.getStringIDValue(id)); } final DocumentQuery query = new DocumentQuery(Criteria.getInstance(CriteriaType.IN, "id", Collections.singletonList(idList), Part.IgnoreCaseType.NEVER)); return find(query, domainType, containerName); }
Source:
<code>protected OuterSchemaCompatibility resolveOuterSchemaCompatibility(RowSerializer newSerializer) { <START> if (version == translateVersion(newSerializer)) { <END> return OuterSchemaCompatibility.COMPATIBLE_AS_IS; } return OuterSchemaCompatibility.COMPATIBLE_AFTER_MIGRATION; }</code><technical_language>If I understood this correctly, this check need performed new serializer. starting 1.11 created new serializer is writing in new format (e.g. legacyModeEnabled is false), combined fact version for RowSerializerSnapshot up-ticked in 1.11, migration is needed is completely encoded / "piggy-backed" in version of RowSerializerSnapshot: i.e. this able simplified to: suggestion if (readVersion <= LAST_VERSION_WITHOUT_ROW_KIND)) { return OuterSchemaCompatibility.COMPATIBLE_AFTER_MIGRATION; } return OuterSchemaCompatibility.COMPATIBLE_AS_IS;</technical_language>

Target:
protected OuterSchemaCompatibility resolveOuterSchemaCompatibility(RowSerializer newSerializer) { if (readVersion <= LAST_VERSION_WITHOUT_ROW_KIND) { return OuterSchemaCompatibility.COMPATIBLE_AFTER_MIGRATION; } return OuterSchemaCompatibility.COMPATIBLE_AS_IS; }
Source:
<code>public synchronized void close() throws IOException { if (closed) { return; } this.closed = true; <START> final Collection<EJBClientContextListener> listeners = new ArrayList<EJBClientContextListener>(this.ejbClientContextListeners); <END> for (final EJBClientContextListener listener : listeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.ejbClientContextTasksExecutorService.shutdownNow(); }</code><technical_language>Instead of wrapping in another collection, this add a synchronized block a Collections.synchronizedSet()? java synchronized (this.ejbClientContextListeners) { for (final EJBClientContextListener listener : this.ejbClientContextListeners) { this.ejbClientContextTasksExecutorService.submit(new Runnable() { @Override public void run() { try { listener.receiverRegistered(ejbReceiverContext); } catch (Throwable t) { // log ignore logger.debug("Exception invoke EJBClientContextListener " + listener + " for EJB client context " + EJBClientContext.this + " registertation of EJBReceiver " + receiver, t); } } }); } }</technical_language>

Target:
public synchronized void close() throws IOException { if (closed) { return; } this.closed = true; EJBClientContextListener[] listeners; synchronized (this.ejbClientContextListeners) { listeners = this.ejbClientContextListeners.toArray(new EJBClientContextListener[this.ejbClientContextListeners.size()]); } for (final EJBClientContextListener listener : listeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.ejbClientContextTasksExecutorService.shutdownNow(); }
Source:
<code>public void propagateEvent(Blackhole hole) { for (int i = 0; i < 100; i++) { <START> pipeline.fireChannelReadComplete(); <END> hole.consume(i); } }</code><technical_language>add some counter handler 100% compiler throw this away</technical_language>

Target:
public void propagateEvent(Blackhole hole) { for (int i = 0; i < 100; i++) { hole.consume(pipeline.fireChannelReadComplete()); } }
Source:
<code>private void deleteSshKey(final String key, final Account account) throws OrmException { ResultSet<AccountSshKey> keys = db.accountSshKeys().byAccount(account.getId()); if (key.equals("ALL")) { db.accountSshKeys().delete(keys); } else { for (AccountSshKey accountSshKey : keys) { if ((accountSshKey.getSshPublicKey() != null && <START> accountSshKey.getSshPublicKey().equals(key.trim())) <END> || accountSshKey.getComment().trim().equals(key)) { db.accountSshKeys().delete(Collections.singleton(accountSshKey)); } } } sshKeyCache.evict(account.getUserName()); }</code><technical_language>If reverse this equals check skip preceding null check</technical_language>

Target:
private void deleteSshKey(final String key, final Account account) throws OrmException { ResultSet<AccountSshKey> keys = db.accountSshKeys().byAccount(account.getId()); if (key.equals("ALL")) { db.accountSshKeys().delete(keys); } else { for (AccountSshKey accountSshKey : keys) { if (key.trim().equals(accountSshKey.getSshPublicKey()) || accountSshKey.getComment().trim().equals(key)) { db.accountSshKeys().delete(Collections.singleton(accountSshKey)); } } } sshKeyCache.evict(account.getUserName()); }
Source:
<code>private Properties loadKieServerInstanceData() { Properties properties = new Properties(); try (InputStream is = new FileInputStream(userFile)) { properties.load(is); } catch (Exception e) { <START> log.errorf("file not found %1$s", userFile); <END> } return properties; }</code><technical_language>Please separate FileNotFoundException exception handling other IO exceptions. FileNotFoundException expected in case user creates entry, in this case warning enough, file found, empty instance data returned. For other IO exceptions I leave error severity</technical_language>

Target:
private Properties loadKieServerInstanceData() { Properties properties = new Properties(); try (InputStream is = new FileInputStream(userFile)) { properties.load(is); } catch (IOException e) { log.errorf(e, "An error ocurred. File <%1$s> is a directory, it does not exist or it cannot be opened", userFile); } return properties; }
Source:
<code>private boolean resolvesReferenceBindingTo(ITypeBinding sb, String signature) { if (sb == null) { return false; } <START> if (new String(sb.getName()).startsWith(signature) || (sb.isArray() && "array".equals(signature))) { END> return true; } List<ITypeBinding> bindings = new ArrayList<>(); Collections.addAll(bindings, sb.getInterfaces()); bindings.add(sb.getSuperclass()); boolean result = false; Iterator<ITypeBinding> it = bindings.iterator(); while (it.hasNext() && result == false) { result = resolvesReferenceBindingTo(it.next(), signature); } return result; }</code><technical_language>getQualifiedName(). Otherwise, e.g. List<String> a; a.<<ctrltab>> offer 'for'</technical_language>

Target:
private boolean resolvesReferenceBindingTo(ITypeBinding sb, String signature) { if (sb == null) { return false; } if (new String(sb.getQualifiedName()).startsWith(signature) || (sb.isArray() && "array".equals(signature))) { return true; } List<ITypeBinding> bindings = new ArrayList<>(); Collections.addAll(bindings, sb.getInterfaces()); bindings.add(sb.getSuperclass()); boolean result = false; Iterator<ITypeBinding> it = bindings.iterator(); while (it.hasNext() && result == false) { result = resolvesReferenceBindingTo(it.next(), signature); } return result; }
Source:
<code>public void annotationKeys() { assertThat(CassandraUtil.annotationKeys(QueryRequest.builder() .lookback(86400000L) .serviceName("service") .addAnnotation(Constants.ERROR) .addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build())) <START> .containsExactly("service", "error", "http.method:GET"); <END> }</code><technical_language>interesting.. surprised this works, I</technical_language>

Target:
public void annotationKeys() { assertThat(CassandraUtil.annotationKeys(QueryRequest.builder() .lookback(86400000L) .serviceName("service") .addAnnotation(Constants.ERROR) .addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build())) .containsExactly("error", "http.method:GET", "service"); }
Source:
<code>public void testEquationXY() { final IterableInterval<DoubleType> image1 = ops.create().img(dimensions, new DoubleType()); ops.image().equation(image1, (x, y) -> 10 * (Math.cos(0.3 * x) + Math.sin( 0.3 * y))); assertEquals(ops.stats().sum(image1).getRealDouble(), 446.1755977585166, 0.001); final IterableInterval<IntType> image2 = ops.create().img(dimensions, new IntType()); ops.image().equation(image2, (x, y) -> Math.pow(x, 2) + Math.pow(y, 2)); assertEquals(ops.stats().sum(image2).getRealDouble(), 6.567e7, 0.001); final IterableInterval<FloatType> image3 = ops.create().img(dimensions, new FloatType()); ops.image().equation(image3, (x, y) -> Math.pow(start[0] + spacing[0] * x, <START> 2) + Math.pow(start[1] + spacing[1] * y, 2)); <END> assertEquals(6801.346801346799, ops.stats().sum(image3).getRealDouble(), 0.00001); }</code><technical_language>ops().run(net.imagej.ops.image.equation.DefaultXYEquation.class, out, in), ensure DefaultXYEquation is tested some other op. This issue now, if creates another CoordinatesEquationOp</technical_language>

Target:
public void testEquationXY() { final IterableInterval<DoubleType> image1 = ops.create().img(dimensions, new DoubleType()); ops.image().equation(image1, (x, y) -> 10 * (Math.cos(0.3 * x) + Math.sin( 0.3 * y))); assertEquals(ops.stats().sum(image1).getRealDouble(), 446.1755977585166, 0.001); final IterableInterval<IntType> image2 = ops.create().img(dimensions, new IntType()); ops.image().equation(image2, (x, y) -> Math.pow(x, 2) + Math.pow(y, 2)); assertEquals(ops.stats().sum(image2).getRealDouble(), 6.567e7, 0.001); final IterableInterval<FloatType> image3 = ops.create().img(dimensions, new FloatType()); DoubleBinaryOperator equation = (x, y) -> Math.pow(start[0] + spacing[0] * x, 2) + Math.pow(start[1] + spacing[1] * y, 2); ops.run(net.imagej.ops.image.equation.DefaultXYEquation.class, image3, equation); assertEquals(6801.346801346799, ops.stats().sum(image3).getRealDouble(), 0.00001); }
Source:
<code>private void writeGetMethod(JavaWriter writer, ExecutableElement constructor, boolean disambiguateFields, boolean injectMembers, String strippedTypeName) <START> throws IOException { <END> writer.emitJavadoc(AdapterJavadocs.GET_METHOD, strippedTypeName); writer.emitAnnotation(Override.class); writer.beginMethod(strippedTypeName, "get", PUBLIC); StringBuilder newInstance = new StringBuilder(); newInstance.append(strippedTypeName).append(" result = new "); newInstance.append(strippedTypeName).append('('); boolean first = true; for (VariableElement parameter : constructor.getParameters()) { if (!first) newInstance.append(", "); else first = false; newInstance.append(createParameterName(disambiguateFields, parameter)).append(".get()"); } newInstance.append(')'); writer.emitStatement(newInstance.toString()); if (injectMembers) { writer.emitStatement("injectMembers(result)"); } writer.emitStatement("return result"); writer.endMethod(); writer.emitEmptyLine(); }</code><technical_language>nit: this wrapping is weird</technical_language>

Target:
private void writeGetMethod(JavaWriter writer, ExecutableElement constructor, boolean disambiguateFields, boolean injectMembers, String strippedTypeName) throws IOException { writer.emitJavadoc(AdapterJavadocs.GET_METHOD, strippedTypeName); writer.emitAnnotation(Override.class); writer.beginMethod(strippedTypeName, "get", PUBLIC); StringBuilder newInstance = new StringBuilder(); newInstance.append(strippedTypeName).append(" result = new "); newInstance.append(strippedTypeName).append('('); boolean first = true; for (VariableElement parameter : constructor.getParameters()) { if (!first) newInstance.append(", "); else first = false; newInstance.append(parameterName(disambiguateFields, parameter)).append(".get()"); } newInstance.append(')'); writer.emitStatement(newInstance.toString()); if (injectMembers) { writer.emitStatement("injectMembers(result)"); } writer.emitStatement("return result"); writer.endMethod(); writer.emitEmptyLine(); }
Source:
<code>protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, true)); Label introductionText = new Label(container, SWT.WRAP); introductionText.setText(EMFCompareRCPUIMessages .getString("PostProcessorPreferencePage.PREFERENCE_PAGE_DESCRIPTION")); IItemRegistry<IPostProcessor.Descriptor> postProcessorRegistryDescriptor = EMFCompareRCPPlugin .getDefault().getPostProcessorDescriptorRegistry(); Set<IItemDescriptor<Descriptor>> activesPostProcessor = ItemUtil.getActiveItems( postProcessorRegistryDescriptor, EMFComparePreferences.DISABLED_POST_PROCESSOR); InteractiveUIBuilder<Descriptor> postProcessorUIBuilder = new InteractiveUIBuilder<IPostProcessor.Descriptor>( container, postProcessorRegistryDescriptor); <START> Set<IItemDescriptor<Descriptor>> descriptors = Sets.newHashSet(postProcessorRegistryDescriptor <END> .getItemDescriptors()); postProcessorUIBuilder.setConfigurationNodeKey(EMFComparePreferences.DISABLED_POST_PROCESSOR) .setDefaultCheck(descriptors).setDefaultSelection( postProcessorRegistryDescriptor.getHighestRankingDescriptor()).setHoldingData( dataHolder).setDefaultCheck(activesPostProcessor); interactiveUI = postProcessorUIBuilder.build(); return container; }</code><technical_language>a LInkedHashSet order is important set is for iteration</technical_language>

Target:
protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, true)); Label introductionText = new Label(container, SWT.WRAP); introductionText.setText(EMFCompareRCPUIMessages .getString("PostProcessorPreferencePage.PREFERENCE_PAGE_DESCRIPTION")); IItemRegistry<IPostProcessor.Descriptor> postProcessorRegistryDescriptor = EMFCompareRCPPlugin .getDefault().getPostProcessorDescriptorRegistry(); Set<IItemDescriptor<Descriptor>> activesPostProcessor = ItemUtil.getActiveItems( postProcessorRegistryDescriptor, EMFComparePreferences.DISABLED_POST_PROCESSOR); InteractiveUIBuilder<Descriptor> postProcessorUIBuilder = new InteractiveUIBuilder<IPostProcessor.Descriptor>( container, postProcessorRegistryDescriptor); Set<IItemDescriptor<Descriptor>> descriptors = Sets.newLinkedHashSet(postProcessorRegistryDescriptor .getItemDescriptors()); postProcessorUIBuilder.setConfigurationNodeKey(EMFComparePreferences.DISABLED_POST_PROCESSOR) .setDefaultCheck(descriptors).setDefaultSelection( postProcessorRegistryDescriptor.getHighestRankingDescriptor()).setHoldingData( dataHolder).setDefaultCheck(activesPostProcessor); interactiveUI = postProcessorUIBuilder.build(); return container; }
Source:
<code>public void shouldBeAbleToWriteIntoFile() throws Exception { final String message = "Test line"; <START> injectWriterMock(fileLineConsumer, writer); <END> doNothing().when(writer).write(anyString()); doNothing().when(writer).flush(); fileLineConsumer.writeLine(message); verify(writer).write(eq(message)); }</code><technical_language>Is do in single place</technical_language>

Target:
public void shouldBeAbleToWriteIntoFile() throws Exception { final String message = "Test line"; fileLineConsumer.writeLine(message); verify(writer).write(eq(message)); }
Source:
<code>public FootballEventStream() throws IOException { textStream = new PlainTextByLineStream( new URLInputSreamFactory(this.getClass().getResource("/opennlp/tools/ml/maxent/football.dat")), <START> Charset.defaultCharset() ); <END> }</code><technical_language>default charset. This is platform dependent changes machines</technical_language>

Target:
public FootballEventStream() throws IOException { textStream = new PlainTextByLineStream( new URLInputStreamFactory(this.getClass().getResource("/opennlp/tools/ml/maxent/football.dat")), StandardCharsets.US_ASCII ); }
Source:
<code>public CreatePostPresenter(@Nonnull PostsDao postsDao) { this.postsDao = postsDao; final Observable<AddPost> filter = OnSubscribeCombineLatestWithoutBackPressure.combineLatest( nameSubject, bodySubject, new Func2<String, String, AddPost>() { @Override public AddPost call(String name, String body) { return new AddPost(name, body); } }) .lift(OperatorSampleWithLastWithObservable.<AddPost>create(sendSubject)) .filter(new Func1<AddPost, Boolean>() { @Override public Boolean call(AddPost addPost) { <START> return !(Strings.isNullOrEmpty(addPost.name()) || Strings.isNullOrEmpty(addPost.body())); <END> } }); filter.subscribe(postsDao.postRequestObserver()); filter.subscribe(showProgress); closeActivitySubject = Observable.merge( postsDao.postSuccesObserver().compose(ResponseOrError.<PostWithBody>onlySuccess()), navigationClickSubject); nameSubject.startWith("") .lift(OperatorSampleWithLastWithObservable.<String>create(sendSubject)) .filter(fieldNullOrEmpty()) .subscribe(nameErrorSubject); bodySubject.startWith("") .lift(OperatorSampleWithLastWithObservable.<String>create(sendSubject)) .filter(fieldNullOrEmpty()) .subscribe(bodyErrorSubject); }</code><technical_language>please line breaking</technical_language>

Target:
public CreatePostPresenter(@Nonnull PostsDao postsDao) { this.postsDao = postsDao; OnSubscribeCombineLatestWithoutBackPressure.combineLatest( nameSubject, bodySubject, new Func2<String, String, AddPost>() { @Override public AddPost call(String name, String body) { return new AddPost(name, body); } }) .lift(OperatorSampleWithLastWithObservable.<AddPost>create(sendSubject)) .filter(new Func1<AddPost, Boolean>() { @Override public Boolean call(AddPost addPost) { final boolean nameIsPresent = !Strings.isNullOrEmpty(addPost.name()); final boolean bodyIsPresent = !Strings.isNullOrEmpty(addPost.body()); return (nameIsPresent && bodyIsPresent); } }) .doOnNext(new Action1<AddPost>() { @Override public void call(AddPost addPost) { showProgress.onNext(true); } }) .subscribe(postsDao.postRequestObserver()); Observable.merge( postsDao.postSuccesObservable().compose(ResponseOrError.<PostWithBody>onlySuccess()), navigationClickSubject) .doOnNext(new Action1<Object>() { @Override public void call(Object o) { showProgress.onNext(false); } }) .subscribe(closeActivitySubject); postsDao.postSuccesObservable() .compose(ResponseOrError.<PostWithBody>onlyError()) .doOnNext(new Action1<Throwable>() { @Override public void call(Throwable throwable) { showProgress.onNext(false); } }).subscribe(postErrorSubject); nameSubject.startWith("") .lift(OperatorSampleWithLastWithObservable.<String>create(sendSubject)) .filter(fieldNullOrEmpty()) .subscribe(nameErrorSubject); bodySubject.startWith("") .lift(OperatorSampleWithLastWithObservable.<String>create(sendSubject)) .filter(fieldNullOrEmpty()) .subscribe(bodyErrorSubject); }
Source:
<code>public void testSSLFactory() { try { SSLFactory sslFactory = TestUtils.createSSLFactory(); SSLContext sslContext = sslFactory.createSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); SSLEngine engine = sslFactory.createSSLEngine(sslContext, "localhost", 9095, true); <START> System.out.println(socketFactory.toString()); <END> System.out.println(serverSocketFactory.toString()); System.out.println(engine.toString()); } catch (Exception e) { fail("Unexpected error in SSLFactory testing"); e.printStackTrace(); } }</code><technical_language>is testcase do verifications expected</technical_language>

Target:
public void testSSLFactory() throws Exception { SSLFactory sslFactory = TestUtils.createSSLFactory(); SSLContext sslContext = sslFactory.createSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); SSLEngine engine = sslFactory.createSSLEngine(sslContext, "localhost", 9095, true); Assert.assertEquals(sslContext.getProtocol(), "TLS"); String[] enabledCipherSuites = engine.getEnabledCipherSuites(); Assert.assertEquals(enabledCipherSuites.length, 1); Assert.assertEquals(enabledCipherSuites[0], "TLS_RSA_WITH_AES_128_CBC_SHA256"); String[] enabledProtocols = engine.getEnabledProtocols(); Assert.assertEquals(enabledProtocols.length, 1); Assert.assertEquals(enabledProtocols[0], "TLSv1.2"); Assert.assertEquals(engine.getNeedClientAuth(), false); Assert.assertEquals(engine.getUseClientMode(), true); Assert.assertEquals(engine.getWantClientAuth(), false); System.out.println(socketFactory.toString()); System.out.println(serverSocketFactory.toString()); System.out.println(engine.toString()); }
Source:
<code>public List<LogicalDeviceDto> getLogicalDevices() { <START> return Collections.unmodifiableList(logicalDevices!=null?logicalDevices:new ArrayList<>()); <END> }</code><technical_language>Add this qualifier: this.logicalDevices</technical_language>

Target:
public List<LogicalDeviceDto> getLogicalDevices() { return Collections.unmodifiableList(this.logicalDevices!=null?this.logicalDevices:new ArrayList<>()); }
Source:
<code>private void importDatabase(String filePath) { ZipFile zipFile = null; try { zipFile = new ZipFile(filePath); } catch (IOException ioe) { Toast.makeText(getContext(), R.string.no_valid_zip_file, Toast.LENGTH_SHORT) .show(); return; } finally { try { zipFile.close(); } catch (Exception e){} } try { if (!databasesDir.exists() && !databasesDir.mkdir()) { throw new Exception("Could not create databases dir"); } if(!(ZipHelper.extractFileFromZip(filePath, newpipe_db.getPath(), "newpipe.db") && ZipHelper.extractFileFromZip(filePath, newpipe_db_journal.getPath(), "newpipe.db-journal"))) { Toast.makeText(getContext(), R.string.could_not_import_all_files, Toast.LENGTH_LONG) .show(); } if(ZipHelper.extractFileFromZip(filePath, newpipe_settings.getPath(), "newpipe.settings")) { AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); alert.setTitle(R.string.import_settings); alert.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override <START> public void onClick(DialogInterface dialog, int which) { <END> dialog.dismiss(); System.exit(0); } }); alert.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); loadSharedPreferences(newpipe_settings); System.exit(0); } }); alert.show(); } else { System.exit(0); } } catch (Exception e) { onError(e); } }</code><technical_language>Please lambda convention here</technical_language>

Target:
private void importDatabase(String filePath) { ZipFile zipFile = null; try { zipFile = new ZipFile(filePath); } catch (IOException ioe) { Toast.makeText(getContext(), R.string.no_valid_zip_file, Toast.LENGTH_SHORT) .show(); return; } finally { try { zipFile.close(); } catch (Exception e){} } try { if (!databasesDir.exists() && !databasesDir.mkdir()) { throw new Exception("Could not create databases dir"); } if(!(ZipHelper.extractFileFromZip(filePath, newpipe_db.getPath(), "newpipe.db") && ZipHelper.extractFileFromZip(filePath, newpipe_db_journal.getPath(), "newpipe.db-journal"))) { Toast.makeText(getContext(), R.string.could_not_import_all_files, Toast.LENGTH_LONG) .show(); } if(ZipHelper.extractFileFromZip(filePath, newpipe_settings.getPath(), "newpipe.settings")) { AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); alert.setTitle(R.string.import_settings); alert.setNegativeButton(android.R.string.no, (dialog, which) -> { dialog.dismiss(); System.exit(0); }); alert.setPositiveButton(android.R.string.yes, (dialog, which) -> { dialog.dismiss(); loadSharedPreferences(newpipe_settings); System.exit(0); }); alert.show(); } else { System.exit(0); } } catch (Exception e) { onError(e); } }
Source:
<code>public int getSourceOpt(int target) { try { return sources[target]; } catch (ArrayIndexOutOfBoundsException e) { <START> throw new Mappings.NoElementException("invalid target " + target); <END> } }</code><technical_language>doc, NoElementException thrown a mapping is expected return element returns none. -1 means is mapped. leave is (and other places), throw ArrayIndexOutOfBoundsException</technical_language>

Target:
public int getSourceOpt(int target) { return sources[target]; }