auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void remoteFileDownload(ILaunchConfiguration config, ILaunch launch, String localExePath, String remoteExePath, IProgressMonitor monitor) throws CoreException { boolean skipDownload = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false); if (skipDownload) return; monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100); try { IRemoteConnection conn = getCurrentConnection(config); IRemoteFileService fs = conn.getService(IRemoteFileService.class); IFileStore remoteFile = fs.getResource(remoteExePath); IFileSystem localfs = EFS.getLocalFileSystem(); IFileStore localFile = localfs.getStore(new Path(localExePath)); if (!localFile.fetchInfo().exists()) { return; } localFile.copy(remoteFile, EFS.OVERWRITE, monitor); Process p = remoteShellExec( config, "", "chmod", "+x " + spaceEscapify(remoteExePath), new SubProgressMonitor(monitor, 5)); try { int waitTime = 1; boolean exited = p.waitFor(waitTime, TimeUnit.SECONDS); if (!exited) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Failed to change file permissions in the remote system, path: " + remoteExePath, null); throw new CoreException(status); } } catch (InterruptedException e) { } } catch (CoreException e) { abort(Messages.RemoteRunLaunchDelegate_6, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } finally { monitor.done(); } }

Target:
public static void remoteFileDownload(ILaunchConfiguration config, ILaunch launch, String localExePath, String remoteExePath, IProgressMonitor monitor) throws CoreException { boolean skipDownload = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false); if (skipDownload) return; monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100); try { IRemoteConnection conn = getCurrentConnection(config); IRemoteFileService fs = conn.getService(IRemoteFileService.class); IFileStore remoteFile = fs.getResource(remoteExePath); IFileSystem localfs = EFS.getLocalFileSystem(); IFileStore localFile = localfs.getStore(new Path(localExePath)); if (!localFile.fetchInfo().exists()) { return; } localFile.copy(remoteFile, EFS.OVERWRITE, monitor); Process p = remoteShellExec( config, "", "chmod", "+x " + spaceEscapify(remoteExePath), new SubProgressMonitor(monitor, 5)); try { int timeOut = 10; boolean exited = p.waitFor(timeOut, TimeUnit.SECONDS); if (!exited) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Failed to change file permissions in the remote system, path: " + remoteExePath, null); throw new CoreException(status); } } catch (InterruptedException e) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Interrupted while changing file permissions in the remote system, path: " + remoteExePath, e); throw new CoreException(status); } } catch (CoreException e) { abort(Messages.RemoteRunLaunchDelegate_6, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } finally { monitor.done(); } }
Source:
private void processBatch(Context context) throws SQLException, IOException, InterruptedException { if (currentBatchValues.size() == 0) return; context.getCounter(PhoenixScrutinyJobCounters.BATCHES_PROCESSED_COUNT).increment(1); String inClause = QueryUtil.constructParameterizedInClause(numTargetPkCols, currentBatchValues.size()); String indexQuery = targetTableQuery + inClause; try (PreparedStatement targetStatement = connection.prepareStatement(indexQuery)) { Map<String, Pair<Long, List<Object>>> targetPkToSourceValues = buildTargetStatement(targetStatement); if (isTest) { ScrutinyTestClock clock = new ScrutinyTestClock(3600000); EnvironmentEdgeManager.injectEdge(clock); } queryTargetTable(context, targetStatement, targetPkToSourceValues); checkIfInvalidRowsExpired(context, targetPkToSourceValues); context.getCounter(PhoenixScrutinyJobCounters.INVALID_ROW_COUNT) .increment(targetPkToSourceValues.size()); if (outputInvalidRows) { for (Pair<Long, List<Object>> sourceRowWithoutTargetRow : targetPkToSourceValues.values()) { List<Object> valuesWithoutTarget = sourceRowWithoutTargetRow.getSecond(); if (OutputFormat.FILE.equals(outputFormat)) { context.write( new Text(Arrays.toString(valuesWithoutTarget.toArray())), new Text("Target row not found")); } else if (OutputFormat.TABLE.equals(outputFormat)) { writeToOutputTable(context, valuesWithoutTarget, null, sourceRowWithoutTargetRow.getFirst(), -1L); } } } if (outputInvalidRows && OutputFormat.TABLE.equals(outputFormat)) { outputUpsertStmt.executeBatch(); outputConn.commit(); } currentBatchValues.clear(); } }

Target:
protected void processBatch(Context context) throws SQLException, IOException, InterruptedException { if (currentBatchValues.size() == 0) return; context.getCounter(PhoenixScrutinyJobCounters.BATCHES_PROCESSED_COUNT).increment(1); String inClause = QueryUtil.constructParameterizedInClause(numTargetPkCols, currentBatchValues.size()); String indexQuery = targetTableQuery + inClause; try (PreparedStatement targetStatement = connection.prepareStatement(indexQuery)) { Map<String, Pair<Long, List<Object>>> targetPkToSourceValues = buildTargetStatement(targetStatement); preQueryTargetTable(); queryTargetTable(context, targetStatement, targetPkToSourceValues); checkIfInvalidRowsExpired(context, targetPkToSourceValues); context.getCounter(PhoenixScrutinyJobCounters.INVALID_ROW_COUNT) .increment(targetPkToSourceValues.size()); if (outputInvalidRows) { for (Pair<Long, List<Object>> sourceRowWithoutTargetRow : targetPkToSourceValues.values()) { List<Object> valuesWithoutTarget = sourceRowWithoutTargetRow.getSecond(); if (OutputFormat.FILE.equals(outputFormat)) { context.write( new Text(Arrays.toString(valuesWithoutTarget.toArray())), new Text("Target row not found")); } else if (OutputFormat.TABLE.equals(outputFormat)) { writeToOutputTable(context, valuesWithoutTarget, null, sourceRowWithoutTargetRow.getFirst(), -1L); } } } if (outputInvalidRows && OutputFormat.TABLE.equals(outputFormat)) { outputUpsertStmt.executeBatch(); outputConn.commit(); } currentBatchValues.clear(); } }
Source:
public SunriseSolutionInfo() { setName(""); setVersion(BuildInfo.version()); setWebsite(""); setEmergencyContact(""); }

Target:
public SunriseSolutionInfo() { setName("commercetools-sunrise-java"); setVersion(BuildInfo.version()); }
Source:
public void merge_TheSameFeatureTwiceById() { setUpWithJson(SAMPLE_JSON); List<Feature> features = new ArrayList<>(); features.addAll(reportResult.getAllFeatures()); features.addAll(reportResult.getAllFeatures()); List<Feature> merged = new ReportFeatureByIdMerger().merge(features); assertThat(merged).hasSize(2); }

Target:
public void merge_TheSameFeatureTwiceById() { setUpWithJson(SAMPLE_JSON); Integer expectedSize = reportResult.getAllFeatures().size(); List<Feature> features = new ArrayList<>(); features.addAll(reportResult.getAllFeatures()); features.addAll(reportResult.getAllFeatures()); List<Feature> merged = new ReportFeatureByIdMerger().merge(features); assertThat(merged).hasSize(expectedSize); }
Source:
public List<RefRight> getAllRights(final ApprovalCategory.Id id) { List<RefRight> l = allRights.get(id); if (l == null) { l = new ArrayList<RefRight>(); l.addAll(getRefRights(id)); l.addAll(getWildcardRights(id)); Collections.sort(l, RefRight.REF_PATTERN_ORDER); l = Collections.unmodifiableList(l); allRights.put(id, l); } return l; }

Target:
public List<RefRight> getAllRights(final ApprovalCategory.Id id) { List<RefRight> l = allRights.get(id); if (l == null) { l = new ArrayList<RefRight>(); l.addAll(getRefRights(id)); l.addAll(getWildcardRights(id)); Collections.sort(l, RefRight.REF_PATTERN_ORDER); l = Collections.unmodifiableList(RefControl.filterMostSpecific(l)); allRights.put(id, l); } return l; }
Source:
public void shouldParseDateTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:DateTime\n" + "0,Mattias,2018-02-27T13:37\n" + "1,Johan,\"2018-03-01T16:20:01\"\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", DateTimeValue.datetime( 2018, 2, 27, 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", DateTimeValue.datetime( 2018, 3, 1, 16, 20, 1, 0, "+00:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }

Target:
public void shouldParseDateTimePropertyValues() throws Exception { DataFactory data = data( ":ID,name,time:DateTime\n" + "0,Mattias,2018-02-27T13:37\n" + "1,Johan,\"2018-03-01T16:20:01\"\n" + "2,Bob,1981-05-11T07:30-05:00\n" ); Iterable<DataFactory> dataIterable = dataIterable( data ); Input input = new CsvInput( dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config( COMMAS ), silentBadCollector( 0 ) ); try ( InputIterator nodes = input.nodes().iterator() ) { assertNextNode( nodes, 0L, new Object[]{"name", "Mattias", "time", DateTimeValue.datetime( 2018, 2, 27, 13, 37, 0, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 1L, new Object[]{"name", "Johan", "time", DateTimeValue.datetime( 2018, 3, 1, 16, 20, 1, 0, "+00:00" )}, labels() ); assertNextNode( nodes, 2L, new Object[]{"name", "Bob", "time", DateTimeValue.datetime( 1981, 5, 11, 7, 30, 0, 0, "-05:00" )}, labels() ); assertFalse( readNext( nodes ) ); } }
Source:
public static List<AggregatedPayload> createBundleList(String json) throws JsonSyntaxException { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray jArray = parser.parse(json).getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = gson.fromJson( obj , AggregatedPayload.class); bundleList.add(bundle); } return bundleList; }

Target:
public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray jArray = parser.parse(json).getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = gson.fromJson( obj , AggregatedPayload.class); bundleList.add(bundle); } return bundleList; }
Source:
public void consume(ParsableByteArray data) { while (data.bytesLeft() > 0) { switch (state) { case STATE_FINDING_SYNC: if (skipToNextSync(data)) { state = STATE_READING_HEADER; headerScratchBytes.data[0] = (byte)0xAC; headerScratchBytes.data[1] = 0x40; if (hasCRC) headerScratchBytes.data[1] = 0x41; bytesRead = 2; } break; case STATE_READING_HEADER: if (continueRead(data, headerScratchBytes.data, Ac4Util.HEADER_SIZE_FOR_PARSER)) { parseHeader(); headerScratchBytes.setPosition(0); output.sampleData(headerScratchBytes, Ac4Util.HEADER_SIZE_FOR_PARSER); state = STATE_READING_SAMPLE; } break; case STATE_READING_SAMPLE: int bytesToRead = Math.min(data.bytesLeft(), sampleSize - bytesRead); output.sampleData(data, bytesToRead); bytesRead += bytesToRead; if (bytesRead == sampleSize) { output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null); timeUs += sampleDurationUs; state = STATE_FINDING_SYNC; } break; default: break; } } }

Target:
public void consume(ParsableByteArray data) { while (data.bytesLeft() > 0) { switch (state) { case STATE_FINDING_SYNC: if (skipToNextSync(data)) { state = STATE_READING_HEADER; headerScratchBytes.data[0] = (byte)0xAC; headerScratchBytes.data[1] = (byte)(hasCRC ? 0x41 : 0x40); bytesRead = 2; } break; case STATE_READING_HEADER: if (continueRead(data, headerScratchBytes.data, Ac4Util.HEADER_SIZE_FOR_PARSER)) { parseHeader(); headerScratchBytes.setPosition(0); output.sampleData(headerScratchBytes, Ac4Util.HEADER_SIZE_FOR_PARSER); state = STATE_READING_SAMPLE; } break; case STATE_READING_SAMPLE: int bytesToRead = Math.min(data.bytesLeft(), sampleSize - bytesRead); output.sampleData(data, bytesToRead); bytesRead += bytesToRead; if (bytesRead == sampleSize) { output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null); timeUs += sampleDurationUs; state = STATE_FINDING_SYNC; } break; default: break; } } }
Source:
public TextIndexES(TextIndexConfig config, ESSettings esSettings) throws Exception{ this.INDEX_NAME = esSettings.getIndexName(); this.docDef = config.getEntDef(); this.isMultilingual = config.isMultilingualSupport(); if (this.isMultilingual && config.getEntDef().getLangField() == null) { docDef.setLangField("lang"); } if(client == null) { LOGGER.debug("Initializing the Elastic Search Java Client with settings: " + esSettings); Settings settings = Settings.builder() .put(CLUSTER_NAME, esSettings.getClusterName()).build(); List<InetSocketTransportAddress> addresses = new ArrayList<>(); for(String host: esSettings.getHostToPortMapping().keySet()) { InetSocketTransportAddress addr = new InetSocketTransportAddress(InetAddress.getByName(host), esSettings.getHostToPortMapping().get(host)); addresses.add(addr); } InetSocketTransportAddress socketAddresses[] = new InetSocketTransportAddress[addresses.size()]; client = new PreBuiltTransportClient(settings).addTransportAddresses(addresses.toArray(socketAddresses)); LOGGER.debug("Successfully initialized the client"); } IndicesExistsResponse exists = client.admin().indices().exists(new IndicesExistsRequest(INDEX_NAME)).get(); if(!exists.isExists()) { Settings indexSettings = Settings.builder() .put(NUM_OF_SHARDS, esSettings.getShards()) .put(NUM_OF_REPLICAS, esSettings.getReplicas()) .build(); LOGGER.debug("Index with name " + INDEX_NAME + " does not exist yet. Creating one with settings: " + indexSettings.toString()); client.admin().indices().prepareCreate(INDEX_NAME).setSettings(indexSettings).get(); } }

Target:
public TextIndexES(TextIndexConfig config, ESSettings esSettings) { this.indexName = esSettings.getIndexName(); this.docDef = config.getEntDef(); docDef.setLangField("lang"); try { if(client == null) { LOGGER.debug("Initializing the Elastic Search Java Client with settings: " + esSettings); Settings settings = Settings.builder() .put(CLUSTER_NAME_PARAM, esSettings.getClusterName()).build(); List<InetSocketTransportAddress> addresses = new ArrayList<>(); for(String host: esSettings.getHostToPortMapping().keySet()) { InetSocketTransportAddress addr = new InetSocketTransportAddress(InetAddress.getByName(host), esSettings.getHostToPortMapping().get(host)); addresses.add(addr); } InetSocketTransportAddress socketAddresses[] = new InetSocketTransportAddress[addresses.size()]; client = new PreBuiltTransportClient(settings).addTransportAddresses(addresses.toArray(socketAddresses)); LOGGER.debug("Successfully initialized the client"); } IndicesExistsResponse exists = client.admin().indices().exists(new IndicesExistsRequest(indexName)).get(); if(!exists.isExists()) { Settings indexSettings = Settings.builder() .put(NUM_OF_SHARDS_PARAM, esSettings.getShards()) .put(NUM_OF_REPLICAS_PARAM, esSettings.getReplicas()) .build(); LOGGER.debug("Index with name " + indexName + " does not exist yet. Creating one with settings: " + indexSettings.toString()); client.admin().indices().prepareCreate(indexName).setSettings(indexSettings).get(); } }catch (Exception e) { throw new TextIndexException("Exception occurred while instantiating ElasticSearch Text Index", e); } }
Source:
public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.resultReference = new AtomicReference<>(); this.mockRestAdapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); add(new retrofit.client.Header(key, value)); } } }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); }

Target:
public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.resultReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.restAdapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); add(new retrofit.client.Header(key, value)); } } }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build(); this.mockRestAdapter.setAdapter(this.restAdapter); }
Source:
public List<T> getClusterEndpoints() { if (!warmedUp) { updateTask.run(); executorService.schedule(backgroundTask, 0, TimeUnit.SECONDS); warmedUp = true; } return resultsRef.get(); }

Target:
public List<T> getClusterEndpoints() { if (warmedUp.compareAndSet(false, true)) { doWarmUp(); executorService.schedule( backgroundTask, transportConfig.getAsyncResolverRefreshIntervalMs(), TimeUnit.MILLISECONDS); } return resultsRef.get(); }
Source:
protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } asyncTask = volume.getAsyncTask(); getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }

Target:
protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }
Source:
private void visitEnrollPage_forCourseWithoutResponses_noWarningMessage() throws Exception { ______TS("Typical case 1: open the enroll page of a course without existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor4"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor4", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals("", pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = "instructorCourseEnroll Page Load<br>" + "Enrollment for Course <span class=\"bold\">[" + courseId + "]</span>"; AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }

Target:
private void visitEnrollPage_forCourseWithoutResponses_noWarningMessage() throws Exception { ______TS("Typical case 1: open the enroll page of a course without existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor4"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor4", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals("", pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = String.format( Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId); AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }
Source:
private MappingType toMappingType(Attribute attribute, int depth, int maxDepth) { AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: return MappingType.BOOLEAN; case CATEGORICAL: case CATEGORICAL_MREF: case FILE: case MREF: case ONE_TO_MANY: case XREF: if (depth < maxDepth) { return MappingType.NESTED; } else { Attribute refLabelAttribute = attribute.getRefEntity().getLabelAttribute(); return toMappingType(refLabelAttribute, depth + 1, maxDepth); } case DATE: return MappingType.DATE; case DATE_TIME: return MappingType.DATE_TIME; case DECIMAL: return MappingType.DOUBLE; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return MappingType.TEXT; case INT: return MappingType.INTEGER; case LONG: return MappingType.LONG; case COMPOUND: throw new RuntimeException(format("Illegal attribute type '%s'", attributeType)); default: throw new RuntimeException(format("Unknown attribute type '%s'", attributeType)); } }

Target:
private MappingType toMappingType(Attribute attribute, int depth, int maxDepth) { AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: return MappingType.BOOLEAN; case CATEGORICAL: case CATEGORICAL_MREF: case FILE: case MREF: case ONE_TO_MANY: case XREF: return toMappingTypeReferenceAttribute(attribute, depth, maxDepth); case DATE: return MappingType.DATE; case DATE_TIME: return MappingType.DATE_TIME; case DECIMAL: return MappingType.DOUBLE; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return MappingType.TEXT; case INT: return MappingType.INTEGER; case LONG: return MappingType.LONG; case COMPOUND: throw new RuntimeException(format("Illegal attribute type '%s'", attributeType)); default: throw new RuntimeException(format("Unknown attribute type '%s'", attributeType)); } }
Source:
public void removeRemoteSource(TaskId taskId, TaskId remoteSourceTaskId) { requireNonNull(taskId, "taskId is null"); requireNonNull(remoteSourceTaskId, "srcTaskId is null"); tasks.getUnchecked(taskId).removeRemoteSource(remoteSourceTaskId); }

Target:
public void removeRemoteSource(TaskId taskId, TaskId remoteSourceTaskId) { requireNonNull(taskId, "taskId is null"); requireNonNull(remoteSourceTaskId, "remoteSourceTaskId is null"); tasks.getUnchecked(taskId).removeRemoteSource(remoteSourceTaskId); }
Source:
public FlatFilterBuilder beginPropertyIsILikeType(String operator) { return beginPropertyIsLikeType(operator); }

Target:
public FlatFilterBuilder beginPropertyIsILikeType(String operator) { return beginPropertyIsLikeOrIsILike(operator); }
Source:
private List<List<Double>> getRubricWeightsForEachCell(Map<String, String[]> requestParameters, int numOfRubricChoices, int numOfRubricSubQuestions, boolean hasAssignedWeights) { List<List<Double>> rubricWeightsForEachCell = new ArrayList<>(); if (!hasAssignedWeights) { return rubricWeightsForEachCell; } int weightRows = -1; for (int i = 0; i < numOfRubricSubQuestions; i++) { String subQn = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-" + i); if (subQn == null || subQn.trim().isEmpty()) { continue; } boolean rowAdded = false; for (int j = 0; j < numOfRubricChoices; j++) { String choice = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-" + j); String paramName = Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-" + i + "-" + j; String weight = HttpRequestHelper.getValueFromParamMap(requestParameters, paramName); if (weight != null && choice != null) { if (!rowAdded) { weightRows++; rubricWeightsForEachCell.add(new ArrayList<Double>()); rowAdded = true; } try { rubricWeightsForEachCell.get(weightRows).add(Double.parseDouble(weight)); } catch (NumberFormatException e) { log.warning("Failed to parse weight for rubric question " + weight); } } } } return rubricWeightsForEachCell; }

Target:
private List<List<Double>> getRubricWeightsForEachCell(Map<String, String[]> requestParameters, int numOfRubricChoices, int numOfRubricSubQuestions, boolean hasAssignedWeights) { List<List<Double>> rubricWeightsForEachCell = new ArrayList<>(); if (!hasAssignedWeights) { return rubricWeightsForEachCell; } int weightRows = -1; for (int i = 0; i < numOfRubricSubQuestions; i++) { String subQn = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-" + i); if (subQn == null || subQn.trim().isEmpty()) { continue; } boolean rowAdded = false; for (int j = 0; j < numOfRubricChoices; j++) { String choice = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-" + j); String paramName = Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-" + i + "-" + j; String weight = HttpRequestHelper.getValueFromParamMap(requestParameters, paramName); if (weight != null && choice != null) { if (!rowAdded) { weightRows++; rubricWeightsForEachCell.add(new ArrayList<Double>()); rowAdded = true; } try { rubricWeightsForEachCell.get(weightRows).add(Double.parseDouble(weight)); } catch (NumberFormatException e) { log.severe("Failed to parse weight for rubric question " + weight); } } } } return rubricWeightsForEachCell; }
Source:
public SubTabVirtualMachineNetworkInterfaceView( SearchableDetailModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel> modelProvider, EventBus eventBus, ClientStorage clientStorage, ApplicationConstants constants, ApplicationMessages messages, ApplicationTemplates templates) { super(new VmInterfaceListModelTable(modelProvider, eventBus, clientStorage, constants, messages, templates) { @Override public void initTable(final CommonApplicationConstants constants) { super.initTable(constants); getTable().enableColumnResizing(); BooleanColumn<VmNetworkInterface> portMirroringColumn = new BooleanColumn<VmNetworkInterface>(constants.portMirroringEnabled()) { @Override public Boolean getRawValue(VmNetworkInterface object) { return object.isPortMirroring(); } }; portMirroringColumn.makeSortable(VmNetworkInterfaceComparator.BY_PORT_MIRRORING); getTable().addColumnWithHtmlHeader(portMirroringColumn, constants.portMirroring(), "85px"); } }); ViewIdHandler.idHandler.generateAndSetIds(this); initTable(constants); initWidget(getModelBoundTableWidget()); }

Target:
public SubTabVirtualMachineNetworkInterfaceView( SearchableDetailModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel> modelProvider, EventBus eventBus, ClientStorage clientStorage, ApplicationConstants constants, ApplicationMessages messages, ApplicationTemplates templates) { super(new VmInterfaceListModelTable(modelProvider, eventBus, clientStorage, constants, messages, templates) { @Override public void initTable(final CommonApplicationConstants constants) { super.initTable(constants); getTable().enableColumnResizing(); BooleanColumn<VmNetworkInterface> portMirroringColumn = new BooleanColumn<VmNetworkInterface>(constants.portMirroringEnabled()) { @Override public Boolean getRawValue(VmNetworkInterface object) { return object.isPortMirroring(); } }; portMirroringColumn.makeSortable(); getTable().addColumnWithHtmlHeader(portMirroringColumn, constants.portMirroring(), "85px"); } }); ViewIdHandler.idHandler.generateAndSetIds(this); initTable(constants); initWidget(getModelBoundTableWidget()); }
Source:
public static long nextSequenceId(String counterNode) throws IOException{ RecoverableZooKeeper rzk=ZkUtils.getRecoverableZooKeeper(); int maxTries=Integer.MAX_VALUE; int tries=0; while(tries<=maxTries){ tries++; if (tries > 1) { try { Thread.sleep(50); } catch (Exception e) { throw new IOException(e); } } Stat version=new Stat(); long currentCount; byte[] data; try{ data=rzk.getData(counterNode,false,version); }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } currentCount=Bytes.toLong(data)+1; try{ rzk.setData(counterNode,Bytes.toBytes(currentCount),version.getVersion()); return currentCount; }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: case BADVERSION: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } } throw new IOException("Unable to get next conglomerate sequence, there is an issue "+ "speaking with ZooKeeper"); }

Target:
public static long nextSequenceId(String counterNode) throws IOException{ RecoverableZooKeeper rzk=ZkUtils.getRecoverableZooKeeper(); int maxTries=Integer.MAX_VALUE; int tries=0; while(tries<=maxTries){ tries++; if (tries > 1) { try { Thread.sleep(PipelineUtils.getPauseTime(tries,10)); } catch (Exception e) { throw new IOException(e); } } Stat version=new Stat(); long currentCount; byte[] data; try{ data=rzk.getData(counterNode,false,version); }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } currentCount=Bytes.toLong(data)+1; try{ rzk.setData(counterNode,Bytes.toBytes(currentCount),version.getVersion()); return currentCount; }catch(KeeperException e){ switch(e.code()){ case CONNECTIONLOSS: case OPERATIONTIMEOUT: case BADVERSION: continue; default: throw new IOException(e); } }catch(InterruptedException e){ throw new IOException(e); } } throw new IOException("Unable to get next conglomerate sequence, there is an issue "+ "speaking with ZooKeeper"); }
Source:
public void updateItem(TurboIssue issue, boolean empty) { super.updateItem(issue, empty); if (issue == null) { return; } if (!issue.isOpen()){ if (!getStyleClass().contains("issue-cell-closed")) { getStyleClass().add("issue-cell-closed"); } } else { getStyleClass().remove("issue-cell-closed"); } this.issue = issue; Optional<Model> currentModel = model.getModelById(issue.getRepoId()); if (!currentModel.isPresent()) { logger.error("Model is not present for issue " + issue.getId() + " at " + issue.getRepoId()); setGraphic(getGraphic()); return; } setGraphic(new ListPanelCard(currentModel.get(), issue, parent, issuesWithNewComments)); this.setId(issue.getRepoId() + "_col" + parentPanelIndex + "_" + issue.getId()); }

Target:
public void updateItem(TurboIssue issue, boolean empty) { super.updateItem(issue, empty); if (issue == null) { return; } updateStyleToMatchStatus(issue); this.issue = issue; Optional<Model> currentModel = model.getModelById(issue.getRepoId()); if (!currentModel.isPresent()) { logger.error("Model is not present for issue " + issue.getId() + " at " + issue.getRepoId()); setGraphic(getGraphic()); return; } setGraphic(new ListPanelCard(currentModel.get(), issue, parent, issuesWithNewComments)); this.setId(issue.getRepoId() + "_col" + parentPanelIndex + "_" + issue.getId()); }
Source:
ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); Map<String, String> systemStreamConfigs = new HashMap<>(); graphSpec.getInputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getOutputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getSystemDescriptors().forEach(sd -> systemStreamConfigs.putAll(sd.toConfig())); Map<String, String> appConfigs = new HashMap<>(cfg); appConfigs.putAll(systemStreamConfigs); Config generatedConfig = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(generatedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(generatedConfig, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }

Target:
ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); Map<String, String> systemStreamConfigs = new HashMap<>(); graphSpec.getInputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getOutputDescriptors().forEach((key, value) -> systemStreamConfigs.putAll(value.toConfig())); graphSpec.getSystemDescriptors().forEach(sd -> systemStreamConfigs.putAll(sd.toConfig())); graphSpec.getDefaultSystemDescriptor().ifPresent(dsd -> systemStreamConfigs.put(JobConfig.JOB_DEFAULT_SYSTEM(), dsd.getSystemName())); Map<String, String> appConfigs = new HashMap<>(cfg); appConfigs.putAll(systemStreamConfigs); Config generatedConfig = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(generatedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(generatedConfig, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }
Source:
public void commit() { if (marshalled == null) { throw ControllerLogger.ROOT_LOGGER.rollbackAlreadyInvoked(); } try(InputStream in = getMarshalledInputStream()) { doCommit(in); } catch (IOException ioex) { ioex.printStackTrace(); } }

Target:
public void commit() { if (marshalled == null) { throw ControllerLogger.ROOT_LOGGER.rollbackAlreadyInvoked(); } try(InputStream in = getMarshalledInputStream()) { doCommit(in); } catch (IOException ioex) { MGMT_OP_LOGGER.errorf(ioex, ioex.getMessage()); } }
Source:
public void testHumanPhenotypeOntologyDefaultLocation() { String location = ontologyService.getDefaultOntologyLocation(); String expected = "<LINK_1>"; Assert.assertTrue(location.equalsIgnoreCase(expected)); }

Target:
public void testHumanPhenotypeOntologyDefaultLocation() { String location = ontologyService.getDefaultOntologyLocation(); Assert.assertNotNull(location); Assert.assertTrue(location.endsWith("hp.obo")); Assert.assertTrue(location.startsWith("http")); }
Source:
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { return null; }

Target:
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { return ValidationResult.OK; }
Source:
public void testAdd(){ long value = TestData.getLong(); long record = client.add("foo",value); Assert.assertEquals(value, client.get("foo", record)); }

Target:
public void testAdd(){ long value = TestData.getLong(); long record = client.add("foo",value); Assert.assertEquals(value, client.get("foo", record)); Assert.assertEquals("foo", Iterables.getOnlyElement(client.describe(record))); }
Source:
public Integer findDatasetByName(String name) { Integer result = dataSetDAO.getDataSetByName(name); if (result == null) { return -1; } return result; }

Target:
public DataSet findDatasetByName(String name) { return dataSetDAO.findDatasetByName(name); }
Source:
public StreamGobbler(InputStream inStream) { lines = new ArrayList<String>(); is = new BufferedInputStream(inStream); inScanner = new Scanner(is); }

Target:
public StreamGobbler(InputStream inStream) { lines = new ArrayList<>(); is = new BufferedInputStream(inStream); inScanner = new Scanner(is); }
Source:
public void enterNameInput() { String input = nameInputField.getText(); if (!input.isEmpty()) { this.playerName = nameInputField.getText(); } this.setVisible(false); Settings.names[number - 1] = this.playerName; if (number == 1 && StartController.getLimitOfPlayers() == 2) { namePlayer2(); } else { try { switchScreen("level.fxml"); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public void enterNameInput() { String input = nameInputField.getText(); if (!input.isEmpty()) { this.playerName = nameInputField.getText(); } this.setVisible(false); Settings.setName(this.playerName, number - 1); if (number == 1 && StartController.getLimitOfPlayers() == 2) { namePlayer2(); } else { try { switchScreen("level.fxml"); } catch (IOException e) { e.printStackTrace(); } } }
Source:
private boolean selectBySelection(ConcreteMarker marker) { if (onResource == ON_ANY || marker == null) { return true; } if (focusResource == null) { return true; } IResource resource = marker.getResource(); if (onResource == ON_WORKING_SET) { if (resource != null) { return isEnclosed(resource); } } else if (onResource == ON_ANY_IN_SAME_CONTAINER) { IProject project = resource.getProject(); if (project == null) { return false; } for (IResource focusResource : focusResource) { IProject selectedProject = focusResource.getProject(); if (selectedProject == null) { continue; } if (project.equals(selectedProject)) { return true; } } } else if (onResource == ON_SELECTED_ONLY) { for (IResource focusResource : focusResource) { if (resource.equals(focusResource)) { return true; } } } else if (onResource == ON_SELECTED_AND_CHILDREN) { for (IResource focusResource : focusResource) { IResource parentResource = resource; while (parentResource != null) { if (parentResource.equals(focusResource)) { return true; } parentResource = parentResource.getParent(); } } } return false; }

Target:
private boolean selectBySelection(ConcreteMarker marker) { if (onResource == ON_ANY || marker == null) { return true; } if (focusResources == null) { return true; } IResource resource = marker.getResource(); if (onResource == ON_WORKING_SET) { if (resource != null) { return isEnclosed(resource); } } else if (onResource == ON_ANY_IN_SAME_CONTAINER) { IProject project = resource.getProject(); if (project == null) { return false; } for (IResource focusResource : focusResources) { IProject selectedProject = focusResource.getProject(); if (selectedProject == null) { continue; } if (project.equals(selectedProject)) { return true; } } } else if (onResource == ON_SELECTED_ONLY) { for (IResource focusResource : focusResources) { if (resource.equals(focusResource)) { return true; } } } else if (onResource == ON_SELECTED_AND_CHILDREN) { for (IResource focusResource : focusResources) { IResource parentResource = resource; while (parentResource != null) { if (parentResource.equals(focusResource)) { return true; } parentResource = parentResource.getParent(); } } } return false; }
Source:
protected static boolean hasComposition(final PasswordData passwordData) { final List<Rule> rules = new ArrayList<>(); rules.add(COMPOSITION_RULE); final PasswordValidator compositionValidator = new PasswordValidator(rules); return compositionValidator.validate(passwordData).isValid(); }

Target:
private static boolean hasComposition(final PasswordData passwordData) { final List<Rule> rules = new ArrayList<>(); rules.add(COMPOSITION_RULE); final PasswordValidator compositionValidator = new PasswordValidator(rules); return compositionValidator.validate(passwordData).isValid(); }
Source:
private static TaskContext deserializeContext(String pathToFile) throws IOException, ClassNotFoundException, InterruptedException { File f = new File(pathToFile); if (!f.exists()) { throw new IllegalStateException(CONTEXT_FILE + f + " does not exist"); } if (!f.canRead()) { throw new IllegalStateException(CONTEXT_FILE + f + " exists but cannot be read"); } if (!f.canWrite()) { throw new IllegalStateException(CONTEXT_FILE + f + " exists but cannot be written"); } try (ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(f))) { return (TaskContext) inputStream.readObject(); } finally { deleteContextFile(f); } }

Target:
private TaskContext deserializeContext(String pathToFile) throws IOException, ClassNotFoundException, InterruptedException { File f = new File(pathToFile); if (!f.exists()) { throw new IllegalStateException(CONTEXT_FILE + f + " does not exist"); } if (!f.canRead()) { throw new IllegalStateException(CONTEXT_FILE + f + " exists but cannot be read"); } if (!f.canWrite()) { throw new IllegalStateException(CONTEXT_FILE + f + " exists but cannot be written"); } try (ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(f))) { return (TaskContext) inputStream.readObject(); } finally { deleteContextFile(f); } }
Source:
private List<String> putLocalDirectory(Message<?> requestMessage, File file, String subDirectory) { File[] files = file.listFiles(); List<File> filteredFiles = this.filterMputFiles(files); List<String> replies = new ArrayList<String>(); for (File fyle : filteredFiles) { if (!fyle.isDirectory()) { String path = this.doPut(MessageBuilder.withPayload(fyle) .copyHeaders(requestMessage.getHeaders()) .build(), subDirectory); if (path == null) { if (logger.isDebugEnabled()) { logger.debug("File " + fyle.getAbsolutePath() + " removed before transfer; ignoring"); } } else { replies.add(path); } } else if (this.options.contains(Option.RECURSIVE)){ String newSubDirectory = (StringUtils.hasText(subDirectory) ? subDirectory + this.remoteFileSeparator : "") + fyle.getName(); replies.addAll(this.putLocalDirectory(requestMessage, fyle, newSubDirectory)); } } return replies; }

Target:
private List<String> putLocalDirectory(Message<?> requestMessage, File file, String subDirectory) { File[] files = file.listFiles(); List<File> filteredFiles = this.filterMputFiles(files); List<String> replies = new ArrayList<String>(); for (File filteredFile : filteredFiles) { if (!filteredFile.isDirectory()) { String path = this.doPut(MessageBuilder.withPayload(filteredFile) .copyHeaders(requestMessage.getHeaders()) .build(), subDirectory); if (path == null) { if (logger.isDebugEnabled()) { logger.debug("File " + filteredFile.getAbsolutePath() + " removed before transfer; ignoring"); } } else { replies.add(path); } } else if (this.options.contains(Option.RECURSIVE)){ String newSubDirectory = (StringUtils.hasText(subDirectory) ? subDirectory + this.remoteFileTemplate.getRemoteFileSeparator() : "") + filteredFile.getName(); replies.addAll(this.putLocalDirectory(requestMessage, filteredFile, newSubDirectory)); } } return replies; }
Source:
public void write(Path pom, InternalNIOCompilationRequest request) { try { Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(pom))); if (model == null) { logger.error("Model null from pom file:", pom.toString()); return; } PomPlaceHolder pomPH = new PomPlaceHolder(pom.toAbsolutePath().toString(), model.getArtifactId(), model.getGroupId(), model.getVersion(), model.getPackaging(), Files.readAllBytes(Paths.get(pom.toAbsolutePath().toString()))); if (!history.contains(pomPH)) { PluginPresents plugs = updatePom(model); request.getInfo().lateAdditionKiePluginPresent(plugs.isKiePluginPresent()); if (plugs.isKiePluginPresent()) { String args[] = addCreateClasspathMavenArgs(request.getKieCliRequest().getArgs()); request.getKieCliRequest().setArgs(args); } if (plugs.pomOverwriteRequired()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writer.write(baos, model); if (logger.isDebugEnabled()) { logger.debug("Pom changed:{}", new String(baos.toByteArray(), StandardCharsets.UTF_8)); } Files.delete(Paths.get(pom.getParent().toAbsolutePath().toString(), POM_NAME)); Files.write(Paths.get(pom.getParent().toAbsolutePath().toString(), POM_NAME), baos.toByteArray(), StandardOpenOption.CREATE_NEW); } history.add(pomPH); } } catch (Exception e) { logger.error(e.getMessage()); } }

Target:
public void write(Path pom, InternalNIOCompilationRequest request) { try { Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(pom))); if (model == null) { logger.error("Model null from pom file:", pom.toString()); return; } PomPlaceHolder pomPH = new PomPlaceHolder(pom.toAbsolutePath().toString(), model.getArtifactId(), model.getGroupId(), model.getVersion(), model.getPackaging(), Files.readAllBytes(Paths.get(pom.toAbsolutePath().toString()))); if (!history.contains(pomPH)) { PluginPresents plugs = updatePom(model); request.getInfo().lateAdditionKiePluginPresent(plugs.isKiePluginPresent()); if (plugs.isKiePluginPresent()) { String args[] = addCreateClasspathMavenArgs(request.getKieCliRequest().getArgs()); request.getKieCliRequest().setArgs(args); } if (plugs.pomOverwriteRequired()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writer.write(baos, model); if (logger.isDebugEnabled()) { logger.debug("Pom changed:{}", new String(baos.toByteArray(), StandardCharsets.UTF_8)); } Path pomParent = Paths.get(pom.getParent().toAbsolutePath().toString(), POM_NAME); Files.delete(pomParent); Files.write(pomParent, baos.toByteArray(), StandardOpenOption.CREATE_NEW); } history.add(pomPH); } } catch (Exception e) { logger.error(e.getMessage()); } }
Source:
public void checkPreviewUpdatedAfterDestroyRecreate() { waitFor(mActivityRule.getActivity().mPreviewIdlingResource); pressBackButton(); resetPreviewIdlingResource(); mIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); mActivityRule.launchActivity(mIntent); waitFor(mActivityRule.getActivity().mPreviewIdlingResource); }

Target:
public void checkPreviewUpdatedAfterDestroyRecreate() { IdlingRegistry.getInstance().register(mActivityRule.getActivity().getViewIdlingResource()); pressBackButton(); mIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); mActivityRule.getActivity().startActivity(mIntent); onView(withId(R.id.textureView)).check(matches(isDisplayed())); IdlingRegistry.getInstance().unregister( mActivityRule.getActivity().getViewIdlingResource()); }
Source:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if(properties == null) return; if(properties.get("provider") != null) { providerName = (String) properties.get("provider"); } if(properties.get("defaultHeight") != null) { defaultHeight = Integer.parseInt((String)properties.get("defaultHeight")); } if(properties.get("defaultWidth") != null) { defaultWidth = Integer.parseInt((String)properties.get("defaultWidth")); } if(properties.get("scale") != null) { scale = Double.parseDouble((String)properties.get("scale")); if(scale < 0.1) scale = 1.0; } }

Target:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if(properties == null) return; if(properties.get("provider") != null) { providerName = (String) properties.get("provider"); } if(properties.get("defaultHeight") != null) { defaultHeight = Integer.parseInt((String)properties.get("defaultHeight")); } if(properties.get("defaultWidth") != null) { defaultWidth = Integer.parseInt((String)properties.get("defaultWidth")); } if(properties.get("scale") != null) { scale = Double.parseDouble((String)properties.get("scale")); if(scale < 0.1) { scale = 1.0; } } }