auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public StsTokenExchangeResponse exchangeToken() throws IOException { UrlEncodedContent content = new UrlEncodedContent(buildTokenRequest()); HttpRequest httpRequest = httpRequestFactory .buildPostRequest(new GenericUrl(tokenExchangeEndpoint), content); httpRequest.setParser(new JsonObjectParser(OAuth2Utils.JSON_FACTORY)); if (headers != null) { httpRequest.setHeaders(headers); } <START> HttpResponse response; <END> try { response = httpRequest.execute(); } catch (IOException e) { if (!(e instanceof HttpResponseException)) { throw e; } GenericJson errorResponse = parseJson(((HttpResponseException) e).getContent()); String errorCode = (String) errorResponse.get("error"); String errorDescription = null; String errorUri = null; if (errorResponse.containsKey("error_description")) { errorDescription = (String) errorResponse.get("error_description"); } if (errorResponse.containsKey("error_uri")) { errorUri = (String) errorResponse.get("error_uri"); } throw new OAuthException(errorCode, errorDescription, errorUri); } GenericData responseData = response.parseAs(GenericData.class); return buildResponse(responseData); }</code><technical_language>split try block. code block</technical_language>

Target:
public StsTokenExchangeResponse exchangeToken() throws IOException { UrlEncodedContent content = new UrlEncodedContent(buildTokenRequest()); HttpRequest httpRequest = httpRequestFactory.buildPostRequest(new GenericUrl(tokenExchangeEndpoint), content); httpRequest.setParser(new JsonObjectParser(OAuth2Utils.JSON_FACTORY)); if (headers != null) { httpRequest.setHeaders(headers); } try { HttpResponse response = httpRequest.execute(); GenericData responseData = response.parseAs(GenericData.class); return buildResponse(responseData); } catch (IOException e) { if (!(e instanceof HttpResponseException)) { throw e; } GenericJson errorResponse = parseJson(((HttpResponseException) e).getContent()); String errorCode = (String) errorResponse.get("error"); String errorDescription = null; String errorUri = null; if (errorResponse.containsKey("error_description")) { errorDescription = (String) errorResponse.get("error_description"); } if (errorResponse.containsKey("error_uri")) { errorUri = (String) errorResponse.get("error_uri"); } throw new OAuthException(errorCode, errorDescription, errorUri); } }
Source:
<code>public static Object extractPartitioningValue(RelDistribution dist) { RexNode partitioningNode = dist.getPartitionEqualValue(); if (partitioningNode instanceof RexLiteral) { RexLiteral literal = (RexLiteral) partitioningNode; Comparable value = literal.getValue(); if (value instanceof Number) { return ((Number) value).longValue(); } else { try { <START> RexLiteral.stringValue(literal); <END> } catch(Exception ex) { } } } return null; }</code><technical_language>missing return</technical_language>

Target:
public static Object extractPartitioningValue(RelDistribution dist) { RexNode partitioningNode = dist.getPartitionEqualValue(); if (partitioningNode instanceof RexLiteral) { RexLiteral literal = (RexLiteral) partitioningNode; Comparable value = literal.getValue(); if (value instanceof Number) { return ((Number) value).longValue(); } else { try { return RexLiteral.stringValue(literal); } catch(Exception ex) { } } } return null; }
Source:
<code>public void reportCompleting(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, JobResult result) { Map<String, Object> request = Map.of( "agent_runtime_info", agentRuntimeInfo, "job_identifier", jobIdentifier, "job_result", result); try { this.httpClientHttpInvokerRequestExecutor.doPost("report_completing", gson.toJson(new ReportCompleteStatusRequest(agentRuntimeInfo, jobIdentifier, result))); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>I exception needs serialised server. IOException. Right</technical_language>

Target:
public void reportCompleting(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, JobResult result) { try { this.httpClientHttpInvokerRequestExecutor.doPost("report_completing", gson.toJson(new ReportCompleteStatusRequest(agentRuntimeInfo, jobIdentifier, result), ReportCompleteStatusRequest.class)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); if ("coinmarketcap".equalsIgnoreCase(exchangeType)) { String preferredFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } <START> return new CoinexchangeRateSource(preferredFiatCurrency); <END> }else if ("zcoinfix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); }catch (Throwable e) { } } String preferredFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }</code><technical_language>"coinmarketcap" prefix for CoinexchangeRateSource</technical_language>

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); if ("coinmarketcap".equalsIgnoreCase(exchangeType)) { String preferredFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new CoinmarketcapRateSource(preferredFiatCurrency); }else if ("zcoinfix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); }catch (Throwable e) { } } String preferredFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }
Source:
<code>protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { if (buf.readableBytes() < FRAME_MIN_SIZE) { return null; } <START> int indexStart = buf.indexOf(buf.readerIndex(), buf.writerIndex(), FRAME_START_SYMBOL); <END> if (indexStart == -1) { buf.clear(); return null; } indexStart++; int index, cnt; for (index = indexStart, cnt = 0;; index++) { int i = index; index = buf.indexOf(index, buf.writerIndex(), FRAME_END_SYMBOL); if (index == -1) { break; } for (;; i++, cnt++) { i = buf.indexOf(i, index, FRAME_FREE_TEXT_BLOCK_SYMBOL); if (i == -1 || i >= index) { break; } } if (cnt % 2 == 0) { break; } } if (index == -1) { while (buf.readableBytes() > FRAME_MAX_SIZE) { int i = buf.indexOf(buf.readerIndex() + 1, buf.writerIndex(), FRAME_START_SYMBOL); if (i == -1) { buf.clear(); } else { buf.readerIndex(i); } } return null; } buf.readerIndex(indexStart); ChannelBuffer result = buf.readBytes(index - indexStart); buf.readerIndex(buf.readerIndex() + 1); return result; }</code><technical_language>I this is necessary. character</technical_language>

Target:
protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { if (buf.readableBytes() < 2) { return null; } int frameStartIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '('); if (frameStartIndex == -1) { buf.clear(); return null; } int frameEndIndex, freeTextSymbolCounter; for (frameEndIndex = frameStartIndex, freeTextSymbolCounter = 0;; frameEndIndex++) { int freeTextIndex = frameEndIndex; frameEndIndex = buf.indexOf(frameEndIndex, buf.writerIndex(), (byte) ')'); if (frameEndIndex == -1) { break; } for (;; freeTextIndex++, freeTextSymbolCounter++) { freeTextIndex = buf.indexOf(freeTextIndex, frameEndIndex, (byte) '$'); if (freeTextIndex == -1 || freeTextIndex >= frameEndIndex) { break; } } if (freeTextSymbolCounter % 2 == 0) { break; } } if (frameEndIndex == -1) { while (buf.readableBytes() > 1024) { int discardUntilIndex = buf.indexOf(buf.readerIndex() + 1, buf.writerIndex(), (byte) '('); if (discardUntilIndex == -1) { buf.clear(); } else { buf.readerIndex(discardUntilIndex); } } return null; } buf.readerIndex(frameStartIndex); ChannelBuffer result = buf.readBytes(frameEndIndex + 1 - frameStartIndex); return result; }
Source:
<code>public void correctlyMapsPathString() throws Exception { final Take take = new Take() { @Override public Response act(final Request req) throws IOException { return new RsText(new RqHref.Base(req).href().toString()); } }; <START> for (final String method:TkProxyTest.METHODS) { <END> new FtRemote(take).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { MatcherAssert.assertThat( new RsPrint( new TkProxy(home).act( new RqFake(method, "/a/b/c") ) ).printBody(), Matchers.equalTo( String.format( "http://%s:%d/a/b/c", home.getHost(), home.getPort() ) ) ); } } ); } }</code><technical_language>@sebing spaces :</technical_language>

Target:
public void correctlyMapsPathString() throws Exception { final Take take = new Take() { @Override public Response act(final Request req) throws IOException { return new RsText(new RqHref.Base(req).href().toString()); } }; new FtRemote(take).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { MatcherAssert.assertThat( new RsPrint( new TkProxy(home).act(new RqFake("GET", "/a/b/c")) ).printBody(), Matchers.equalTo( String.format( "http://%s:%d/a/b/c", home.getHost(), home.getPort() ) ) ); } } ); }
Source:
<code>public List<SqlNode> getOperandList() { <START> return Collections.unmodifiableList(Arrays.asList(operands)); <END> }</code><technical_language>worth adding pattern Util? public static <T> List<T> Util.unmodifiableList(T[] elems)</technical_language>

Target:
public List<SqlNode> getOperandList() { return Util.unmodifiableList(operands); }
Source:
<code>public String getDistribute() { <START> return String.valueOf("true".equals(distribute)); <END> }</code><technical_language>I cleaner do Boolean.toString(Boolean.parseBoolean(distribute)). way, string "true" in code</technical_language>

Target:
public String getDistribute() { return Boolean.toString(Boolean.parseBoolean(distribute)); }
Source:
<code>public void testRemoveNonExistant() throws Exception { setUpEntityQueryExpectations(VdcQueryType.GetMacPoolById, IdQueryParameters.class, new String[] { "Id" }, <START> new Object[] { NON_EXISTANT_GUID }, <END> null); control.replay(); try { resource.guid = NON_EXISTANT_GUID; resource.remove(); fail("expected WebApplicationException"); } catch (WebApplicationException wae) { assertNotNull(wae.getResponse()); assertEquals(404, wae.getResponse().getStatus()); } }</code><technical_language>I is MAC_POOL_ID avoid assigning resource.guid later, this test need changing if resource.guid is changed visibility changed</technical_language>

Target:
public void testRemoveNonExistant() throws Exception { setUpEntityQueryExpectations(VdcQueryType.GetMacPoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { MAC_POOL_ID }, null); control.replay(); try { resource.remove(); fail("expected WebApplicationException"); } catch (WebApplicationException wae) { assertNotNull(wae.getResponse()); assertEquals(404, wae.getResponse().getStatus()); } }
Source:
<code>public WmdPassageScorer(String index, Integer k) throws IOException { this.wmdDictionary = new WordEmbeddingDictionary(index); wmdDictionary.getEmbeddingVector("newton"); this.topPassages = k; scoredPassageHeap = MinMaxPriorityQueue.maximumSize(topPassages).create(); stopWords = new ArrayList<>(); InputStream is = getClass().getResourceAsStream("/io/anserini/qa/english-stoplist.txt"); BufferedReader bRdr = new BufferedReader(new InputStreamReader(is)); String line; while ((line = bRdr.readLine()) != null) { <START> if (!line.contains("#")) { <END> stopWords.add(line); } } }</code><technical_language>startsWith</technical_language>

Target:
public WmdPassageScorer(String index, Integer k) throws IOException { this.wmdDictionary = new WordEmbeddingDictionary(index); this.topPassages = k; scoredPassageHeap = MinMaxPriorityQueue.maximumSize(topPassages).create(); stopWords = new ArrayList<>(); InputStream is = getClass().getResourceAsStream("/io/anserini/qa/english-stoplist.txt"); BufferedReader bRdr = new BufferedReader(new InputStreamReader(is)); String line; while ((line = bRdr.readLine()) != null) { if (!line.startsWith("#")) { stopWords.add(line); } } }
Source:
<code>public void run() { try { int requestCount = 0; while (requestCount < numberOfRequests) { int size = new Random().nextInt(5000); BlobProperties properties = new BlobProperties(size, "service1", "owner id check", "image/jpeg", false); byte[] metadata = new byte[new Random().nextInt(1000)]; byte[] blob = new byte[size]; new Random().nextBytes(metadata); new Random().nextBytes(blob); try { String blobId = coordinator.putBlob(properties, ByteBuffer.wrap(metadata), new ByteArrayInputStream(blob)); blockingQueue.put(new Payload(properties, metadata, blob, blobId)); requestCount++; } catch (CoordinatorException e) { if (e.getErrorCode() != CoordinatorError.UnexpectedInternalError) { throw e; } else { <START> System.err.println("Ignoring unexpected putBlob exception to avoid hanging test."); <END> e.printStackTrace(); } } } } catch (Exception e) { e.printStackTrace(); } finally { completedLatch.countDown(); } }</code><technical_language>fail in cases</technical_language>

Target:
public void run() { try { for (int i = 0; i < numberOfRequests; i++) { int size = new Random().nextInt(5000); BlobProperties properties = new BlobProperties(size, "service1", "owner id check", "image/jpeg", false); byte[] metadata = new byte[new Random().nextInt(1000)]; byte[] blob = new byte[size]; new Random().nextBytes(metadata); new Random().nextBytes(blob); String blobId = coordinator.putBlob(properties, ByteBuffer.wrap(metadata), new ByteArrayInputStream(blob)); blockingQueue.put(new Payload(properties, metadata, blob, blobId)); } } catch (Exception e) { e.printStackTrace(); } finally { completedLatch.countDown(); } }
Source:
<code>public static String getMessageFromValue(final int value) { switch (value) { case INVALID_DATE: return "Can only access during valid times: "; case INVALID_PERMISSION: return "Can only perform task with valid permission: "; case NO_AUTH_SENT: return "No Authentication Information was received: "; case INSUFFICIENT_HASH: <START> return "A problem occurred so a hash of sufficient strength could not be created: "; <END> default: return null; } }</code><technical_language>Change "so" "and" (I sounds better)</technical_language>

Target:
public static String getMessageFromValue(final int value) { switch (value) { case INVALID_DATE: return "Can only access during valid times: "; case INVALID_PERMISSION: return "Can only perform task with valid permission: "; case NO_AUTH_SENT: return "No Authentication Information was received: "; case INSUFFICIENT_HASH: return "A problem occurred and a hash of sufficient strength could not be created: "; default: return null; } }
Source:
<code>public void base64EncodedPasswordAfterAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("base64encoded-issue-1840"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; <START> assertThat(ldapUserDetails.getDn()).isEqualTo("uid=base64encoded-issue-1840,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("base64encoded-issue-1840"); assertThat(ldapUserDetails.getPassword()).isEqualTo("{MD5}5f4dcc3b5aa765d61d8327deb882cf99"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains( new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE") ); <END> }</code><technical_language>suggestion assertThat(ldapUserDetails.getDn()).isEqualTo("uid=base64encoded-issue-1840,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("base64encoded-issue-1840"); assertThat(ldapUserDetails.getPassword()).isEqualTo("{MD5}5f4dcc3b5aa765d61d8327deb882cf99"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains(new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE"));</technical_language>

Target:
public void base64EncodedPasswordAfterAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("issue1840-type-1"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(ldapUserDetails.getDn()).isEqualTo("uid=issue1840-type-1,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("issue1840-type-1"); assertThat(ldapUserDetails.getPassword()).isEqualTo("{MD5}5f4dcc3b5aa765d61d8327deb882cf99"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains(new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE")); }
Source:
<code>public void aggregate(StructuredRecord groupKey, Iterator<StructuredRecord> iterator, Emitter<StructuredRecord> emitter) throws Exception { if (!iterator.hasNext()) { return; } SelectionFunction selectionFunction; if (filterFunction == null) { emitter.emit(iterator.next()); } else { StructuredRecord firstRecord = iterator.next(); Schema.Field firstField = firstRecord.getSchema().getField(filterFunction.getField()); selectionFunction = filterFunction.getSelectionFunction(firstField.getSchema()); selectionFunction.beginFunction(); selectionFunction.operateOn(firstRecord); while (iterator.hasNext()) { selectionFunction.operateOn(iterator.next()); } selectionFunction.finishFunction(); List<StructuredRecord> outputRecords = selectionFunction.getSelectedRecords(); for (StructuredRecord outputRecord : outputRecords) { Schema outputSchema = getOutputSchema(outputRecord.getSchema()); <START> validateSchema(outputSchema, uniqueFields, filterFunction); <END> StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : outputRecord.getSchema().getFields()) { builder.set(field.getName(), outputRecord.get(field.getName())); } emitter.emit(builder.build()); } } }</code><technical_language>misunderstanding, I schema invalid this point. In order get here, unique fields present grouping, function worked. If is validation needed, happen in group method</technical_language>

Target:
public void aggregate(StructuredRecord groupKey, Iterator<StructuredRecord> iterator, Emitter<StructuredRecord> emitter) throws Exception { if (!iterator.hasNext()) { return; } SelectionFunction selectionFunction; if (filterFunction == null) { emitter.emit(iterator.next()); } else { StructuredRecord firstRecord = iterator.next(); Schema.Field firstField = firstRecord.getSchema().getField(filterFunction.getField()); selectionFunction = filterFunction.getSelectionFunction(firstField.getSchema()); selectionFunction.beginFunction(); selectionFunction.operateOn(firstRecord); while (iterator.hasNext()) { selectionFunction.operateOn(iterator.next()); } List<StructuredRecord> outputRecords = selectionFunction.getSelectedRecords(); for (StructuredRecord outputRecord : outputRecords) { Schema outputSchema = getOutputSchema(outputRecord.getSchema()); StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : outputRecord.getSchema().getFields()) { builder.set(field.getName(), outputRecord.get(field.getName())); } emitter.emit(builder.build()); } } }
Source:
<code>public void add(Storable storable) throws StorageException { Preconditions.checkNotNull(storable, "Storable argument can not be null"); final Storable existing = get(storable.getStorableKey()); if (existing == null) { try { atlasMetadataService.createEntity(referenceOf(storable)); } catch (EntityExistsException e) { LOG.error("Another instance exists with the same primary key [{}]", storable.getPrimaryKey(), e); throw new AlreadyExistsException("Another instance exists with the same primary key: " + storable.getPrimaryKey()); } catch (Exception e) { throw new StorageException(e); } <START> } else if (existing.equals(storable)) { <END> return; } else { throw new AlreadyExistsException("Another instance with same id = " + storable.getPrimaryKey() + " exists with different value in namespace " + storable.getNameSpace() + " Consider using addOrUpdate method if you always want to overwrite."); } }</code><technical_language>merge this else if else parts else if</technical_language>

Target:
public void add(Storable storable) throws StorageException { Preconditions.checkNotNull(storable, "Storable argument can not be null"); final Storable existing = get(storable.getStorableKey()); if (existing == null) { try { atlasMetadataService.createEntity(referenceOf(storable)); } catch (EntityExistsException e) { LOG.error("Another instance exists with the same primary key [{}]", storable.getPrimaryKey(), e); throw new AlreadyExistsException("Another instance exists with the same primary key: " + storable.getPrimaryKey()); } catch (Exception e) { throw new StorageException(e); } } else if (!existing.equals(storable)) { throw new AlreadyExistsException("Another instance with same id = " + storable.getPrimaryKey() + " exists with different value in namespace " + storable.getNameSpace() + " Consider using addOrUpdate method if you always want to overwrite."); } }
Source:
<code>public static IStatus setTraceType(IResource resource, TraceTypeHelper traceType) throws CoreException { String traceBundle = null, traceTypeId = traceType.getCanonicalName(), traceIcon = null; if (isCustomTraceId(traceTypeId)) { traceBundle = Activator.getDefault().getBundle().getSymbolicName(); traceIcon = DEFAULT_TRACE_ICON_PATH; } else { IConfigurationElement ce = TmfTraceType.getInstance().getTraceAttributes(traceTypeId); traceBundle = ce.getContributor().getName(); traceIcon = ce.getAttribute(TmfTraceType.ICON_ATTR); } resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, traceBundle); resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, traceTypeId); resource.setPersistentProperty(TmfCommonConstants.TRACEICON, traceIcon); TmfProjectElement tmfProject = TmfProjectRegistry.getProject(resource.getProject(), true); if (resource.getParent().equals(tmfProject.getTracesFolder().getResource())) { for (TmfTraceElement traceElement : tmfProject.getTracesFolder().getTraces()) { if (traceElement.getName().equals(resource.getName())) { traceElement.refreshTraceType(); break; } } } else { for (TmfExperimentElement experimentElement : tmfProject.getExperimentsFolder().getExperiments()) { if (resource.getParent().equals(experimentElement.getResource())) { for (TmfTraceElement traceElement : experimentElement.getTraces()) { if (traceElement.getName().equals(resource.getName())) { <START> traceElement.refreshTraceType(); <END> break; } } break; } } } tmfProject.refresh(); return Status.OK_STATUS; }</code><technical_language>loop refresh is common code</technical_language>

Target:
public static IStatus setTraceType(IResource resource, TraceTypeHelper traceType) throws CoreException { String traceBundle = null, traceTypeId = traceType.getCanonicalName(), traceIcon = null; if (isCustomTraceId(traceTypeId)) { traceBundle = Activator.getDefault().getBundle().getSymbolicName(); traceIcon = DEFAULT_TRACE_ICON_PATH; } else { IConfigurationElement ce = TmfTraceType.getInstance().getTraceAttributes(traceTypeId); traceBundle = ce.getContributor().getName(); traceIcon = ce.getAttribute(TmfTraceType.ICON_ATTR); } resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, traceBundle); resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, traceTypeId); resource.setPersistentProperty(TmfCommonConstants.TRACEICON, traceIcon); TmfProjectElement tmfProject = TmfProjectRegistry.getProject(resource.getProject(), true); if (resource.getParent().equals(tmfProject.getTracesFolder().getResource())) { refreshTraceElement(tmfProject.getTracesFolder().getTraces(), resource.getName()); } else { for (TmfExperimentElement experimentElement : tmfProject.getExperimentsFolder().getExperiments()) { if (resource.getParent().equals(experimentElement.getResource())) { refreshTraceElement(experimentElement.getTraces(), resource.getName()); break; } } } tmfProject.refresh(); return Status.OK_STATUS; }
Source:
<code>public void testMoveNodeConnectWithAnotherNode() { aDiagram.addNode(aClassNode, new Point2D.Double(5, 5)); aDiagram.addNode(aInterfaceNode, new Point2D.Double(44, 44)); aDiagram.addNode(aPackageNode, new Point2D.Double(87, 87)); aDiagram.addEdge(aAggregationEdge, new Point2D.Double(8, 10), new Point2D.Double(45, 48)); aDiagram.addEdge(aAssociationEdge, new Point2D.Double(47, 49), new Point2D.Double(9, 17)); aDiagram.addEdge(aDependencyEdge, new Point2D.Double(90, 93), new Point2D.Double(44, 49)); Rectangle2D edge1Bond = aAggregationEdge.getBounds(); Rectangle2D edge3Bond = aDependencyEdge.getBounds(); Rectangle2D packageNodeBonds = aPackageNode.getBounds(); Rectangle2D interFaceNodeBonds = aInterfaceNode.getBounds(); aClassNode.translate(20, 20); assertEquals(aClassNode, aAggregationEdge.getStart()); assertEquals(aInterfaceNode, aAggregationEdge.getEnd()); assertFalse(edge1Bond == aAggregationEdge.getBounds()); assertEquals(interFaceNodeBonds, aInterfaceNode.getBounds()); <START> <END> aInterfaceNode.translate(-19, 45); assertEquals(aPackageNode, aDependencyEdge.getStart()); assertEquals(aInterfaceNode, aDependencyEdge.getEnd()); assertFalse(edge3Bond == aDependencyEdge.getBounds()); assertEquals(packageNodeBonds, aPackageNode.getBounds()); }</code><technical_language>double blanks</technical_language>

Target:
public void testMoveNodeConnectWithAnotherNode() { aDiagram.addNode(aClassNode, new Point2D.Double(5, 5)); aDiagram.addNode(aInterfaceNode, new Point2D.Double(44, 44)); aDiagram.addNode(aPackageNode, new Point2D.Double(87, 87)); aDiagram.addEdge(aAggregationEdge, new Point2D.Double(8, 10), new Point2D.Double(45, 48)); aDiagram.addEdge(aAssociationEdge, new Point2D.Double(47, 49), new Point2D.Double(9, 17)); aDiagram.addEdge(aDependencyEdge, new Point2D.Double(90, 93), new Point2D.Double(44, 49)); Rectangle2D edge1Bounds = aAggregationEdge.getBounds(); Rectangle2D edge3Bounds = aDependencyEdge.getBounds(); Rectangle2D packageNodeBounds = aPackageNode.getBounds(); Rectangle2D interFaceNodeBounds = aInterfaceNode.getBounds(); aClassNode.translate(20, 20); assertEquals(aClassNode, aAggregationEdge.getStart()); assertEquals(aInterfaceNode, aAggregationEdge.getEnd()); assertFalse(edge1Bounds == aAggregationEdge.getBounds()); assertEquals(interFaceNodeBounds, aInterfaceNode.getBounds()); aInterfaceNode.translate(-19, 45); assertEquals(aPackageNode, aDependencyEdge.getStart()); assertEquals(aInterfaceNode, aDependencyEdge.getEnd()); assertFalse(edge3Bounds == aDependencyEdge.getBounds()); assertEquals(packageNodeBounds, aPackageNode.getBounds()); }
Source:
<code>public boolean handle(TreeNode treeNode) { EObject data = treeNode.getData(); boolean handles = data instanceof Match && data.eContainer() instanceof Comparison; return <START> handles; <END> }</code><technical_language>inline this variable</technical_language>

Target:
public boolean handle(TreeNode treeNode) { EObject data = treeNode.getData(); return data instanceof Match && data.eContainer() instanceof Comparison; }
Source:
<code>public void field_inNestedObject() { Assume.assumeTrue( "Projections on fields within nested object fields are not supported yet", false ); StubMappingSearchTarget searchTarget = indexManager.createSearchTarget(); for ( FieldModel<?> fieldModel : indexMapping.nestedObject.supportedFieldModels ) { SubTest.expectSuccess( fieldModel, model -> { String fieldPath = indexMapping.nestedObject.relativeFieldName + "." + model.relativeFieldName; assertThat( searchTarget.query() <START> .asProjections( searchTarget.projection().field( fieldPath, model.type ).toProjection() ) <END> .predicate( f -> f.matchAll().toPredicate() ) .build() ).hasHitsAnyOrder( model.document1Value.indexedValue, model.document2Value.indexedValue, model.document3Value.indexedValue, null ); } ); } }</code><technical_language>I I name asProjection(). Otherwise, I kinda expect return type consistent adding another projection returned. methods totally behavior. Especially, I imagine wanting asProjections() 1, 2, 3 elements consistent in behavior code is generic</technical_language>

Target:
public void field_inNestedObject() { Assume.assumeTrue( "Projections on fields within nested object fields are not supported yet", false ); StubMappingSearchTarget searchTarget = indexManager.createSearchTarget(); for ( FieldModel<?> fieldModel : indexMapping.nestedObject.supportedFieldModels ) { SubTest.expectSuccess( fieldModel, model -> { String fieldPath = indexMapping.nestedObject.relativeFieldName + "." + model.relativeFieldName; assertThat( searchTarget.query() .asProjection( searchTarget.projection().field( fieldPath, model.type ).toProjection() ) .predicate( f -> f.matchAll().toPredicate() ) .build() ).hasHitsAnyOrder( model.document1Value.indexedValue, model.document2Value.indexedValue, model.document3Value.indexedValue, null ); } ); } }
Source:
<code>private static void tryCleanupTempFiles(Path masterLogFile) { try { for (Path file : MoreFiles.listFiles(masterLogFile.getParent())) { String fileName = file.getFileName().toString(); String fileNameWithoutPrefix; if (fileName.startsWith(TEMP_PREFIX)) { fileNameWithoutPrefix = fileName.substring(TEMP_PREFIX.length()); } else if (fileName.startsWith(DELETED_PREFIX)) { fileNameWithoutPrefix = fileName.substring(DELETED_PREFIX.length()); } else { continue; } if (LogFileName.forName(masterLogFile.getFileName().toString(), fileNameWithoutPrefix).isPresent()) { try { Files.deleteIfExists(file); } <START> catch (IOException ignored) { } } } } catch (IOException ignored) { } } <END></code><technical_language>Do want reportError here</technical_language>

Target:
private static void tryCleanupTempFiles(Path masterLogFile) { try { for (Path file : MoreFiles.listFiles(masterLogFile.getParent())) { String fileName = file.getFileName().toString(); String fileNameWithoutPrefix; if (fileName.startsWith(TEMP_PREFIX)) { fileNameWithoutPrefix = fileName.substring(TEMP_PREFIX.length()); } else if (fileName.startsWith(DELETED_PREFIX)) { fileNameWithoutPrefix = fileName.substring(DELETED_PREFIX.length()); } else { continue; } if (LogFileName.parseHistoryLogFileName(masterLogFile.getFileName().toString(), fileNameWithoutPrefix).isPresent()) { try { Files.deleteIfExists(file); } catch (IOException ignored) { } } } } catch (IOException ignored) { } }
Source:
<code>protected ProcessStatusStore buildStore() { Properties props = new Properties(); String home = System.getenv("HOME"); <START> File f = new File(home, ".geotools/postgis.properties"); <END> FileInputStream is = null; try { is = new FileInputStream(f); props.load(is); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (IOException e) { e.printStackTrace(); } } Map<Object, Object> params = props; params.put(PostgisNGDataStoreFactory.ENCODE_FUNCTIONS.key, true); try { datastore = DataStoreFinder.getDataStore(params); } catch (IOException e) { e.printStackTrace(); } statusStore = new JDBCStatusStore(datastore); return statusStore; }</code><technical_language>This online type test, e..g, skipped, fail, if postgis.properties file is</technical_language>

Target:
protected ProcessStatusStore buildStore() { Properties props = GSFixtureUtilitiesDelegate.loadFixture(fixtureID); Map<String, Serializable> params = new HashMap<>(); for(Entry<Object, Object> entry:props.entrySet()) { params.put((String)entry.getKey(), (Serializable)entry.getValue()); } params.put(PostgisNGDataStoreFactory.ENCODE_FUNCTIONS.key, true); try { datastore = DataStoreFinder.getDataStore(params); } catch (IOException e) { e.printStackTrace(); } if(datastore == null) { throw new RuntimeException("failed to create StatusStore with \n"+props); } statusStore = new JDBCStatusStore(datastore); if(statusStore == null) { throw new RuntimeException("failed to create StatusStore with \n"+props); } return statusStore; }
Source:
<code>public Supplier<IntIterator> makeDimensionProcessor(DimensionSelector selector) { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); <START> return dimensionCaches.get(selector).get(dimensionId).iterator(); <END> } else { return IntIterators.EMPTY_ITERATOR; } }; }</code><technical_language>This is safe selector a 'real' dictionary, i.e. selector.getValueCardinality() return DimensionSelector.CARDINALITY_UNKNOWN. If is unknown ids valid context of a specific row. So, in case need fall slower code</technical_language>

Target:
public Supplier<IntIterator> makeDimensionProcessor(DimensionSelector selector) { if (selector.getValueCardinality() == DimensionDictionarySelector.CARDINALITY_UNKNOWN) { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else { return IntIterators.EMPTY_ITERATOR; } }; } else { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getAndCacheRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else { return IntIterators.EMPTY_ITERATOR; } }; } }
Source:
<code>private void openGitCreateProjectViaWizardWizard(ExecutionEvent event, RepositoryTreeNode node, String path, List<String> pPaths) { <START> if (pPaths.size() == 1) <END> path = pPaths.get(0); GitCreateProjectViaWizardWizard wizard = new GitCreateProjectViaWizardWizard( node.getRepository(), path); if (pPaths.size() > 1) wizard.setFilter(pPaths); WizardDialog dlg = new WizardDialog(getShell(event), wizard) { @Override protected IDialogSettings getDialogBoundsSettings() { return Activator.getDefault().getDialogSettings(); } }; dlg.setHelpAvailable(false); dlg.open(); }</code><technical_language>missing braces</technical_language>

Target:
private void openGitCreateProjectViaWizardWizard(ExecutionEvent event, RepositoryTreeNode node, String path, List<String> pPaths) { if (pPaths.size() == 1) { path = pPaths.get(0); } GitCreateProjectViaWizardWizard wizard = new GitCreateProjectViaWizardWizard( node.getRepository(), path); if (pPaths.size() > 1) { wizard.setFilter(pPaths); } WizardDialog dlg = new WizardDialog(getShell(event), wizard) { @Override protected IDialogSettings getDialogBoundsSettings() { return Activator.getDefault().getDialogSettings(); } }; dlg.setHelpAvailable(false); dlg.open(); }
Source:
<code>private void visit(QuestionNode nextNode){ if(isALoop(nextNode)){ Log.d(TAG,String.format("visit(%s) -> Not advancing",nextNode.getQuestion().getCode())); return; } if(!nextNode.isVisibleInReview()){ <START> if(Session.getSurvey()!=null && !Session.getSurvey().isInProgress()) <END> for (QuestionRelation questionRelation : nextNode.getQuestion().getQuestionRelations()) { if (questionRelation.isAReminder()) { nonVisibleNode = nextNode; if(nextNode==null){ return; } next(null); return; } } Log.d(TAG,String.format("visit(%s) -> In position %d",nextNode.getQuestion().getCode(),currentPosition)); rewindVisited(nextNode); nonVisibleNode = nextNode; return; } nonVisibleNode=null; currentPosition++; Log.d(TAG,String.format("visit(%s) -> In position %d",nextNode.getQuestion().getCode(),currentPosition)); visited.add(nextNode); }</code><technical_language>@idelcano Add curly brackets for this 'if' please. In general brackets more clear special a loop if (not properly indented btw)</technical_language>

Target:
private void visit(QuestionNode nextNode){ if(isALoop(nextNode)){ Log.d(TAG,String.format("visit(%s) -> Not advancing",nextNode.getQuestion().getCode())); return; } if(!nextNode.isVisibleInReview()){ if(Session.getSurvey()!=null && !Session.getSurvey().isInProgress()) { for (QuestionRelation questionRelation : nextNode.getQuestion().getQuestionRelations()) { if (questionRelation.isAReminder()) { nonVisibleNode = nextNode; if (nextNode == null) { return; } next(null); return; } } } Log.d(TAG,String.format("visit(%s) -> In position %d",nextNode.getQuestion().getCode(),currentPosition)); rewindVisited(nextNode); nonVisibleNode = nextNode; return; } nonVisibleNode=null; currentPosition++; Log.d(TAG,String.format("visit(%s) -> In position %d",nextNode.getQuestion().getCode(),currentPosition)); visited.add(nextNode); }
Source:
<code>public boolean isNull() { <START> return doubles[index] == null; <END> }</code><technical_language>this return NullHandling.replaceWithDefault() ? false : doubles[index] == null</technical_language>

Target:
public boolean isNull() { return !NullHandling.replaceWithDefault() && doubles[index] == null; }
Source:
<code>public void onEvent(AppendColumnEvent event) { context.getStatus().setColumnId(String.valueOf(new Date().getTime())); context.getStatus().setColumnGroup(event.getColumnGroup()); commonExecution(context, new AppendColumnCommand()); <START> context.getScenarioGridPanel().setFocus(true); <END> }</code><technical_language>@jomarko If is preventing this, move "context.getScenarioGridPanel().setFocus(true);" commonExecution</technical_language>

Target:
public void onEvent(AppendColumnEvent event) { context.getStatus().setColumnId(String.valueOf(new Date().getTime())); context.getStatus().setColumnGroup(event.getColumnGroup()); commonExecution(context, new AppendColumnCommand(), true); }
Source:
<code>public void untrackView(View view) { <START> nativeVideo.unregisterInteractionViews(); <END> super.untrackView(view); }</code><technical_language>Check if nativeVideo is null. This crashes</technical_language>

Target:
public void untrackView(View view) { if (nativeVideo != null) { nativeVideo.unregisterInteractionViews(); } super.untrackView(view); }
Source:
<code>protected boolean saveBaseMessageToCacheDir( boolean overrideIfExists ) throws CpfException { String baseMsgPath = Util.joinPath( getDashboardFolderPath(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); IBasicFile basePropertiesFile = null; if ( getDashboardAccess().fileExists( baseMsgPath ) ) { basePropertiesFile = getDashboardAccess().fetchFile( baseMsgPath ); String basePropertiesCachePath = Util.joinPath( getBaseTempCacheFolder(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); if ( !getPluginAccess().fileExists( basePropertiesCachePath ) || overrideIfExists ) { try { getPluginAccess().saveFile( basePropertiesCachePath, basePropertiesFile.getContents() ); } catch ( IOException e ) { <START> throw new CpfException( e ); <END> } } } return true; }</code><technical_language>point of catching throwing a wrapped exception - again, additional context of info is provided</technical_language>

Target:
protected boolean saveBaseMessageToCacheDir( boolean overrideIfExists ) throws IOException { String baseMsgPath = Util.joinPath( getDashboardFolderPath(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); IBasicFile basePropertiesFile = null; if ( getDashboardAccess().fileExists( baseMsgPath ) ) { basePropertiesFile = getDashboardAccess().fetchFile( baseMsgPath ); String basePropertiesCachePath = Util.joinPath( getBaseTempCacheFolder(), ( BASE_MESSAGES_FILENAME + MESSAGES_EXTENSION ) ); if ( !getPluginAccess().fileExists( basePropertiesCachePath ) || overrideIfExists ) { getPluginAccess().saveFile( basePropertiesCachePath, basePropertiesFile.getContents() ); } } return true; }
Source:
<code>public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException { StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_SNAPSHOT_OUTPUT, LTTngControlServiceConstants.OPTION_SESSION, sessionName); ICommandResult result = executeCommand(command.toString(), monitor); Document doc = getDocumentFromStrings(result.getOutput()); NodeList rawSnapshotsOutputs = doc.getElementsByTagName(MIStrings.SNAPSHOT_OUTPUTS); ISnapshotInfo snapshotInfo = new SnapshotInfo(""); for (int i = 0; i < rawSnapshotsOutputs.getLength(); i++) { NodeList rawSnapshotOutput = rawSnapshotsOutputs.item(i).getChildNodes(); for (int j = 0; j < rawSnapshotOutput.getLength(); j++) { Node rawInfo = rawSnapshotOutput.item(j); switch (rawInfo.getNodeName()) { case MIStrings.ID: snapshotInfo.setId(Integer.parseInt(rawInfo.getTextContent())); break; case MIStrings.NAME: snapshotInfo.setName(rawInfo.getTextContent()); break; case MIStrings.SNAPSHOT_CTRL_URL: snapshotInfo.setSnapshotPath(rawInfo.getTextContent()); break; <START> case MIStrings.SNAPSHOT_DATA_URL: <END> break; default: break; } } } Matcher matcher2 = LTTngControlServiceConstants.TRACE_NETWORK_PATTERN.matcher(snapshotInfo.getSnapshotPath()); if (matcher2.matches()) { snapshotInfo.setStreamedSnapshot(true); } return snapshotInfo; }</code><technical_language>add this populate</technical_language>

Target:
public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException { StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_SNAPSHOT_OUTPUT, LTTngControlServiceConstants.OPTION_SESSION, sessionName); ICommandResult result = executeCommand(command.toString(), monitor); Document doc = getDocumentFromStrings(result.getOutput()); NodeList rawSnapshotsOutputs = doc.getElementsByTagName(MIStrings.SNAPSHOT_OUTPUTS); ISnapshotInfo snapshotInfo = new SnapshotInfo(""); for (int i = 0; i < rawSnapshotsOutputs.getLength(); i++) { NodeList rawSnapshotOutput = rawSnapshotsOutputs.item(i).getChildNodes(); for (int j = 0; j < rawSnapshotOutput.getLength(); j++) { Node rawInfo = rawSnapshotOutput.item(j); switch (rawInfo.getNodeName()) { case MIStrings.ID: snapshotInfo.setId(Integer.parseInt(rawInfo.getTextContent())); break; case MIStrings.NAME: snapshotInfo.setName(rawInfo.getTextContent()); break; case MIStrings.SNAPSHOT_CTRL_URL: snapshotInfo.setSnapshotPath(rawInfo.getTextContent()); break; default: break; } } } Matcher matcher2 = LTTngControlServiceConstants.TRACE_NETWORK_PATTERN.matcher(snapshotInfo.getSnapshotPath()); if (matcher2.matches()) { snapshotInfo.setStreamedSnapshot(true); } return snapshotInfo; }
Source:
<code>public void testBackwardsCompatibility() throws IOException { byte[] bytes = readHllBytes("hllp_small.bin"); HyperLogLogPlus hll = HyperLogLogPlus.Builder.build(bytes); <START> Assert.assertEquals(17815, hll.cardinality()); <END> byte[] bytes2 = readHllBytes("hllp_large.bin"); HyperLogLogPlus hll2 = HyperLogLogPlus.Builder.build(bytes2); Assert.assertEquals(34144234, hll2.cardinality()); }</code><technical_language>else do do HLLs? exercise if easy</technical_language>

Target:
public void testBackwardsCompatibility() throws IOException, CardinalityMergeException { byte[] bytes = readHllBytes("hllp_small.bin"); HyperLogLogPlus hll = HyperLogLogPlus.Builder.build(bytes); Assert.assertEquals(17815, hll.cardinality()); byte[] bytes2 = readHllBytes("hllp_large.bin"); HyperLogLogPlus hll2 = HyperLogLogPlus.Builder.build(bytes2); Assert.assertEquals(34144234, hll2.cardinality()); Assert.assertEquals(34174200, hll.merge(hll2).cardinality()); }
Source:
<code>public void testAllDomainsHaveSpaceForAllDisksFailure() { setUpGeneralValidations(); setUpDiskValidations(); <START> doReturn(Collections.EMPTY_LIST).when(cmd).getDisksList(); <END> doReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleStorageDomainsValidator) .allDomainsHaveSpaceForAllDisks(anyList(), anyList()); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN); verify(multipleStorageDomainsValidator).allDomainsHaveSpaceForAllDisks(anyList(), anyList()); }</code><technical_language>Please generics-friendly Collections.emptyList()</technical_language>

Target:
public void testAllDomainsHaveSpaceForAllDisksFailure() { setUpGeneralValidations(); setUpDiskValidations(); doReturn(Collections.emptyList()).when(cmd).getDisksList(); doReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleStorageDomainsValidator) .allDomainsHaveSpaceForAllDisks(eq(Collections.<DiskImage>emptyList()), anyList()); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN); verify(multipleStorageDomainsValidator).allDomainsHaveSpaceForAllDisks(eq(Collections.<DiskImage>emptyList()), anyList()); }
Source:
<code>private void makeResourceWritable() throws CoreException { final IFile file = (IFile) model.getResource(); final Shell shell = this.getSite().getWorkbenchWindow().getShell(); final boolean[] ok = new boolean[] { false }; <START> shell.getDisplay().syncExec(new Runnable() { <END> private final String dialogTitle = "Read-only File Encountered"; private final String dialogMessage = "File ''{0}'' is read-only. Do you wish to make it writable?"; public void run() { ok[0] = MessageDialog.openQuestion(shell, dialogTitle, NLS.bind(dialogMessage, new String[] { file.getFullPath().toString() })); } }); if (ok[0]) { setWritable(file); } if (file.getResourceAttributes().isReadOnly()) { throw new CoreException(new Status(IStatus.ERROR, Q7UIPlugin.PLUGIN_ID.toString(), "is read-only")); } }</code><technical_language>in GUI thread</technical_language>

Target:
private void makeResourceWritable() throws CoreException { final IFile file = (IFile) model.getResource(); final Shell shell = this.getSite().getWorkbenchWindow().getShell(); final boolean[] ok = new boolean[] { false }; final String dialogTitle = "Read-only File Encountered"; final String dialogMessage = "File ''{0}'' is read-only. Do you wish to make it writable?"; ok[0] = MessageDialog.openQuestion(shell, dialogTitle, NLS.bind(dialogMessage, new String[] { file.getFullPath().toString() })); if (ok[0]) { setWritable(file); } if (file.getResourceAttributes().isReadOnly()) { throw new CoreException(new Status(IStatus.ERROR, Q7UIPlugin.PLUGIN_ID.toString(), "is read-only")); } }
Source:
<code>public void ok() { new OkButton().click(); <START> new WaitWhile(new ShellIsActive("Open CDI Named Bean")); <END> }</code><technical_language>ShellIsAvailable</technical_language>

Target:
public void ok() { new OkButton().click(); new WaitWhile(new ShellIsAvailable("Open CDI Named Bean")); }
Source:
<code><START> public void setInbox(Inbox inbox) { <END> this.inbox = inbox; }</code><technical_language>do need this change</technical_language>

Target:
protected void setInbox(Inbox inbox) { this.inbox = inbox; }
Source:
<code>public void run() { try { if (httpClient != null) { close(); } } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>LOG MAN LOG</technical_language>

Target:
public void run() { try { if (httpClient != null) { close(); } } catch (Exception e) { logError(e) .addMessage("Caught exception closing HTTP client") .log(); } }