auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void reportIssues() { Iterator<NPEContext> i = detectedIssues.iterator(); while (i.hasNext()) { NPEContext context = i.next(); reportIssue(context.symbolicValue, context.tree, context.node); i.remove(); } }

Target:
private void reportIssues() { Set<NullDereferenceIssue> issues = detectedIssues.pop(); issues.forEach(issue -> reportIssue(issue.symbolicValue, issue.tree, issue.node)); }
Source:
protected void init() { super.init(); if (getDiskImage().getVmEntityType().isTemplateType()) { initVmTemplateId(); } addCustomValue("DiskAlias", getDiskImage().getDiskAlias()); }

Target:
protected void init() { super.init(); if (getDiskImage().getVmEntityType().isTemplateType()) { initVmTemplateId(); } }
Source:
public Object[] getElements(Object inputElement) { ILaunchConfiguration[] all = null; try { all = LaunchConfigurationManager.filterConfigs(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations()); } catch (CoreException e) { DebugUIPlugin.log(e); return new ILaunchConfiguration[0]; } List<ILaunchConfiguration> list = new ArrayList<>(all.length); ViewerFilter filter = new LaunchGroupFilter(fHistory.getLaunchGroup()); for (ILaunchConfiguration a : all) { if (filter.select(null, null, a)) { list.add(a); } } list.removeAll(fCurrentFavoriteSet); Object[] objs = list.toArray(); new WorkbenchViewerComparator().sort(getCheckBoxTableViewer(), objs); return objs; }

Target:
public Object[] getElements(Object inputElement) { ILaunchConfiguration[] all = null; try { all = LaunchConfigurationManager.filterConfigs(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations()); } catch (CoreException e) { DebugUIPlugin.log(e); return new ILaunchConfiguration[0]; } List<ILaunchConfiguration> list = new ArrayList<>(all.length); ViewerFilter filter = new LaunchGroupFilter(fHistory.getLaunchGroup()); for (ILaunchConfiguration config : all) { if (filter.select(null, null, config)) { list.add(config); } } list.removeAll(fCurrentFavoriteSet); Object[] objs = list.toArray(); new WorkbenchViewerComparator().sort(getCheckBoxTableViewer(), objs); return objs; }
Source:
public List<WorkerLostStorageInfo> getWorkerLostStorage() throws IOException { return retryRPC(() -> mClient .getWorkerLostStorage(GetWorkerLostStoragePOptions.getDefaultInstance()) .getWorkerLostStorageInfoList(), LOG, "GetWorkerLostStorage", "options=%s", ""); }

Target:
public List<WorkerLostStorageInfo> getWorkerLostStorage() throws IOException { return retryRPC(() -> mClient .getWorkerLostStorage(GetWorkerLostStoragePOptions.getDefaultInstance()) .getWorkerLostStorageInfoList(), RPC_LOG, "GetWorkerLostStorage", ""); }
Source:
public void setUp() { logoutIfNecessary(); stubFor(get(urlEqualTo("/rest/v1.1/me/")) .inScenario("Sign up") .whenScenarioStateIs(Scenario.STARTED)); }

Target:
public void setUp() { logoutIfNecessary(); }
Source:
protected void run() throws UnloggedFailure { nw = columns - 50; Date now = new Date(); stdout.format( "%-25s %-20s now %16s\n", "Gerrit Code Review", Version.getVersion() != null ? Version.getVersion() : "", new SimpleDateFormat("HH:mm:ss zzz").format(now)); stdout.format( "%-25s %-20s uptime %16s\n", "", "", uptime(now.getTime() - serverStarted)); stdout.print('\n'); stdout.print(String.format( "%1s %-"+nw+"s|%-21s| %-5s |%-9s|\n" , "" , "Name" , "Entries" , "AvgGet" , "Hit Ratio" )); stdout.print(String.format( "%1s %-"+nw+"s|%6s %6s %7s| %-5s |%-4s %-4s|\n" , "" , "" , "Mem" , "Disk" , "Space" , "" , "Mem" , "Disk" )); stdout.print("--"); for (int i = 0; i < nw; i++) { stdout.print('-'); } stdout.print("+---------------------+---------+---------+\n"); Collection<CacheInfo> caches = getCaches(); printMemoryCoreCaches(caches); printMemoryPluginCaches(caches); printDiskCaches(caches); stdout.print('\n'); sshSummary(); SummaryInfo summary = getSummary.get().setGc(gc).setJvm(showJVM).apply(new ConfigResource()); taskSummary(summary.taskSummary); memSummary(summary.memSummary); threadSummary(summary.threadSummary); if (summary.jvmSummary != null) { jvmSummary(summary.jvmSummary); } stdout.flush(); }

Target:
protected void run() throws UnloggedFailure { nw = columns - 50; Date now = new Date(); stdout.format( "%-25s %-20s now %16s\n", "Gerrit Code Review", Version.getVersion() != null ? Version.getVersion() : "", new SimpleDateFormat("HH:mm:ss zzz").format(now)); stdout.format( "%-25s %-20s uptime %16s\n", "", "", uptime(now.getTime() - serverStarted)); stdout.print('\n'); stdout.print(String.format( "%1s %-"+nw+"s|%-21s| %-5s |%-9s|\n" , "" , "Name" , "Entries" , "AvgGet" , "Hit Ratio" )); stdout.print(String.format( "%1s %-"+nw+"s|%6s %6s %7s| %-5s |%-4s %-4s|\n" , "" , "" , "Mem" , "Disk" , "Space" , "" , "Mem" , "Disk" )); stdout.print("--"); for (int i = 0; i < nw; i++) { stdout.print('-'); } stdout.print("+---------------------+---------+---------+\n"); Collection<CacheInfo> caches = getCaches(); printMemoryCoreCaches(caches); printMemoryPluginCaches(caches); printDiskCaches(caches); stdout.print('\n'); sshSummary(); SummaryInfo summary = getSummary.get().setGc(gc).setJvm(showJVM).apply(new ConfigResource()); taskSummary(summary.taskSummary); memSummary(summary.memSummary); threadSummary(summary.threadSummary); if (showJVM && summary.jvmSummary != null) { jvmSummary(summary.jvmSummary); } stdout.flush(); }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof EntitlementDTO && super.equals(obj)) { EntitlementDTO that = (EntitlementDTO) obj; String thisOwnerId = this.getOwner() != null ? this.getOwner().getId() : null; String thatOwnerId = that.getOwner() != null ? that.getOwner().getId() : null; String thisPoolId = this.getPool() != null ? this.getPool().getId() : null; String thatPoolId = that.getPool() != null ? that.getPool().getId() : null; String thisConsumerId = this.getConsumer() != null ? this.getConsumer().getUuid() : null; String thatConsumerId = that.getConsumer() != null ? that.getConsumer().getUuid() : null; EqualsBuilder builder = new EqualsBuilder() .append(this.getId(), that.getId()) .append(thisOwnerId, thatOwnerId) .append(thisPoolId, thatPoolId) .append(thisConsumerId, thatConsumerId) .append(this.getQuantity(), that.getQuantity()) .append(this.isDirty(), that.isDirty()) .append(this.getEndDateOverride(), that.getEndDateOverride()) .append(this.isUpdatedOnStart(), that.isUpdatedOnStart()) .append(this.isDeletedFromPool(), that.isDeletedFromPool()) .append(this.getEndDate(), that.getEndDate()) .append(this.getStartDate(), that.getStartDate()); boolean equals = builder.isEquals(); equals = equals && Util.collectionsAreEqual(this.getCertificates(), that.getCertificates()); return equals; } return false; }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof EntitlementDTO && super.equals(obj)) { EntitlementDTO that = (EntitlementDTO) obj; String thisOwnerId = this.getOwner() != null ? this.getOwner().getId() : null; String thatOwnerId = that.getOwner() != null ? that.getOwner().getId() : null; String thisPoolId = this.getPool() != null ? this.getPool().getId() : null; String thatPoolId = that.getPool() != null ? that.getPool().getId() : null; String thisConsumerId = this.getConsumer() != null ? this.getConsumer().getUuid() : null; String thatConsumerId = that.getConsumer() != null ? that.getConsumer().getUuid() : null; EqualsBuilder builder = new EqualsBuilder() .append(this.getId(), that.getId()) .append(thisOwnerId, thatOwnerId) .append(thisPoolId, thatPoolId) .append(thisConsumerId, thatConsumerId) .append(this.getQuantity(), that.getQuantity()) .append(this.isDeletedFromPool(), that.isDeletedFromPool()) .append(this.getEndDate(), that.getEndDate()) .append(this.getStartDate(), that.getStartDate()); boolean equals = builder.isEquals(); equals = equals && Util.collectionsAreEqual(this.getCertificates(), that.getCertificates(), new Comparator<CertificateDTO>() { @Override public int compare(CertificateDTO c1, CertificateDTO c2) { if (c1 == c2) { return 0; } if (c1 != null && c1.getId() != null) { return c1.getId().compareTo(c2.getId()); } return 1; } }); return equals; } return false; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(this.command + "\n"); for (String key: this.headers.keySet()){ builder.append(key + ":" + this.headers.get(key) + "\n"); } builder.append("\n"); if (Command.SEND.toString().equals(this.command)) { JsonRpcRequest request = JsonRpcRequest.fromByteArray(this.content); builder.append(request.toString()); } else if (Command.MESSAGE.toString().equals(this.command)) { JsonRpcResponse response = JsonRpcResponse.fromByteArray(this.content); builder.append(response.toString()); } return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(this.command).append("\n"); for (String key : this.headers.keySet()) { builder.append(key).append(":").append(this.headers.get(key)).append("\n"); } builder.append("\n"); if (Command.SEND.toString().equals(this.command)) { JsonRpcRequest request = JsonRpcRequest.fromByteArray(this.content); builder.append(request.toString()); } else if (Command.MESSAGE.toString().equals(this.command)) { JsonRpcResponse response = JsonRpcResponse.fromByteArray(this.content); builder.append(response.toString()); } return builder.toString(); }
Source:
private byte[] toBytes(long checkpointId) throws Exception { EnumChkT enumCkpt = enumerator.snapshotState(); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(baos)) { out.writeInt(enumCheckpointSerializer.getVersion()); out.writeObject(enumCheckpointSerializer.serialize(enumCkpt)); context.snapshotState(checkpointId, splitSerializer, out); out.flush(); return baos.toByteArray(); } }

Target:
private byte[] toBytes(long checkpointId) throws Exception { EnumChkT enumCkpt = enumerator.snapshotState(); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputViewStreamWrapper(baos)) { writeCoordinatorSerdeVersion(out); out.writeInt(enumCheckpointSerializer.getVersion()); byte[] serialziedEnumChkpt = enumCheckpointSerializer.serialize(enumCkpt); out.writeInt(serialziedEnumChkpt.length); out.write(serialziedEnumChkpt); context.snapshotState(checkpointId, splitSerializer, out); out.flush(); return baos.toByteArray(); } }
Source:
public void onNext(T t) { SwitchMapSingleObserver<R> current = inner.get(); if (current != null) { current.dispose(); } SingleSource<? extends R> ms; try { ms = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null SingleSource"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); upstream.dispose(); inner.getAndSet((SwitchMapSingleObserver)INNER_DISPOSED); onError(ex); return; } SwitchMapSingleObserver<R> observer = new SwitchMapSingleObserver<R>(this); for (;;) { current = inner.get(); if (current == INNER_DISPOSED) { break; } if (inner.compareAndSet(current, observer)) { ms.subscribe(observer); break; } } }

Target:
public void onNext(T t) { SwitchMapSingleObserver<R> current = inner.get(); if (current != null) { current.dispose(); } SingleSource<? extends R> ss; try { ss = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null SingleSource"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); upstream.dispose(); inner.getAndSet((SwitchMapSingleObserver)INNER_DISPOSED); onError(ex); return; } SwitchMapSingleObserver<R> observer = new SwitchMapSingleObserver<R>(this); for (;;) { current = inner.get(); if (current == INNER_DISPOSED) { break; } if (inner.compareAndSet(current, observer)) { ss.subscribe(observer); break; } } }
Source:
public boolean equals(Object o) { if (o instanceof Bounds) { Bounds other = (Bounds) o; return ((null != ul) ? ul.equals(other.ul) : null == other.ul) && ((null != lr) ? lr.equals(other.lr) : null == other.lr); } return false; }

Target:
public boolean equals(Object o) { if (o instanceof Bounds) { Bounds other = (Bounds) o; return Objects.equals(ul, other.ul) && Objects.equals(lr, other.lr); } return false; }
Source:
private void initEnvironmentMasterKeyService() { if (environmentMasterKeyService == null) { Configuration configuration = new Configuration(); try { environmentMasterKeyService = MasterKeyServiceImpl.getMasterKeyService(null, configuration.getMasterKeyLocation(), configuration.isMasterKeyPersisted()); } catch (AmbariException e) { throw new SecurityException("You are trying to use a persisted master key but its initialization has been failed!", e); } } }

Target:
private void initEnvironmentMasterKeyService() { if (environmentMasterKeyService == null) { environmentMasterKeyService = new MasterKeyServiceImpl(configuration); if (!environmentMasterKeyService.isMasterKeyInitialized()) { throw new SecurityException("You are trying to use a persisted master key but its initialization has been failed!"); } } }
Source:
public void before() throws Exception { Map<String, Object> config = new HashMap<>(); config.put(ROOT_PATH_KEY, ROOT_PATH); localFileSystemBackend = spy(new LocalFileSystemStorage()); localFileSystemBackend.init(config); PhysicalPlans.InstanceInfo info = PhysicalPlans.InstanceInfo.newBuilder() .setTaskId(TASK_ID) .setComponentIndex(COMPONENT_INDEX) .setComponentName(COMPONENT_NAME) .build(); instance = PhysicalPlans.Instance.newBuilder() .setInstanceId(INSTANCE_ID) .setStmgrId(STMGR_ID) .setInfo(info) .build(); checkpoint = InstanceStateCheckpoint.newBuilder() .setCheckpointId(CHECKPOINT_ID) .setState(ByteString.copyFrom(BYTES)) .build(); saveInstanceStateRequest = SaveInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpoint(checkpoint) .build(); getInstanceStateRequest = GetInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpointId(CHECKPOINT_ID) .build(); }

Target:
public void before() throws Exception { Map<String, Object> config = new HashMap<>(); config.put(StatefulStorageTestContext.ROOT_PATH_KEY, StatefulStorageTestContext.ROOT_PATH); localFileSystemStorage = spy(new LocalFileSystemStorage()); localFileSystemStorage.init(config); instance = StatefulStorageTestContext.getInstance(); checkpoint = StatefulStorageTestContext.getInstanceStateCheckpoint(); }
Source:
private void processClientHello(final ClientHello clientHello, final Record record, final Connection connection) throws HandshakeException { if (LOGGER.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Processing CLIENT_HELLO from peer [").append(record.getPeerAddress()).append("]"); if (LOGGER.isTraceEnabled()) { msg.append(":").append(StringUtil.lineSeparator()).append(record); } LOGGER.debug(msg.toString()); } if (record.getEpoch() > 0) { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, clientHello.getPeer()), session); } else if (isClientInControlOfSourceIpAddress(clientHello, record)) { if (isHandshakeAlreadyStartedForMessage(clientHello, connection)) { processOngoingHandshakeMessage(clientHello, record, connection); } else if (clientHello.hasSessionId()) { resumeExistingSession(clientHello, record); } else { terminateConnection(connection); startNewHandshake(clientHello, record); } } }

Target:
private void processClientHello(final ClientHello clientHello, final Record record, final Connection connection) throws HandshakeException { if (LOGGER.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Processing CLIENT_HELLO from peer [").append(record.getPeerAddress()).append("]"); if (LOGGER.isTraceEnabled()) { msg.append(":").append(StringUtil.lineSeparator()).append(record); } LOGGER.debug(msg.toString()); } if (record.getEpoch() > 0) { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, clientHello.getPeer()), session); return; } if (isClientInControlOfSourceIpAddress(clientHello, record)) { if (isHandshakeAlreadyStartedForMessage(clientHello, connection)) { processOngoingHandshakeMessage(clientHello, record, connection); } else if (clientHello.hasSessionId()) { resumeExistingSession(clientHello, record); } else { terminateConnection(connection); startNewHandshake(clientHello, record); } } }
Source:
public Chart generateChart(BarData data) { BarChart chart = new BarChart(StatisticsScreen.this); chart.setDrawGridBackground(false); chart.getLegend().setTextColor(Color.WHITE); chart.getXAxis().setTextColor(Color.WHITE); chart.getAxisLeft().setTextColor(Color.WHITE); chart.getAxisRight().setTextColor(Color.WHITE); chart.getAxisLeft().setValueFormatter(new ChartYAxisValueFormatter()); chart.getAxisRight().setValueFormatter(new ChartYAxisValueFormatter()); chart.setData(data); chart.setDescription(""); return chart; }

Target:
public Chart generateChart(BarData data) { BarChart chart = new BarChart(StatisticsScreen.this); chart.setDrawGridBackground(false); chart.getLegend().setTextColor(Color.WHITE); chart.getXAxis().setTextColor(Color.WHITE); chart.getAxisLeft().setTextColor(Color.WHITE); chart.getAxisRight().setTextColor(Color.WHITE); chart.getAxisLeft().setValueFormatter(yAxisValueFormatter); chart.getAxisRight().setValueFormatter(yAxisValueFormatter); chart.setData(data); chart.setDescription(""); return chart; }
Source:
public void testLoadOrderedPublicEvents_9() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", "status") .param("direction", FieldSearchFilter.ASC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {"EVN193", "EVN194", "EVN191", "EVN25", "EVN21", "EVN24", "EVN23", "EVN192", "EVN20"}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } }

Target:
public void testLoadOrderedPublicEvents_9() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", "status") .param("direction", FieldSearchFilter.ASC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN193"))) .andExpect(jsonPath("$.payload[1].id", is("EVN194"))) .andExpect(jsonPath("$.payload[2].id", is("EVN191"))) .andExpect(jsonPath("$.payload[3].id", is("EVN25"))) .andExpect(jsonPath("$.payload[4].id", is("EVN21"))) .andExpect(jsonPath("$.payload[5].id", is("EVN24"))) .andExpect(jsonPath("$.payload[6].id", is("EVN23"))) .andExpect(jsonPath("$.payload[7].id", is("EVN192"))) .andExpect(jsonPath("$.payload[8].id", is("EVN20"))); }
Source:
void setContents(InputStream stream) throws CoreException { try { fArch = null; fContainers = null; fImplicit = null; fJREContainer = null; fIncluded = null; fName = null; fNL = null; fOS = null; fProgramArgs = null; fVMArgs = null; fWS = null; fSequenceNumber = 0; fDocument = null; fRoot = null; TargetDefinitionPersistenceHelper.initFromXML(this, stream); } catch (ParserConfigurationException e) { setDocument(createNewDocument()); abort(Messages.TargetDefinition_0, e); } catch (SAXException e) { setDocument(createNewDocument()); abort(Messages.TargetDefinition_0, e); } catch (IOException e) { setDocument(createNewDocument()); abort(Messages.TargetDefinition_0, e); } }

Target:
void setContents(InputStream stream) throws CoreException { try { fArch = null; fContainers = null; fImplicit = null; fJREContainer = null; fIncluded = null; fName = null; fNL = null; fOS = null; fProgramArgs = null; fVMArgs = null; fWS = null; fSequenceNumber = 0; fDocument = null; fRoot = null; TargetDefinitionPersistenceHelper.initFromXML(this, stream); } catch (ParserConfigurationException | SAXException | IOException e) { setDocument(createNewDocument()); abort(Messages.TargetDefinition_0, e); } }
Source:
public XML read() throws IOException { final String memo = this.item.get(DyRepo.ATTR_MEMO).getS(); return new StrictXML( Memo.CLEANUP.transform( new XMLDocument(memo) ), Memo.SCHEMA ); }

Target:
public XML read() throws IOException { return new StrictXML( Memo.CLEANUP.transform( new XMLDocument(this.item.get(DyRepo.ATTR_MEMO).getS()) ), Memo.SCHEMA ); }
Source:
public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException { checkParameterCount(parameters, 0, 4); Object[] values = parameters.toArray(); format = ((CompoundVariable) values[0]).execute(); dateToShift = ((CompoundVariable) values[1]).execute(); amountToShift = ((CompoundVariable) values[2]).execute(); variableName = ((CompoundVariable) values[3]).execute().trim(); }

Target:
public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException { checkParameterCount(parameters, 0, 4); Object[] values = parameters.toArray(); format = ((CompoundVariable) values[0]).execute().trim(); dateToShift = ((CompoundVariable) values[1]).execute().trim(); amountToShift = ((CompoundVariable) values[2]).execute().trim(); variableName = ((CompoundVariable) values[3]).execute().trim(); if (dateTimeFormatterCache == null) { dateTimeFormatterCache = buildCache(); } }
Source:
private TableEventRequest tableRequest(int queryCount, long queryIndex, Map<Long, ITmfEventAspect<?>> aspects, @Nullable ITmfFilter searchFilter, boolean forwardSearch, @Nullable ITmfFilter collapseFilter, @Nullable IProgressMonitor monitor) { return new TableEventRequest(queryIndex) { private long rank = queryIndex; @Override public void handleData(ITmfEvent event) { super.handleData(event); if (monitor != null && monitor.isCanceled()) { cancel(); return; } List<EventTableLine> events = getEventLines(); if ((searchFilter == null || searchFilter.matches(event)) && (collapseFilter == null || collapseFilter.matches(event))) { if (events.size() < queryCount) { EventTableLine eventLine = buildEventTableLine(aspects, event, rank, rank); events.add(eventLine); } } else if (collapseFilter != null && !events.isEmpty()) { int lastIndex = events.size() - 1; EventTableLine prevLine = events.get(lastIndex); long prevRepeatCount = prevLine.getRepeatCount(); events.set(lastIndex, new EventTableLine(prevLine.getLine(), prevLine.getIndex(), prevLine.getTimestamp(), prevLine.getRank(), prevRepeatCount++)); } if ((searchFilter != null && !forwardSearch && getNbRead() == queryCount) || events.size() == queryCount) { done(); return; } rank++; } }; }

Target:
private TableEventRequest tableRequest(int queryCount, long queryIndex, Map<Long, ITmfEventAspect<?>> aspects, @Nullable ITmfFilter searchFilter, boolean forwardSearch, @Nullable ITmfFilter collapseFilter, @Nullable IProgressMonitor monitor) { return new TableEventRequest(queryIndex) { private long rank = queryIndex; @Override public void handleData(ITmfEvent event) { super.handleData(event); if (monitor != null && monitor.isCanceled()) { cancel(); return; } List<EventTableLine> events = getEventLines(); if ((searchFilter == null || searchFilter.matches(event)) && (collapseFilter == null || collapseFilter.matches(event))) { if (events.size() < queryCount) { events.add(buildEventTableLine(aspects, event, rank, rank)); } } else if (collapseFilter != null && !events.isEmpty()) { int lastIndex = events.size() - 1; EventTableLine prevLine = events.get(lastIndex); long prevRepeatCount = prevLine.getRepeatCount(); events.set(lastIndex, new EventTableLine(prevLine.getLine(), prevLine.getIndex(), prevLine.getTimestamp(), prevLine.getRank(), prevRepeatCount++)); } if ((searchFilter != null && !forwardSearch && getNbRead() == queryCount) || events.size() == queryCount) { done(); return; } rank++; } }; }
Source:
protected void drawForeground(final int mouseX, final int mouseY) { super.drawForeground(mouseX, mouseY); FluidInstance fluid = tankEntity.getTank().getFluidInstance(); if (fluid.isEmpty()) { font.draw("Empty", 10, 20, 4210752); } else { font.draw("Fluid Type:", 10, 20, 4210752); font.draw(FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752); font.draw("Fluid Amount:", 10, 50, 4210752); font.draw(fluid.getAmount().toString(), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getCapacity().getRawValue() * 100)); font.draw("Used: " + percentFilled + "%", 10, 70, 4210752); font.draw("Wrench unit to retain contents", 10, 80, 16711680); } }

Target:
protected void drawForeground(final int mouseX, final int mouseY) { super.drawForeground(mouseX, mouseY); FluidInstance fluid = tankEntity.getTank().getFluidInstance(); if (fluid.isEmpty()) { font.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752); } else { font.draw(StringUtils.t("gui.techreborn.tank.type"), 10, 20, 4210752); font.draw(FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752); font.draw(StringUtils.t("gui.techreborn.tank.amount"), 10, 50, 4210752); font.draw(fluid.getAmount().toString(), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getCapacity().getRawValue() * 100)); font.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); font.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); } }
Source:
public void prepareRun(BatchSourceContext context) throws DatasetManagementException { super.prepareRun(context); String schemaString = tableConfig.getSchemaStr(); if (schemaString != null) { try { Schema schema = Schema.parseJson(schemaString); if (schema.getFields() != null) { FieldOperation operation = new FieldReadOperation("Read", "Read from Table dataset", EndPoint.of(context.getNamespace(), tableConfig.getName()), schema.getFields().stream().map(Schema.Field::getName) .collect(Collectors.toList())); context.record(Collections.singletonList(operation)); } } catch (IOException e) { throw new IllegalStateException("Failed to parse schema.", e); } } }

Target:
public void prepareRun(BatchSourceContext context) throws DatasetManagementException { super.prepareRun(context); Schema schema = tableConfig.getSchema(); if (schema != null && schema.getFields() != null) { FieldOperation operation = new FieldReadOperation("Read", "Read from Table dataset", EndPoint.of(context.getNamespace(), tableConfig.getName()), schema.getFields().stream().map(Schema.Field::getName) .collect(Collectors.toList())); context.record(Collections.singletonList(operation)); } }
Source:
public static Interface findInterfaceOfNodeTemplate(Map<String, Interface> nodeTemplateInterfaces, List<String> validInterfaceNames) { if (nodeTemplateInterfaces != null) { for (String interfaceName : validInterfaceNames) { if (nodeTemplateInterfaces.containsKey(interfaceName)) { return nodeTemplateInterfaces.get(interfaceName); } } } return null; }

Target:
public static Optional<Interface> findInterfaceOfNodeTemplate(Map<String, Interface> nodeTemplateInterfaces, List<String> validInterfaceNames) { if (nodeTemplateInterfaces != null) { for (String interfaceName : validInterfaceNames) { if (nodeTemplateInterfaces.containsKey(interfaceName)) { return Optional.of(nodeTemplateInterfaces.get(interfaceName)); } } } return Optional.absent(); }
Source:
private void addCloudEventTracePlaceHolder(Iterable<CloudEvent> events) { if (TracerProxy.isTracingEnabled()) { for (CloudEvent event : events) { if (event.getExtensionAttributes() == null || (event.getExtensionAttributes().get(Constants.TRACE_PARENT) == null && event.getExtensionAttributes().get(Constants.TRACE_STATE) == null)) { event.addExtensionAttribute(Constants.TRACE_PARENT, Constants.TRACE_PARENT_PLACEHOLDER); event.addExtensionAttribute(Constants.TRACE_STATE, Constants.TRACE_STATE_PLACEHOLDER); } } } }

Target:
private void addCloudEventTracePlaceHolder(Iterable<CloudEvent> events) { if (TracerProxy.isTracingEnabled()) { for (CloudEvent event : events) { if (event.getExtensionAttributes() == null || (event.getExtensionAttributes().get(Constants.TRACE_PARENT) == null && event.getExtensionAttributes().get(Constants.TRACE_STATE) == null)) { event.addExtensionAttribute(Constants.TRACE_PARENT, Constants.TRACE_PARENT_PLACEHOLDER_UUID); event.addExtensionAttribute(Constants.TRACE_STATE, Constants.TRACE_STATE_PLACEHOLDER_UUID); } } } }
Source:
protected void configure() { bind(EventBus.class).toInstance(eventBus); bind(ApplicationEventPublisher.class).to(GuavaApplicationEventPublisher.class); bindListener(Matchers.any(), subscribingTypeListener); }

Target:
protected void configure() { com.google.inject.Provider<ApplicationEventDispatcher> dispatcherProvider = binder().getProvider(ApplicationEventDispatcher.class); bindListener(Matchers.any(), new ApplicationEventSubscribingTypeListener(dispatcherProvider)); bindListener(Matchers.any(), new ApplicationEventSubscribingProvisionListener(dispatcherProvider)); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DataNode other = (DataNode) obj; if (nodeId != other.nodeId) { return false; } if (!content.equals(other.content)) { return false; } if (refEndPoint != other.refEndPoint) { return false; } if (refStartPoint != other.refStartPoint) { return false; } if (!Arrays.equals(source, other.source)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DataNode other = (DataNode) obj; return this.getId() == other.getId(); }
Source:
public boolean hasSameConfigOrigin(PipelineConfig other) { if (!(isConfigDefinedRemotely())) return false; RepoConfigOrigin otherOrigin = (RepoConfigOrigin) other.getOrigin(); RepoConfigOrigin repoConfigOrigin = (RepoConfigOrigin) this.origin; return repoConfigOrigin == otherOrigin; }

Target:
public boolean hasSameConfigOrigin(PipelineConfig other) { if (!(isConfigDefinedRemotely())) return false; return this.origin.equals(other.getOrigin()); }
Source:
public void getGroupObjectNotFoundTest() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); Group adminGroup = null; try { context.turnOffAuthorisationSystem(); adminGroup = groupService.create(context); context.commit(); adminGroup = context.reloadEntity(adminGroup); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isNotFound()); } finally { if (adminGroup != null) { GroupBuilder.deleteGroup(adminGroup.getID()); } } }

Target:
public void getGroupObjectNotFoundTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = GroupBuilder.createGroup(context) .withName("test group") .build(); context.restoreAuthSystemState(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isNoContent()); }
Source:
private void configureAdminUser() { logger().debug("Configuring couchbase admin user with username: \"" + username + "\""); Response response = doHttpRequest(MGMT_PORT, "/settings/web", "POST", new FormBody.Builder() .add("username", username) .add("password", password) .add("port", Integer.toString(MGMT_PORT)) .build(), false); checkSuccessfulResponse(response, "Could not configure couchbase admin user"); }

Target:
private void configureAdminUser() { logger().debug("Configuring couchbase admin user with username: \"{}\"", username); Response response = doHttpRequest(MGMT_PORT, "/settings/web", "POST", new FormBody.Builder() .add("username", username) .add("password", password) .add("port", Integer.toString(MGMT_PORT)) .build(), false); checkSuccessfulResponse(response, "Could not configure couchbase admin user"); }
Source:
public void withLabelAndChannelTypeUID_shouldCreateChannelType() { ChannelType channelType = stateBuilder.build(); assertThat(channelType.getUID(), is(CHANNEL_TYPE_UID)); assertThat(channelType.getItemType(), is(ITEM_TYPE)); assertThat(channelType.getLabel(), is(LABEL)); }

Target:
public void withLabelAndChannelTypeUID_shouldCreateChannelType() { ChannelType channelType = stateBuilder.build(); assertThat(channelType.getUID(), is(CHANNEL_TYPE_UID)); assertThat(channelType.getItemType(), is(ITEM_TYPE)); assertThat(channelType.getLabel(), is(LABEL)); assertThat(channelType.getKind(), is(ChannelKind.STATE)); }
Source:
private boolean isMapTask(TaskAttemptImpl taskAttempt) { boolean isMapTask = false; for(TezCounter counter : taskAttempt.getCounters().getGroup("HIVE")) { if(counter.getName().startsWith("RECORDS_IN_Map")) { isMapTask = true; } } return isMapTask; }

Target:
private boolean isMapTask(TaskAttemptImpl taskAttempt) { return taskAttempt.getCounters().getGroup("HIVE").findCounter("RECORDS_IN_Map") == null; }
Source:
} catch (Throwable t) { LOGGER.info("Could not load JNR LibC Library, native calls will not be available"); }

Target:
} catch (Throwable t) { if (LOGGER.isDebugEnabled()) LOGGER.debug("Could not load JNR LibC Library, native calls will not be available", t); else LOGGER.info("Could not load JNR LibC Library, native calls will not be available (set this logger level to DEBUG to see the full stack trace)"); }
Source:
private Mono<Void> authenticate(ServerWebExchange exchange, WebFilterChain chain, Authentication token) { WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, chain); ReactiveAuthenticationManager authenticationManager = this.authenticationManagerResolver .resolve(exchange.getRequest()) .block(); return authenticationManager.authenticate(token) .switchIfEmpty(Mono.defer(() -> Mono.error(new IllegalStateException("No provider found for " + token.getClass())))) .flatMap(authentication -> onAuthenticationSuccess(authentication, webFilterExchange)) .onErrorResume(AuthenticationException.class, e -> this.authenticationFailureHandler .onAuthenticationFailure(webFilterExchange, e)); }

Target:
private Mono<Void> authenticate(ServerWebExchange exchange, WebFilterChain chain, Authentication token) { WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, chain); return this.authenticationManagerResolver.resolve(exchange.getRequest()) .flatMap(authenticationManager -> authenticationManager.authenticate(token)) .switchIfEmpty(Mono.defer(() -> Mono.error(new IllegalStateException("No provider found for " + token.getClass())))) .flatMap(authentication -> onAuthenticationSuccess(authentication, webFilterExchange)) .onErrorResume(AuthenticationException.class, e -> this.authenticationFailureHandler .onAuthenticationFailure(webFilterExchange, e)); }
Source:
public GdbAutoTerminateAction() { super(ConsoleMessages.ConsoleAutoTerminateAction_name, IAction.AS_CHECK_BOX); setText(ConsoleMessages.ConsoleAutoTerminateAction_name); setToolTipText(ConsoleMessages.ConsoleAutoTerminateAction_description); setChecked(readState()); }

Target:
public GdbAutoTerminateAction() { super(ConsoleMessages.ConsoleAutoTerminateAction_name, IAction.AS_CHECK_BOX); setToolTipText(ConsoleMessages.ConsoleAutoTerminateAction_description); setChecked(readState()); }
Source:
public VALUE get(KEY key) throws IOException { CacheValue<VALUE> cacheValue = Optional.fromNullable(cache.get(new CacheKey<>(key))).orNull(); if (cacheValue != null) { return cacheValue.getCacheValue(); } if (cacheCleanupPolicy == TableCacheImpl.CacheCleanupPolicy.AFTER_FLUSH) { return getFromTable(key); } else { return null; } }

Target:
public VALUE get(KEY key) throws IOException { CacheResult<CacheValue<VALUE>> cacheResult = cache.lookup(new CacheKey<>(key)); if (cacheResult.getCacheStatus() == EXISTS) { return cacheResult.getValue().getCacheValue(); } else if (cacheResult.getCacheStatus() == NOT_EXIST) { return null; } else { return getFromTable(key); } }
Source:
private void stop() { if ((sessionManagerProxy != 0) && (clientObjectPath != null)) { long error = new long [1]; long clientInfo = OS.g_dbus_proxy_call_sync( sessionManagerProxy, Converter.javaStringToCString("UnregisterClient"), composeVariantTupleO(clientObjectPath), OS.G_DBUS_CALL_FLAGS_NONE, dbusTimeoutMsec, 0, error); if (error[0] != 0) { System.err.format( "SWT SessionManagerDBus: Failed to UnregisterClient: %s%n", extractFreeGError(error[0])); } clientObjectPath = null; } if (clientProxy != 0) { OS.g_object_unref(clientProxy); clientProxy = 0; } if (sessionManagerProxy != 0) { OS.g_object_unref(sessionManagerProxy); sessionManagerProxy = 0; } shutdownHook.remove(); }

Target:
private void stop() { if ((sessionManagerProxy != 0) && (clientObjectPath != null)) { long args = OS.g_variant_new( Converter.javaStringToCString("(o)"), Converter.javaStringToCString(clientObjectPath)); long error = new long [1]; OS.g_dbus_proxy_call_sync( sessionManagerProxy, Converter.javaStringToCString("UnregisterClient"), args, OS.G_DBUS_CALL_FLAGS_NONE, dbusTimeoutMsec, 0, error); if (error[0] != 0) { System.err.format( "SWT SessionManagerDBus: Failed to UnregisterClient: %s%n", extractFreeGError(error[0])); } clientObjectPath = null; } if (clientProxy != 0) { OS.g_object_unref(clientProxy); clientProxy = 0; } if (sessionManagerProxy != 0) { OS.g_object_unref(sessionManagerProxy); sessionManagerProxy = 0; } g_signal_callback.dispose(); shutdownHook.remove(); }
Source:
public void setCanceled(boolean cancel) { if (!isCancelable()) { throw new UnsupportedOperationException( "Attempted to modify the unmodifiable canceled state of a non-cancelable event of type: " + this.getClass().getCanonicalName() ); } isCanceled = cancel; }

Target:
public void setCanceled(boolean cancel) { if (!isCancelable()) { throw new UnsupportedOperationException( "Attempted to call Event#setCanceled() on a non-cancelable event of type: " + this.getClass().getCanonicalName() ); } isCanceled = cancel; }
Source:
public Query visitOrExpression(OrFilterExpression expression) { Query query = builder.bool() .should(expression.getLeft().accept(this)) .should(expression.getRight().accept(this)) .createQuery(); return query; }

Target:
public Query visitOrExpression(OrFilterExpression expression) { return builder.bool() .should(expression.getLeft().accept(this)) .should(expression.getRight().accept(this)) .createQuery(); }
Source:
private void loadChildEntities(LibraryDilution dilution) throws IOException { if (dilution.getLibrary() != null) { dilution.setLibrary(libraryDao.get(dilution.getLibrary().getId())); } if (dilution.getTargetedSequencing() != null && dilution.getTargetedSequencing().getId() != null) { dilution.setTargetedSequencing(targetedSequencingDao.get(dilution.getTargetedSequencing().getId())); } }

Target:
private void loadChildEntities(LibraryDilution dilution) throws IOException { if (dilution.getLibrary() != null) { dilution.setLibrary(libraryDao.get(dilution.getLibrary().getId())); } if (dilution.getTargetedSequencing() != null) { dilution.setTargetedSequencing(targetedSequencingDao.get(dilution.getTargetedSequencing().getId())); } }
Source:
public void testNativeQueryExecuteUpdate() throws Exception { OgmSession session = (OgmSession) openSession(); Transaction transaction = session.beginTransaction(); String findQueryString = "MATCH (n:UPDATE) RETURN n"; Query findQuery = session.createNativeQuery( findQueryString ); String createQuery = "CREATE (n:UPDATE { author:'Giorgio Faletti' })"; int updates = session.createNativeQuery( createQuery ).executeUpdate(); if ( TestHelper.getCurrentDatastoreProviderType() != DatastoreProviderType.NEO4J_HTTP ) { assertThat( updates ).isEqualTo( 3 ); } Object createdNode = findQuery.uniqueResult(); assertThat( createdNode ).isNotNull(); String deleteQuery = "MATCH (n:UPDATE) DELETE n "; int deletes = session.createNativeQuery( deleteQuery ).executeUpdate(); if ( TestHelper.getCurrentDatastoreProviderType() != DatastoreProviderType.NEO4J_HTTP ) { assertThat( deletes ).isEqualTo( 1 ); } Object uniqueResult = findQuery.uniqueResult(); assertThat( uniqueResult ).isNull(); transaction.commit(); session.clear(); session.close(); }

Target:
public void testNativeQueryExecuteUpdate() throws Exception { OgmSession session = (OgmSession) openSession(); Transaction transaction = session.beginTransaction(); String findQueryString = "MATCH (n:" + UPDATE_LABEL + ") RETURN n"; Query findQuery = session.createNativeQuery( findQueryString ); String createQuery = "CREATE (n:" + UPDATE_LABEL + " { author:'Giorgio Faletti' })"; int updates = session.createNativeQuery( createQuery ).executeUpdate(); if ( TestHelper.getCurrentDatastoreProviderType() != DatastoreProviderType.NEO4J_HTTP ) { assertThat( updates ).isEqualTo( 3 ); } Object createdNode = findQuery.uniqueResult(); assertThat( createdNode ).isNotNull(); String deleteQuery = "MATCH (n:" + UPDATE_LABEL + ") DELETE n "; int deletes = session.createNativeQuery( deleteQuery ).executeUpdate(); if ( TestHelper.getCurrentDatastoreProviderType() != DatastoreProviderType.NEO4J_HTTP ) { assertThat( deletes ).isEqualTo( 1 ); } Object uniqueResult = findQuery.uniqueResult(); assertThat( uniqueResult ).isNull(); transaction.commit(); session.clear(); session.close(); }
Source:
protected Date convertStartDateToUnspecifiedDateTime(String value) { return convertDateStringToDate(value, false); }

Target:
protected Date convertStartDateToUnspecifiedDateTime(String value) throws ParseException { if (value == null || value.isEmpty()) { return null; } else { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'"); return df.parse(value); } }
Source:
public void canSerialize() throws Exception { DynamoAppConfigElement element = new DynamoAppConfigElement(); element.setKey("studyId:id"); element.setStudyId("studyId"); element.setRevision(1L); element.setId("id"); element.setPublished(true); element.setDeleted(true); element.setData(TestUtils.getClientData()); element.setCreatedOn(CREATED_ON.getMillis()); element.setModifiedOn(MODIFIED_ON.getMillis()); element.setVersion(2L); JsonNode node = BridgeObjectMapper.get().valueToTree(element); assertNull(node.get("key")); assertNull(node.get("studyId")); assertEquals(1L, node.get("revision").longValue()); assertEquals("id", node.get("id").textValue()); assertTrue(node.get("published").booleanValue()); assertTrue(node.get("deleted").booleanValue()); assertEquals(TestUtils.getClientData(), node.get("data")); assertEquals(CREATED_ON.toString(), node.get("createdOn").textValue()); assertEquals(MODIFIED_ON.toString(), node.get("modifiedOn").textValue()); assertEquals(2L, node.get("version").longValue()); AppConfigElement deser = BridgeObjectMapper.get().readValue(node.toString(), AppConfigElement.class); element.setKey(null); element.setStudyId(null); assertEquals(element, deser); }

Target:
public void canSerialize() throws Exception { DynamoAppConfigElement element = new DynamoAppConfigElement(); element.setStudyId(TestConstants.TEST_STUDY_IDENTIFIER); element.setId(ID); element.setRevision(1L); element.setDeleted(true); element.setData(TestUtils.getClientData()); element.setCreatedOn(CREATED_ON.getMillis()); element.setModifiedOn(MODIFIED_ON.getMillis()); element.setVersion(2L); JsonNode node = BridgeObjectMapper.get().valueToTree(element); assertNull(node.get("key")); assertNull(node.get("studyId")); assertEquals(1L, node.get("revision").longValue()); assertEquals(ID, node.get("id").textValue()); assertTrue(node.get("deleted").booleanValue()); assertEquals(TestUtils.getClientData(), node.get("data")); assertEquals(CREATED_ON.toString(), node.get("createdOn").textValue()); assertEquals(MODIFIED_ON.toString(), node.get("modifiedOn").textValue()); assertEquals(2L, node.get("version").longValue()); assertEquals("AppConfigElement", node.get("type").textValue()); AppConfigElement deser = BridgeObjectMapper.get().readValue(node.toString(), AppConfigElement.class); deser.setStudyId(TestConstants.TEST_STUDY_IDENTIFIER); assertEquals(element, deser); }
Source:
public void testRenameIdNotFoundOnOldName() throws Exception { typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus, MAX_CACHE_SIZE); ListenableFuture<Void> response = typeContext.rename("oldName", "newName"); Futures.addCallback(response, new FutureCallback<Void>() { @Override public void onSuccess(final Void result) { fail(); } @Override public void onFailure(final Throwable throwable) { } }); }

Target:
public void testRenameIdNotFoundOnOldName() throws Exception { typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus, MAX_CACHE_SIZE); try { typeContext.rename("oldName", "newName").get(); fail("Rename should have failed when it did not find the current name."); } catch (ExecutionException exception) { assertTrue(exception.getCause() instanceof LabelException); } }
Source:
private boolean isSpecifiedDisksExist(List<DiskImage> disks) { if (disks != null) { List<DiskImage> disksNotExistInDb = ImagesHandler.imagesSubtract(getParameters().getDisks(), getDisksList()); if (!disksNotExistInDb.isEmpty()) { List<String> disksNotExistInDbIds = new ArrayList<>(disksNotExistInDb.size()); for (DiskImage diskImage : disksNotExistInDb) { disksNotExistInDbIds.add(diskImage.getId().toString()); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_NOT_EXIST, String.format("$%1$s %2$s", "diskIds", StringUtils.join(disksNotExistInDbIds, ","))); } } return true; }

Target:
private boolean isSpecifiedDisksExist(List<DiskImage> disks) { if (disks == null || disks.isEmpty()) { return true; } DiskImagesValidator diskImagesValidator = createDiskImageValidator(disks); if (!validate(diskImagesValidator.diskImagesNotExist())) { return false; } return true; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); Bundle arguments = getArguments(); if (!TextUtils.isEmpty(arguments.getString(MapboxWebMapType.ARG_MAPBOX_ACCESS_TOKEN)) && !TextUtils.isEmpty(arguments.getString(MapboxWebMapType.ARG_MAPBOX_MAPID))) { MapboxWebMapType mapType = MapboxWebMapType.fromBundle(arguments); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); } else { AirMapType mapType = AirMapType.fromBundle(arguments); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); } webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); AirMapType mapType = AirMapType.fromBundle(getArguments()); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }