auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Result[] next(ResultScanner<Row> resultScanner, ByteKeyRangeTracker rangeTracker) throws IOException { List<Result> results = new ArrayList<>(); for (int i = 0; i < arraySize; i++) { Row row = resultScanner.next(); if (row == null) { break; } ByteKey key = ByteKey.copyFrom(row.getKey().toByteArray()); if (!rangeTracker.tryReturnRecordAt(true, key)) { break; } results.add(Adapters.ROW_ADAPTER.adaptResponse(row)); } return results.toArray(new Result[results.size()]); }

Target:
public Result[] next(ResultScanner<Row> resultScanner, ByteKeyRangeTracker rangeTracker) throws IOException { List<Result> results = new ArrayList<>(); for (int i = 0; i < arraySize; i++) { Row row = resultScanner.next(); if (row == null) { break; } ByteKey key = toByteKey(row.getKey()); if (!rangeTracker.tryReturnRecordAt(true, key)) { break; } results.add(Adapters.ROW_ADAPTER.adaptResponse(row)); } return results.toArray(new Result[results.size()]); }
Source:
public LogResult postLog(@NonNull final LogType logType, @NonNull final Calendar date, @NonNull final String log, @Nullable final String logPassword, @NonNull final List<TrackableLog> trackableLogs) { try { final CheckBox favCheck = (CheckBox) activity.findViewById(R.id.favorite_check); final ImmutablePair<StatusCode, String> postResult = GCWebAPI.postLog(cache, logType, date.getTime(), log, trackableLogs, favCheck.isChecked()); if (postResult.left == StatusCode.NO_ERROR) { DataStore.saveVisitDate(cache.getGeocode(), date.getTime().getTime()); if (logType.isFoundLog()) { GCLogin.getInstance().increaseActualCachesFound(); } if (logType == LogType.TEMP_DISABLE_LISTING) { cache.setDisabled(true); } else if (logType == LogType.ENABLE_LISTING) { cache.setDisabled(false); } if (favCheck.isChecked()) { cache.setFavorite(true); cache.setFavoritePoints(cache.getFavoritePoints() + 1); } } return new LogResult(postResult.left, postResult.right); } catch (final Exception e) { Log.e("GCLoggingManager.postLog", e); } return new LogResult(StatusCode.LOG_POST_ERROR, ""); }

Target:
public LogResult postLog(@NonNull final LogType logType, @NonNull final Calendar date, @NonNull final String log, @Nullable final String logPassword, @NonNull final List<TrackableLog> trackableLogs) { try { final CheckBox favCheck = (CheckBox) activity.findViewById(R.id.favorite_check); final ImmutablePair<StatusCode, String> postResult = GCWebAPI.postLog(cache, logType, date.getTime(), log, trackableLogs, favCheck.isChecked()); if (postResult.left == StatusCode.NO_ERROR) { DataStore.saveVisitDate(cache.getGeocode(), date.getTime().getTime()); if (logType.isFoundLog()) { GCLogin.getInstance().increaseActualCachesFound(); } else if (logType == LogType.TEMP_DISABLE_LISTING) { cache.setDisabled(true); } else if (logType == LogType.ENABLE_LISTING) { cache.setDisabled(false); } if (favCheck.isChecked()) { cache.setFavorite(true); cache.setFavoritePoints(cache.getFavoritePoints() + 1); } } return new LogResult(postResult.left, postResult.right); } catch (final Exception e) { Log.e("GCLoggingManager.postLog", e); } return new LogResult(StatusCode.LOG_POST_ERROR, ""); }
Source:
public void json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = encoder.encode(oInstance, ContentFormat.JSON, new LwM2mPath("/3/0"), model); StringBuilder b = new StringBuilder(); b.append("{\"e\":["); b.append("{\"n\":\"0\",\"sv\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"sv\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"sv\":\"345000123\"},"); b.append("{\"n\":\"3\",\"sv\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11\",\"v\":0},"); b.append("{\"n\":\"13\",\"v\":1.367491215E9},"); b.append("{\"n\":\"14\",\"sv\":\"+02:00\"},"); b.append("{\"n\":\"15\",\"sv\":\"U\"}]}"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }

Target:
public void json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = encoder.encode(oInstance, ContentFormat.JSON, new LwM2mPath("/3/0"), model); StringBuilder b = new StringBuilder(); b.append("{\"bn\":\"/3/0\",\"e\":["); b.append("{\"n\":\"0\",\"sv\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"sv\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"sv\":\"345000123\"},"); b.append("{\"n\":\"3\",\"sv\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11\",\"v\":0},"); b.append("{\"n\":\"13\",\"v\":1.367491215E9},"); b.append("{\"n\":\"14\",\"sv\":\"+02:00\"},"); b.append("{\"n\":\"15\",\"sv\":\"U\"}]}"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }
Source:
public @Gutter int getGutter() { return mGutter; }

Target:
public int getGutter() { return mGutter; }
Source:
private GlusterGeoRepSessionConfiguration getConfig(Map<String, Object> innerMap) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setKey(innerMap.containsKey(OPTION_NAME) ? (String)innerMap.get(OPTION_NAME) : null); config.setValue(innerMap.containsKey(DESCRIPTION) ? (String) innerMap.get(DESCRIPTION) : null); return config; }

Target:
private GlusterGeoRepSessionConfiguration getConfig(Map<String, Object> innerMap) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setKey(innerMap.containsKey(OPTION_NAME) ? (String)innerMap.get(OPTION_NAME) : null); config.setValue(innerMap.containsKey(OPTION_VALUE) ? (String) innerMap.get(OPTION_VALUE) : null); return config; }
Source:
public void tearDown() throws IOException{ StorageOperations.deleteDir(new File(PathBuilder.buildProjectPath("testProject"))); }

Target:
public void tearDown() throws IOException { StorageOperations.deleteDir(new File(PathBuilder.buildProjectPath(getClass().getSimpleName()))); }
Source:
protected Command dropAssociation(final DropObjectsRequest dropRequest, final Element semanticLink) { Collection<?> endtypes = ClassLinkMappingHelper.getInstance().getSource(semanticLink); if (endtypes.size() == 1) { Element source = (Element) endtypes.toArray()[0]; Element target = (Element) endtypes.toArray()[0]; return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() == 2) { Element source = null; Element target = null; final List<Property> memberEnds = ((Association) semanticLink).getMemberEnds(); if (memberEnds.get(0).equals(endtypes.toArray()[0])) { source = (Element) endtypes.toArray()[0]; target = (Element) endtypes.toArray()[1]; } else { source = (Element) endtypes.toArray()[1]; target = (Element) endtypes.toArray()[0]; } return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() > 2) { MultiAssociationHelper associationHelper = new MultiAssociationHelper(getEditingDomain()); return associationHelper.dropMutliAssociation((Association) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView()); } return UnexecutableCommand.INSTANCE; }

Target:
protected Command dropAssociation(final DropObjectsRequest dropRequest, final Element semanticLink) { final List<?> endtypes = new ArrayList<>(ClassLinkMappingHelper.getInstance().getSource(semanticLink)); if (endtypes.size() == 1) { Element source = (Element) endtypes.get(0); Element target = (Element) endtypes.get(0); return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() == 2) { Element source = null; Element target = null; final List<Property> memberEnds = ((Association) semanticLink).getMemberEnds(); if (memberEnds.get(0).equals(endtypes.get(0))) { source = (Element) endtypes.get(0); target = (Element) endtypes.get(1); } else { source = (Element) endtypes.get(1); target = (Element) endtypes.get(0); } return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() > 2) { MultiAssociationHelper associationHelper = new MultiAssociationHelper(getEditingDomain()); return associationHelper.dropMutliAssociation((Association) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView()); } return UnexecutableCommand.INSTANCE; }
Source:
public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); copy.setAttributes(this.getAttributes()); return copy; }

Target:
public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); Map<String, String> attributes = this.getAttributes(); copy.setAttributes(null); if (attributes != null) { copy.setAttributes(attributes); } return copy; }
Source:
public static String encrypt(ServletContext ctx, String rawText) throws Exception { SsoLocalConfig config = getSsoContext(ctx).getSsoLocalConfig(); try (InputStream in = new FileInputStream(config.getPKIEngineCert().getAbsoluteFile())) { return EnvelopeEncryptDecrypt.encrypt( "AES/OFB/PKCS5Padding", 256, CertificateFactory.getInstance("X.509").generateCertificate(in), 100, rawText.getBytes(StandardCharsets.UTF_8)); } }

Target:
public static String encrypt(ServletContext ctx, String rawText) throws Exception { return EnvelopeEncryptDecrypt.encrypt( "AES/OFB/PKCS5Padding", 256, getSsoContext(ctx).getEngineCertificate(), 100, rawText.getBytes(StandardCharsets.UTF_8)); }
Source:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); try { for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!decodeMap.containsKey(name) || decodeMap.get(name) == DecoderType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.STRING) { obj = ((String) in.get(name)).getBytes(); } else if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } byte[] outValue = new byte[0]; DecoderType type = decodeMap.get(name); if (type == DecoderType.STRING_BASE32 || type == DecoderType.BASE32) { outValue = base32Decoder.decode(obj); } else if (type == DecoderType.STRING_BASE64 || type == DecoderType.BASE64) { outValue = base64Decoder.decode(obj); } else if (type == DecoderType.HEX) { outValue = hexDecoder.decode(obj); } if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } emitter.emit(builder.build()); } catch (Exception e) { emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), in)); } }

Target:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!decodeMap.containsKey(name) || decodeMap.get(name) == DecoderType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.STRING) { obj = ((String) in.get(name)).getBytes(); } else if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } byte[] outValue = new byte[0]; DecoderType type = decodeMap.get(name); if (type == DecoderType.STRING_BASE32 || type == DecoderType.BASE32) { outValue = base32Decoder.decode(obj); } else if (type == DecoderType.STRING_BASE64 || type == DecoderType.BASE64) { outValue = base64Decoder.decode(obj); } else if (type == DecoderType.HEX) { outValue = hexDecoder.decode(obj); } if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } emitter.emit(builder.build()); }
Source:
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle connectorTableHandle) { KuduTableHandle tableHandle = fromConnectorTableHandle(session, connectorTableHandle); Schema schema = clientSession.getTableSchema(tableHandle); ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder(); for (int i = 0; i < schema.getColumnCount(); i++) { ColumnSchema col = schema.getColumnByIndex(i); String name = col.getName(); Type type = TypeHelper.fromKuduColumn(col); KuduColumnHandle columnHandle = new KuduColumnHandle(name, i, type); columnHandles.put(name, columnHandle); } return columnHandles.build(); }

Target:
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle connectorTableHandle) { KuduTableHandle tableHandle = (KuduTableHandle) connectorTableHandle; Schema schema = clientSession.getTableSchema(tableHandle); ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder(); for (int ordinal = 0; ordinal < schema.getColumnCount(); ordinal++) { ColumnSchema col = schema.getColumnByIndex(ordinal); String name = col.getName(); Type type = TypeHelper.fromKuduColumn(col); KuduColumnHandle columnHandle = new KuduColumnHandle(name, ordinal, type); columnHandles.put(name, columnHandle); } return columnHandles.build(); }
Source:
public void makeBucket(MakeBucketArgs args) throws InvalidBucketNameException, RegionConflictException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException, IOException { if ((args == null)) { throw new IllegalArgumentException("null value is not allowed in arguments"); } String region = null; if (args.region() != null && !args.region().isEmpty()) { region = args.region(); } else if (this.region != null && !this.region.isEmpty()) { region = this.region; } else { region = US_EAST_1; } if (this.region != null && !this.region.equals(region)) { throw new RegionConflictException( "passed region conflicts with the one previously specified"); } CreateBucketConfiguration config = null; if (!region.equals(US_EAST_1)) { config = new CreateBucketConfiguration(region); } Map<String, String> headerMap = null; if (args.objectLock()) { headerMap = new HashMap<>(); headerMap.put("x-amz-bucket-object-lock-enabled", "true"); } Response response = executePut(args.bucketName(), null, region, headerMap, null, config, 0); response.body().close(); }

Target:
public void makeBucket(MakeBucketArgs args) throws InvalidBucketNameException, RegionConflictException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException, IOException { if (args == null) { throw new IllegalArgumentException("null value is not allowed in arguments"); } String region = US_EAST_1; if (args.region() != null && !args.region().isEmpty()) { region = args.region(); } else if (this.region != null && !this.region.isEmpty()) { region = this.region; } if (this.region != null && !this.region.equals(region)) { throw new RegionConflictException( "passed region conflicts with the one previously specified"); } CreateBucketConfiguration config = null; if (!region.equals(US_EAST_1)) { config = new CreateBucketConfiguration(region); } Map<String, String> headerMap = null; if (args.objectLock()) { headerMap = new HashMap<>(); headerMap.put("x-amz-bucket-object-lock-enabled", "true"); } Response response = executePut(args.bucketName(), null, region, headerMap, null, config, 0); response.body().close(); }
Source:
public UnweightedDoubleReservoirSample(int maxSamples) { this.maxSamples = maxSamples; checkArguments(); this.elements = new double[0]; }

Target:
public UnweightedDoubleReservoirSample(int maxSamples) { checkArgument(maxSamples > 0, "Cannot use 0 number of samples for a reservoir"); checkArgument(maxSamples <= MAX_SAMPLES_LIMIT, "Maximum number of reservoir samples is capped"); this.count = 0; this.samples = new double[maxSamples]; }
Source:
public static <T extends NamedNode> T createModelFromXml(CamelContext context, InputStream stream, Class<T> type) throws JAXBException { JAXBContext jaxbContext; if (context == null) { jaxbContext = createJAXBContext(); } else { jaxbContext = context.getModelJAXBContextFactory().newJAXBContext(); } Map<String, String> namespaces = new LinkedHashMap<>(); Document dom = context.getTypeConverter().convertTo(Document.class, stream); extractNamespaces(dom, namespaces); Binder<Node> binder = jaxbContext.createBinder(); Object result = binder.unmarshal(dom); if (result == null) { throw new JAXBException("Cannot unmarshal to " + type + " using JAXB"); } if (result instanceof RoutesDefinition) { List<RouteDefinition> routes = ((RoutesDefinition) result).getRoutes(); for (RouteDefinition route : routes) { applyNamespaces(route, namespaces); } } else if (result instanceof RouteDefinition) { RouteDefinition route = (RouteDefinition) result; applyNamespaces(route, namespaces); } return type.cast(result); }

Target:
public static <T extends NamedNode> T createModelFromXml(CamelContext context, InputStream stream, Class<T> type) throws JAXBException { return modelToXml(context, stream, type); }
Source:
public void update(KijiTableLayout layout) throws IOException { if (mState.get() == State.CLOSED) { LOG.debug("KijiTableReader instance is closed; ignoring layout update."); return; } final CellDecoderProvider provider; if (null != mCellSpecOverrides) { provider = CellDecoderProvider.create( layout, mTable.getKiji().getSchemaTable(), SpecificCellDecoderFactory.get(), mCellSpecOverrides); } else { provider = CellDecoderProvider.create( layout, mOverrides, mAlternatives, mOnDecoderCacheMiss); } if (mReaderLayoutCapsule != null) { LOG.debug( "Updating layout used by KijiTableReader: for table: from version: to: {}", this, mTable.getURI(), mReaderLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug("Initializing KijiTableReader: for table: with table layout version: {}", this, mTable.getURI(), layout.getDesc().getLayoutId()); } mReaderLayoutCapsule = new ReaderLayoutCapsule( provider, layout, HBaseColumnNameTranslator.from(layout)); }

Target:
public void update(KijiTableLayout layout) throws IOException { if (mState.get() == State.CLOSED) { LOG.debug("AsyncKijiTableReader instance is closed; ignoring layout update."); return; } final CellDecoderProvider provider; if (null != mCellSpecOverrides) { provider = CellDecoderProvider.create( layout, mTable.getKiji().getSchemaTable(), SpecificCellDecoderFactory.get(), mCellSpecOverrides); } else { provider = CellDecoderProvider.create( layout, mOverrides, mAlternatives, mOnDecoderCacheMiss); } if (mReaderLayoutCapsule != null) { LOG.debug( "Updating layout used by AsyncKijiTableReader: for table: from version: to: {}", this, mTable.getURI(), mReaderLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug("Initializing AsyncKijiTableReader: for table: with table layout version: {}", this, mTable.getURI(), layout.getDesc().getLayoutId()); } mReaderLayoutCapsule = new ReaderLayoutCapsule( provider, layout, HBaseColumnNameTranslator.from(layout)); }
Source:
private Map<String, List<TurboIssue>> tallyMetadataUpdate(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); return filterExprs.stream() .filter(Qualifier::hasUpdatedQualifier) .flatMap(filterExpr -> allModelIssues.stream() .filter(issue -> { try { return Qualifier.process(models, filterExpr, issue); } catch (SemanticException e) { return false; } })) .distinct() .collect(Collectors.groupingBy(TurboIssue::getRepoId)); }

Target:
private Map<String, List<TurboIssue>> tallyMetadataUpdate(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); return filterExprs.stream() .filter(Qualifier::hasUpdatedQualifier) .flatMap(filterExpr -> allModelIssues.stream() .filter(issue -> { try { return Qualifier.process(models, filterExpr, issue); } catch (FilterException e) { Platform.runLater(() -> UI.events.triggerEvent( new FilterExceptionEvent(filterExpr, e.getMessage()))); return false; } })) .distinct() .collect(Collectors.groupingBy(TurboIssue::getRepoId)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_matching_picture); animation_to_middle = AnimationUtils.loadAnimation(this, R.anim.to_middle); animation_from_middle = AnimationUtils.loadAnimation(this, R.anim.from_middle); flowLayout = (com.wefika.flowlayout.FlowLayout) findViewById(R.id.flow_layout_id); addViews(); gameManager = new GameManager(); if (onePersonMod){ gameManager.addPlayer(new Player(0, "Thien")); } tvScore = (TextView) findViewById(R.id.tv_sore); tvScore.setText(gameManager.getPlayer(0).getScore()+""); tvName = (TextView) findViewById(R.id.tv_name); tvName.setText(gameManager.getPlayer(0).getName()); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_matching_picture); animation_to_middle = AnimationUtils.loadAnimation(this, R.anim.to_middle); animation_from_middle = AnimationUtils.loadAnimation(this, R.anim.from_middle); flowLayout = (com.wefika.flowlayout.FlowLayout) findViewById(R.id.flow_layout_id); gameManager = new GameManager(); gameManager.setEndGameListenner(this); if (onePersonMod) { gameManager.addPlayer(new Player(0, "Thien")); } newGame(); tvScore = (TextView) findViewById(R.id.tv_sore); tvScore.setText(gameManager.getCurrentPlayer().getScore() + ""); tvName = (TextView) findViewById(R.id.tv_name); tvName.setText(gameManager.getCurrentPlayer().getName()); }
Source:
protected Map<String, Long> collectMessagesCountByType(String prefix) { Map<String, Long> res = new HashMap<>(); prefix = MetricUtils.metricName(COMMUNICATION_METRICS_GROUP_NAME, prefix); for (Metric metric : mreg) { if (metric.name().startsWith(prefix)) { try { short directType = Short.parseShort(metric.name().substring(prefix.length())); Map<Short, String> msgTypMap0 = msgTypMap; if (msgTypMap0 != null) { String typeName = msgTypMap0.get(directType); if (typeName != null) res.put(typeName, ((LongMetric)metric).value()); } } catch (NumberFormatException ignore) { } } } return res; }

Target:
protected Map<String, Long> collectMessagesCountByType(String prefix) { Map<String, Long> res = new HashMap<>(); prefix = metricName(COMMUNICATION_METRICS_GROUP_NAME, prefix); for (Metric metric : mreg) { if (metric.name().startsWith(prefix)) { short directType = Short.parseShort(metric.name().substring(prefix.length())); Map<Short, String> msgTypMap0 = msgTypMap; if (msgTypMap0 != null) { String typeName = msgTypMap0.get(directType); if (typeName != null) res.put(typeName, ((LongMetric)metric).value()); } } } return res; }
Source:
public void lookupAddessAll() { FavouritesDbHelper favorites = ctx.getFavorites(); lookupAddressForPointToNavigate(); lookupAddessForStartPoint(); for (TargetPoint targetPoint : intermediatePoints) { lookupAddressForIntermediatePoint(targetPoint); } favorites.lookupAddressForHomePoint(); favorites.lookupAddressForWorkPoint(); favorites.lookupAddressForParkingPoint(); lookupAddressForMyLocationPoint(); }

Target:
public void lookupAddessAll() { lookupAddressForPointToNavigate(); lookupAddessForStartPoint(); for (TargetPoint targetPoint : intermediatePoints) { lookupAddressForIntermediatePoint(targetPoint); } lookupAddressForMyLocationPoint(); }
Source:
public List<Script> fromScriptPaths(List<Path> scriptPaths, Charset charset){ List<Script> scripts = scriptsUnderTest; int index = 0; for (Path path : scriptPaths) { Preconditions.checkState(Files.exists(path), "File %s does not exist", path); try { String sqlText = new String(Files.readAllBytes(path), charset); scripts.add(new HiveRunnerScript(index++, path, sqlText)); } catch (IOException e) { throw new IllegalArgumentException("Failed to load script file '" + path + "'"); } } return scripts; }

Target:
public List<Script> fromScriptPaths(List<Path> scriptPaths, Charset charset) { List<Script> scripts = new ArrayList(); int index = 0; for (Path path : scriptPaths) { Preconditions.checkState(Files.exists(path), "File %s does not exist", path); try { String sqlText = new String(Files.readAllBytes(path), charset); scripts.add(new HiveRunnerScript(index++, path, sqlText)); } catch (IOException e) { throw new IllegalArgumentException("Failed to load script file '" + path + "'"); } } return scripts; }
Source:
public void sendFeedBackEmail(final String feedBack, final String pluginVersion, final String rating, final String customerEmail) { StringBuilder mailBody = new StringBuilder(); if ((customerEmail != null) && !customerEmail.isEmpty()) { mailBody.append(CUSTOMER_EMAIL_PREFIX); mailBody.append(customerEmail); mailBody.append("\n"); } mailBody.append(PREFIX_PLUGIN_RATED); mailBody.append(rating); mailBody.append("\n"); mailBody.append(feedBack); String defaultFrom = getFromMail(); if (!FEEDBACK_EMAIL_DEFAULT_VALUE.equals(feedBackEmailTo) && (defaultFrom != null)) { Email email = new Email(feedBackEmailTo); email.setFrom(defaultFrom); email.setSubject(FEEDBACK_EMAIL_SUBJECT + " " + pluginVersion + " - " + DateTimeConverterUtil.dateToString(new Date())); email.setBody(mailBody.toString()); SingleMailQueueItem singleMailQueueItem = new SingleMailQueueItem(email); singleMailQueueItem.setMailThreader(null); ComponentAccessor.getMailQueue().addItem(singleMailQueueItem); } else { LOGGER.info( "Feedback not sent, beacause To mail address is not setted . \n" + "The message: \n" + mailBody.toString()); } }

Target:
public void sendFeedBackEmail(final String feedBack, final String pluginVersion, final String rating, final String customerEmail) { StringBuilder mailBody = new StringBuilder(); if ((customerEmail != null) && !customerEmail.isEmpty()) { mailBody.append(CUSTOMER_EMAIL_PREFIX); mailBody.append(customerEmail); mailBody.append("\n"); } mailBody.append(PREFIX_PLUGIN_RATED); mailBody.append(rating); mailBody.append("\n"); mailBody.append(feedBack); String defaultFrom = getFromMail(); if (!FEEDBACK_EMAIL_DEFAULT_VALUE.equals(feedBackEmailTo) && (defaultFrom != null)) { Email email = new Email(feedBackEmailTo); email.setFrom(defaultFrom); email.setSubject(FEEDBACK_EMAIL_SUBJECT + " " + pluginVersion + " - " + DateTimeConverterUtil.dateToString(new Date())); email.setBody(mailBody.toString()); SingleMailQueueItem singleMailQueueItem = new SingleMailQueueItem(email); singleMailQueueItem.setMailThreader(null); ComponentAccessor.getMailQueue().addItem(singleMailQueueItem); } else { LOGGER.info( "Feedback not sent, beacause To mail address is not defined. \n" + "The message: \n" + mailBody.toString()); } }
Source:
public static ArrayList<State> getStates(Region region) { ArrayList<State> states = new ArrayList<>(); for (Vertex vertex : region.getSubvertices()) { if (vertex instanceof State) { states.add((State) vertex); } } return states; }

Target:
public static List<State> getStates(Region region) { List<State> states = new ArrayList<>(); for (Vertex vertex : region.getSubvertices()) { if (vertex instanceof State) { states.add((State) vertex); } } return states; }
Source:
public Catalog loadSchema(HSQLInterface hsql, DdlProceduresToLoad whichProcs, String... ddlFilePaths) throws VoltCompilerException { m_catalog = new Catalog(); m_catalog.execute("add / clusters cluster"); Database db = initCatalogDatabase(m_catalog); List<VoltCompilerReader> ddlReaderList = DDLPathsToReaderList(ddlFilePaths); final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker(this); InMemoryJarfile jarOutput = new InMemoryJarfile(); compileDatabase(db, hsql, voltDdlTracker, null, null, ddlReaderList, new ArrayList<>(), null, whichProcs, jarOutput); return m_catalog; }

Target:
public Catalog loadSchema(HSQLInterface hsql, DdlProceduresToLoad whichProcs, String... ddlFilePaths) throws VoltCompilerException { m_catalog = new Catalog(); m_catalog.execute("add / clusters cluster"); Database db = initCatalogDatabase(m_catalog); List<VoltCompilerReader> ddlReaderList = DDLPathsToReaderList(ddlFilePaths); final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker(this); InMemoryJarfile jarOutput = new InMemoryJarfile(); compileDatabase(db, hsql, voltDdlTracker, null, null, ddlReaderList, Collections.emptyList(), null, whichProcs, jarOutput); return m_catalog; }
Source:
public boolean match() { if (m_expr1 == null || m_expr2 == null) { return m_expr1 == m_expr2; } else if (!exprTypesMatch(m_expr1, m_expr2)) { return valueConstantsMatch(m_expr1, m_expr2) || comparisonsMatch(m_expr1, m_expr2); } else if (m_expr1 instanceof ConstantValueExpression) { return m_expr1.equals(m_expr2); } else if (m_expr1 instanceof TupleValueExpression) { return tvesMatch((TupleValueExpression) m_expr1, (TupleValueExpression) m_expr2); } else if (m_expr1 instanceof VectorValueExpression) { return vectorsMatch((VectorValueExpression) m_expr1, (VectorValueExpression) m_expr2) && childrenMatch(m_expr1, m_expr2); } else if(EXCHANGEABLE_EXPRESSIONS.contains(m_expr1.getExpressionType())) { return (argsMatch(m_expr1, m_expr2) && childrenMatch(m_expr1, m_expr2)) || ((new FilterMatcher(m_expr1.getLeft(), m_expr2.getRight())).match() && (new FilterMatcher(m_expr1.getRight(), m_expr2.getLeft())).match()); } else return argsMatch(m_expr1, m_expr2) && childrenMatch(m_expr1, m_expr2); }

Target:
public boolean match() { if (m_expr1 == null || m_expr2 == null) { return m_expr1 == m_expr2; } else if (m_expr1.getExpressionType() != m_expr2.getExpressionType()) { return valueConstantsMatch(m_expr1, m_expr2) || revComparisonsMatch(m_expr1, m_expr2); } else if (m_expr1 instanceof ConstantValueExpression) { return m_expr1.equals(m_expr2); } else if (m_expr1 instanceof TupleValueExpression) { return tvesMatch((TupleValueExpression) m_expr1, (TupleValueExpression) m_expr2); } else if (m_expr1 instanceof VectorValueExpression) { return vectorsMatch((VectorValueExpression) m_expr1, (VectorValueExpression) m_expr2); } else if(EXCHANGEABLE_EXPRESSIONS.contains(m_expr1.getExpressionType())) { return (argsMatch(m_expr1, m_expr2) && childrenMatch(m_expr1, m_expr2)) || (new FilterMatcher(m_expr1.getLeft(), m_expr2.getRight()).match() && new FilterMatcher(m_expr1.getRight(), m_expr2.getLeft()).match()); } else { return argsMatch(m_expr1, m_expr2) && childrenMatch(m_expr1, m_expr2); } }
Source:
public void expire(String version) { String barrierStatePath = keyBuilder.getBarrierStatePath(version); State barrierState = zkUtils.getZkClient().readData(barrierStatePath); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expiring the barrier version: %s. Marking the barrier state: %s as %s.", version, barrierStatePath, State.TIMED_OUT)); zkUtils.writeData(keyBuilder.getBarrierStatePath(version), State.TIMED_OUT); } }

Target:
public void expire(String version) { String barrierStatePath = keyBuilder.getBarrierStatePath(version); State barrierState = zkUtils.getZkClient().readData(barrierStatePath); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expiring the barrier version: %s. Marking the barrier state: %s as %s.", version, barrierStatePath, State.TIMED_OUT)); zkUtils.writeData(keyBuilder.getBarrierStatePath(version), State.TIMED_OUT); } else { LOG.debug(String.format("Barrier version: %s is at: %s state. Not marking barrier as %s.", version, barrierState, State.TIMED_OUT)); } }
Source:
private void deleteSegmentsOnAck(PBDSegment<M> segment, int entryNumber) { if (m_cursorClosed || m_segments.size() == 1) { return; } PBDSegment<M> lastSegment = m_segments.lastEntry().getValue(); if (segment.segmentIndex() == m_segments.firstKey() && segment.m_deleteOnAck == true) { Iterator<PBDSegment<M>> itr = m_segments.values().iterator(); while (itr.hasNext()) { PBDSegment<M> toDelete = itr.next(); try { if (toDelete.segmentIndex() != lastSegment.segmentIndex() && canDeleteSegment(toDelete)) { itr.remove(); closeAndDeleteSegment(toDelete); } else { break; } } catch(IOException e) { m_usageSpecificLog.error("Unexpected error deleting segment after all have been read and acked", e); } } return; } deleteSegmentsBefore(segment, entryNumber); }

Target:
private void deleteSegmentsOnAck(PBDSegment<M> segment, int entryNumber) { if (m_cursorClosed || m_segments.size() == 1) { return; } if (segment.m_deleteOnAck == true && segment.segmentIndex() == m_segments.firstKey()) { Iterator<PBDSegment<M>> itr = m_segments.values().iterator(); while (itr.hasNext()) { PBDSegment<M> toDelete = itr.next(); try { if (toDelete.m_deleteOnAck == true && canDeleteSegment(toDelete)) { itr.remove(); closeAndDeleteSegment(toDelete); } else { break; } } catch(IOException e) { m_usageSpecificLog.error("Unexpected error deleting segment after all have been read and acked", e); } } return; } deleteSegmentsBefore(segment, entryNumber); }
Source:
@Test public void forResource_inJarFile() throws URISyntaxException, IOException { JavaFileObject resourceInJar = JavaFileObjects.forResource("java/lang/Object.class"); ASSERT.that(resourceInJar.getKind()).isEqualTo(CLASS); ASSERT.that(resourceInJar.toUri()) .isEqualTo(Resources.getResource("java/lang/Object.class").toURI()); ASSERT.that(resourceInJar.getName()) .isEqualTo(Resources.getResource("java/lang/Object.class").toURI().getSchemeSpecificPart()); }

Target:
@Test public void forResource_inJarFile() throws URISyntaxException, IOException { JavaFileObject resourceInJar = JavaFileObjects.forResource("java/lang/Object.class"); ASSERT.that(resourceInJar.getKind()).isEqualTo(CLASS); ASSERT.that(resourceInJar.toUri()).isEqualTo(URI.create("/java/lang/Object.class")); ASSERT.that(resourceInJar.getName()) .isEqualTo(Resources.getResource("java/lang/Object.class").toString()); ASSERT.that(resourceInJar.isNameCompatible("Object", CLASS)); }
Source:
public void testAlterDatabase() { sql("alter database db1 set dbproperties('k1'='v1')") .ok("ALTER DATABASE `DB1` SET (\n" + " 'k1' = 'v1',\n" + " 'alter.database.op' = 'CHANGE_PROPS'\n" + ")"); sql("alter database db1 set location '/new/path'") .ok("ALTER DATABASE `DB1` SET (\n" + " 'alter.database.op' = 'CHANGE_LOCATION',\n" + " 'database.location_uri' = '/new/path'\n" + ")"); sql("alter database db1 set owner user user1") .ok("ALTER DATABASE `DB1` SET (\n" + " 'alter.database.op' = 'CHANGE_OWNER',\n" + " 'database.owner.type' = 'user',\n" + " 'database.owner.name' = 'USER1'\n" + ")"); sql("alter database db1 set owner role role1") .ok("ALTER DATABASE `DB1` SET (\n" + " 'alter.database.op' = 'CHANGE_OWNER',\n" + " 'database.owner.type' = 'role',\n" + " 'database.owner.name' = 'ROLE1'\n" + ")"); }

Target:
public void testAlterDatabase() { sql("alter database db1 set dbproperties('k1'='v1')") .ok("ALTER DATABASE `DB1` SET DBPROPERTIES (\n" + " 'k1' = 'v1'\n" + ")"); sql("alter database db1 set location '/new/path'") .ok("ALTER DATABASE `DB1` SET LOCATION '/new/path'"); sql("alter database db1 set owner user user1") .ok("ALTER DATABASE `DB1` SET OWNER USER `USER1`"); sql("alter database db1 set owner role role1") .ok("ALTER DATABASE `DB1` SET OWNER ROLE `ROLE1`"); }
Source:
private void playSound() { try { AssetFileDescriptor fileDescriptor = getAssets().openFd(DRUMROLL_FILE_NAME); player.reset(); player.setDataSource( fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getLength()); player.prepare(); player.start(); player.setOnCompletionListener(mediaPlayer -> textToSpeechManager.speak(chosenNamesText)); } catch (Exception ex) { UIUtils.showLongToast(R.string.drumroll_error, this); } handler.removeCallbacks(animateNamesTask); handler.postDelayed(animateNamesTask, 2600); }

Target:
private void playSound() { try { AssetFileDescriptor fileDescriptor = getAssets().openFd(DRUMROLL_FILE_NAME); player.reset(); player.setDataSource( fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getLength()); player.prepare(); player.start(); } catch (Exception ex) { UIUtils.showLongToast(R.string.drumroll_error, this); } handler.removeCallbacks(animateNamesTask); handler.postDelayed(animateNamesTask, 2600); }
Source:
private void parseCounterBound(XMLExtendedStreamReader reader, Element element, ModelNode counter) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case VALUE: { if (element.equals(Element.LOWER_BOUND)) { StrongCounterResource.LOWER_BOUND.parseAndSetParameter(value, counter, reader); } if (element.equals(Element.UPPER_BOUND)) { StrongCounterResource.UPPER_BOUND.parseAndSetParameter(value, counter, reader); } break; } default: { throw ParseUtils.unexpectedAttribute(reader, i); } } } while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { throw ParseUtils.unexpectedElement(reader); } }

Target:
private void parseCounterBound(XMLExtendedStreamReader reader, Element element, ModelNode counter) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case VALUE: { if (element.equals(Element.LOWER_BOUND)) { StrongCounterResource.LOWER_BOUND.parseAndSetParameter(value, counter, reader); } if (element.equals(Element.UPPER_BOUND)) { StrongCounterResource.UPPER_BOUND.parseAndSetParameter(value, counter, reader); } break; } default: { throw ParseUtils.unexpectedAttribute(reader, i); } } } if (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { throw ParseUtils.unexpectedElement(reader); } }
Source:
private <T> void unregisterHandler(String address, Handler<Message<T>> handler, Handler<AsyncResult<Void>> completionHandler) { checkStarted(); Handlers handlers = handlerMap.get(address); if (handlers != null) { synchronized (handlers) { int size = handlers.list.size(); for (int i = 0; i < size; i++) { HandlerHolder holder = handlers.list.get(i); if (holder.handler == handler) { if (holder.timeoutID != -1) { vertx.cancelTimer(holder.timeoutID); } handlers.list.remove(i); holder.setRemoved(); if (handlers.list.isEmpty()) { handlerMap.remove(address); if (subs != null && !holder.localOnly) { removeSub(address, serverID, completionHandler); } else if (completionHandler != null) { callCompletionHandlerAsync(completionHandler); } } else if (completionHandler != null) { callCompletionHandler(completionHandler); } holder.context.removeCloseHook(new HandlerEntry<T>(address, handler)); break; } } } } }

Target:
private <T> void unregisterHandler(String address, Handler<Message<T>> handler, Handler<AsyncResult<Void>> completionHandler) { checkStarted(); Handlers handlers = handlerMap.get(address); if (handlers != null) { synchronized (handlers) { int size = handlers.list.size(); for (int i = 0; i < size; i++) { HandlerHolder holder = handlers.list.get(i); if (holder.handler == handler) { if (holder.timeoutID != -1) { vertx.cancelTimer(holder.timeoutID); } handlers.list.remove(i); holder.setRemoved(); if (handlers.list.isEmpty()) { handlerMap.remove(address); if (subs != null && !holder.localOnly) { removeSub(address, serverID, completionHandler); } else if (completionHandler != null) { callCompletionHandlerAsync(completionHandler); } } else if (completionHandler != null) { callCompletionHandlerAsync(completionHandler); } holder.context.removeCloseHook(new HandlerEntry<T>(address, handler)); break; } } } } }
Source:
public void launch() { List<String> commands = Lists.newLinkedList(); String appName = getEntity().getConfig(NodeJsWebAppService.APP_NAME); String appFile = getEntity().getConfig(NodeJsWebAppService.APP_FILE); String appCommand = getEntity().getConfig(NodeJsWebAppService.APP_COMMAND); commands.add(String.format("cd %s", Os.mergePathsUnix(getRunDir(), appName))); commands.add(BashCommands.sudo("nohup " + appCommand + " " + appFile + " &")); newScript(MutableMap.of(USE_PID_FILE, true), LAUNCHING) .body.append(commands) .execute(); }

Target:
public void launch() { List<String> commands = Lists.newLinkedList(); String appName = getEntity().getConfig(NodeJsWebAppService.APP_NAME); String appFile = getEntity().getConfig(NodeJsWebAppService.APP_FILE); String appCommand = getEntity().getConfig(NodeJsWebAppService.APP_COMMAND); String appCommandLine = getEntity().getConfig(NodeJsWebAppService.APP_COMMAND_LINE); if (Strings.isBlank(appCommandLine)) { appCommandLine = appCommand + " " + appFile; } commands.add(String.format("cd %s", Os.mergePathsUnix(getRunDir(), appName))); commands.add("nohup " + appCommandLine + " > console.out 2>&1 &"); newScript(MutableMap.of(USE_PID_FILE, true), LAUNCHING) .body.append(commands) .execute(); }
Source:
private List<HRegionLocation> getRegionBoundaries(ParallelScanGrouper scanGrouper) throws SQLException{ if (scanGrouper instanceof DefaultParallelScanGrouper) { ((DefaultParallelScanGrouper) scanGrouper).init(context,physicalTableName); } else if (scanGrouper instanceof TableMRParallelScanGrouper) { ((TableMRParallelScanGrouper) scanGrouper).init(context,physicalTableName); } return scanGrouper.getRegionBoundaries(); }

Target:
private List<HRegionLocation> getRegionBoundaries(ParallelScanGrouper scanGrouper) throws SQLException{ return scanGrouper.getRegionBoundaries(context, physicalTableName); }
Source:
public void dump(TopologyAPI.Component.Builder bldr) { bldr.setName(name); bldr.setSpec(TopologyAPI.ComponentObjectSpec.JAVA_SERIALIZED_OBJECT); bldr.setSerializedObject(ByteString.copyFrom(Utils.serialize(component))); TopologyAPI.Config.Builder cBldr = TopologyAPI.Config.newBuilder(); for (Map.Entry<String, Object> entry : componentConfiguration.entrySet()) { TopologyAPI.Config.KeyValue.Builder kvBldr = TopologyAPI.Config.KeyValue.newBuilder(); kvBldr.setKey(entry.getKey()); kvBldr.setValue(entry.getValue() == null ? "null" : entry.getValue().toString()); kvBldr.setType(TopologyAPI.ConfigValueType.STRING_VALUE); cBldr.addKvs(kvBldr); } bldr.setConfig(cBldr); }

Target:
public void dump(TopologyAPI.Component.Builder bldr) { bldr.setName(name); bldr.setSpec(TopologyAPI.ComponentObjectSpec.JAVA_SERIALIZED_OBJECT); bldr.setSerializedObject(ByteString.copyFrom(Utils.serialize(component))); TopologyAPI.Config.Builder cBldr = TopologyAPI.Config.newBuilder(); for (Map.Entry<String, Object> entry : componentConfiguration.entrySet()) { if (entry.getKey() == null) { LOG.warning("ignore: config key is null"); continue; } if (entry.getValue() == null) { LOG.warning("ignore: config key " + entry.getKey() + " has null value"); continue; } TopologyAPI.Config.KeyValue.Builder kvBldr = TopologyAPI.Config.KeyValue.newBuilder(); kvBldr.setKey(entry.getKey()); kvBldr.setValue(entry.getValue().toString()); kvBldr.setType(TopologyAPI.ConfigValueType.STRING_VALUE); cBldr.addKvs(kvBldr); } bldr.setConfig(cBldr); }
Source:
public boolean onSetSurface(Surface surface) { mSurface = surface; return true; }

Target:
public boolean onSetSurface(Surface surface) { mSurface = surface; if (surface != null) { draw(); } return true; }
Source:
private String trimNameAndAddID(String query) { String trimmedNamed = query.replaceAll(":", "="); trimmedNamed = trimmedNamed.replaceAll("[^A-Za-z0-9_.\\s=-]", ""); if (query.length() > 240) { trimmedNamed = query.substring(0, 240); } String id = findQueryIDByQueryString(query); return id + " - " + trimmedNamed; }

Target:
private String trimNameAndAddID(String query) { String trimmedNamed = MATCHCOLON.matcher(query).replaceAll("="); trimmedNamed = MATCHILLEGALCHARACTERS.matcher(trimmedNamed).replaceAll(""); if (query.length() > 240) { trimmedNamed = query.substring(0, 240); } String id = findQueryIDByQueryString(query); return id + " - " + trimmedNamed; }
Source:
private String getDetails(String key, Map<String, Set<String>> info) { if (info.isEmpty() || !info.containsKey(key)) { return ""; } StringBuilder sb = new StringBuilder(); for (String item : info.get(key)) { sb.append(item + "\n"); } return sb.toString(); }

Target:
private String getDetails(String key, Map<String, Set<String>> info) { if (info.isEmpty() || !info.containsKey(key)) { return ""; } StringBuilder sb = new StringBuilder(); for (String item : info.get(key)) { sb.append(item).append('\n'); } return sb.toString(); }
Source:
public void transformOffset(){ final ITmfTimestampTransform offset = TimestampTransformFactory.create(100); final ITmfTimestampTransform offset1 = TimestampTransformFactory.create(BigDecimal.ONE, new BigDecimal(100)); final ITmfTimestampTransform offset2 = TimestampTransformFactory.create(1.0, 100); final ITmfTimestampTransform compositeTransform = offset.composeWith(TimestampTransformFactory.create(new TmfNanoTimestamp(-100))); assertEquals(tn100, offset.transform(t0)); assertEquals(tn100, offset.transform(tn0)); assertEquals(tn0, compositeTransform.transform(t0)); assertEquals(t0, compositeTransform.transform(t0)); assertEquals(offset1.toString(), offset.toString()); assertEquals(offset1.toString(), offset2.toString()); }

Target:
public void transformOffset(){ final ITmfTimestampTransform offset = TimestampTransformFactory.create(100); final ITmfTimestampTransform compositeTransform = offset.composeWith(TimestampTransformFactory.create(new TmfNanoTimestamp(-100))); assertEquals(tn100, offset.transform(t0)); assertEquals(tn100, offset.transform(tn0)); assertEquals(tn0, compositeTransform.transform(t0)); assertEquals(t0, compositeTransform.transform(t0)); }
Source:
private void updateEditLicenseText() { editLicenseText = (TextView) findViewById(R.id.edit_section_license_text); editLicenseText.setText(Html.fromHtml(getString(R.string.edit_save_action_license))); if (!app.getUserInfoStorage().isLoggedIn()) { editLicenseText.append(Html.fromHtml(getString(R.string.edit_save_action_ip_edit))); } editLicenseText.setMovementMethod(new LinkMovementMethodExt(new LinkMovementMethodExt.UrlHandler() { @Override public void onUrlClick(String url) { if (url.equals("https://#login")) { funnel.logLoginAttempt(); Intent loginIntent = new Intent(EditSectionActivity.this, LoginActivity.class); loginIntent.putExtra(LoginActivity.LOGIN_REQUEST_SOURCE, LoginFunnel.SOURCE_EDIT); loginIntent.putExtra(LoginActivity.EDIT_SESSION_TOKEN, funnel.getEditSessionToken()); startActivityForResult(loginIntent, LoginActivity.REQUEST_LOGIN); } else { Utils.handleExternalLink(EditSectionActivity.this, Uri.parse(url)); } } })); }

Target:
private void updateEditLicenseText() { editLicenseText = (TextView) findViewById(R.id.edit_section_license_text); if (app.getUserInfoStorage().isLoggedIn()) { editLicenseText.setText(Html.fromHtml(getString(R.string.edit_save_action_license_logged_in))); } else { editLicenseText.append(Html.fromHtml(getString(R.string.edit_save_action_license_anon))); } editLicenseText.setMovementMethod(new LinkMovementMethodExt(new LinkMovementMethodExt.UrlHandler() { @Override public void onUrlClick(String url) { if (url.equals("https://#login")) { funnel.logLoginAttempt(); Intent loginIntent = new Intent(EditSectionActivity.this, LoginActivity.class); loginIntent.putExtra(LoginActivity.LOGIN_REQUEST_SOURCE, LoginFunnel.SOURCE_EDIT); loginIntent.putExtra(LoginActivity.EDIT_SESSION_TOKEN, funnel.getEditSessionToken()); startActivityForResult(loginIntent, LoginActivity.REQUEST_LOGIN); } else { Utils.handleExternalLink(EditSectionActivity.this, Uri.parse(url)); } } })); }