auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <T> T[] toObjectArray(LogicalType elementType) { Class<T> elementClass = (Class<T>) LogicalTypeUtils.toInternalConversionClass(elementType); T[] values = (T[]) Array.newInstance(elementClass, size); for (int i = 0; i < size; i++) { if (!isNullAt(i)) { ArrayData.ElementGetter elementGetter = ArrayData.createElementGetter(elementType); values[i] = (T) elementGetter.getElementOrNull(this, i); } } return values; }

Target:
public <T> T[] toObjectArray(LogicalType elementType) { Class<T> elementClass = (Class<T>) LogicalTypeUtils.toInternalConversionClass(elementType); ArrayData.ElementGetter elementGetter = ArrayData.createElementGetter(elementType); T[] values = (T[]) Array.newInstance(elementClass, size); for (int i = 0; i < size; i++) { if (!isNullAt(i)) { values[i] = (T) elementGetter.getElementOrNull(this, i); } } return values; }
Source:
@Test public void testEliminateCommonExprInCondition() { RexSimplify rexSimplify = new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, EXECUTOR); RexNode or1 = or( and(vBool(0), vBool(1)), and(vBool(0), vBool(1), vBool(2)) ); RexNode orSimplified2 = rexSimplify.eliminateCommonExprInCondition(or1); checkDigest(orSimplified2, "AND(?0.bool0, ?0.bool1)"); RexNode or2 = or( and(vBool(0), vBool(1)), and(vBool(0), vBool(2)), and(vBool(0), vBool(3)) ); RexNode orSimplified1 = rexSimplify.eliminateCommonExprInCondition(or2); checkDigest(orSimplified1, "AND(?0.bool0, OR(?0.bool1, ?0.bool2, ?0.bool3))"); RexNode and1 = and( or(vBool(0), vBool(1)), or(vBool(0), vBool(1), vBool(2)) ); RexNode andSimplified1 = rexSimplify.eliminateCommonExprInCondition(and1); checkDigest(andSimplified1, "OR(?0.bool0, ?0.bool1)"); RexNode and2 = and( or(vBool(0), vBool(1), vBool(2)), or(vBool(0), vBool(3), vBool(4)) ); RexNode andSimplified2 = rexSimplify.eliminateCommonExprInCondition(and2); checkDigest(andSimplified2, "OR(?0.bool0, AND(OR(?0.bool1, ?0.bool2), OR(?0.bool3, ?0.bool4)))"); }

Target:
@Test public void testEliminateCommonExprInCondition() { RexSimplify rexSimplify = new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, EXECUTOR); RexNode or1 = or( and(vBool(0), vBool(1)), and(vBool(0), vBool(1), vBool(2)) ); RexNode orSimplified1 = rexSimplify.eliminateCommonExprInCondition(or1); checkDigest(orSimplified1, "AND(?0.bool0, ?0.bool1)"); RexNode or2 = or( and(vBool(0), vBool(1)), and(vBool(0), vBool(2)), and(vBool(0), vBool(3)) ); RexNode orSimplified2 = rexSimplify.eliminateCommonExprInCondition(or2); checkDigest(orSimplified2, "AND(?0.bool0, OR(?0.bool1, ?0.bool2, ?0.bool3))"); RexNode and1 = and( or(vBool(0), vBool(1)), or(vBool(0), vBool(1), vBool(2)) ); RexNode andSimplified1 = rexSimplify.eliminateCommonExprInCondition(and1); checkDigest(andSimplified1, "OR(?0.bool0, ?0.bool1)"); RexNode and2 = and( or(vBool(0), vBool(1), vBool(2)), or(vBool(0), vBool(3), vBool(4)) ); RexNode andSimplified2 = rexSimplify.eliminateCommonExprInCondition(and2); checkDigest(andSimplified2, "OR(?0.bool0, AND(OR(?0.bool1, ?0.bool2), OR(?0.bool3, ?0.bool4)))"); }
Source:
public Aggregator factorize(ColumnSelectorFactory metricFactory) { return null; }

Target:
public Aggregator factorize(ColumnSelectorFactory metricFactory) throws UnsupportedOperationException { throw new UnsupportedOperationException("Invalid operation for AveragerFactoryWrapper."); }
Source:
public boolean setTrace(@NonNull ITmfTrace trace) throws TmfAnalysisException { boolean ret = super.setTrace(trace); if (!ret) { return ret; } ret = fCriticalPathModule.setTrace(trace); fCriticalPathModule.setParameter(CriticalPathModule.PARAM_GRAPH, getId()); return ret; }

Target:
public boolean setTrace(@NonNull ITmfTrace trace) throws TmfAnalysisException { boolean ret = super.setTrace(trace); if (!ret) { return ret; } ret = fCriticalPathModule.setTrace(trace); if (ret) { fCriticalPathModule.setParameter(CriticalPathModule.PARAM_GRAPH, getId()); } return ret; }
Source:
static <E, T> Validation<E, Seq<T>> sequence(Iterable<? extends Validation<E, T>> values) { Objects.requireNonNull(values, "values is null"); List<E> errors = List.empty(); List<T> list = List.empty(); for (Validation<E, T> value : values) { if (value.isInvalid()) { Seq<? extends E> otherErrors = value.getErrors().reverse(); errors = errors.prependAll(otherErrors); } else if (errors.isEmpty()) { list = list.prepend(value.get()); } } return errors.isEmpty() ? valid(list.reverse()) : invalid(errors.reverse()); }

Target:
static <E, T> Validation<E, Seq<T>> sequence(Iterable<? extends Validation<E, T>> values) { Objects.requireNonNull(values, "values is null"); List<E> errors = List.empty(); List<T> list = List.empty(); for (Validation<E, T> value : values) { if (value.isInvalid()) { errors = errors.prependAll(value.getErrors().reverse()); } else if (errors.isEmpty()) { list = list.prepend(value.get()); } } return errors.isEmpty() ? valid(list.reverse()) : invalid(errors.reverse()); }
Source:
public final static String tupleName(final int arity) { StringBuilder out = new StringBuilder(); out.append('('); for (int n = 1; n < arity; n++) { out.append(','); } out.append('('); return out.toString(); }

Target:
public final static String tupleName(final int arity) { return String.format("(%s)", Strings.repeat(",", arity)); }
Source:
public JSONObject getDebugState(boolean full, String endpointId) { JSONObject debugState = new JSONObject(); debugState.put("id", id); debugState.put("name", conferenceName == null ? null : conferenceName); if (full) { debugState.put("gid", gid); debugState.put("expired", expired); debugState.put("creationTime", creationTime); debugState.put("lastActivity", lastActivityTime); debugState.put("speechActivity", speechActivity.getDebugState()); debugState.put("includeInStatistics", includeInStatistics); debugState.put("statistics", statistics.getJson()); ConfOctoTransport tentacle = this.tentacle; debugState.put( "tentacle", tentacle == null ? null : tentacle.getDebugState()); } JSONObject endpoints = new JSONObject(); debugState.put("endpoints", endpoints); for (Endpoint e : endpointsCache) { if (endpointId == null || endpointId.equals(e.getID())) { endpoints.put(e.getID(), full ? e.getDebugState() : e.getStatsId()); } } return debugState; }

Target:
public JSONObject getDebugState(boolean full, String endpointId) { JSONObject debugState = new JSONObject(); debugState.put("id", id); debugState.put("name", conferenceName); if (full) { debugState.put("gid", gid); debugState.put("expired", expired); debugState.put("creationTime", creationTime); debugState.put("lastActivity", lastActivityTime); debugState.put("speechActivity", speechActivity.getDebugState()); debugState.put("includeInStatistics", includeInStatistics); debugState.put("statistics", statistics.getJson()); ConfOctoTransport tentacle = this.tentacle; debugState.put( "tentacle", tentacle == null ? null : tentacle.getDebugState()); } JSONObject endpoints = new JSONObject(); debugState.put("endpoints", endpoints); for (Endpoint e : endpointsCache) { if (endpointId == null || endpointId.equals(e.getID())) { endpoints.put(e.getID(), full ? e.getDebugState() : e.getStatsId()); } } return debugState; }
Source:
public static void checkoutEntry(final Repository repo, File f, DirCacheEntry entry, ObjectReader or) throws IOException { ObjectLoader ol = or.open(entry.getObjectId()); File parentDir = f.getParentFile(); parentDir.mkdirs(); File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); FileOutputStream rawChannel = new FileOutputStream(tmpFile); OutputStream channel; if (opt.getAutoCRLF() == AutoCRLF.TRUE) channel = new AutoCRLFOutputStream(rawChannel); else channel = rawChannel; try { ol.copyTo(channel); } finally { channel.close(); } FS fs = repo.getFS(); if (opt.isFileMode() && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { FileUtils.delete(f, FileUtils.IGNORE_ERRORS); FileUtils.delete(f, FileUtils.EMPTY_DIRECTORIES_ONLY | FileUtils.RECURSIVE | FileUtils.IGNORE_ERRORS); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); if (opt.getAutoCRLF() != AutoCRLF.FALSE) entry.setLength(f.length()); else entry.setLength((int) ol.getSize()); }

Target:
public static void checkoutEntry(final Repository repo, File f, DirCacheEntry entry, ObjectReader or) throws IOException { ObjectLoader ol = or.open(entry.getObjectId()); File parentDir = f.getParentFile(); parentDir.mkdirs(); File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); FileOutputStream rawChannel = new FileOutputStream(tmpFile); OutputStream channel; if (opt.getAutoCRLF() == AutoCRLF.TRUE) channel = new AutoCRLFOutputStream(rawChannel); else channel = rawChannel; try { ol.copyTo(channel); } finally { channel.close(); } FS fs = repo.getFS(); if (opt.isFileMode() && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } try { FileUtils.rename(tmpFile, f); } catch (IOException e) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } entry.setLastModified(f.lastModified()); if (opt.getAutoCRLF() != AutoCRLF.FALSE) entry.setLength(f.length()); else entry.setLength((int) ol.getSize()); }
Source:
public static EventNotificationMethod valueOfString(String value) { return valueOf(value != null ? value.toUpperCase() : null); }

Target:
public static EventNotificationMethod valueOfString(String value) { return value != null ? valueOf(value.toUpperCase()) : null; }
Source:
private void processFlow(ExecutionReference reference, ExecutableFlow exflow, Set<Executor> availableExecutors) throws ExecutorManagerException { synchronized (exflow) { Executor selectedExecutor = selectExecutor(exflow, availableExecutors); if (selectedExecutor != null) { try { dispatch(reference, exflow, selectedExecutor); } catch (ExecutorManagerException e) { logger.debug(String.format( "Executor %s responded with exception for exec: %d", selectedExecutor, exflow.getExecutionId()), e); handleDispatchExceptionCase(reference, exflow, selectedExecutor, availableExecutors); } } else { handleNoExecutorSelectedCase(reference, exflow); } } }

Target:
private void processFlow(ExecutionReference reference, ExecutableFlow exflow, Set<Executor> availableExecutors) throws ExecutorManagerException { synchronized (exflow) { Executor selectedExecutor = selectExecutor(exflow, availableExecutors); if (selectedExecutor != null) { try { dispatch(reference, exflow, selectedExecutor); } catch (ExecutorManagerException e) { logger.warn(String.format( "Executor %s responded with exception for exec: %d", selectedExecutor, exflow.getExecutionId()), e); handleDispatchExceptionCase(reference, exflow, selectedExecutor, availableExecutors); } } else { handleNoExecutorSelectedCase(reference, exflow); } } }
Source:
protected boolean checkStoragePool() { if (!super.checkStoragePool()) return false; if (getStoragePool().getstatus() != StoragePoolStatus.Up) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_ACTIVE); return false; } return true; }

Target:
protected boolean checkStoragePool() { if (!super.checkStoragePool()) return false; if (getStoragePool().getstatus() == StoragePoolStatus.Uninitialized) { return true; } if (getStoragePool().getstatus() != StoragePoolStatus.Up) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_ACTIVE); return false; } return true; }
Source:
public void invoke() { PRPAIN201305UV02 request = new PRPAIN201305UV02(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); Properties webContextProperties = new Properties(); PatientDiscoveryDeferredRequestAuditLogger auditLogger = mock(PatientDiscoveryDeferredRequestAuditLogger.class); OutboundPatientDiscoveryDeferredRequestDelegate delegate = mock(OutboundPatientDiscoveryDeferredRequestDelegate.class); OutboundPatientDiscoveryDeferredRequestOrchestratable returnedOrchestratable = mock(OutboundPatientDiscoveryDeferredRequestOrchestratable.class); when(returnedOrchestratable.getResponse()).thenReturn(expectedResponse); when(delegate.process(any(OutboundPatientDiscoveryDeferredRequestOrchestratable.class))).thenReturn( returnedOrchestratable); PassthroughOutboundPatientDiscoveryDeferredRequest passthroughPatientDiscovery = new PassthroughOutboundPatientDiscoveryDeferredRequest( auditLogger, delegate); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.processPatientDiscoveryAsyncReq(request, assertion, targets); assertSame(expectedResponse, actualResponse); verify(auditLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME)); }

Target:
public void invoke() { PRPAIN201305UV02 request = new PRPAIN201305UV02(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); PatientDiscoveryDeferredRequestAuditLogger auditLogger = mock(PatientDiscoveryDeferredRequestAuditLogger.class); OutboundPatientDiscoveryDeferredRequestDelegate delegate = mock(OutboundPatientDiscoveryDeferredRequestDelegate.class); OutboundPatientDiscoveryDeferredRequestOrchestratable returnedOrchestratable = mock(OutboundPatientDiscoveryDeferredRequestOrchestratable.class); when(returnedOrchestratable.getResponse()).thenReturn(expectedResponse); when(delegate.process(any(OutboundPatientDiscoveryDeferredRequestOrchestratable.class))).thenReturn( returnedOrchestratable); PassthroughOutboundPatientDiscoveryDeferredRequest passthroughPatientDiscovery = new PassthroughOutboundPatientDiscoveryDeferredRequest( auditLogger, delegate); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.processPatientDiscoveryAsyncReq(request, assertion, targets); assertSame(expectedResponse, actualResponse); verify(auditLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME)); }
Source:
public static void setDisposition(int n, int num){ if(factionDisposition.get(n) <= 100) factionDisposition.set(n, factionDisposition.get(n) + num); }

Target:
public static void setDisposition(int n, int num) { if (factionDisposition.get(n) <= 100) { factionDisposition.set(n, factionDisposition.get(n) + num); } }
Source:
public AuditLogType getAuditLogTypeValue() { UserProfile existingProfile = getUserProfile(); if (existingProfile != null && isSSHPublicKeyUpdate(existingProfile)) { return getSucceeded() ? AuditLogType.USER_UPDATE_PROFILE : AuditLogType.USER_UPDATE_PROFILE_FAILED; } else { return getSucceeded() ? AuditLogType.USER_ADD_PROFILE : AuditLogType.USER_ADD_PROFILE_FAILED; } }

Target:
public AuditLogType getAuditLogTypeValue() { UserProfile existingProfile = getUserProfile(); if (existingProfile != null) { return getSucceeded() ? AuditLogType.USER_UPDATE_PROFILE : AuditLogType.USER_UPDATE_PROFILE_FAILED; } else { return getSucceeded() ? AuditLogType.USER_ADD_PROFILE : AuditLogType.USER_ADD_PROFILE_FAILED; } }
Source:
public RankedAdapterFactoryDescriptor.Registry getAdapterFactoryRegistry() { RankedAdapterFactoryDescriptorRegistryImpl rankedAdapterFactoryRegistry = new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, Multimaps .unmodifiableMultimap(adapterFactoryRegistry)); return rankedAdapterFactoryRegistry; }

Target:
public RankedAdapterFactoryDescriptor.Registry getAdapterFactoryRegistry() { return rankedAdapterFactoryRegistry; }
Source:
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) { ISelection selection = getSite().getSelectionProvider().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) selection; for (Object element : sSel.toArray()) { if (element instanceof TimeEvent) { TimeEvent event = (TimeEvent) element; IContributionItem contribItem = createOpenSourceCodeAction(getPresentationProvider().getEventHoverToolTipInfo(event, getTimeGraphViewer().getSelectionBegin())); if (contribItem != null) { menuManager.add(contribItem); } } } } }

Target:
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) { ISelection selection = getSite().getSelectionProvider().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) selection; for (Object element : sSel.toArray()) { if (element instanceof TimeEvent) { TimeEvent event = (TimeEvent) element; IContributionItem contribItem = createOpenSourceCodeAction(getPresentationProvider().getEventHoverToolTipInfo(event, getTimeGraphViewer().getSelectionBegin())); if (contribItem != null) { menuManager.add(contribItem); break; } } } } }
Source:
public void run() { LOG.debug("Creating new event pack"); EventPack pack = new EventPack(packSize); while (isRunning()) { try { FileTailerEvent event = queue.take(); pack.add(event); if (pack.isFull()) { LOG.debug("Event pack is full"); uploadEventPack(pack); LOG.debug("Saving File Tailer state"); stateProcessor.saveState(pack.getState()); LOG.debug("Cleanup event pack"); pack.clear(); } } catch (InterruptedException e) { LOG.info("Sink was interrupted"); break; } catch (IOException e) { LOG.info("Exception while sending events", e); break; } } LOG.info("Sink stopped."); }

Target:
public void run() { LOG.debug("Creating new event pack"); EventPack pack = new EventPack(packSize); List<FileTailerEvent> events = new ArrayList<FileTailerEvent>(packSize); while (isRunning()) { try { queue.drainTo(events, pack.getFreeSize()); pack.addAll(events); events.clear(); if (pack.isFull()) { LOG.debug("Event pack is full"); uploadEventPack(pack); LOG.debug("Saving File Tailer state"); stateProcessor.saveState(pack.getState()); LOG.debug("Cleanup event pack"); pack.clear(); } } catch (InterruptedException e) { LOG.info("Sink was interrupted"); break; } catch (IOException e) { LOG.warn("Exception while sending events", e); break; } } LOG.info("Sink stopped."); }
Source:
public Object[] transform(InputRow inputRow) { final String originalValue = inputRow.getValue(column); if (originalValue == null) { return new String[1]; } if (lookUpEveryToken) { SynonymCatalogConnection.Replacement replacement = synonymCatalogConnection.replaceInline(originalValue); return new Object[] { replacement.getReplacedString(), replacement.getSynonyms(), replacement.getMasterTerms() }; } else { final String replacedValue = lookup(originalValue); return new String[] { replacedValue }; } }

Target:
public Object[] transform(InputRow inputRow) { final String originalValue = inputRow.getValue(column); if (originalValue == null) { return new String[1]; } if (lookUpEveryToken) { final SynonymCatalogConnection.Replacement replacement = synonymCatalogConnection.replaceInline(originalValue); if (replacedSynonymsType == ReplacedSynonymsType.STRING) { return new Object[] { replacement.getReplacedString(), Joiner.on(' ').join(replacement.getSynonyms()), Joiner.on(' ').join(replacement.getMasterTerms()) }; } else { return new Object[] { replacement.getReplacedString(), replacement.getSynonyms(), replacement.getMasterTerms() }; } } else { final String replacedValue = lookup(originalValue); return new String[] { replacedValue }; } }
Source:
public int getMonitoringLocationFiles(ZipOutputStream target, String provider, String organization, String monitoringLocation) { LOG.trace("Getting file for: providers/{}/organizations/{}/monitoringLocation/{}", organization, monitoringLocation); StreamingCallbackHandler handler = new StreamingCallbackHandler(target); jdbcTemplate.query("select object_name, object_content from station_object where data_source = ? and organization = ? and site_id = ? order by object_id", new Object[] {provider, organization, monitoringLocation}, handler); return handler.getRowCount(); }

Target:
public int getMonitoringLocationFiles(ZipOutputStream target, String provider, String organization, String monitoringLocation) { LOG.trace("Getting file for: providers/{}/organizations/{}/monitoringLocation/{}", provider, organization, monitoringLocation); StreamingCallbackHandler handler = new StreamingCallbackHandler(target); jdbcTemplate.query("select object_name, object_content from station_object where data_source = ? and organization = ? and site_id = ? order by object_id", new Object[] {provider, organization, monitoringLocation}, handler); return handler.getRowCount(); }
Source:
@Test public void basicInjectionWithExtension() { ObjectGraph root = ObjectGraph.createWith(new TestingLoader(), new RootModule()); RealSingleton rs = root.get(RealSingleton.class); assertThat(rs.ints).contains(0, 1); ObjectGraph extension = root.plus(new ExtensionModule()); Main main = extension.get(Main.class); assertThat(main.ints).contains(0, 1, 2, 3); ObjectGraph extension2 = root.plus(new ExtensionModule()); Main main2 = extension2.get(Main.class); assertThat(main2.ints).contains(0, 1, 4, 5); }

Target:
@Test public void basicInjectionWithExtension() { ObjectGraph root = ObjectGraph.createWith(new TestingLoader(), new RootModule()); RealSingleton rs = root.get(RealSingleton.class); assertThat(rs.ints).containsOnly(0, 1); ObjectGraph extension = root.plus(new ExtensionModule()); Main main = extension.get(Main.class); assertThat(main.ints).containsOnly(0, 1, 2, 3); ObjectGraph extension2 = root.plus(new ExtensionModule()); Main main2 = extension2.get(Main.class); assertThat(main2.ints).containsOnly(0, 1, 4, 5); }
Source:
public void commit(Xid xid, boolean onePhase) throws XAException { log.infof("commit xid:[%s], %s one phase", xid, onePhase ? "with" : "without"); checker.addCommit(); }

Target:
public void commit(Xid xid, boolean onePhase) throws XAException { log.tracef("commit xid:[%s], %s one phase", xid, onePhase ? "with" : "without"); checker.addCommit(); }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of( MethodMatcher.create().name("wait"), MethodMatcher.create().name("wait").addParameter("long"), MethodMatcher.create().name("wait").addParameter("long").addParameter("int"), MethodMatcher.create().typeDefinition("java.util.concurrent.locks.Condition").name(NameCriteria.startsWith("await")).withNoParameterConstraint() ); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of( MethodMatcher.create().name("wait").withoutParameter(), MethodMatcher.create().name("wait").addParameter("long"), MethodMatcher.create().name("wait").addParameter("long").addParameter("int"), MethodMatcher.create().typeDefinition("java.util.concurrent.locks.Condition").name(NameCriteria.startsWith("await")).withAnyParameters() ); }
Source:
private boolean isAllowed(MutableHttpServletRequest request, String paramName) { String layersParam = request.getParameterIgnoreCase(paramName); List<Layer> all = layerService.findAll(); boolean match = false; for (Layer layer : all) { if (layer.getSource() instanceof ImageWmsLayerDataSource) { ImageWmsLayerDataSource source = (ImageWmsLayerDataSource) layer.getSource(); if (source.getLayerNames().equalsIgnoreCase(layersParam) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { match = true; } } } return match; }

Target:
private boolean isAllowed(MutableHttpServletRequest request, String paramName) { String layersParam = request.getParameterIgnoreCase(paramName); List<Layer> all = layerService.findAll(); boolean match = false; for (Layer layer : all) { if (layer.getSource() instanceof ImageWmsLayerDataSource) { ImageWmsLayerDataSource source = (ImageWmsLayerDataSource) layer.getSource(); if (source.getLayerNames().equalsIgnoreCase(layersParam) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { match = true; break; } } } return match; }
Source:
public static void main(String[] args) { LOG.info("Application started"); File configurationFile; if (args.length == 0) { configurationFile = new File(FileTailerMain.class.getClassLoader().getResource("file-tailer.properties").getPath()); } else if (args.length == 1) { configurationFile = new File(args[0]); } else { LOG.info("Too many arguments: {}. Requirement: 0 or 1", args.length); return; } PipeManager manager = new PipeManager(configurationFile); try { manager.setupPipes(); } catch (IOException e) { LOG.error("Error during flows: setup", e); return; } LOG.info("Staring flows"); manager.startUp(); Runtime.getRuntime().addShutdownHook(new Thread(new PipeShutdownTask(manager))); }

Target:
public static void main(String[] args) { LOG.info("Application started"); File configurationFile; if (args.length == 0) { configurationFile = new File(FileTailerMain.class.getClassLoader().getResource("file-tailer.properties").getPath()); } else if (args.length == 1) { configurationFile = new File(args[0]); } else { LOG.info("Too many arguments: {}. Requirement: 0 or 1", args.length); return; } PipeManager manager = new PipeManager(configurationFile); LOG.info("Staring pipes"); manager.startAsync(); Runtime.getRuntime().addShutdownHook(new Thread(new PipeShutdownTask(manager))); }
Source:
@Override public void complete(Bitmap result, Picasso.LoadedFrom from) { if (result == null) { throw new AssertionError( String.format("Attempted to complete action with no result!\n%s", this)); } ImageView target = this.target.get(); if (target == null) { return; } result.prepareToDraw(); Context context = picasso.context; boolean indicatorsEnabled = picasso.indicatorsEnabled; PicassoDrawable.setBitmap(target, context, result, from, noFade, indicatorsEnabled); if (callback != null) { callback.onSuccess(); } }

Target:
@Override public void complete(Bitmap result, Picasso.LoadedFrom from) { if (result == null) { throw new AssertionError( String.format("Attempted to complete action with no result!\n%s", this)); } ImageView target = this.target.get(); if (target == null) { return; } Context context = picasso.context; boolean indicatorsEnabled = picasso.indicatorsEnabled; PicassoDrawable.setBitmap(target, context, result, from, noFade, indicatorsEnabled); if (callback != null) { callback.onSuccess(); } }
Source:
private XMLGregorianCalendar getBeginDate(final Map<String, String> parameters) { if (parameters.containsKey(PlatformSmartmeteringKeys.KEY_BEGIN_DATE)) { try { final Date beginDate = SDF.parse(parameters.get(PlatformSmartmeteringKeys.KEY_BEGIN_DATE)); return DateConverter.createXMLGregorianCalendar(beginDate); } catch (final ParseException e) { LOGGER.debug("Error parsing begin date", e); } } LOGGER.debug("Key for begin date not found in parameters, using default value."); return DateConverter.createXMLGregorianCalendar(DEFAULT_BEGIN_DATE.toDate()); }

Target:
private XMLGregorianCalendar getBeginDate(final Map<String, String> parameters) { final DateTime dateTime = Helpers.getDate(parameters, PlatformSmartmeteringKeys.KEY_BEGIN_DATE, DEFAULT_BEGIN_DATE); return DateConverter.createXMLGregorianCalendar(dateTime.toDate()); }
Source:
public List<Integer> getRecoveredPartitions() { if (StringUtils.isEmpty(m_recoveredPartitions)) { return Lists.newArrayList(); } List<Integer> partitions = Stream.of(m_recoveredPartitions.split(",")) .map(Integer::parseInt).sorted().collect(Collectors.toList()); return partitions; }

Target:
public Set<Integer> getRecoveredPartitions() { Set<Integer> partitionSet = Sets.newHashSet(); if (StringUtils.isEmpty(m_recoveredPartitions)) { return partitionSet; } String partitions[] = m_recoveredPartitions.split(","); for (String partition : partitions) { try { partitionSet.add(Integer.valueOf(partition)); } catch (NumberFormatException e) { } } return partitionSet; }
Source:
protected String retrieveAuthorizationUrl(final WebContext context) { final String authorizationUrl; if (requiresStateParameter() || (stateData != null && !stateData.isEmpty())) { String state = getStateParameter(context); logger.debug("State parameter: {}", state); context.setSessionAttribute(getName() + STATE_PARAMETER, state); authorizationUrl = ((StateOAuth20Service) this.service).getAuthorizationUrl(state); } else { authorizationUrl = this.service.getAuthorizationUrl(null); } logger.debug("authorizationUrl : {}", authorizationUrl); return authorizationUrl; }

Target:
protected String retrieveAuthorizationUrl(final WebContext context) { final String authorizationUrl = this.service.getAuthorizationUrl(null); logger.debug("authorizationUrl : {}", authorizationUrl); return authorizationUrl; }
Source:
public void execute(final String containerName, ListContainerOptions listOptions) { final AtomicBoolean deleteFailure = new AtomicBoolean(); final int numOutStandingRequests = 1024; int retries = maxErrors; final Semaphore semaphore = new Semaphore(numOutStandingRequests); final List<AtomicReference<ListenableFuture<Void>>> outstandingFutures = Collections .synchronizedList(new ArrayList<AtomicReference<ListenableFuture<Void>>>()); while (retries > 0) { deleteFailure.set(false); executeOneIteration(containerName, listOptions.clone(), semaphore, outstandingFutures, deleteFailure); try { if (!semaphore.tryAcquire(numOutStandingRequests, maxTime, TimeUnit.MILLISECONDS)) { cancelOutstandingFutures(outstandingFutures); throw new BlobRuntimeException("Timeout while deleting blobs"); } semaphore.release(numOutStandingRequests); } catch (InterruptedException e) { logger.debug("Interrupted while waiting for blobs to be deleted"); cancelOutstandingFutures(outstandingFutures); Thread.currentThread().interrupt(); } if (deleteFailure.get() && --retries > 0) { String message = getMessage(containerName, listOptions); retryHandler.imposeBackoffExponentialDelay(maxErrors - retries, message); } else { break; } } if (retries == 0) { cancelOutstandingFutures(outstandingFutures); throw new BlobRuntimeException("Exceeded maximum retry attempts"); } }

Target:
public void execute(final String containerName, ListContainerOptions listOptions) { final AtomicBoolean deleteFailure = new AtomicBoolean(); int retries = maxErrors; final Semaphore semaphore = new Semaphore(maxParallelDeletes); final Set<ListenableFuture<Void>> outstandingFutures = Collections .synchronizedSet(new HashSet<ListenableFuture<Void>>()); while (retries > 0) { deleteFailure.set(false); executeOneIteration(containerName, listOptions.clone(), semaphore, outstandingFutures, deleteFailure, false); waitForCompletion(semaphore, outstandingFutures); if (deleteFailure.get() && --retries > 0) { String message = getMessage(containerName, listOptions); retryHandler.imposeBackoffExponentialDelay(maxErrors - retries, message); } else { break; } } if (retries == 0) { cancelOutstandingFutures(outstandingFutures); throw new BlobRuntimeException("Exceeded maximum retry attempts"); } }
Source:
private static List<File> search(File[] mounts, boolean isDirectChild) { List<File> candidates = new ArrayList<>(); for ( File f : mounts ) { if ( f.exists() && f.isDirectory() ) { if ( isDirectChild ) { if ( hasOdkInstancesDirectory(f) ) { candidates.add(f); } } else { File[] subdirs = f.listFiles(f1 -> f1.isDirectory()); for ( File s : subdirs ) { if ( hasOdkInstancesDirectory(s) ) { candidates.add(s); } } } } } return candidates; }

Target:
private static List<File> search(File[] mounts, boolean isDirectChild) { List<File> candidates = new ArrayList<>(); for ( File f : mounts ) { if ( f.exists() && f.isDirectory() ) { if ( isDirectChild ) { if ( hasOdkInstancesDirectory(f) ) { candidates.add(f); } } else { File[] subdirs = f.listFiles(file -> file.isDirectory()); for ( File s : subdirs ) { if ( hasOdkInstancesDirectory(s) ) { candidates.add(s); } } } } } return candidates; }
Source:
private void addLldpInfo(NetworkInterfaceModel nic) { insertHorizontalLine(); addRow(templates.strongTextWithColor(constants.lldpTlvs(), WHITE_TEXT_COLOR)); List<Tlv> tlvs = nic.getSetupModel().getNetworkTlvsByGuid().get(nic.getOriginalIface().getId()); if (tlvs != null) { tlvs.stream().filter(this::isTlvImportant) .forEach(tlv -> tlv.getProperties().entrySet().stream() .forEach(entry -> addRow(entry.getKey(), entry.getValue()))); } }

Target:
private void addLldpInfo(NetworkInterfaceModel nic) { HostSetupNetworksModel model = nic.getSetupModel(); Guid id = nic.getOriginalIface().getId(); List<Tlv> tlvs = model.getNetworkTlvsByGuid(id); insertHorizontalLine(); addRow(templates.strongTextWithColor(constants.linkLayerInfo(), WHITE_TEXT_COLOR)); if (tlvs != null) { tlvs.stream().filter(this::isTlvImportant) .forEach(tlv -> tlv.getProperties().entrySet().stream() .forEach(entry -> addRow(entry.getKey(), entry.getValue()))); } else { if (model.isNetworkTlvsPresent(id)) { addRow(SafeHtmlUtils.fromSafeConstant(constants.noLldpInfoAvailable())); } else { addRow(SafeHtmlUtils.fromSafeConstant(constants.fetchingLldpInfo())); } } }
Source:
public void layoutContainer(Container target) { synchronized (target.getTreeLock()) { synchronized (this.oppositeAlignedItems) { ParentDimensions targetDims = getTargetDimensions(target); List<Component> components = Arrays.asList(target.getComponents()); List<WrapLayoutRow> rows = getAllRows(components, true, targetDims.innerWidth); boolean ltr = target.getComponentOrientation().isLeftToRight(); boolean useBaseline = getAlignOnBaseline(); int rowY = targetDims.insets.top + getVgap(); int leftX = targetDims.insets.left + getHgap(); int rightX = targetDims.outerWidth - targetDims.insets.right - getHgap(); for (WrapLayoutRow row : rows) { int rowHeight = row.height; int curX = 0; if (row.components != null) { for (Component origComp : row.components) { curX += setComponentDims(origComp, useBaseline, ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap(); } } if (row.oppositeAligned != null) { curX = 0; Collections.reverse(row.oppositeAligned); for (Component oppAlignedComp : row.oppositeAligned) { curX += setComponentDims(oppAlignedComp, useBaseline, !ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap(); } } rowY += rowHeight + getVgap(); } } } }

Target:
public void layoutContainer(Container target) { ParentDimensions targetDims = getTargetDimensions(target); List<Component> components = Arrays.asList(target.getComponents()); List<WrapLayoutRow> rows = getAllRows(components, true, targetDims.getInnerWidth()); boolean ltr = target.getComponentOrientation().isLeftToRight(); boolean useBaseline = isAlignOnBaseline(); int rowY = targetDims.getInsets().top + getVerticalGap(); int leftX = targetDims.getInsets().left + getHorizontalGap(); int rightX = targetDims.getOuterWidth() - targetDims.getInsets().right - getHorizontalGap(); for (WrapLayoutRow row : rows) { int rowHeight = row.getHeight(); int curX = 0; if (row.getComponents() != null) { for (Component origComp : row.getComponents()) { curX += setComponentDims(origComp, useBaseline, ltr, rowY, rowHeight, leftX, rightX, curX) + getHorizontalGap(); } } if (row.getOppositeAligned() != null) { curX = 0; Collections.reverse(row.getOppositeAligned()); for (Component oppAlignedComp : row.getOppositeAligned()) { curX += setComponentDims(oppAlignedComp, useBaseline, !ltr, rowY, rowHeight, leftX, rightX, curX) + getHorizontalGap(); } } rowY += rowHeight + getVerticalGap(); } }
Source:
public void appendVerificationSubmissionState(long verificationId, VerificationState newState) { if (DELETE_ATTACHMENTS_STATES.contains(newState.getState())) { jdbcTemplate.update(SQL_DELETE_FILE_IDS, verificationId); } long stateId = idGenerator.generateNewId(IdType.VERIFICATION_SUBMISSION_ID); DBOVerificationState dbo = copyVerificationStateDTOtoDBO(verificationId, stateId, newState); basicDao.createNew(dbo); }

Target:
public void appendVerificationSubmissionState(long verificationId, VerificationState newState) { if (DELETE_ATTACHMENTS_STATES.contains(newState.getState())) { jdbcTemplate.update(SQL_DELETE_FILE_IDS, verificationId); jdbcTemplate.update(SQL_UPDATE_SUBMISSION_ETAG, verificationId); } long stateId = idGenerator.generateNewId(IdType.VERIFICATION_SUBMISSION_ID); DBOVerificationState dbo = copyVerificationStateDTOtoDBO(verificationId, stateId, newState); basicDao.createNew(dbo); }
Source:
private boolean validateCWL(String cwlFilePath) { final String[] s = { "cwltool", "--non-strict", "--validate", cwlFilePath }; try { io.cwl.avro.Utilities.executeCommand(Joiner.on(" ").join(Arrays.asList(s)), false, Optional.absent(), Optional.absent()); } catch (Exception ex) { return false; } return true; }

Target:
private boolean validateCWL(String cwlFilePath) { final String[] s = { "cwltool", "--non-strict", "--validate", cwlFilePath }; try { io.cwl.avro.Utilities.executeCommand(Joiner.on(" ").join(Arrays.asList(s)), false, Optional.absent(), Optional.absent()); return true; } catch (RuntimeException e) { return false; } catch (Exception e) { throw new RuntimeException("An unexpected exception unrelated to validation has occurred"); } }
Source:
public InputStatus emitNext(DataOutput<T> output) throws Exception { if (!isBlockedAvailability.isApproximatelyAvailable()) { return InputStatus.NOTHING_AVAILABLE; } return operator.emitNext(output); }

Target:
public InputStatus emitNext(DataOutput<T> output) throws Exception { if (isBlockedAvailability.isApproximatelyAvailable()) { return operator.emitNext(output); } return InputStatus.NOTHING_AVAILABLE; }
Source:
public static ShouldHavePeriod shouldHaveYears(Period actual, int actualYear, int expectedYear) { String metric; if (expectedYear == 1 || expectedYear == -1) { metric = "year"; } else { metric = "years"; } return new ShouldHavePeriod(actual, actualYear, expectedYear, metric); }

Target:
public static ShouldHavePeriod shouldHaveYears(Period actual, int actualYear, int expectedYear) { final String metric = Math.abs(expectedYear) == 1 ? "year" : "years"; return new ShouldHavePeriod(actual, actualYear, expectedYear, metric); }
Source:
protected UriBuilder createAuthorizationUrl(AuthenticationRequest request) { UriBuilder uriBuilder = super.createAuthorizationUrl(request); String nonce = UUID.randomUUID().toString(); request.getAuthenticationSession().setClientNote(BROKER_NONCE_PARAM, nonce); uriBuilder.queryParam(OIDCLoginProtocol.NONCE_PARAM, nonce); return uriBuilder; }

Target:
protected UriBuilder createAuthorizationUrl(AuthenticationRequest request) { UriBuilder uriBuilder = super.createAuthorizationUrl(request); String nonce = Base64Url.encode(KeycloakModelUtils.generateSecret(16)); AuthenticationSessionModel authenticationSession = request.getAuthenticationSession(); authenticationSession.setClientNote(BROKER_NONCE_PARAM, nonce); uriBuilder.queryParam(OIDCLoginProtocol.NONCE_PARAM, nonce); return uriBuilder; }
Source:
private void onFinish() { removeRedundantVolumesForOrphanedDisks(); getSnapshotDao().updateStatus(getParameters().getSnapshot().getId(), Snapshot.SnapshotStatus.OK); setSucceeded(true); }

Target:
private void onFinish() { removeRedundantVolumesForOrphanedDisks(); setSucceeded(true); }
Source:
public Object[][] get3PrimeSoftClipData() { return new Object[][]{ {"20M", true, 0}, {"20M", false, 0}, {"2H20M", true, 0}, {"2H20M", false, 0}, {"2S20M", false, 0}, {"2S20M", true, 2}, {"20M2S", true, 0}, {"20M2S", false, 2}, {"2S20M5S", false, 5}, {"2S20M4S", true, 2}, {"4S20M2S", true, 4}, {"4S20M2S", false, 2}, }; }

Target:
public Object[][] get3PrimeSoftClipData() { return new Object[][]{ {"20M", true, 0}, {"20M", false, 0}, {"5H2S", true, 0}, {"5H2S", false, 0}, {"5H2S6H", false, 0}, {"5H2S6H", true, 0}, {"2H20M", true, 0}, {"2H20M", false, 0}, {"2S20M", false, 0}, {"2S20M", true, 2}, {"20M2S", true, 0}, {"20M2S", false, 2}, {"20M2S4S", false, 6}, {"20M2S4S", true, 0}, {"2S20M5S", false, 5}, {"2S20M4S", true, 2}, {"4S20M2S", true, 4}, {"4S20M2S", false, 2}, {"2H3S10M4S5H", false,4}, {"2H3S10M4S5H", true,3}, }; }
Source:
private void lockEntities() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(getSnapshot(), SnapshotStatus.OK); getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.LOCKED); getCompensationContext().snapshotEntityStatus(getVm().getDynamicData(), VMStatus.Down); getCompensationContext().snapshotEntityStatus(getVm().getDynamicData(), VMStatus.ImageLocked); getCompensationContext().stateChanged(); return null; } }); freeLock(); }

Target:
private void lockEntities() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(getSnapshot(), getSnapshot().getStatus()); getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.LOCKED); getCompensationContext().snapshotEntityStatus(getVm().getDynamicData(), getVm().getDynamicData().getstatus()); getVmDynamicDao().updateStatus(getVm().getId(), VMStatus.ImageLocked); getCompensationContext().stateChanged(); return null; } }); freeLock(); }
Source:
private void showPopup(MouseEvent me) { if (!me.isPopupTrigger()) return; int row = financeTable.getSelectedRow(); if (row < 0) return; JPopupMenu popup = new JPopupMenu(); JMenu menu = new JMenu(I18N.getString("menu.gmMode")); popup.add(menu); menu.add(makeGMOnlyItem("DELETE", I18N.getString("menu.gmMode.action.delete"), (idx, tx) -> { gui.getCampaign().addReport(tx.voidTransaction()); financeModel.deleteTransaction(idx); MekHQ.triggerEvent(new TransactionVoidedEvent(tx)); })); menu.add(makeGMOnlyItem("EDIT", I18N.getString("menu.gmMode.action.edit"), (idx, tx) -> { EditTransactionDialog dialog = new EditTransactionDialog(tx, gui.getFrame(), true); dialog.setVisible(true); if (!tx.equals(dialog.getOldTransaction())) { financeModel.setTransaction(idx, tx); MekHQ.triggerEvent(new TransactionChangedEvent(dialog.getOldTransaction(), tx)); gui.getCampaign().addReport(tx.updateTransaction(dialog.getOldTransaction())); } })); popup.show(me.getComponent(), me.getX(), me.getY()); }

Target:
private void showPopup(MouseEvent me) { if (!me.isPopupTrigger()) { return; } int row = financeTable.getSelectedRow(); if (row < 0) { return; } JPopupMenu popup = new JPopupMenu(); JMenu menu = new JMenu(I18N.getString("menu.gmMode")); popup.add(menu); menu.add(makeGMOnlyItem("DELETE", I18N.getString("menu.gmMode.action.delete"), (idx, tx) -> { gui.getCampaign().addReport(tx.voidTransaction()); financeModel.deleteTransaction(idx); MekHQ.triggerEvent(new TransactionVoidedEvent(tx)); })); menu.add(makeGMOnlyItem("EDIT", I18N.getString("menu.gmMode.action.edit"), (idx, tx) -> { EditTransactionDialog dialog = new EditTransactionDialog(tx, gui.getFrame(), true); dialog.setVisible(true); if (!tx.equals(dialog.getOldTransaction())) { financeModel.setTransaction(idx, tx); MekHQ.triggerEvent(new TransactionChangedEvent(dialog.getOldTransaction(), tx)); gui.getCampaign().addReport(tx.updateTransaction(dialog.getOldTransaction())); } })); popup.show(me.getComponent(), me.getX(), me.getY()); }
Source:
public static String getSignature(String name, Class<?>[] parameterTypes) { StringBuilder signature = new StringBuilder( name.length() + 2 + parameterTypes.length * 25 ); signature.append( name ).append( "(" ); boolean separator = false; for ( Class<?> parameterType : parameterTypes ) { if ( separator ) { signature.append( "," ); } else { separator = true; } signature.append( parameterType.getName() ); } signature.append( ")" ); return signature.toString(); }

Target:
public static Signature getSignature(String name, Class<?>[] parameterTypes) { return new Signature( name, parameterTypes ); }
Source:
public void testUpdateNode() throws Exception { final DefaultDockerClient dockerClient = new DefaultDockerClient(builder); enqueueServerApiVersion("1.28"); enqueueServerApiResponse(200, "fixtures/1.28/listNodes.json"); final List<Node> nodes = dockerClient.listNodes(); assertThat(nodes.size(), is(1)); final Node node = nodes.get(0); assertThat(node.id(), is("24ifsmvkjbyhk")); assertThat(node.version().index(), is(8L)); assertThat(node.spec().name(), is("my-node")); assertThat(node.spec().role(), is("manager")); assertThat(node.spec().availability(), is("active")); assertThat(node.spec().labels(), hasKey(is("foo"))); final NodeSpec updatedNodeSpec = NodeSpec.builder(node.spec()) .addLabel("foobar", "foobar") .build(); enqueueServerApiVersion("1.28"); enqueueServerApiEmptyResponse(200); dockerClient.updateNode(node.id(), node.version().index(), updatedNodeSpec); }

Target:
public void testUpdateNode() throws Exception { final DefaultDockerClient dockerClient = new DefaultDockerClient(builder); enqueueServerApiVersion("1.28"); enqueueServerApiResponse(200, "fixtures/1.28/listNodes.json"); final List<Node> nodes = dockerClient.listNodes(); assertThat(nodes.size(), is(1)); final Node node = nodes.get(0); assertThat(node.id(), equalTo("24ifsmvkjbyhk")); assertThat(node.version().index(), equalTo(8L)); assertThat(node.spec().name(), equalTo("my-node")); assertThat(node.spec().role(), equalTo("manager")); assertThat(node.spec().availability(), equalTo("active")); assertThat(node.spec().labels(), hasKey(equalTo("foo"))); final NodeSpec updatedNodeSpec = NodeSpec.builder(node.spec()) .addLabel("foobar", "foobar") .build(); enqueueServerApiVersion("1.28"); enqueueServerApiEmptyResponse(200); dockerClient.updateNode(node.id(), node.version().index(), updatedNodeSpec); }
Source:
private String getDefaultDefinition(final ColumnModel column) { if (!column.hasDefaultValue() && !column.isNotNull()) { return ""; } if (column.hasDefaultValue()) { return " DEFAULT '" + column.getDefaultValue() + "'"; } return " DEFAULT " + getFalseLiteralValue(); }

Target:
private String getDefaultDefinition(final ColumnModel column) { if (!column.hasDefaultValue() && !column.isNotNull()) { return ""; } if (column.hasDefaultValue()) { return " DEFAULT '" + (column.getDefaultValue(Boolean.class) ? getTrueLiteralValue() : getFalseLiteralValue()) + "'"; } return " DEFAULT " + getFalseLiteralValue(); }
Source:
public Optional<Repository> getRepository(Class<? extends Message> stateClass) { final RepositoryAccess repositoryAccess = repositories.get(stateClass); if (repositoryAccess == null) { throw newIllegalArgumentException( "A repository for the state class (%s) was not registered in VisibilityGuard", stateClass.getName()); } return repositoryAccess.get(); }

Target:
public Optional<Repository> getRepository(Class<? extends Message> stateClass) { checkNotNull(stateClass); final RepositoryAccess repositoryAccess = repositories.get(stateClass); if (repositoryAccess == null) { throw newIllegalArgumentException( "A repository for the state class (%s) was not registered in VisibilityGuard", stateClass.getName()); } return repositoryAccess.get(); }
Source:
public ParseSpec withTimestampSpec(TimestampSpec spec) { return new JSONParseSpec(spec, getDimensionsSpec(), flattenSpec); }

Target:
public ParseSpec withTimestampSpec(TimestampSpec spec) { return new JSONParseSpec(spec, getDimensionsSpec(), getFlattenSpec()); }
Source:
public void setErrataDetailPanelVisibilty(boolean visible) { logger.info("updateErrataDetailPanelVisibilty"); splitLayoutPanel.clear(); if (visible) { splitLayoutPanel.addSouth(errataDetailPanel, SOUTH_SIZE); } splitLayoutPanel.add(errataTableView); }

Target:
public void setErrataDetailPanelVisibilty(boolean visible) { splitLayoutPanel.clear(); if (visible) { splitLayoutPanel.addSouth(errataDetailPanel, SOUTH_SIZE); } splitLayoutPanel.add(errataTableView); }
Source:
private Collection<Unit> getUnprotectedUnits(final BattleState.Side side) { final Collection<Unit> unitsToKill; unitsToKill = CollectionUtils.getMatches( battleState.getUnits(EnumSet.of(side)), getActiveUnits().and(Matches.unitIsNotInfrastructure())); return unitsToKill; }

Target:
private Collection<Unit> getUnprotectedUnits(final BattleState.Side side) { return CollectionUtils.getMatches( battleState.getUnits(side), Matches.unitIsActiveInTerritory(battleState.getBattleSite()) .and(Matches.unitIsNotInfrastructure())); }